123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- export const changeAssay=(state,action)=>{
- const res=Object.assign({},state);
- res.assay = res.assay.map(item => {
- if(item.id === action.item.id && item.name === action.item.name){
- item.checked = !item.checked
- }
- return item
- })
- return res;
- };
- export const changeCheck=(state,action)=>{
- const res=Object.assign({},state);
- res.check = res.check.map(item => {
- if(item.id === action.item.id && item.name === action.item.name){
- item.checked = !item.checked
- }
- return item
- })
- return res;
- };
- //获取右侧推送信息
- export const setAdvice=(state,action)=>{
- const res=Object.assign({},state);
- // res.determine = action.determine
- //不展示确诊,将确诊跟疑似诊断放在一起展示
- res.doubt = action.determine.concat(action.doubt);
- res.possible = action.possible;
- res.vigilant = action.vigilant;
- res.likely = action.likely;
- res.assay = action.lab;
- res.check = action.pacs;
- res.setPushEmergency = action.setPushEmergency;
- res.setPushEmergencyIdx=action.setPushEmergencyIdx
- return res;
- };
- //获取医嘱信息字符串
- function getAdviceStr(advice) {
- const commontreatment = advice.commontreatment
- const scheme = advice.scheme || '';
- const adviceInput = advice.adviceInput || '';
- const assay = advice.assay || '';
- const check = advice.check || '';
- const followUp = advice.followUp || '';
- let AdviceStr = advice.AdviceStr || '';
- if(assay || check) {
- AdviceStr = assay + check +'; ' + AdviceStr;
- }
- if(commontreatment) {
- AdviceStr = AdviceStr + commontreatment + ';';
- }
- if(followUp) {
- AdviceStr = AdviceStr + '回访时间:'+followUp + '后回访,不适随诊' + ';';
- }
- for (let i = 0; i < scheme.length; i++) {
- for (let j = 0; j < scheme[i].treatment.length; j++) {
- if(scheme[i].treatment[j].treatmentStr === '') {
- AdviceStr = AdviceStr + scheme[i].treatment[j].treatmentStr
- } else {
- AdviceStr = AdviceStr + scheme[i].treatment[j].treatmentStr + ', '
- }
- }
- }
- if(AdviceStr.slice(AdviceStr.length-2) == ', ') {
- AdviceStr = AdviceStr.slice(0, AdviceStr.length-2)
- }
- // if(commontreatment) {
- // AdviceStr = commontreatment +'; ' + AdviceStr;
- // }
- if(adviceInput) {
- AdviceStr = AdviceStr +'; ' + adviceInput;
- }
- let reg=/<[^>]+>/gim;
- AdviceStr = AdviceStr.replace(reg,"");
- return AdviceStr;
- }
- //治疗方案添加到医嘱
- export const addScheme = (state, action) => {
- const res = JSON.parse(JSON.stringify(state))
- const treatment = action.treatment;
- const treatItem = {};
- treatItem.name = action.title;
- const scheme = res.advice.scheme || [];
- let isRepeat = false;
- let RepeatIndex;
- let SelectedDrugNum = 0 //选中的药品数量
- for (let i = 0; i < treatment.length; i++) {
- let treatmentStr = '';
- let drugList = []
- for (let j = 0; j < treatment[i].medicitionsList.length; j++) {
- if(treatment[i].medicitionsList[j].selected) {
- treatmentStr = treatmentStr + treatment[i].medicitionsList[j].medicitionName + ', '
- drugList.push({conceptId: treatment[i].medicitionsList[j].conceptId, conceptName: treatment[i].medicitionsList[j].medicitionName })
- SelectedDrugNum++
- }
- }
- treatment[i].treatmentStr = treatmentStr.substring(0,treatmentStr.length-2)
- treatment[i].drugList = drugList
- }
- if(SelectedDrugNum > 0) { //如果有选中的药品,滚动到医嘱框
- document.getElementById("adviceBox").scrollIntoView(true)
- }
- treatItem.treatment = treatment;
- for (let i = 0; i < scheme.length; i++) {
- if (scheme[i].name === treatItem.name) {
- isRepeat = true
- }
- }
- //判断医嘱中是否包含该诊断
- scheme.map((item, index) => {
- if(item.name === treatItem.name) {
- isRepeat = true
- RepeatIndex = index;
- }
- })
- if (isRepeat) {
- //将同类药添加到一起
- for (let i = 0; i < scheme[RepeatIndex].treatment.length; i++) {
- for (let j = 0; j < treatment.length; j++) {
- if (scheme[RepeatIndex].treatment[i].id === treatment[j].id && scheme[RepeatIndex].treatment[i].bigdrugsName === treatment[j].bigdrugsName && scheme[RepeatIndex].treatment[i].subdrugsName === treatment[j].subdrugsName) {
- for(let z = 0; z < treatment[j].medicitionsList.length; z++) {
- if(treatment[j].medicitionsList[z].selected) {
- if(scheme[RepeatIndex].treatment[i].treatmentStr !== '') {
- scheme[RepeatIndex].treatment[i].treatmentStr = scheme[RepeatIndex].treatment[i].treatmentStr + ', ' + treatment[j].medicitionsList[z].medicitionName
- } else {
- scheme[RepeatIndex].treatment[i].treatmentStr = scheme[RepeatIndex].treatment[i].treatmentStr + '' + treatment[j].medicitionsList[z].medicitionName
- }
- scheme[RepeatIndex].treatment[i].drugList.push({conceptId: treatment[j].medicitionsList[z].conceptId, conceptName: treatment[j].medicitionsList[z].medicitionName })
- }
- }
- }
- }
- }
- // let repeatDiag = res.advice.scheme[RepeatIndex].treatment
- // for (let i = 0; i < repeatDiag.length; i++) {
- // for (let j = 0; j < action.treatment.length; j++) {
- // if(repeatDiag[i].id === action.treatment[j].id) {
- // repeatDiag[i].medicitionsList = repeatDiag[i].medicitionsList.concat(action.treatment[j].medicitionsList)
- // }
- // }
- // }
- // repeatDiag = repeatDiag.concat(action.treatment)
- } else {
- for (let i = 0; i < treatItem.treatment.length; i++) {
- for (let j = 0; j < treatItem.treatment[i].medicitionsList.length; j++) {
- if(treatItem.treatment[i].medicitionsList[j].selected) {
- res.advice.scheme = scheme.concat(treatItem)
- }
- }
- }
-
- }
- res.AdviceStr = getAdviceStr(res.advice)
- if (res.advice.scheme) {
- res.advice.drugList = getDrugList(res.advice.scheme)
- }
-
- return res;
- }
- //获取开单到医嘱的药品列表
- function getDrugList(scheme) {
- const drugList = [];
- for(let i = 0 ; i < scheme.length; i++) {
- for(let j = 0; j <scheme[i].treatment.length; j++ ) {
- for (let z = 0; z < scheme[i].treatment[j].drugList.length; z++) {
- drugList.push(scheme[i].treatment[j].drugList[z]);
- }
- }
- }
- return drugList
- }
- //设置提示信息
- export const setTips = (state, action) => {
- const res = Object.assign({}, state)
- res.tips = action.tips;
- res.tmpFlg = action.tmpFlg
- res.showPartName = action.showPartName
- return res;
- }
- //设置提示信息详情页
- export const setTipsDetails = (state, action) => {
- const res = Object.assign({}, state)
- res.tipsDetails = action.tipsDetails;
- res.showAllName = action.showAllName
- return res;
- }
- export const setChangeAdviceTreatment = (state, action) => {
- const res = JSON.parse(JSON.stringify(state))
- const index = action.index; //诊断的下标
- const ii = action.ii //同类药下表
- const changeInput = action.changeInput;
- let scheme = res.advice.scheme;
- scheme[index].treatment[ii].treatmentStr = changeInput
- return res;
- }
- export const setChangeAdviceAssay = (state, action) => {
- const res = JSON.parse(JSON.stringify(state))
- res.advice.assay = action.changeInput;
- return res;
- }
- export const setChangeAdviceCheck = (state, action) => {
- const res = JSON.parse(JSON.stringify(state))
- res.advice.check = action.changeInput;
- return res;
- }
- export const addBilling = (state, action) => {
- const res = JSON.parse(JSON.stringify(state));
- const {assay,check} = action;
- res.assay = res.assay.map((item,index)=>{
- item.checked = false
- return item
- })
- res.check = res.check.map((item,index)=>{
- item.checked = false
- return item
- })
- res.advice.assay = res.advice.assay || '';
- res.advice.check = res.advice.check || '';
- for (let i = 0; i < assay.length; i++) {
- if ( res.advice.assay === '') { //如果最后一个,则不需要逗号
- res.advice.assay = res.advice.assay + assay[i].name
- } else {
- if( i === 0 && res.advice.check !== '') {
- res.advice.assay = res.advice.assay + assay[i].name
- } else {
- res.advice.assay = res.advice.assay + ', ' + assay[i].name
- }
- }
-
- }
- for (let i = 0; i < check.length; i++) {
- if ( res.advice.check === '') { //如果最后一个,则不需要逗号
- res.advice.check = res.advice.check + check[i].name
- } else {
- res.advice.check = res.advice.check + ', '+ check[i].name
- }
- }
- if(res.advice.assay && res.advice.check !== '') {
- if(res.advice.assay.substring(res.advice.assay.length-2,res.advice.assay.length-1) !== ',') {
- res.advice.assay = res.advice.assay + ', '
- }
- }
- res.AdviceStr = getAdviceStr(res.advice)
- return res;
- }
- export const clearAllPushMessage = (state, action) => {
- const res = JSON.parse(JSON.stringify(state));
- res.advice = action.data;
- res.AdviceStr = action.saveText;
- res.tips = {};
- res.vigilant = [];
- res.doubt = [];
- res.possible = [];
- res.determine = [];
- res.assay = [];
- res.check = [];
- res.chronicPushItems = [];//量表
- res.formulaResult = {}; //量表计算结果
- res.scaleInfo = {}; //量表选中项
- res.drugList = []; //开单药品列表
- return res;
- }
- export const showTipsDetails = (state, action) => {
- const res = Object.assign({}, state);
- res.showTipsDetails = true;
- return res;
- }
- export const hideTipsDetails = (state, action) => {
- const res = Object.assign({}, state);
- res.showTipsDetails = false;
- return res;
- }
- //一般治疗添加到医嘱
- export const setCommontreatment = (state, action) => {
- const res = JSON.parse(JSON.stringify(state));
- res.advice.commontreatment = action.commontreatment;
- res.AdviceStr = getAdviceStr(res.advice)
- return res;
- }
- export const setAdviceInput = (state, action) => {
- const res = JSON.parse(JSON.stringify(state));
- res.advice.adviceInput = action.adviceInput;
- res.AdviceStr = getAdviceStr(res.advice)
- return res;
- }
- //保存回访时间
- export const saveFollowUp = (state, action) => {
- const res = JSON.parse(JSON.stringify(state));
- res.advice.followUp = action.followUp;
- if(action.hasFollowUp) {
- res.advice.hasFollowUp = action.hasFollowUp
- }
- return res;
- }
- //删除回访时间
- export const delFollowUp = (state, action) => {
- const res = JSON.parse(JSON.stringify(state));
- res.advice.follow = '';
- return res;
- }
|