import request from '@/utils/request'

export function getPatientList(queryParams) {
  return request({
    url: '/reg-doctorstation/advice-manage/reg-patient-zk',
    method: 'get',
    params: queryParams
  })
}

// 诊断相关接口
/**
 * 保存诊断
 */
export function saveDiagnosis(data) {
  return request({
    url: '/doctor-station/diagnosis/save-doctor-diagnosis',
    method: 'post',
    data: data
  })
}

/**
 * 添加诊断绑定
 */
export function saveDiagnosisBind(data) {
  return request({
    url: '/doctor-station/diagnosis/diagnosis-belong-binding',
    method: 'post',
    data: data
  })
}
/**
 * 删除诊断绑定
 */
export function deleteDiagnosisBind(id) {
  return request({
    url: '/doctor-station/diagnosis/diagnosis-belong-binding?id=' + id,
    method: 'delete',
  })
}

/**
 * 获取诊断定义列表
 */
export function getDiagnosisDefinitionList(queryParams) {
  return request({
    url: '/doctor-station/diagnosis/condition-definition-metadata',
    method: 'get',
    params: queryParams
  })
}

/**
 * 获取诊断分类数据，历史诊断/个人常用诊断/科室常用诊断
 */
export function getConditionDefinitionInfo(patientId) {
  return request({
    url: '/doctor-station/diagnosis/get-condition-definition-class?patientId=' + patientId,
    method: 'get',
  })
}

/**
 * 获取诊断基础下拉数据
 */
export function diagnosisInit() {
  return request({
    url: '/doctor-station/diagnosis/init',
    method: 'get',
  })
}

/**
 * 
 * 获取诊断回显数据
 */
export function getEncounterDiagnosis(encounterId) {
  return request({
    url: '/doctor-station/diagnosis/get-encounter-diagnosis?encounterId=' + encounterId,
    method: 'get',
  })
}

/**
 * 
 * 删除就诊诊断
 */
export function delEncounterDiagnosis(conditionId) {
  return request({
    url: '/doctor-station/diagnosis/encounter-diagnosis?conditionId=' + conditionId,
    method: 'delete',
  })
}

/**
 * 是否是食源性诊断
 */
export function isFoodDiseasesNew(params) {
  return request({
    url: '/external-integration/foodborne-acquisition/is-food-diseases-new',
    method: 'get',
    params: params
  })
}


/**
 * 获取中医诊断
 */
export function getTcmCondition(params) {
  return request({
    url: '/doctor-station/chinese-medical/condition-info',
    method: 'get',
    params: params
  })
}

/**
 * 获取辩证分型
 */
export function getTcmSyndrome(params) {
  return request({
    url: '/doctor-station/chinese-medical/syndrome-info',
    method: 'get',
    params: params
  })
}

/**
 * 获取本次就诊中医诊断
 */
export function getTcmDiagnosis(params) {
  return request({
    url: '/doctor-station/chinese-medical/get-tcm-encounter-diagnosis',
    method: 'get',
    params: params
  })
}

/**
 * 保存中医诊断
 */
export function saveTcmDiagnosis(data) {
  return request({
    url: '/doctor-station/chinese-medical/save-tcm-diagnosis',
    method: 'post',
    data: data
  })
}
/**
 * 获取人员慢性病诊断
 */
export function getChronicDisease(params) {
  return request({
    url: '/yb-request/getConditionDefinition',
    method: 'get',
    params: params
  })
}


/**
 * 获取药品列表
 */
export function getAdviceBaseInfo(queryParams) {
  return request({
    url: '/doctor-station/advice/advice-base-info',
    method: 'get',
    params: queryParams
  })
}

/**
 * 保存处方(单条)
 */
export function savePrescription(data) {
  return request({
    url: '/reg-doctorstation/advice-manage/save-reg-advice',
    method: 'post',
    data: data
  })
}
/**
 * 签发处方
 */
export function savePrescriptionSign(data) {
  return request({
    url: '/reg-doctorstation/advice-manage/sign-reg-advice',
    method: 'post',
    data: data
  })
}
/**
 * 处方签退
 */
export function singOut(data) {
  return request({
    url: '/reg-doctorstation/advice-manage/sign-off-reg',
    method: 'post',
    data: data
  })
}
/**
 * 停嘱
 */
export function stopAdvice(data) {
  return request({
    url: '/reg-doctorstation/advice-manage/stop-reg-advice',
    method: 'post',
    data: data
  })
}
/**
 * 获取患者本次就诊处方
 */
export function getPrescriptionList(encounterId) {
  return request({
    url: '/reg-doctorstation/advice-manage/reg-request-base-info?encounterId=' + encounterId,
    method: 'get',
  })
}

/**
 * 获取费用性质
 */
export function getContract(params) {
  return request({
    url: '/doctor-station/advice/get-encounter-contract',
    method: 'get',
    params: params
  })
}

/**
 * 获取科室列表
 */
export function getOrgTree() {
  return request({
    url: '/base-data-manage/organization/organization',
    method: 'get',
  })
}


export function getEmrDetail(encounterId) {
  return request({
    url: '/doctor-station/emr/emr-detail?encounterId=' + encounterId,
    method: 'get',
  })
}


/**
 * 组合/拆组
 */
export function updateGroupId(data) {
  return request({
    url: '/doctor-station/advice/update-groupid',
    method: 'put',
    data: data
  })
}
