From 8f4ee464dc536d235cf004c27483e7399e4fb13c Mon Sep 17 00:00:00 2001 From: zoujiandong <10130823232@qq.com> Date: Sat, 21 Jun 2025 17:43:26 +0800 Subject: [PATCH] =?UTF-8?q?6.21=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api.js | 7 +- case/pages/createCase/createCase.js | 540 ++++++----- case/pages/createCase/createCase.wxml | 1152 ++++++++++++----------- case/pages/createCase/createCase.wxss | 11 + components/paintCanvas/paintCanvas.js | 50 +- components/paintCanvas/paintCanvas.wxml | 2 +- utils/utils.js | 72 +- 7 files changed, 990 insertions(+), 844 deletions(-) diff --git a/api/api.js b/api/api.js index d164d35..2303ef0 100644 --- a/api/api.js +++ b/api/api.js @@ -5,12 +5,13 @@ function addCase(data){ //添加病例 function caseDetail(id){ //病例详情 return request('/medicalRecord/getDetail/'+id,'GET',{},true) }; +function editCase(data){ //修改病例 + return request('/medicalRecord/update','POST',data,true) + }; function caseList(data){ //病例列表 return request('/medicalRecord/getList','POST',data,true) }; -function editCase(data){ //修改病例 - return request('/medicalRecord/update','POST',data,true) -}; + function getCaptcha(){ //获取图片验证码 return request('/user/getCaptcha','GET') }; diff --git a/case/pages/createCase/createCase.js b/case/pages/createCase/createCase.js index 211a2d4..4802bb4 100644 --- a/case/pages/createCase/createCase.js +++ b/case/pages/createCase/createCase.js @@ -18,6 +18,10 @@ Page({ ganwaiOption:ganwaiOption, moshiOption:moshiOption, hospitalOption:hospitalOption, + editorHeight:'calc(100vh - 600rpx)', + paintFrom:'basic', + paintSrc:'', + showPaint:false, active:0, wordLength:0, showSaveBtn:true, @@ -35,7 +39,6 @@ Page({ showDel:false, showAttention:false, fileList_basic:[], - fileList_abstract:[], fileList_check:[], dpmas_list:[{fileList:[],treatTime:''}], disable_ziliao:false, @@ -73,36 +76,52 @@ Page({ otherValue:'' }, }, - disease_desc:'', - disease_history:'', - past_history:'',//临床资料结束 + abstract_str:'',//临床资料结束 dpmas:[{ 'dpmasImg':'', 'treatTime':'' }], headTime:'', afterTime:'', + lastTime:'', headTb:'', afterTb:'', - headAlt:'', - afterAlt:'', - headAlb:'', - afterAlb:'', - headAst:'', - afterAst:'', - headInr:'', - afterInr:'', + lastTb:'', headDb:'', afterDb:'', + lastDb:'', headIb:'', afterIb:'', + lastIb:'', + headAlt:'', + afterAlt:'', + lastALt:'', + headAst:'', + afterAst:'', + lastAst:'', + headAlb:'', + afterAlb:'', + lastAlb:'', headPta:'', afterPta:'', + lastPta:'', + headInr:'', + afterInr:'', + lastInr:'', + headCrp:'', + afterCrp:'', + lastCrp:'', headIl6:'', afterIl6:'', + lastIl6:'', headTnf:'', afterTnf:'', - checkImg:'' + lastTnf:'', + checkImg:'', + discharge_time:'', + day:'', + discharge_situation:'', + discharge_status:'' }, time_type:'date', time_str:"hospitalTime", @@ -131,6 +150,17 @@ Page({ }, }, + onEditorReady() { + const that = this + wx.createSelectorQuery().select('#editor').context(function (res) { + that.editorCtx = res.context; + let html = + "

【主诉】:


【现病史】:


【既往史】:



"; + that.editorCtx.setContents({ + html:html + }) + }).exec() + }, onChangeCheck(event){ console.log(event); let arr=event.detail; @@ -161,9 +191,6 @@ Page({ toggleCheck(event){ console.log(event); }, - dealImg(e){ - console.log(e); - }, save:throttle(function(){ this.data.medicalRecordId?this.handleEditCase():this.handleAddCase(); }), @@ -205,20 +232,20 @@ Page({ }), isHasValue(){ - let {name,uid,sex,age,admissionTime,caseType,main_diagnose,disease_cause,trigger,disease_desc,disease_history,past_history,headTime,afterTime,headTb,afterTb,headAlt,afterAlt,headAlb,afterAlb,headAst,afterAst,headInr,afterInr,headDb,afterDb,headIb,afterIb,headPta,afterPta,headIl6,afterIl6,headTnf,afterTnf}=this.data.case; - let {fileList_basic,fileList_abstract,fileList_check,dpmas_list}=this.data; + let {name,uid,sex,age,admissionTime,caseType,main_diagnose,disease_cause,trigger,abstract_str,headTime,afterTime,headTb,afterTb,headAlt,afterAlt,headAlb,afterAlb,headAst,afterAst,headInr,afterInr,headDb,afterDb,headIb,afterIb,headPta,afterPta,headIl6,afterIl6,headTnf,afterTnf}=this.data.case; + let {fileList_basic,fileList_check,dpmas_list,discharge_time,day,discharge_status,discharge_situation}=this.data; let hasTime=dpmas_list.some(item=>{ return item.fileList.length>0}); let hasImg=dpmas_list.some(item=>{ return item.treatTime!=''}); - if(name || uid || sex || age || admissionTime || caseType.length>0 || main_diagnose.select.length>0 || main_diagnose.otherValue || disease_cause.select.length>0 || disease_cause.otherValue || trigger.inside.select.length>0 || trigger.inside.otherValue || trigger.outside.select.length>0 || trigger.outside.otherValue || disease_desc || disease_history ||past_history || headTime || afterTime || headTb || afterTb || headAlt || afterAlt || headAlb || afterAlb || headAst || afterAst || headInr || afterInr || headDb || afterDb || headIb || afterIb || headPta || afterPta || headIl6 || afterIl6 || headTnf || afterTnf || fileList_basic.length>0 || fileList_abstract.length>0 || fileList_check.length>0 || hasTime || hasImg){ + if(name || uid || sex || age || admissionTime || caseType.length>0 || main_diagnose.select.length>0 || main_diagnose.otherValue || disease_cause.select.length>0 || disease_cause.otherValue || trigger.inside.select.length>0 || trigger.inside.otherValue || trigger.outside.select.length>0 || trigger.outside.otherValue || abstract_str || headTime || afterTime || headTb || afterTb || headAlt || afterAlt || headAlb || afterAlb || headAst || afterAst || headInr || afterInr || headDb || afterDb || headIb || afterIb || headPta || afterPta || headIl6 || afterIl6 || headTnf || afterTnf || fileList_basic.length>0 || fileList_check.length>0 || hasTime || hasImg || discharge_time || day|| discharge_status ||discharge_situation){ return true }else{ return false } }, handleAddCase(){ - let {fileList_basic,fileList_abstract,fileList_check,dpmas_list}=this.data; + let {fileList_basic,fileList_check,dpmas_list}=this.data; let baseImg=''; let abstractImg=''; let checkImg=''; @@ -230,13 +257,7 @@ Page({ baseImg+=item.url; } }) - fileList_abstract.forEach(item=>{ - if(abstractImg){ - abstractImg+="," +item.url - }else{ - abstractImg+=item.url; - } - }) + fileList_check.forEach(item=>{ if(checkImg){ checkImg+="," +item.url @@ -366,16 +387,6 @@ Page({ }) } - }else if(key=='abstractImg'){ - if(res[key]){ - let imgList=res[key].split(','); - this.setData({ - ['case.'+key]:res[key], - fileList_abstract:imgList.map(item=>{ - return {url:item} - }) - }) - } }else if(key=='checkImg'){ if(res[key]){ let imgList=res[key].split(','); @@ -572,7 +583,20 @@ Page({ }) return false } - + if(main_diagnose.select.length==0){ + flag && wx.showToast({ + title: '请选择主要诊断类型', + icon:"none" + }) + return false + } + if(main_diagnose.select.length==0 && !main_diagnose.otherValue){ + flag && wx.showToast({ + title: '主要诊断其他不能为空', + icon:"none" + }) + return false + } if(fileList_basic.length==0){ flag && wx.showToast({ title: '请上传出院诊断照片', @@ -625,28 +649,15 @@ Page({ return true }, validateZiliao(flag){ - let {disease_desc,disease_history,past_history}=this.data.case; - if( !disease_desc){ + let {abstract_str}=this.data.case; + if( !abstract_str){ flag && wx.showToast({ - title: '病历摘要主诉不能为空', + title: '病历摘要不能为空', icon:"none" }) - return false - } - if( !disease_history){ - flag && wx.showToast({ - title: '病历摘要现病史不能为空', - icon:"none" - }) - return false - } - if( !past_history){ - flag && wx.showToast({ - title: '病历摘要现病史不能为空', - icon:"none" - }) - return false + return false } + return true }, validateRecord(flag){ @@ -710,131 +721,178 @@ Page({ return true }, validateCheck(flag){ - let {headTime,afterTime,headTb,afterTb,headAlt,afterAlt,headInr,afterInr,headDb,afterDb,headIb,afterIb,headPta,afterPta,headIl6,afterIl6,headTnf,afterTnf,caseType,admissionTime,dpmas }=this.data.case; + let {headTime,afterTime,lastTime,headTb,afterTb,lastTb,headAlt,afterAlt,lastAlt,headAst,afterAst,lastAst,headInr,afterInr,lastInr,headAlb,afterAlb,lastAlb,caseType,admissionTime,dpmas}=this.data.case; let {fileList_check}=this.data; - if(!headTime){ + if(!headTime){ flag && wx.showToast({ - title: '治疗前检测时间不能为空', + title: '首次治疗前检测时间不能为空', icon:"none" }) return false }; if(!afterTime){ flag && wx.showToast({ - title: '治疗后检测时间不能为空', + title: '首次治疗后检测时间不能为空', + icon:"none" + }) + return false + }; + if(!lastTime){ + flag && wx.showToast({ + title: '最后一次治疗后检测时间不能为空', icon:"none" }) return false }; let headTime_new=dayjs(headTime).format('YYYY-MM-DD'); let afterTime_new=dayjs(afterTime).format('YYYY-MM-DD'); - let firstTime=dayjs(dpmas[0].treatTime).format('YYYY-MM-DD'); + let lastTime_new=dayjs(lastTime).format('YYYY-MM-DD'); + let firstTime=dayjs(dpmas[0].treatTime).format('YYYY-MM-DD');//第一次治疗时间 - let lastTime=dayjs(dpmas[dpmas.length-1].treatTime).format('YYYY-MM-DD') - let admissionTime_new=dayjs(admissionTime).format('YYYY-MM-DD'); - - if(caseType==2){ - if(!(dayjs(headTime_new).diff(dayjs(admissionTime_new))>=0 && dayjs(headTime_new).diff(dayjs(firstTime))<=0)){ - flag && wx.showToast({ - title: '治疗前检测时间应该在入院时间与第一次治疗时间之间', - icon:"none" - }) - return false - } - if(dpmas.length<2){ - if(!(dayjs(afterTime_new).diff(dayjs(firstTime))>=0)){ - flag && wx.showToast({ - title: '治疗后检测时间应该在第一次之后', - icon:"none" - }) - return false - } - - }else{ - let secondTime=dayjs(dpmas[1].treatTime).format('YYYY-MM-DD') - if(!(dayjs(afterTime_new).diff(dayjs(firstTime))>=0 && dayjs(afterTime_new).diff(dayjs(secondTime))<=0)){ - flag && wx.showToast({ - title: '治疗后检测时间应该在第一次与第二次治疗时间之间', - icon:"none" - }) - return false - }; - } - - - }; - if(caseType==1){ - if(!(dayjs(headTime_new).diff(dayjs(admissionTime_new))>=0 && dayjs(headTime_new).diff(dayjs(firstTime))<=0)){ - flag && wx.showToast({ - title: '治疗前检测时间应该在入院时间与第一次治疗时间之间', - icon:"none" - }) - return false - } - if(!(dayjs(afterTime_new).diff(dayjs(lastTime)>=0))){ - flag && wx.showToast({ - title: '治疗后检测时间应该最后一次治疗时间之后', - icon:"none" - }) - return false - } - } - if(!headTb || !afterTb){ + let lastTreatTime=dayjs(dpmas[dpmas.length-1].treatTime).format('YYYY-MM-DD')//最后一次治疗时间 + let admissionTime_new=dayjs(admissionTime).format('YYYY-MM-DD'); //住院时间 + //新加判断 + if(dayjs(headTime_new).diff(dayjs(afterTime_new))>=0){ flag && wx.showToast({ - title: '总胆红素未填写完整', - icon:"none" - }) - return false - }; - if(!headAlt || !afterAlt){ + title: '首次治疗时间前检测时间应该早于首次治疗后检测时间', + icon:'none' + }) + return false; + } + if(dayjs(afterTime_new).diff(dayjs(lastTime_new))>0){ flag && wx.showToast({ - title: '谷丙转氨酶未填写完整', - icon:"none" - }) - return false - }; - if(!headInr || !afterInr){ - flag && wx.showToast({ - title: '国际标准化比值未填写完整', - icon:"none" - }) - return false - } - // if(!headDb || !afterDb){ - // flag && wx.showToast({ - // title: '直接胆红素未填写完整', - // icon:"none" - // }) - // return false - // } - // if(!headIb || !afterIb){ - // flag && wx.showToast({ - // title: '间接胆红素未填写完整', - // icon:"none" - // }) - // return false - // } - // if(!headPta || !afterPta){ - // flag && wx.showToast({ - // title: '凝血酶原活动度未填写完整', - // icon:"none" - // }) - // return false - // } - // if(!headIl6 || !afterIl6){ - // flag && wx.showToast({ - // title: '白介素6未填写完整', + title: '最后一次治疗后检测时间应该早于或者等于首次次治疗后检测时间', + icon:'none' + }) + return false; + } + + // if(caseType==2){ + // if(!(dayjs(headTime_new).diff(dayjs(admissionTime_new))>=0 && dayjs(headTime_new).diff(dayjs(firstTime))<=0)){ + // flag && wx.showToast({ + // title: '治疗前检测时间应该在入院时间与第一次治疗时间之间', // icon:"none" // }) // return false + // } + // if(dpmas.length<2){ + // if(!(dayjs(afterTime_new).diff(dayjs(firstTime))>=0)){ + // flag && wx.showToast({ + // title: '治疗后检测时间应该在第一次之后', + // icon:"none" + // }) + // return false + // } + + // }else{ + // let secondTime=dayjs(dpmas[1].treatTime).format('YYYY-MM-DD') + // if(!(dayjs(afterTime_new).diff(dayjs(firstTime))>=0 && dayjs(afterTime_new).diff(dayjs(secondTime))<=0)){ + // flag && wx.showToast({ + // title: '治疗后检测时间应该在第一次与第二次治疗时间之间', + // icon:"none" + // }) + // return false + // }; // } - // if(!headTnf || !afterTnf){ - // wx.showToast({ - // title: '肿瘤坏死因子', - // icon:"none" - // }) - // return false - // } + + + // }; + // if(caseType==1){ + // if(!(dayjs(headTime_new).diff(dayjs(admissionTime_new))>=0 && dayjs(headTime_new).diff(dayjs(firstTime))<=0)){ + // flag && wx.showToast({ + // title: '治疗前检测时间应该在入院时间与第一次治疗时间之间', + // icon:"none" + // }) + // return false + // } + // if(!(dayjs(afterTime_new).diff(dayjs(lastTime)>=0))){ + // flag && wx.showToast({ + // title: '治疗后检测时间应该最后一次治疗时间之后', + // icon:"none" + // }) + // return false + // } + // } + if(!headTb || !afterTb){ + flag && wx.showToast({ + title: '总胆红素首次治疗前后未填写完整', + icon:"none" + }) + return false + }; + if(dpmas.length>1){ + if(!lastTb){ + flag && wx.showToast({ + title: '总胆红素最后一次治疗后不能为空', + icon:"none" + }) + return false + } + } + if(!headAlt || !afterAlt){ + flag && wx.showToast({ + title: '丙氨酸氨基转移酶首次治疗前后未填写完整', + icon:"none" + }) + return false + }; + if(dpmas.length>1){ + if(!lastAlt){ + flag && wx.showToast({ + title: '丙氨酸氨基转移酶最后一次治疗后不能为空', + icon:"none" + }) + return false + } + } + if(!headAst || !afterAst){ + flag && wx.showToast({ + title: '天门冬氨酸氨基转移酶首次治疗前后未填写完整', + icon:"none" + }) + return false + }; + if(dpmas.length>1){ + if(!lastAst){ + flag && wx.showToast({ + title: '天门冬氨酸氨基转移酶最后一次治疗后不能为空', + icon:"none" + }) + return false + } + } + if(!headAlb || !afterAlb){ + flag && wx.showToast({ + title: '白蛋白首次治疗前后未填写完整', + icon:"none" + }) + return false + }; + if(dpmas.length>1){ + if(!lastAlb){ + flag && wx.showToast({ + title: '白蛋白最后一次治疗后不能为空', + icon:"none" + }) + return false + } + } + if(!headInr || !afterInr){ + flag && wx.showToast({ + title: '国际标准化比值首次治疗前后未填写完整', + icon:"none" + }) + return false + } + if(dpmas.length>1){ + if(!lastInr){ + flag && wx.showToast({ + title: '国际标准化比值最后一次治疗后不能为空', + icon:"none" + }) + return false + } + } if(fileList_check.length==0){ flag && wx.showToast({ title: '请上传报告单', @@ -844,6 +902,38 @@ Page({ } return true; }, + validateBack(flag){ + let {discharge_time,day,discharge_status,discharge_situation}=this.data.case; + if(!discharge_time){ + flag && wx.showToast({ + title: '请选择出院时间', + icon:"none" + }) + return false + } + if(!day){ + flag && wx.showToast({ + title: '请输入住院天数', + icon:"none" + }) + return false + } + if(!discharge_situation){ + flag && wx.showToast({ + title: '请输入出院情况', + icon:"none" + }) + return false + } + if(!discharge_status){ + flag && wx.showToast({ + title: '请输入出院状态', + icon:"none" + }) + return false + } + return true + }, onChangeAbstract(event){ let {value}=event.detail this.setData({ @@ -871,7 +961,7 @@ Page({ }) }, saveDraft(){ - let {fileList_basic,fileList_abstract,fileList_check,dpmas_list}=this.data; + let {fileList_basic,fileList_check,dpmas_list}=this.data; let baseImg=''; let abstractImg=''; let checkImg=''; @@ -882,13 +972,6 @@ Page({ baseImg+=item.url; } }) - fileList_abstract.forEach(item=>{ - if(abstractImg){ - abstractImg+="," +item.url - }else{ - abstractImg+=item.url; - } - }) fileList_check.forEach(item=>{ if(checkImg){ checkImg+="," +item.url @@ -999,13 +1082,13 @@ Page({ }else if(time_str=="dealTime"){ key="dealTime" let year=dayjs(event.detail).format('YYYY') - if(year!=2024){ - this.setData({ - showTip:true, - showTime:false - }) - return false - } + // if(year!=2024){ + // this.setData({ + // showTip:true, + // showTime:false + // }) + // return false + // } time=dayjs(event.detail).format('YYYY-MM-DD HH:mm'); }else if(time_str=="headTime"){ @@ -1092,6 +1175,7 @@ Page({ time_type:'datetime', time_str:"dealTime", time_title:'选择治疗时间', + maxDate:new Date(dayjs().add(10,'year').toString()).getTime() }) }, openHeadTime(){ @@ -1123,7 +1207,7 @@ Page({ }, deleteImg(event){ - const { fileList_basic,fileList_abstract,fileList_check,dpmas_list} = this.data; + const { fileList_basic,fileList_check,dpmas_list} = this.data; const {name,index} = event.detail; if(name=='basic'){ @@ -1131,11 +1215,6 @@ Page({ this.setData({ fileList_basic:fileList_basic }) - }else if(name=="abstract"){ - fileList_abstract.splice(index,1); - this.setData({ - fileList_abstract:fileList_abstract - }) }else if(name=="check"){ fileList_check.splice(index,1); this.setData({ @@ -1157,7 +1236,7 @@ Page({ let { accessid, dir,policy,signature,host} = resdata; let imgUrl = file; //let index = imgUrl.lastIndexOf("/"); - let filename = FileUtil.UUID()+'.'+imgUrl.match(/\.(\w+)$/)[1]; + let filename = FileUtil.UUID()+'.'+THIS.getImageFormat(imgUrl); //imgUrl.substring(index + 1, imgUrl.length); @@ -1174,6 +1253,10 @@ Page({ success(res) { if (res.statusCode === 204) { + wx.showToast({ + title: '图片上传成功', + icon: "none" + }) resolve(true) let url = host + '/' + dir + filename; // 上传完成需要更新 fileList @@ -1183,10 +1266,6 @@ Page({ const { fileList_basic} = THIS.data; fileList_basic.push({ url: url }); THIS.setData({ fileList_basic }); - }else if(name=='abstract'){ - const { fileList_abstract} = THIS.data; - fileList_abstract.push({ url: url }); - THIS.setData({ fileList_abstract }); }else if(name=='check'){ const { fileList_check} = THIS.data; fileList_check.push({ url: url }); @@ -1213,51 +1292,58 @@ Page({ }) }, - afterRead(event) { - - console.log( event.detail) - const { file,name} = event.detail; - console.log(file) - wx.showLoading({ + getImageFormat(imageUrl){ + console.log(imageUrl) + var parts = imageUrl.split('.'); + return parts[parts.length - 1]; + }, + afterhandlePaint(e){ + wx.showLoading({ title: '图片上传中', mask: true }) - var promiseFun = []; - for (let i = 0; i < file.length; i++) { - var cur_file = file[i].url; - promiseFun.push( - this.uploadImg(cur_file,name) - ) - }; - Promise.all(promiseFun).then((res) => { - wx.showToast({ - title: '图片上传成功', - icon: "none" - }) - console.log(res.length+"张上传成功"); - wx.hideLoading(); + this.setData({ + showPaint:false + }) + const {imgSrc,name}=e.detail + console.log(e); + this.uploadImg(imgSrc,name) + }, + afterRead(event) { + console.log( event.detail) + const { file,name} = event.detail; + this.setData({ + paintSrc:file.url, + paintFrom:name, + showPaint:true + }) + console.log(file) + // wx.showLoading({ + // title: '图片上传中', + // mask: true + // }) + // var promiseFun = []; + // for (let i = 0; i < file.length; i++) { + // var cur_file = file[i].url; + // promiseFun.push( + // this.uploadImg(cur_file,name) + // ) + // }; + // Promise.all(promiseFun).then((res) => { + // wx.showToast({ + // title: '图片上传成功', + // icon: "none" + // }) + // console.log(res.length+"张上传成功"); + // wx.hideLoading(); - }).catch(error=>{ - wx.showToast({ - title: '图片上传失败', - icon: "none" - }) - console.log(error) - wx.hideLoading(); - }); - - // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式 - // wx.uploadFile({ - // url: 'https://example.weixin.qq.com/upload', // 仅为示例,非真实的接口地址 - // filePath: file.url, - // name: 'file', - // formData: { user: 'test' }, - // success(res) { - // // 上传完成需要更新 fileList - // const { fileList = [] } = this.data; - // fileList.push({ ...file, url: res.data }); - // this.setData({ fileList }); - // }, + // }).catch(error=>{ + // wx.showToast({ + // title: '图片上传失败', + // icon: "none" + // }) + // console.log(error) + // wx.hideLoading(); // }); }, /** diff --git a/case/pages/createCase/createCase.wxml b/case/pages/createCase/createCase.wxml index 73c850f..4f82585 100644 --- a/case/pages/createCase/createCase.wxml +++ b/case/pages/createCase/createCase.wxml @@ -72,40 +72,35 @@ 主要诊断(多选)* - - {{item.name}} + + {{item.name}} -