import request from "@/utils/request";

let url = 'Emr/'

/**
 * 获取患者病历树状图
 * @param patNo 住院号
 * @param times 住院次数
 * @returns {*} 返回数
 */
export function getPatientDataTree(patNo, times) {
    return request({
        url: url + 'getPatientDataTree',
        method: 'get',
        params: {patNo, times}
    })
}

/**
 * 获取电子病历的树状图
 * @returns {*}
 */
export function getEmrTree(type = 'all') {
    return request({
        url: url + 'getEmrTree',
        method: 'get',
        params: {type}
    })
}

/**
 * 获取病程片段
 * @returns {*}
 */
export function getSnippetTree() {
    return request({
        url: url + 'getSnippetTree',
        method: 'get',
    })
}

export function insertEmrData(data) {
    return request({
        url: url + 'insertEmrData',
        method: 'post',
        data
    })
}

export function deletePatientEmrByDocumentId(documentId) {
    return request({
        url: url + 'deletePatientEmrByDocumentId',
        method: 'get',
        params: {documentId}
    })
}

export function existCourseRecord(patNo, times) {
    return request({
        url: url + 'existCourseRecord',
        method: 'get',
        params: {patNo, times}
    })
}

export function queryWhetherThePatientHasASpecifiedMedicalRecord(data) {
    return request({
        url: url + 'queryWhetherThePatientHasASpecifiedMedicalRecord',
        method: 'post',
        data
    })
}

export function submitMedicalRecord(documentId) {
    return request({
        url: url + 'submitMedicalRecord',
        method: 'get',
        params: {documentId}
    })
}


export function getDrgIntelligentGrouping(patNo, times) {
    return request({
        url: url + 'getDrgIntelligentGrouping',
        method: 'get',
        params: {patNo, times}
    })
}

export function getDischargeTimes(patNo) {
    return request({
        url: url + 'getDischargeTimes',
        method: 'get',
        params: {patNo}
    })
}

/**
 * 获取患者提取到的数据
 * @param patNo 住院号
 * @param times 次数
 * @returns {AxiosPromise} 数据
 */
export function getExtractDataElement(patNo, times) {
    return request({
        url: url + 'getExtractDataElement',
        method: 'get',
        params: {patNo, times}
    })
}

export function getEmrAllWardsApi() {
    return request({
        url: url + 'getAllWards',
        method: 'get',
    })
}


export function getDeleteMedicalRecord(patNo) {
    return request({
        url: url + 'getDeleteMedicalRecord',
        method: 'get',
        params: {patNo}
    })
}

export function getInvalidByDocumentId(id) {
    return request({
        url: url + 'getInvalidByDocumentId',
        method: 'get',
        params: {id}
    })
}

export function resumeMedicalRecords(documentId) {
    return request({
        url: url + 'resumeMedicalRecords',
        method: 'get',
        params: {documentId}
    })
}

export function getDisReqEmr(flag) {
    return request({
        url: url + 'getDisReqEmr',
        method: 'get',
        params: {flag}
    })
}

export function saveDisEmrReq(data) {
    return request({
        url: url + 'saveDisEmrReq',
        method: 'post',
        data
    })
}


export function deleteDisEmrDis(patNo) {
    return request({
        url: url + 'deleteDisEmrDis',
        method: 'get',
        params: {patNo}
    })
}

export function adoptEmrDisReq(patNo) {
    return request({
        url: url + 'adoptEmrDisReq',
        method: 'get',
        params: {patNo}
    })
}

export function refuseEmrDisReq(patNo, reviewNotes) {
    return request({
        url: url + 'refuseEmrDisReq',
        method: 'get',
        params: {patNo, reviewNotes}
    })
}

export function isDisReqEdit(patNo) {
    return request({
        url: url + 'isDisReqEdit',
        method: 'get',
        params: {patNo}
    })
}

export function getHistory(documentId) {
    return request({
        url: url + 'getHistory',
        method: 'get',
        params: {documentId}
    })
}

export function getEmrTips() {
    return request({
        url: url + 'getEmrTips',
        method: 'get',
    })
}

export function addEmrTips(data) {
    return request({
        url: url + 'addEmrTips',
        method: 'post',
        data
    })
}

export function updateEmrTips(data) {
    return request({
        url: url + 'updateEmrTips',
        method: 'post',
        data
    })
}

export function deleteEmrTips(id) {
    return request({
        url: url + 'deleteEmrTips',
        method: 'get',
        params: {id}
    })
}

export function getEmrTipsData(name) {
    return request({
        url: url + 'getEmrTipsData',
        method: 'get',
        params: {name}
    })
}

export function hotSearchSorting(userCode, code, tableName) {
    return request({
        url: url + 'hotSearchSorting',
        method: 'get',
        params: {userCode, code, tableName}
    })
}

export function getListOfDischargedPatients(patNo) {
    return request({
        url: url + 'getListOfDischargedPatients',
        method: 'get',
        params: {patNo}
    })
}

export function getYzTemperature(patNo, times) {
    return request({
        url: url + 'getYzTemperature',
        method: 'get',
        params: {patNo, times}
    })
}

export function getExamine(patNo, times) {
    return request({
        url: url + 'getExamine',
        method: 'get',
        params: {patNo, times}
    })
}






