From 5a56083d0cf99c5f29d53ff7b724f03dcf9b5f05 Mon Sep 17 00:00:00 2001 From: zoujiandong <10130823232@qq.com> Date: Thu, 3 Jul 2025 13:14:39 +0800 Subject: [PATCH] =?UTF-8?q?7.3=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api.js | 25 +- app.json | 4 +- case/pages/agreement/agreement.wxss | 1 + case/pages/bankCard/bankCard.js | 180 ++++- case/pages/bankCard/bankCard.wxml | 75 +- case/pages/createCase/createCase.js | 970 ++++++++++++++++++++---- case/pages/createCase/createCase.json | 2 + case/pages/createCase/createCase.wxml | 471 ++++++++---- case/pages/createCase/createCase.wxss | 92 ++- case/pages/mobileLogin/mobileLogin.wxss | 1 + case/pages/paintDraw/paintDraw.js | 4 +- case/pages/pwdLogin/pwdLogin.wxss | 3 + case/pages/scan/scan.js | 197 +++++ case/pages/scan/scan.json | 3 + case/pages/scan/scan.wxml | 27 + case/pages/scan/scan.wxss | 29 + case/pages/webSign/webSign.js | 85 +++ case/pages/webSign/webSign.json | 3 + case/pages/webSign/webSign.wxml | 3 + case/pages/webSign/webSign.wxss | 1 + case/utils/data.js | 115 +-- components/nav/nav.js | 6 +- components/paintCanvas/paintCanvas.js | 15 +- components/paintCanvas/paintCanvas.wxml | 6 +- components/paintCanvas/paintCanvas.wxss | 8 + custom-tab-bar/index.js | 47 +- custom-tab-bar/index.wxml | 4 +- filters/filter.wxs | 11 +- package.json | 6 +- pages/index/index.js | 52 +- pages/index/index.wxml | 2 +- pages/index/index.wxss | 1 + pages/personCenter/personCenter.js | 5 + pages/personCenter/personCenter.wxml | 13 +- static/banner.jpg | Bin 0 -> 47295 bytes static/caozuo.png | Bin 1056 -> 0 bytes static/center_on.png | Bin 1288 -> 0 bytes static/create.png | Bin 20035 -> 0 bytes static/info.png | Bin 0 -> 2734 bytes static/list.png | Bin 574 -> 0 bytes static/list_on.png | Bin 1173 -> 0 bytes static/xiangmu.png | Bin 553 -> 0 bytes utils/request.js | 21 +- utils/tool.js | 0 44 files changed, 2003 insertions(+), 485 deletions(-) create mode 100644 case/pages/scan/scan.js create mode 100644 case/pages/scan/scan.json create mode 100644 case/pages/scan/scan.wxml create mode 100644 case/pages/scan/scan.wxss create mode 100644 case/pages/webSign/webSign.js create mode 100644 case/pages/webSign/webSign.json create mode 100644 case/pages/webSign/webSign.wxml create mode 100644 case/pages/webSign/webSign.wxss create mode 100644 static/banner.jpg delete mode 100644 static/caozuo.png delete mode 100644 static/center_on.png delete mode 100644 static/create.png create mode 100644 static/info.png delete mode 100644 static/list.png delete mode 100644 static/list_on.png delete mode 100644 static/xiangmu.png create mode 100644 utils/tool.js diff --git a/api/api.js b/api/api.js index 2303ef0..5002d3f 100644 --- a/api/api.js +++ b/api/api.js @@ -80,6 +80,24 @@ function getPrivacy(){//获取用户绑定手机号信息 function getProjectStatus(){//获取项目项目状态 return request(`/user/getProjectStatus`,'GET',{},true) } +function getExpertSign(){ //获取医生签名 + return request('/expert/sign','GET',{}) +}; +function getBankInfo(){ //获取医生签名 + return request('/user/getBank','GET',{}) +}; +function getfangxinSite(){ //获取医生签名 + return request('/expert/fxq','post',{}) +}; +function ocrIdCard(data){ + return request('/ocr/idCard','post',data,false) + +} +function ocrImg(data){ + return request('/ocr/image','post',data,false) +} + + // function getCaseNum(){//获取项目病例总数 // return request(`/user/getCaseNum`,'GET',{},true) @@ -115,5 +133,10 @@ module.exports={ modifyInfo, pwdLogin, getPrivacy, - getProjectStatus + getProjectStatus, + getExpertSign, + getBankInfo, + getfangxinSite, + ocrIdCard, + ocrImg } diff --git a/app.json b/app.json index 2f2f51c..4106663 100644 --- a/app.json +++ b/app.json @@ -17,7 +17,9 @@ "pages/privacy/privacy", "pages/bankCard/bankCard", "pages/paintDraw/paintDraw", - "pages/paintCanvas/paintCanvas" + "pages/paintCanvas/paintCanvas", + "pages/webSign/webSign", + "pages/scan/scan" ] } ], diff --git a/case/pages/agreement/agreement.wxss b/case/pages/agreement/agreement.wxss index b2ea1f5..e19154c 100644 --- a/case/pages/agreement/agreement.wxss +++ b/case/pages/agreement/agreement.wxss @@ -1,5 +1,6 @@ /* case/pages/agreement/agreement.wxss */ .page{ + overflow-y: scroll; background: #F7F9F9; flex:1; display: flex; diff --git a/case/pages/bankCard/bankCard.js b/case/pages/bankCard/bankCard.js index ce96e09..038f36a 100644 --- a/case/pages/bankCard/bankCard.js +++ b/case/pages/bankCard/bankCard.js @@ -2,7 +2,7 @@ // case/pages/register/register.js import {throttle} from "../../../utils/util" import {hostConfig} from "../../../utils/config" -import {getArea,addBank} from "../../../api/api" +import {getArea,addBank,getExpertSign,getBankInfo,getfangxinSite,ocrIdCard} from "../../../api/api" const host=hostConfig().host; const app=getApp(); Page({ @@ -10,6 +10,7 @@ Page({ * 页面的初始数据 */ data: { + isCanEdit:true, showSuccess:false, img_host:app.hostConfig().imghost, showArea:false, @@ -36,11 +37,128 @@ Page({ cityId:'', countyId:'', provId:'', - name:'', + idCardName:'', idCardNo:'', signImg:'', }, + seeIdCard(frontFile){ + ocrIdCard({ + frontBase64:frontFile + }).then(res=>{ + wx.hideLoading() + if(res.idCardNo){ + this.setData({ + idCardNo:res.idCardNo + }) + } + }) + }, + afterRead(event){ + + const { file } = event.detail; + console.log(file); + wx.getFileSystemManager().readFile({ + filePath:file.url, + encoding:'base64', + success:res=>{ + console.log(res.data) + wx.showLoading({ + title: '正在识别中...', + mask: true + }) + this.seeIdCard(res.data) + } + }) + }, + getBank(){ + getBankInfo().then(res=>{ + let hasBank=false; + if(res){ + hasBank=true; + for (const key in res) { + this.setData({ + [key]:res[key] + }) + } + let {provId,cityId,countyId,areaColumns}=this.data; + let areaName=''; + + if(provId){ + for (let i = 0; i < areaColumns[0].values.length; i++) { + if(areaColumns[0].values[i].id==provId){ + areaName+=areaColumns[0].values[i].name; + break; + } + } + }; + console.log(areaColumns[1].values) + if(cityId){ + for (let i = 0; i < areaColumns[1].values.length; i++) { + console.log((areaColumns[1].values)[i].id) + if(areaColumns[1].values[i].id==cityId){ + console.log(1111) + console.log(areaColumns[1].values[i]) + areaName+=areaColumns[1].values[i].name; + break; + } + } + }; + if(countyId){ + for (let i = 0; i < areaColumns[2].values.length; i++) { + if(areaColumns[2].values[i].id==countyId){ + areaName+=areaColumns[2].values[i].name; + break; + } + } + }; + this.setData({ + cityName:areaName + }) + }; + this.handleGetSign(hasBank); + }) + }, + getSite(){ + getfangxinSite().then(res=>{ + app.method.navigateTo({ + url:'/case/pages/webSign/webSign?src='+encodeURIComponent(res.linkUrl) + }) + }) + }, + handleGetSign(hasBank){ + getExpertSign().then(res=>{ + //有银行卡,已签署 + if(hasBank && res.taskStatus==1){ + this.setData({ + isCanEdit:false + }) + } + //有银行卡,未签署 + if(hasBank && res.taskStatus==2){ + //跳转签署地址 + //this.getSite(); + + } + //无银行卡,未签署 + if(!hasBank && res.taskStatus==2){ + //跳转签署地址 + + } + }).catch(error=>{ + if(error.code==30007){ + wx.showToast({ + title: '您未登录', + icon:'none', + duration:4000 + }) + app.method.navigateTo({ + url: '/case/pages/mobileLogin/mobileLogin', + }) + } + }) + }, opeArea(){ + if(!this.data.isCanEdit) return false; this.setData({ showArea:true }) @@ -119,8 +237,15 @@ Page({ handleAddBank:throttle(function(){ - let {signImg,bankCardNo,bankName,cityId,countyId,idCardNo,name,provId}=this.data; - if (!/^([\u4e00-\u9fa5\·]{2,10})$/.test(name)) { + if(!this.data.isCanEdit){ + wx.showToast({ + title: `当前状态不可提交`, + icon: 'none', + }); + return false + }; + let {signImg,bankCardNo,bankName,cityId,countyId,idCardNo,idCardName,provId}=this.data; + if (!/^([\u4e00-\u9fa5\·]{2,10})$/.test(idCardName)) { wx.showToast({ title: `姓名要求在2-10个汉字`, icon: 'none', @@ -155,34 +280,35 @@ Page({ }); return false; }; - if(!signImg){ - wx.showToast({ - title: `请添加签名`, - icon: 'none', - }); - return false; - } + // if(!signImg){ + // wx.showToast({ + // title: `请添加签名`, + // icon: 'none', + // }); + // return false; + // } addBank({ - signImg, bankCardNo, bankName, cityId, countyId, idCardNo, - name, + idCardName, provId }).then(res=>{ + let that=this; wx.showToast({ title: '绑定成功', icon:'none', duration:2000, success:function(){ - let timer=setTimeout(()=>{ - wx.switchTab({ - url: '/pages/index/index', - }) - clearTimeout(timer) - },1000) + that.getBank(); + // let timer=setTimeout(()=>{ + // wx.switchTab({ + // url: '/pages/index/index', + // }) + // clearTimeout(timer) + // },1000) } }) }) @@ -236,9 +362,9 @@ Page({ this.setData({ [obj]:res }) - + this.getBank(); } - + }).catch(error=>{ console.log(error) }) @@ -268,7 +394,8 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { - this.handleGetArea('',1); + + }, /** @@ -282,7 +409,14 @@ Page({ * 生命周期函数--监听页面显示 */ onShow() { - + this.handleGetArea('',1); + + // app.method.navigateTo({ + // url:'/case/pages/webSign/webSign?src='+encodeURIComponent("https://mobile.fangxinqian.cn/contractedit?sid=A2378423BDBED02430A89F5E26E35B4B&rid=45489629134796B315C1DFE27BE72C57&tno=1938884566517420032"), + // complete(e){ + // console.log(e); + // } + // }) }, /** diff --git a/case/pages/bankCard/bankCard.wxml b/case/pages/bankCard/bankCard.wxml index 8f5dcc4..c792c8d 100644 --- a/case/pages/bankCard/bankCard.wxml +++ b/case/pages/bankCard/bankCard.wxml @@ -1,29 +1,38 @@ - + 请确定开户人姓名与真实姓名一致 - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 提交 + 签署协议 + - - + + \ No newline at end of file diff --git a/case/pages/createCase/createCase.js b/case/pages/createCase/createCase.js index 4802bb4..5661fb3 100644 --- a/case/pages/createCase/createCase.js +++ b/case/pages/createCase/createCase.js @@ -1,9 +1,10 @@ // case/pages/createCase/createCase.js -import {addCase,caseDetail,editCase,getOssSign} from "../../../api/api" +import {addCase,caseDetail,editCase,getOssSign,ocrImg} from "../../../api/api" const dayjs = require("../../../utils/dayjs"); import {throttle} from "../../../utils/util" import { FileUtil } from '../../../utils/fileutil' -import {diagnoseOption,patientSickOption,ganneiOption,ganwaiOption,moshiOption,hospitalOption,kangningOption} from "../../utils/data" +import {diagnoseOption,patientSickOption,ganneiOption,ganwaiOption,moshiOption,hospitalOption,kangningOption,il6Unit,doseUnit} from "../../utils/data" + const app=getApp(); Page({ /** @@ -11,14 +12,21 @@ Page({ */ data: { value:[], + ocrChecked:false, + tagList:[], + ocrType:'', + showOcr:false, kangningOption:kangningOption, diagnoseOption:diagnoseOption, patientSickOption:patientSickOption, ganneiOption:ganneiOption, ganwaiOption:ganwaiOption, + il6Unit:il6Unit, + doseUnit:doseUnit, moshiOption:moshiOption, hospitalOption:hospitalOption, editorHeight:'calc(100vh - 600rpx)', + editorHeight2:'calc(100vh - 800rpx)!important', paintFrom:'basic', paintSrc:'', showPaint:false, @@ -30,6 +38,10 @@ Page({ showDraft:false, showUseDraft:false, isUseDraft:false, + cursorText:{ + before:'', + after:'' + }, medicalRecordId:'', dealIndex:0, showTime:false, @@ -56,17 +68,17 @@ Page({ sex:null, age:'', admissionTime:'', - caseType:'', - main_diagnose:{ + caseType:[], + mainDiagnose:{ select:[], otherValue:'', - main_diagnose_img:[] + mainDiagnoseImg:'' }, - disease_cause:{ + diseaseCause:{ select:[], otherValue:'' }, - trigger:{ //基本信息结束 + seductionReason:{ //基本信息结束 inside:{ select:[], otherValue:'' @@ -76,10 +88,48 @@ Page({ otherValue:'' }, }, - abstract_str:'',//临床资料结束 + abstractStr:'',//临床资料结束 dpmas:[{ - 'dpmasImg':'', - 'treatTime':'' + 'treatTime':'', + 'content':{ + "mode":{ // 模式 + "select":"", + "otherValue":"", + }, + "plasma":{ // 血浆 + "handle":"", + "replace":"" + }, + "dose":{ // 抗凝剂量 + "select":[], + "heparin":{ // 肝素 + "firstDose":"",//首剂 + "firstDoseUnit":'1', + "append":"",//追加 + "appendUnit":'1', + }, + "lowHeparin":{ // 低分子肝素 + "value":"" + }, + "citricAcid":{ // 枸橼酸 + "bloodFlowRate":"",//血液流速 + "citricAcidFlowRate":"",//枸橼酸钠流速 + "calciumAgent":{ // 钙剂 + "select":"", + "value":"", + } + }, + "nafamostat":{ // 甲磺酸萘莫司他 + "value":"" + }, + "other":{ // 其他 + "name":"", + "dose":"" + } + } + + }, + dpmasImg:'' }], headTime:'', afterTime:'', @@ -89,13 +139,14 @@ Page({ lastTb:'', headDb:'', afterDb:'', + il6Unit:'2', lastDb:'', headIb:'', afterIb:'', lastIb:'', headAlt:'', afterAlt:'', - lastALt:'', + lastAlt:'', headAst:'', afterAst:'', lastAst:'', @@ -118,10 +169,10 @@ Page({ afterTnf:'', lastTnf:'', checkImg:'', - discharge_time:'', + dischargeTime:'', day:'', - discharge_situation:'', - discharge_status:'' + dischargeSituation:'', + dischargeStatus:'' }, time_type:'date', time_str:"hospitalTime", @@ -130,6 +181,8 @@ Page({ currentDate: new Date().getTime(), maxDate:new Date().getTime(),//new Date().getTime(), minDate:new Date('2024-10-01').getTime(), + editorCtx:null, + editorCtxDischarge:null, formatter(type, value) { if (type === 'year') { return `${value}年`; @@ -150,43 +203,355 @@ Page({ }, }, + onChangeOcrCheck(event){ + let {tagList}=this.data; + this.setData({ + ocrChecked:event.detail, + }); + let {ocrChecked}=this.data; + if(ocrChecked){ + tagList.forEach((item,index)=>{ + let key='tagList['+index+'].checked'; + this.setData({ + [key]:true + }); + }) + }else{ + tagList.forEach((item,index)=>{ + let key='tagList['+index+'].checked'; + this.setData({ + [key]:false + }); + }) + } + }, + afterReadOcr(event){ + const { file,name} = event.detail; + // this.uploadImg(file.url,'').then(res=>{ + // console.log(res) + // let link='https://dev-wx.igandan.com/croper/croper.htm?imgUrl='+res+'&name='+name; + // wx.navigateTo({ + // url: '/case/pages/webSign/webSign?src='+encodeURIComponent(link), + // }) + // }) + + wx.getFileSystemManager().readFile({ + filePath:file.url, + encoding:'base64', + success:res=>{ + // wx.showLoading({ + // title: '正在识别中...', + // mask: true + // }) + this.ocrImgText(res.data,name) + } + }) + }, + toggleWord(event){ + let index=Number(event.target.dataset.index); + let {tagList}=this.data; + + let checked=!tagList[index].checked; + let key='tagList['+index+'].checked'; + console.log(checked); + this.setData({ + [key]:checked + }); + }, + blurDischargeSituation(e){ + const { value, cursor } = e.detail; + const textBeforeCursor = value.substring(0, cursor); // 光标前的文本 + const textAfterCursor = value.substring(cursor); // 光标后的文本 + this.setData({ + cursorText:{ + before:textBeforeCursor, + after:textAfterCursor + } + }) + console.log('Text before cursor:', textBeforeCursor); + console.log('Text after cursor:', textAfterCursor); + }, + confirmOcr(){ + let {tagList,ocrType,cursorText}=this.data; + let txt=''; + tagList.forEach(item=>{ + if(item.checked){ + if(txt){ + txt+=item.words; + }else{ + txt+=item.words + } + } + + }) + if(ocrType=="dischargeSituation"){ + // let {cursorText}=this.data; + // this.setData({ + // ['case.'+ocrType]:cursorText.before+txt+cursorText.after, + // }) + this.data.editorCtxDischarge.insertText({ + text:txt, + + }); + }else{ + this.data.editorCtx.insertText({ + text:txt, + + }); + + } + this.setData({ + showOcr:false + }) + }, + ocrImgText(mageBase64,name){ + this.setData({ + ocrChecked:false + }) + wx.showLoading({ + title: '正在识别中...', + mask: true + }) + ocrImg({ + imageBase64:mageBase64 + }).then(res=>{ + wx.hideLoading(); + //let txt='' + let list=res.wordsResult; + + if(list.length>0){ + + let arr=list.map(item=>{ + + return { + checked:false, + words:item.words + } + + }) + this.setData({ + tagList:arr, + ocrType:name, + showOcr:true + }) + + }; + + + + }) + }, + closeOcr(){ + this.setData({ + showOcr:false + }) + }, onEditorReady() { const that = this wx.createSelectorQuery().select('#editor').context(function (res) { - that.editorCtx = res.context; + that.setData({ + editorCtx:res.context + }) let html = "

【主诉】:


【现病史】:


【既往史】:



"; - that.editorCtx.setContents({ + let str=that.data.case.abstractStr; + + if(str){ + html=str + }; + that.data.editorCtx.setContents({ html:html }) + + }).exec() + }, + onEditorReadyDischarge() { + const that = this + wx.createSelectorQuery().select('#editor2').context(function (res) { + that.setData({ + editorCtxDischarge:res.context + }) + + let str=that.data.case.dischargeSituation; + let html=''; + if(str){ + html=str; + that.data.editorCtxDischarge.setContents({ + html:html + }); + that.data.editorCtxDischarge.blur() + }; + }).exec() }, onChangeCheck(event){ console.log(event); + let type=event.target.dataset.type; + let clear=event.target.dataset.clear; let arr=event.detail; - this.setData({ - value:arr - }) - if(arr[arr.length-1]=="-1"){ + this.setData({ + [type]:event.detail + }); + if(type.indexOf('dose')>-1){ + if(arr.indexOf('1')==-1){ this.setData({ - value:["-1"] + [clear+'.heparin.firstDose']:'', + [clear+'.heparin.append']:'' }) - }else{ - let index=arr.indexOf("-1"); - if(index>-1){ - arr.splice(index, 1); - this.setData({ - value:arr - }) + }; + if(arr.indexOf('2')==-1){ + this.setData({ + [clear+'.lowHeparin.value']:'', + }) + } + if(arr.indexOf('3')==-1){ + this.setData({ + [clear+'.citricAcid.bloodFlowRate']:'', + [clear+'.citricAcid.citricAcidFlowRate']:'', + [clear+'.citricAcid.calciumAgent.value']:'', + [clear+'.citricAcid.calciumAgent.select']:'', + + }) + } + if(arr.indexOf('4')==-1){ + this.setData({ + [clear+'.nafamostat.value']:'', + }) + } + if(arr.indexOf('-1')==-1){ + this.setData({ + [clear+'.other.name']:'', + [clear+'.other.dose']:'', + }) + } + }else{ + if(clear && arr.indexOf('-1')==-1){ + this.setData({ + [clear]:'' + }) + } + + } + }, + deepClone(source) { + if (typeof source !== 'object' || source == null) { + return source; + } + const target = Array.isArray(source) ? [] : {}; + for (const key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + if (typeof source[key] === 'object' && source[key] !== null) { + target[key] = this.deepClone(source[key]); + } else { + target[key] = source[key]; + } } } - console.log(this.data.value) + return target; + }, + formatString(obj){ + let newObj=this.deepClone(obj); + for (const key in newObj) { + if(key=='mainDiagnose' || key=='diseaseCause'){ + // for (const j in newObj[key]){ + // let item=newObj[key][j]; + // if(typeof item=='object'){ + // newObj[key][j]=JSON.stringify(item) + // } + + // } + newObj[key]=JSON.stringify(newObj[key]) + } + + if(key=="seductionReason"){ + // for (const j in newObj.seductionReason.inside){ + // let item=newObj.seductionReason.inside[j]; + // if(typeof item=='object'){ + // newObj.seductionReason.inside[j]=JSON.stringify(item) + // } + + // } + // newObj.seductionReason.inside=JSON.stringify( newObj.seductionReason.inside); + // for (const i in newObj.seductionReason.outside){ + // let item=newObj.seductionReason.outside[i]; + // if(typeof item=='object'){ + // newObj.seductionReason.outside[i]=JSON.stringify(item) + // } + + // } + // newObj.seductionReason.outside=JSON.stringify(newObj.seductionReason.outside); + newObj.seductionReason=JSON.stringify(newObj.seductionReason); + + } + if(key=="dpmas"){ + for (let index = 0; index < newObj.dpmas.length; index++) { + const element = (newObj.dpmas)[index]; + // console.log(element.content.mode) + + // element.content.mode=JSON.stringify(element.content.mode); + // element.content.plasma=JSON.stringify(element.content.plasma) + + // element.content.dose.select=JSON.stringify(element.content.dose.select); + // element.content.dose.heparin=JSON.stringify(element.content.dose.heparin); + // element.content.dose.lowHeparin=JSON.stringify(element.content.dose.lowHeparin); + // element.content.dose.citricAcid.calciumAgent=JSON.stringify(element.content.dose.citricAcid.calciumAgent); + // element.content.dose.citricAcid=JSON.stringify( element.content.dose.citricAcid) + // element.content.dose.nafamostat=JSON.stringify( element.content.dose.nafamostat) + // element.content.dose.other=JSON.stringify( element.content.dose.other) + // element.content.dose=JSON.stringify( element.content.dose) + element.content=JSON.stringify(element.content) + + + } + } + } + return newObj + }, + formatJson(obj){ + for (const key in obj) { + if(key=="mainDiagnose" || key=="diseaseCause" ||key=="caseType"){ + obj[key]=JSON.parse(obj[key]); + //obj[key].select=JSON.parse(obj[key].select) + }; + + if(key=="seductionReason"){ + obj.seductionReason=JSON.parse(obj.seductionReason); + // obj.seductionReason.inside=JSON.parse(obj.seductionReason.inside); + // obj.seductionReason.inside.slect=JSON.parse(obj.seductionReason.inside.select); + // obj.seductionReason.outside=JSON.parse(obj.seductionReason.outside); + // obj.seductionReason.outside.slect=JSON.parse(obj.seductionReason.outside.select); + }; + if(key=="dpmas"){ + for (let index = 0; index < obj.dpmas.length; index++) { + const element = obj.dpmas[index]; + element.content=JSON.parse(element.content); + // element.content.mode=JSON.parse(element.content.mode); + // element.content.mode.select=JSON.parse(element.content.mode.select); + // element.content.plasma=JSON.parse(element.content.plasma); + // element.content.dose=JSON.parse(element.content.dose); + // element.content.dose.select=JSON.parse(element.content.dose.select); + // element.content.dose.heparin=JSON.parse(element.content.dose.heparin); + // element.content.dose.lowHeparin=JSON.parse(element.content.dose.lowHeparin); + // element.content.dose.citricAcid=JSON.parse(element.content.dose.citricAcid); + // element.content.dose.citricAcid.calciumAgent=JSON.parse(element.content.dose.citricAcid.calciumAgent); + // element.content.dose.nafamostat=JSON.parse(element.content.dose.citrnafamostaticAcid); + // element.content.dose.other=JSON.parse(element.content.dose.other); + + + } + } + + + + } + return obj }, onChangeOther(event){ let {detail,currentTarget}=event; - this.setData({ - [currentTarget.dataset.type]:detail.value - }) + let type=currentTarget.dataset.type + this.setData({ + [type]:detail.value + }) }, toggleCheck(event){ console.log(event); @@ -201,7 +566,6 @@ Page({ }) } - !this.data.medicalRecordId && this.saveDraft(); }, saveAbstract(){ @@ -220,6 +584,14 @@ Page({ } !this.data.medicalRecordId && this.saveDraft(); }, + saveCheck(){ + if(this.validateCheck(true)){ + this.setData({ + active:4 + }) + } + !this.data.medicalRecordId && this.saveDraft(); + }, goBack:throttle(function(){ let {medicalRecordId}=this.data; if(!medicalRecordId && this.isHasValue()){ @@ -231,14 +603,60 @@ Page({ } }), + hasRecordValue(){ + let {dpmas}=this.data.case; + for (let i = 0; i < dpmas.length; i++) { + let item=dpmas[i].content; + if(item){ + if(item.mode.select){ + return true + }; + if(item.mode.otherValue){ + return true + } + if(item.plasma.handle){ + return true + } + if(item.plasma.replace){ + return true + } + if(item.dose.select.length>0){ + return true + } + if(item.dose.heparin.firstDose || item.dose.heparin.append){ + return true + } + if(item.dose.lowHeparin.value){ + return true + } + let qys=item.dose.citricAcid; + if(qys.bloodFlowRate || qys.citricAcidFlowRate || qys.calciumAgent.select || qys.calciumAgent.value){ + return true + } + if(item.dose.nafamostat.value){ + return true + }; + if(item.dose.other.name || item.dose.other.dose){ + return true + } + } + + + } + return false + }, isHasValue(){ - 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 {name,uid,sex,age,admissionTime,caseType,mainDiagnose,diseaseCause,seductionReason,abstractStr,headTime,afterTime,headTb,afterTb,headAlt,afterAlt,headAlb,afterAlb,headAst,afterAst,headInr,afterInr,headDb,afterDb,headIb,afterIb,headPta,afterPta,headIl6,afterIl6,headTnf,afterTnf,dpmas}=this.data.case; + let {fileList_basic,fileList_check,dpmas_list,dischargeTime,day,dischargeStatus,dischargeSituation}=this.data; + let hasTime=dpmas_list.some(item=>{ return item.fileList.length>0}); let hasImg=dpmas_list.some(item=>{ return item.treatTime!=''}); + let hasRec=false; + if(!hasTime && !hasImg){ + hasRec= this.hasRecordValue(); + } - 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){ + if(name || uid || sex || age || admissionTime || caseType.length>0 || mainDiagnose.select.length>0 || mainDiagnose.otherValue || diseaseCause.select.length>0 || diseaseCause.otherValue || seductionReason.inside.select.length>0 || seductionReason.inside.otherValue || seductionReason.outside.select.length>0 || seductionReason.outside.otherValue || abstractStr || 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 || dischargeTime || day || dischargeStatus || dischargeSituation || hasRec){ return true }else{ return false @@ -249,7 +667,7 @@ Page({ let baseImg=''; let abstractImg=''; let checkImg=''; - if(this.validateBasic(true) && this.validateZiliao(true) && this.validateRecord(true) && this.validateCheck(true)){ + if(this.validateBasic(true) && this.validateZiliao(true) && this.validateRecord(true) && this.validateCheck(true) && this.validateBack(true)){ fileList_basic.forEach(item=>{ if(baseImg){ baseImg+="," +item.url @@ -281,16 +699,19 @@ Page({ }) }) this.setData({ - 'case.baseImg':baseImg, + 'case.mainDiagnose.mainDiagnoseImg':baseImg, 'case.abstractImg':abstractImg, 'case.checkImg':checkImg }) - let caseObj=this.data.case; - let {admissionTime,headTime,afterTime}=this.data.case; + let caseObj=this.formatString(this.data.case); + caseObj.caseType=JSON.stringify(this.data.case.caseType); + let {admissionTime,headTime,afterTime,lastTime,dischargeTime}=this.data.case; Object.assign(caseObj,{ admissionTime:dayjs(admissionTime).format('YYYY-MM-DD HH:mm:ss'), headTime:dayjs(headTime).format('YYYY-MM-DD HH:mm:ss'), - afterTime:dayjs(afterTime).format('YYYY-MM-DD HH:mm:ss') + afterTime:dayjs(afterTime).format('YYYY-MM-DD HH:mm:ss'), + lastTime:lastTime?dayjs(lastTime).format('YYYY-MM-DD HH:mm:ss'):'', + dischargeTime:dayjs(dischargeTime).format('YYYY-MM-DD HH:mm:ss') }) addCase({...caseObj}).then(res=>{ wx.showToast({ @@ -310,7 +731,7 @@ Page({ let baseImg=''; let abstractImg=''; let checkImg=''; - if(this.validateBasic(true) && this.validateZiliao(true) && this.validateRecord(true) && this.validateCheck(true)){ + if(this.validateBasic(true) && this.validateZiliao(true) && this.validateRecord(true) && this.validateCheck(true) && this.validateBack(true)){ fileList_basic.forEach(item=>{ if(baseImg){ baseImg+="," +item.url @@ -342,19 +763,22 @@ Page({ }) }) this.setData({ - 'case.baseImg':baseImg, + 'case.mainDiagnose.mainDiagnoseImg':baseImg, 'case.abstractImg':abstractImg, 'case.checkImg':checkImg }) - let {admissionTime,headTime,afterTime}=this.data.case; + let {admissionTime,headTime,afterTime,lastTime,dischargeTime}=this.data.case; this.setData({ 'case.id':medicalRecordId }) - let caseObj=this.data.case; + let caseObj=this.formatString(this.data.case); + caseObj.caseType=JSON.stringify(this.data.case.caseType); Object.assign(caseObj,{ admissionTime:dayjs(admissionTime).format('YYYY-MM-DD HH:mm:ss'), headTime:dayjs(headTime).format('YYYY-MM-DD HH:mm:ss'), - afterTime:dayjs(afterTime).format('YYYY-MM-DD HH:mm:ss') + afterTime:dayjs(afterTime).format('YYYY-MM-DD HH:mm:ss'), + lastTime:lastTime?dayjs(lastTime).format('YYYY-MM-DD HH:mm:ss'):"", + dischargeTime:dayjs(dischargeTime).format('YYYY-MM-DD HH:mm:ss') }) editCase({...caseObj}).then(res=>{ wx.showToast({ @@ -369,24 +793,35 @@ Page({ initAllvalue(res){ let caseObj=this.data.case; for (const key in caseObj) { - if(key=="admissionTime"){ + if(key=="admissionTime" || key=="dischargeTime"){ this.setData({ ['case.'+key]:res[key]?dayjs(res[key]).format('YYYY-MM-DD'):'' }) - }else if(key=='main_diagnose'){ + }else if(key=="caseType"){ + if(typeof res[key]=="string"){ this.setData({ - 'case.main_diagnose.select':res[key].select, - 'case.main_diagnose.otherValue':res[key].otherValue + ['case.'+key]:JSON.parse(res[key]) + }) + }else{ + this.setData({ + ['case.'+key]:res[key] + }) + } + }else if(key=='mainDiagnose'){ + this.setData({ + 'case.mainDiagnose':res[key] }) - if(res[key].main_diagnose_img.length>0){ - let arr=res[key].main_diagnose_img.map(item=>{ - url:item + if(res[key].mainDiagnoseImg){ + let imgList=res[key].mainDiagnoseImg.split(','); + //console.log(imgList) + let arr=imgList.map(item=>{ + return {url:item} }) this.setData({ 'fileList_basic':arr }) } - + }else if(key=='checkImg'){ if(res[key]){ let imgList=res[key].split(','); @@ -414,15 +849,15 @@ Page({ [objFile]:imgList.map(item1=>{ return {url:item1} }), - [objTime]:item.treatTime?dayjs(item.treatTime).format('YYYY-MM-DD HH'):'' + [objTime]:item.treatTime?dayjs(item.treatTime).format('YYYY-MM-DD'):'' }) } }) - }else if(key=='headTime' || key=='afterTime'){ + }else if(key=='headTime' || key=='afterTime' || key=="lastTime"){ this.setData({ - ['case.'+key]:res[key]?dayjs(res[key]).format('YYYY-MM-DD HH'):'' + ['case.'+key]:res[key]?dayjs(res[key]).format('YYYY-MM-DD'):'' }) }else if(key=='abstractStr'){ this.setData({ @@ -441,7 +876,9 @@ Page({ handleCaseDetail(){ let { medicalRecordId}=this.data; caseDetail(medicalRecordId).then(res=>{ - this.initAllvalue(res) + let result=this.formatJson(res); + console.log(result); + this.initAllvalue(result) }) }, onBeforeChange(event){ @@ -452,46 +889,59 @@ Page({ }) callback(true); }else if(index==1){ - // if(this.validateBasic()){ + if(this.validateBasic()){ callback(true); this.setData({ active:1 }) - // }else{ - // this.setData({ - // showAttention:true - // }) - // callback(false) - // } + + }else{ + this.setData({ + showAttention:true + }) + callback(false) + } }else if(index==2){ - // if(this.validateBasic(false) && this.validateZiliao(false)){ + if(this.validateBasic(false) && this.validateZiliao(false)){ callback(true); this.setData({ active:2 }) - // }else{ - // this.setData({ - // showAttention:true - // }) - // callback(false) - // } + }else{ + this.setData({ + showAttention:true + }) + callback(false) + } }else if(index==3){ - // if(this.validateBasic(false) && this.validateZiliao(false) && this.validateRecord(false)){ + if(this.validateBasic(false) && this.validateZiliao(false) && this.validateRecord(false)){ callback(true); this.setData({ active:3 }) - // }else{ - // this.setData({ - // showAttention:true - // }) - // callback(false) - // } + }else{ + this.setData({ + showAttention:true + }) + callback(false) + } }else if(index==4){ + if(this.validateBasic(false) && this.validateZiliao(false) && this.validateRecord(false) && this.validateCheck(false)){ callback(true); this.setData({ active:4 }) + }else{ + this.setData({ + showAttention:true + }) + callback(false) + } + }else if(index==5){ + callback(true); + this.setData({ + active:5 + }) } }, confirmDelRecord(event){ @@ -505,11 +955,11 @@ Page({ let {dpmas}=this.data.case; let {dpmas_list}=this.data; let index=this.data.delIndex; - dpmas.splice(index,1); + dpmas.splice(index,1); dpmas_list.splice(index,1); this.setData({ 'case.dpmas':dpmas, - dpmas_list:dpmas_list + dpmas_list:dpmas_list }) }, @@ -534,11 +984,16 @@ Page({ this.validateBasic(); this.validateZiliao(); this.validateRecord(); + }else if(index==4){ + this.validateBasic(); + this.validateZiliao(); + this.validateRecord(); + this.validateCheck(); } }, validateBasic(flag){ - let {name,uid,sex,age,admissionTime,caseType,main_diagnose,disease_cause,trigger}=this.data.case; + let {name,uid,sex,age,admissionTime,caseType,mainDiagnose,diseaseCause,seductionReason}=this.data.case; let {fileList_basic}=this.data; if(!name){ flag && wx.showToast({ @@ -583,14 +1038,14 @@ Page({ }) return false } - if(main_diagnose.select.length==0){ + if(mainDiagnose.select.length==0){ flag && wx.showToast({ title: '请选择主要诊断类型', icon:"none" }) return false } - if(main_diagnose.select.length==0 && !main_diagnose.otherValue){ + if(mainDiagnose.select.length==0 && !mainDiagnose.otherValue){ flag && wx.showToast({ title: '主要诊断其他不能为空', icon:"none" @@ -604,42 +1059,43 @@ Page({ }) return false } - if(disease_cause.select.length==0){ + //console.log(this.data.case) + if(diseaseCause.select.length==0){ flag && wx.showToast({ title: '请选择患者病因类型', icon:"none" }) return false } - if(disease_cause.select.length==0 && !disease_cause.otherValue){ + if(diseaseCause.select.length==0 && !diseaseCause.otherValue){ flag && wx.showToast({ title: '患者病因其他不能为空', icon:"none" }) return false } - if(trigger.inside.select.length==0){ - flag && wx.showToast({ - title: '请选择诱因肝内类型', - icon:"none" - }) - return false - } - if(trigger.inside.select.length==0 && !trigger.inside.otherValue){ + // if(seductionReason.inside.select.length==0){ + // flag && wx.showToast({ + // title: '请选择诱因肝内类型', + // icon:"none" + // }) + // return false + // } + if(seductionReason && seductionReason.inside && seductionReason.inside.select && seductionReason.inside.select.indexOf('-1')!=-1 && !seductionReason.inside.otherValue){ flag && wx.showToast({ title: '请选择诱因肝内其他不能为空', icon:"none" }) return false } - if(trigger.outside.select.length==0){ - flag && wx.showToast({ - title: '请选择诱因肝外类型', - icon:"none" - }) - return false - } - if(trigger.outside.select.length==0 && !trigger.outside.otherValue){ + // if(seductionReason.outside.select.length==0){ + // flag && wx.showToast({ + // title: '请选择诱因肝外类型', + // icon:"none" + // }) + // return false + // } + if(seductionReason && seductionReason.outside && seductionReason.outside.select && seductionReason.outside.select.indexOf('-1')!=-1 && !seductionReason.outside.otherValue){ flag && wx.showToast({ title: '请选择诱因肝外其他不能为空', icon:"none" @@ -649,8 +1105,8 @@ Page({ return true }, validateZiliao(flag){ - let {abstract_str}=this.data.case; - if( !abstract_str){ + let {abstractStr}=this.data.case; + if( !abstractStr){ flag && wx.showToast({ title: '病历摘要不能为空', icon:"none" @@ -661,23 +1117,23 @@ Page({ return true }, validateRecord(flag){ - let {dpmas,admissionTime,caseType}=this.data.case; + let {dpmas,admissionTime}=this.data.case; let {dpmas_list}=this.data; - if(caseType==1 && dpmas.length<4){ - flag && wx.showToast({ - title: 'DPMAS治疗不少于4次', - icon:'none' - }) - return false; - }; - if(caseType==2 && dpmas.length<1){ - flag && wx.showToast({ - title: 'DPMAS治疗不少于1次', - icon:'none' - }) - return false; - } + // if(caseType==1 && dpmas.length<4){ + // flag && wx.showToast({ + // title: 'DPMAS治疗不少于4次', + // icon:'none' + // }) + // return false; + // }; + // if(caseType==2 && dpmas.length<1){ + // flag && wx.showToast({ + // title: 'DPMAS治疗不少于1次', + // icon:'none' + // }) + // return false; + // } for (let i = 0; i < dpmas.length; i++) { if(!dpmas[i].treatTime){ flag && wx.showToast({ @@ -690,13 +1146,13 @@ Page({ let time1=dayjs(admissionTime).format('YYYY-MM-DD'); let time2=dayjs(dpmas[0].treatTime).format('YYYY-MM-DD'); - if(dayjs(time1).diff(dayjs(time2))>0){ - flag && wx.showToast({ - title: '患者基本信息入院时间应该早于第一次治疗时间', - icon:'none' - }) - return false; - } + // if(dayjs(time1).diff(dayjs(time2))>0){ + // flag && wx.showToast({ + // title: '患者基本信息入院时间应该早于第一次治疗时间', + // icon:'none' + // }) + // return false; + // } for (let i = 0; i < dpmas.length-1; i++) { if(dayjs(dpmas[i].treatTime).diff(dayjs(dpmas[i+1].treatTime))>0){ flag && wx.showToast({ @@ -706,11 +1162,127 @@ Page({ return false; } - } + }; + for (let i = 0;i < dpmas.length; i++) { + let item=dpmas[i].content; + if(!item.mode.select){ + flag && wx.showToast({ + title: '请选择第'+(i+1)+'次治疗模式', + icon:'none' + }) + return false; + }; + if(item.mode.select==-1 && !item.mode.otherValue){ + flag && wx.showToast({ + title: '第'+(i+1)+'次治疗模式其他不能为空', + icon:'none' + }) + return false; + } + if(!item.plasma.handle){ + flag && wx.showToast({ + title: '第'+(i+1)+'次治疗血浆吸附处理量不能为空', + icon:'none' + }) + return false; + } + if(!item.plasma.replace){ + flag && wx.showToast({ + title: '第'+(i+1)+'次治疗血浆置换量不能为空', + icon:'none' + }) + return false; + } + // if(item.dose.select.length>0){ + // if(item.dose.select.includes(1)){ + // if(!item.dose.heparin.firstDose){ + // flag && wx.showToast({ + // title: '第'+(i+1)+'次治疗抗凝剂量中肝素首剂不能为空', + // icon:'none' + // }) + // return false; + // } + // if(!item.dose.heparin.append){ + // flag && wx.showToast({ + // title: '第'+(i+1)+'次治疗抗凝剂量中肝素追加不能为空', + // icon:'none' + // }) + // return false; + // } + // } + + // if(item.dose.select.includes(2)){ + // if(!item.dose.lowHeparin.value){ + // flag && wx.showToast({ + // title: '第'+(i+1)+'次治疗抗凝剂量中低分子肝素不能为空', + // icon:'none' + // }) + // return false; + // } + // } + // if(item.dose.select.includes(3)){ + // if(!item.dose.citricAcid.bloodFlowRate){ + // flag && wx.showToast({ + // title: '第'+(i+1)+'次治疗枸橼酸中血液流速不能为空', + // icon:'none' + // }) + // return false; + // } + // if(!item.dose.citricAcid.citricAcidFlowRate){ + // flag && wx.showToast({ + // title: '第'+(i+1)+'次治疗枸橼酸钠流速不能为空', + // icon:'none' + // }) + // return false; + // } + // if(!item.dose.citricAcid.calciumAgent.select){ + // flag && wx.showToast({ + // title: '请选择第'+(i+1)+'次治疗枸橼酸中钙剂选项', + // icon:'none' + // }) + // return false; + // } + // if(!item.dose.citricAcid.calciumAgent.value){ + // flag && wx.showToast({ + // title: '第'+(i+1)+'次治疗枸橼酸中钙剂剂量不能为空', + // icon:'none' + // }) + // return false; + // } + + // } + // if(item.dose.select.includes(4)){ + // if(!item.dose.nafamostat.value){ + // flag && wx.showToast({ + // title: '第'+(i+1)+'次治疗抗凝剂量中甲磺酸萘莫司他不能为空', + // icon:'none' + // }) + // return false; + // } + // } + // if(item.dose.select.includes(5)){ + // if(!item.dose.other.name){ + // flag && wx.showToast({ + // title: '第'+(i+1)+'次治疗抗凝剂量中其他名称不能为空', + // icon:'none' + // }) + // return false; + // } + // if(!item.dose.other.dose){ + // flag && wx.showToast({ + // title: '第'+(i+1)+'次治疗抗凝剂量中其他剂量不能为空', + // icon:'none' + // }) + // return false; + // } + // } + // } + + } for (let index = 0; index 1){ flag && wx.showToast({ title: '最后一次治疗后检测时间不能为空', icon:"none" @@ -903,8 +1475,8 @@ Page({ return true; }, validateBack(flag){ - let {discharge_time,day,discharge_status,discharge_situation}=this.data.case; - if(!discharge_time){ + let {dischargeTime,day,dischargeStatus,dischargeSituation}=this.data.case; + if(!dischargeTime){ flag && wx.showToast({ title: '请选择出院时间', icon:"none" @@ -918,14 +1490,14 @@ Page({ }) return false } - if(!discharge_situation){ + if(!dischargeSituation){ flag && wx.showToast({ title: '请输入出院情况', icon:"none" }) return false } - if(!discharge_status){ + if(!dischargeStatus){ flag && wx.showToast({ title: '请输入出院状态', icon:"none" @@ -934,13 +1506,7 @@ Page({ } return true }, - onChangeAbstract(event){ - let {value}=event.detail - this.setData({ - wordLength:value.length>500?500:value.length, - 'case.abstractStr':value.length>500?value.substring(0,500):value - }) - }, + openType(){ if(!this.data.showSaveBtn)return; this.setData({ @@ -995,7 +1561,7 @@ Page({ }) }) this.setData({ - 'case.baseImg':baseImg, + 'case.mainDiagnose.mainDiagnoseImg':baseImg, 'case.abstractImg':abstractImg, 'case.checkImg':checkImg }) @@ -1079,6 +1645,9 @@ Page({ if(time_str=="hospitalTime"){ key='admissionTime' time=dayjs(event.detail).format('YYYY-MM-DD') + }else if(time_str=="dischargeTime"){ + key='dischargeTime' + time=dayjs(event.detail).format('YYYY-MM-DD') }else if(time_str=="dealTime"){ key="dealTime" let year=dayjs(event.detail).format('YYYY') @@ -1093,10 +1662,13 @@ Page({ }else if(time_str=="headTime"){ key="headTime" - time=dayjs(event.detail).format('YYYY-MM-DD HH') + time=dayjs(event.detail).format('YYYY-MM-DD') }else if(time_str=="afterTime"){ key="afterTime"; - time=dayjs(event.detail).format('YYYY-MM-DD HH') + time=dayjs(event.detail).format('YYYY-MM-DD') + }else if(time_str=="lastTime"){ + key="lastTime"; + time=dayjs(event.detail).format('YYYY-MM-DD') } if(key=="dealTime"){ const obj = "case.dpmas[" + dealIndex + "].treatTime" @@ -1104,7 +1676,7 @@ Page({ this.setData({ showTime:false, currentDate: event.detail, - [oterobj]:dayjs(time).format('YYYY-MM-DD HH'), + [oterobj]:dayjs(time).format('YYYY-MM-DD'), [obj]:time+ ":00" }) console.log(this.data.case.dpmas) @@ -1136,13 +1708,38 @@ Page({ }else{ iptValue=tempValue } - this.setData({ - ['case.'+key]:key=="age"?Number(e.detail.value):iptValue - }) + if(key=='age'){ + if(e.detail.value!=''){ + this.setData({ + ['case.'+key]:Number(e.detail.value) + }) + }else{ + this.setData({ + ['case.'+key]:null + }) + } + }else{ + this.setData({ + ['case.'+key]:iptValue + }) + } + } }, + onChangeEditor(event){ + // console.log(event); + this.setData({ + 'case.abstractStr':event.detail.html + }) + }, + onChangeEditorDischarge(event){ + // console.log(event); + this.setData({ + 'case.dischargeSituation':event.detail.html + }) + }, countDecimals(num) { // 将数值转换为字符串 const str = String(num); @@ -1162,6 +1759,17 @@ Page({ time_title:'选择入院时间', }) }, + openDischargeTime(){ + if(!this.data.showSaveBtn)return; + const caseInfo=this.data.case; + this.setData({ + showTime:true, + currentDate:caseInfo.admissionTime?new Date(caseInfo.dischargeTime).getTime():new Date().getTime(), + time_type:'date', + time_str:"dischargeTime", + time_title:'选择出院时间', + }) + }, openDealTime(event){ if(!this.data.showSaveBtn)return; const caseInfo=this.data.case; @@ -1172,10 +1780,10 @@ Page({ showTime:true, currentDate:caseInfo.dpmas[index].treatTime?new Date(dayjs(caseInfo.dpmas[index].treatTime).format("YYYY-MM-DD HH:mm:ss")).getTime():new Date().getTime(), dealIndex:index, - time_type:'datetime', + time_type:'date', time_str:"dealTime", time_title:'选择治疗时间', - maxDate:new Date(dayjs().add(10,'year').toString()).getTime() + // maxDate:new Date(dayjs().add(10,'year').toString()).getTime() }) }, openHeadTime(){ @@ -1184,7 +1792,7 @@ Page({ this.setData({ showTime:true, currentDate:caseInfo.headTime?new Date(dayjs(caseInfo.headTime).format("YYYY-MM-DD HH:mm:ss")).getTime():new Date().getTime(), - time_type:'datetime', + time_type:'date', time_str:"headTime", time_title:'选择治疗前检测时间', }) @@ -1195,15 +1803,37 @@ Page({ this.setData({ showTime:true, currentDate:caseInfo.afterTime?new Date(dayjs(caseInfo.afterTime).format("YYYY-MM-DD HH:mm:ss")).getTime():new Date().getTime(), - time_type:'datetime', + time_type:'date', time_str:"afterTime", time_title:'选择治疗后检测时间', }) }, - onChange(event) { + openLastTime(){ + if(!this.data.showSaveBtn)return; + const caseInfo=this.data.case; this.setData({ - 'case.sex':Number(event.detail), + showTime:true, + currentDate:caseInfo.afterTime?new Date(dayjs(caseInfo.lastTime).format("YYYY-MM-DD HH:mm:ss")).getTime():new Date().getTime(), + time_type:'date', + time_str:"lastTime", + time_title:'选择最后一次治疗后检测时间', + }) + }, + onChangeRadio(event) { + console.log(event) + let type=event.target.dataset.type; + let clear=event.target.dataset.clear; + this.setData({ + [type]:event.detail }); + if(clear){ + if(event.detail=="-1"){ + this.setData({ + [clear]:'' + }); + } + } + // console.log(this.data.case.content); }, deleteImg(event){ @@ -1252,15 +1882,18 @@ Page({ }, success(res) { - if (res.statusCode === 204) { - wx.showToast({ - title: '图片上传成功', - icon: "none" - }) - resolve(true) - let url = host + '/' + dir + filename; + if (res.statusCode === 204 ) { + if(name){ + wx.showToast({ + title: '图片上传成功', + icon: "none" + }) + } + + //resolve(true) + let url = host + dir + filename; // 上传完成需要更新 fileList - console.log('11111111111111'); + console.log(url); if(name=='basic'){ const { fileList_basic} = THIS.data; @@ -1276,6 +1909,9 @@ Page({ THIS.setData({ [obj]:THIS.data.dpmas_list[recordIndex].fileList.concat([{ url: url }]) }) + }else{ + console.log(444) + resolve(url) } }else{ @@ -1350,6 +1986,12 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { + if(options.imgUrl){ + console.log(options.imgUrl) + } + //let a=this.formatString(this.data.case); + //console.log(a) + //console.log(this.formatJson(a)); if(options.medicalRecordId){ if(options.status==0 || options.status==1){ this.setData({ @@ -1376,6 +2018,8 @@ Page({ }) } } + + // console.log(this.data.case) }, /** diff --git a/case/pages/createCase/createCase.json b/case/pages/createCase/createCase.json index 93b4c3f..3c5ccbc 100644 --- a/case/pages/createCase/createCase.json +++ b/case/pages/createCase/createCase.json @@ -2,6 +2,8 @@ "usingComponents": { "navBar":"../../../components/navBar/navBar", "van-tab": "@vant/weapp/tab/index", + "van-button": "@vant/weapp/button/index", + "van-tag": "@vant/weapp/tag/index", "van-tabs": "@vant/weapp/tabs/index", "van-picker": "@vant/weapp/picker/index", "van-icon": "@vant/weapp/icon/index", diff --git a/case/pages/createCase/createCase.wxml b/case/pages/createCase/createCase.wxml index 4f82585..a1037f8 100644 --- a/case/pages/createCase/createCase.wxml +++ b/case/pages/createCase/createCase.wxml @@ -1,5 +1,6 @@ + {{navName}} @@ -31,7 +32,9 @@ 性别* - + @@ -59,7 +62,9 @@ 治疗类型(多选)* - + DPMAS及联合模式 CA280及联合模式 @@ -72,58 +77,40 @@ 主要诊断(多选)* - + {{item.name}} -