import { json } from "../../utils/ajax"; import store from '@store'; import Notify from '@commonComp/Notify'; import { getAllDataList, getAllDataStringList, pushAllDataList, filterDataArr } from '@utils/tools'; export const saveMessage = (bool) => { let baseList = store.getState(); let state = baseList.patInfo.message; let whichSign = baseList.typeConfig.typeConfig; let jsonStr = getAllDataStringList(baseList); let jsonData = getAllDataList(baseList); // console.log(jsonStr.diag,'保存历史病历') json('/inquiryInfo/saveInquiry', { "doctorId": state.doctorId, "hospitalDeptId": state.hospitalDeptId, "hospitalId": state.hospitalId, "patientId": state.patientId, //患者id "dataJson": JSON.stringify(getAllDataList(baseList)), "detailList": [{ "content": jsonStr.chief, "contentValue":filterDataArr(JSON.parse(jsonStr.chief)), "type": 1 }, { "content": jsonStr.present, "contentValue":filterDataArr(JSON.parse(jsonStr.present)), "type": 2 }, { "content": jsonStr.other, "contentValue":filterDataArr(JSON.parse(jsonStr.other)), "type": 3 }, { "content": jsonStr.vital, "contentValue":filterDataArr(JSON.parse(jsonStr.vital)), "type": 4 }, { "content": jsonStr.lis, "contentValue":jsonStr.lis, "type": 5 }, { "content": jsonStr.pacs, "contentValue":jsonStr.pacs, "type": 6 }, { "content": jsonStr.diag, "contentValue":jsonStr.diag, "type": 7 }, { "content": jsonStr.advice, "contentValue":jsonStr.advice, "type": 8 }], "sign": whichSign, //类型0结构化 1文本 "diagnose": (jsonData.diag.length > 0 ? jsonData.diag[0].name : ''), //诊断 "inquiryCode": state.recordId, //就诊序列号 // "regVisitedState": 0, //就诊状态 // "type": 0, }).then((res) => { let data = res.data if (data.code == 0) { if(!bool){ Notify.success('历史病历保存成功'); } } else { console.log(res) } }) if(bool){ json('/printRecord/savePrintRecords', { "dataJson": JSON.stringify(getAllDataList(baseList)), "doctorId": state.doctorId, "hospitalDeptId": state.hospitalDeptId, "hospitalId": state.hospitalId, "inquiryCode": state.recordId, //就诊序列号 "name": (jsonData.diag.length > 0 ? jsonData.diag[0].name : ''), //诊断 "patientId": state.patientId, //患者id "type": whichSign, //类型0结构化 1文本 "content": { "advice": jsonStr.advice, "chief": jsonStr.present, "diag": jsonStr.diag, "lis": jsonStr.lis, "other": jsonStr.other, "pacs": jsonStr.pacs, "present": jsonStr.present, "vital": jsonStr.vital }, }).then((res) => { let data = res.data if (data.code == 0) { console.log('打印记录保存成功') } else { console.log(res) } }) } }; export const clearMessages = () => { let baseList = store.getState(); let whichSign = baseList.typeConfig.typeConfig; pushAllDataList(whichSign,'clear'); };