ソースを参照

症状展示患者端信息;推理入参使用医生端;隐藏清空功能;必填项校验;主诉拼接special;现病史中症状单独一行

liucf 5 年 前
コミット
760b29d2d6

+ 27 - 5
src/components/Detail.vue

@@ -2,7 +2,7 @@
   <div class="detail-wrap">
     <!-- <div v-for="(item,index) in datas"> -->
     <div v-for="(item,index) in checkDatas.questionMapping">
-      <p class="quest">{{index + 1 +'.' + (item.description || item.name)}}</p>
+      <p class="quest"><span v-show="item.required==1" style="color: red;">*</span>{{index + 1 +'.' + (item.description || item.name)}}</p>
       <img class="questionImg" :src="item.url.replace('{imageUrlPrefix}',imgUrl)" v-if="item.url">
       <Radio v-if="item.controlType==1" 
             :item="item"
@@ -48,7 +48,6 @@ import {patt,trimDots,imageUrlPrefix} from '@utils/tools.js'
     data(){
       return{
         checkDatas:{},
-        finished:false,
         imgUrl:imageUrlPrefix,
       }
     },
@@ -108,12 +107,33 @@ import {patt,trimDots,imageUrlPrefix} from '@utils/tools.js'
         }
       },
       saveData(){//存值
-        this.finished = true;
         this.checkDatas = Object.assign({},this.checkDatas,{select:1});
         const datas = this.checkDatas.questionMapping;
+        const id = this.checkDatas.id;
+        let chooseSymp = this.$store.state.symptom.choose;
+        
         let text = ""; //医生
         let textP = "";//患者
         for(let i in datas){
+          // 校验必填项
+          if(datas[i].required==1 && !datas[i].value){
+            alert("还有必填项没有填哦");
+            return
+          }
+          // 拼到主诉
+          if(datas[i].specFlag==1 && datas[i].value){
+            for(let k in chooseSymp){
+              if(id == (chooseSymp[k].id ||chooseSymp[k].questionId)){
+                if(chooseSymp[k].special){
+                  chooseSymp[k].special += datas[i].value;
+                  chooseSymp[k].specialP += datas[i].valueP;
+                }else{
+                  chooseSymp[k].special = datas[i].value;
+                  chooseSymp[k].specialP = datas[i].valueP;
+                }
+              }
+            }
+          }
           if(datas[i].value){
             text += datas[i].value+',';
             textP += datas[i].valueP+',';
@@ -131,9 +151,11 @@ import {patt,trimDots,imageUrlPrefix} from '@utils/tools.js'
           newMsg = msg;
           newMsgP = msgP;
         }
-        this.$store.commit('setDatas',{data:this.checkDatas,pId:this.checkDatas.id,type:this.data.moduleType,ppId:this.data.ppId});
+        this.$store.commit('setDatas',{data:this.checkDatas,pId:id,type:this.data.moduleType,ppId:this.data.ppId});
         // flag是区分点开已选症状 未点完成
-        this.$store.commit('setText',{text:trimDots(newMsg),textP:trimDots(newMsgP),pId:this.checkDatas.id,type:this.data.moduleType,flag:true,order:this.data.order,arrFlag:true,index:this.data.index});
+        this.$store.commit('setText',{text:trimDots(newMsg),textP:trimDots(newMsgP),pId:id,type:this.data.moduleType,flag:true,order:this.data.order,arrFlag:true,index:this.data.index});
+        // 关闭详情
+        this.$store.commit('setDetail',{detail:{}})
       },
       clearData(){//清空
         const datas = this.checkDatas.questionMapping;

+ 21 - 4
src/components/DetailBox.vue

@@ -17,7 +17,7 @@
           <img src="../images/small-close.png">
         </span>
         <span class="name">{{(privateData.description ||privateData.name)+'详情'}}</span>
-        <span @click="handleClear" :class="{'check':checkF}">清空</span>
+        <!-- <span @click="handleClear" :class="{'check':checkF}">清空</span> -->
         <i>{{tips}}</i>
       </div>
     </div>
@@ -84,13 +84,27 @@
       },
       close(){
         // this.$emit("close");
+        // 有必填项但没值则将choose移除 8-19
+        const type = this.data.moduleType;
+        if(type == moduleCP['symp']){//只处理主诉症状
+          const list = this.privateData.questionMapping;
+          if(list){
+            for(let i in list){
+              if(list[i].required==1 && !list[i].value){
+                this.$store.commit('delChoose', {id: this.privateData.id })
+                this.$store.commit('delText', { type: moduleCP['symp'], pId: this.privateData.id })
+              }
+            }
+          }
+        }
+        
         this.$store.commit('setDetail',{detail:{}})
       },
       complete(){//有选中内容才可以点完成#1919
         if(this.checkF){
           this.$refs.detail.saveData();
           // this.$emit("pComplete");
-          this.$store.commit('setDetail',{detail:{}})
+          // this.$store.commit('setDetail',{detail:{}})
         }
       },
       changeCheck(flag){
@@ -170,8 +184,9 @@
       // height: .88rem;
       height: 1rem; //增加了提示
       line-height: .88rem;
-      display: flex;
-      justify-content: space-between;
+      // display: flex; //有清空时
+      // justify-content: space-between;
+      text-align: center; //去掉清空
       border-bottom: 1px solid #E6E7EF;
       padding: 0 .4rem 0 .32rem;
       font-size: .28rem;
@@ -196,6 +211,8 @@
         display: inline-block;
         height: 100%;
         padding: 0 .1rem;
+        position: absolute;//去掉清空
+        left: .32rem;
         img{
           width:.34rem;
           vertical-align: middle;

+ 10 - 6
src/components/Preview.vue

@@ -26,15 +26,18 @@
             <li>
               <h4><i :style="{'background': '#FF9A9A'}"></i> 主诉:</h4>
               <p>
-                <span v-for="(item,idx) in symptom.choose" :key="item.name+idx">{{(item.description||item.name)+(idx == symptom.choose.length-1?'':'、')}}</span>
+                <span v-for="(item,idx) in symptom.choose" :key="item.name+idx">
+                {{item.specialP?(item.description||item.name)+item.specialP+(idx == symptom.choose.length-1?'':'、'):(item.description||item.name)+(idx == symptom.choose.length-1?'':'、')}}
+                </span>
               </p>
             </li>
             <!-- <li v-if="diagnose.text.length>0||symptom.choose.length>0"> -->
             <li>
               <h4><i :style="{'background': '#3D69D9'}"></i> 现病史:</h4>
-              <p>
+              <!-- <p>
                 <span>{{getText(symptom.text,false)}}</span>
-              </p>
+              </p> -->
+              <p v-for="item in symptom.text">{{item.textP}}</p>
               <p>
                 <span>{{getText(diagnose.text,false)}}</span>
               </p>
@@ -86,15 +89,16 @@
               <li>
                 <h4><i :style="{'background': '#FF9A9A'}"></i> 主诉:</h4>
                 <p>
-                  <span v-for="(item,idx) in symptom.choose" :key="item.name+idx">{{item.name+(idx == symptom.choose.length-1?'':'、')}}</span>
+                  <span v-for="(item,idx) in symptom.choose" :key="item.name+idx">{{item.special?item.name+item.special+(idx == symptom.choose.length-1?'':'、'):item.name+(idx == symptom.choose.length-1?'':'、')}}</span>
                 </p>
               </li>
               <!-- <li v-if="diagnose.text.length>0||symptom.choose.length>0"> -->
               <li>
                 <h4><i :style="{'background': '#3D69D9'}"></i> 现病史:</h4>
-                <p>
+                <!-- <p>
                   <span>{{getText(symptom.text,true)}}</span>
-                </p>
+                </p> -->
+                <p v-for="item in symptom.text">{{item.text}}</p>
                 <p>
                   <span>{{getText(diagnose.text,true)}}</span>
                 </p>

+ 8 - 4
src/components/Symptom.vue

@@ -188,12 +188,12 @@ export default {
       }
 
     },
-    getSympText() {
+    getSympText() {//推送使用医生端信息
       const text = this.$store.state.symptom.text;
       let msg = "";
       for (let i in text) {
-        if(text[i] && text[i].textP){
-          msg += text[i].textP;
+        if(text[i] && text[i].text){
+          msg += text[i].text;
         }
       }
       return trimDots(msg);
@@ -261,7 +261,11 @@ export default {
     checkText:{//更新推送
       handler(newVal,oldVal){
         const sympText = this.getSympText();
-        this.getPush(sympText);
+        if(sympText){
+          this.getPush(sympText);
+        }else{
+          this.getSympList();
+        } 
       },
       deep:true
     }

+ 9 - 0
src/store.js

@@ -351,6 +351,15 @@ const store = new Vuex.Store({
     setChoose(state,param){ //症状情况-已选症状
       state.symptom.choose = param.choose;
     },
+    delChoose(state,param){ //详情有必填项未填--移除症状
+      const id = param.id;
+      let symp = state.symptom.choose;
+      for(let i=0; i<symp.length; i++){
+        if(id == (symp[i].id || symp[i].questionId)){
+          symp.splice(i,1);
+        }
+      }
+    },
     setImgFile(state,param){//区别模块
       const type = parseInt(param.type);
       switch(type){