import service from "@/utils/request";
import {OBX_INIT_VALUE} from "@/views/work/patient/check/checkInitValues";

/**
 * 获取患者的某一页检查项目列表
 * @param {string} patientId 患者id
 * @param {{pageNum: number, pageSize: number}} paginationQueryParam 分页查询参数
 * @return {{rows: import('index').ObxList, total: number,pages: number} }
 */
export function getPageObxList(patientId, paginationQueryParam) {
  /**
   * @type {{rows: import('index').ObxList, total: number,pages: number} }
   */
  let result
  service.get(`/work/result/patid/${patientId}`, (result) => {}, {
    data: paginationQueryParam
  }).then((response) => {

    const {rows, total, pages} = response.data

    result = {
      rows,
      total,
      pages,
    }
  }).catch((error) => {
    console.log(error)
    result = {
      rows: [OBX_INIT_VALUE],
      total: 0,
      pages: 0
    }
  })
  return result
}

/**
 * 获取详细检测报告
 * @param patientId
 */
export function getObr(patientId) {
  service.get(`/work/request/patid/${patientId}`)
  .then((response) => {
    console.log(response)
  })
}
