Przeglądaj źródła

伴随症状控件,填空等

zhouna 5 lat temu
rodzic
commit
4eb1bf2998

+ 13 - 69
src/common/OptionInp.vue

@@ -1,20 +1,14 @@
 <!-- 带输入框选项 -->
 <template>
-  <div :class="['inpbox',{'iptCheck':item.select},{'exclu':exclu}]">
-    <!--<img class="iptimg" :src="item.select?url[0]:url[1]" alt="">-->
+  <div :class="['inpbox',{'iptCheck':item.select}]">
     <span class="prefix" v-if="msg.prefix">{{msg.prefix}}</span>
-    <!-- <div class="inp" @click="preClick"> -->
-      <input :type="msg.type=='number'?'number':'text'"
-              :placeholder="msg.placeholder"
-              :style="{'width':!msg.prefix&&!msg.suffix?'90%':'33%'}"
-              :disabled="exclu"
-              :class="[{'exclu':exclu},{'cancel':item.select==0}]"
-              v-model="txt"
-              @click="handleCli"
-              @blur="handleBlur"
-              @focus="focus"
-              @input="changeVal">
-    <!-- </div> -->
+    <input :type="msg.type=='number'?'number':'text'"
+            :placeholder="msg.placeholder"
+            :style="{'width':!msg.prefix&&!msg.suffix?'90%':'33%'}"
+            :class="[{'cancel':item.select==0}]"
+            v-model="txt"
+            @click="handleCli"
+            @blur="handleBlur">
     <span class="suffix" v-if="msg.suffix">{{msg.suffix}}</span>
   </div>
 </template>
@@ -23,6 +17,7 @@ import { getExpStr,isIos} from '@utils/tools';
 import $ from 'jquery';
   export default {
     name:'OptionInp',
+    props:['item','inx'],
     data(){
       return{
         msg:{},
@@ -31,46 +26,20 @@ import $ from 'jquery';
         url:[require('../images/iptselect.png'),require('../images/iptdis.png')]
       }
     },
-    props:['item','exclu'],
     mounted(){
       const text = this.item.description || this.item.name;
       this.msg = getExpStr(text);
       this.select = this.item.select;
     },
     methods:{
-      changeVal(e){
-        if(this.msg.type=='number'){//数字键盘
-            this.txt = e.target.value=e.target.value.replace(/^\.$/,'').slice(0,10)
-        }
-        const newData = Object.assign({},this.part,{value:this.txt});
-        this.$emit("updata",newData);
-        this.$emit('handleInp',this.txt);
-        this.$emit('handleSelec');
-      },
       handleBlur(){
-        setTimeout(()=>{
+        this.$emit('handleInp',this.txt,this.inx);
+        /*setTimeout(()=>{
           $(".foot").css({'display':'block'})
-        },150)
-          // 如果该项未选中,则不存值
-        // const select = this.item.select;
-        // if(!select){return}
-        // const newData = Object.assign({},this.part,{value:this.txt});
-        // this.$emit("updata",newData);
-        // this.$emit('handleInp',this.txt);
-      },
-      focus(){
-        if(isIos()){
-          setTimeout(() => {
-            $(".foot").css({'display':'none'})
-          }, 150);
-        }
-      },
-      preClick(e){
-        e.stopPropagation();
+        },150)*/
+
       },
       handleCli(e){
-        e.stopPropagation();
-        // const select = this.item.select;
         if(!this.select&&this.txt){//聚焦时自动选中该项
           this.$emit('handleSelec');
         }
@@ -102,13 +71,6 @@ import $ from 'jquery';
       display: inline-block;
       vertical-align: middle;
     }
-    /*.iptimg {
-      width: .34rem;
-      height: .34rem;
-      margin-right: .1rem;
-      position: relative;
-      top: .06rem;
-    }*/
      input{
       height: 100%;
       color: #4F50FF;
@@ -121,23 +83,5 @@ import $ from 'jquery';
       top: 1px;
       box-sizing: border-box;
     }
-    .check{//选中
-      color: #colors[theme];
-    }
-    // .inp .exclu{ //互斥
-    .exclu{ //互斥
-      color:#colors[exclu] !important;
-    }
-    .cancel{ //取消
-      color: #bbbbbb !important;
-    }
-    input:disabled, input[disabled]{
-      background:transparent;
-      border-bottom-color: #DEDEDE !important;
-    }
-    // input:disabled,input[disabled]::-webkit-input-placeholder{
-    .exclu::-webkit-input-placeholder{
-      color:#e6e7e9 !important;
-    }
   }
 </style>

+ 188 - 0
src/common/PushSymptom.vue

@@ -0,0 +1,188 @@
+<template>
+  <portal to="notification-outlet">
+    <div class="select">
+      <div class="selected-tags">
+        <p class="title">已选伴随症状:</p>
+        <ul class="clearfix">
+          <li v-if="selecteds.length>0" v-for="it in selecteds">
+            <span>{{it.description||it.name}}</span>
+            <img @click="delSelected(it)" src="../images/closeimg.png" alt=""/>
+          </li>
+        </ul>
+      </div>
+      <ul class="tags clearfix">
+        <li
+          v-for="(item,idx) in symptoms"
+          :class="[{'liSelect':item.select}]"
+          :key="item.id"
+          @click="selectResult(item,idx)"
+        >
+          {{item.description||item.name}}
+        </li>
+      </ul>
+      <div :class="selecteds.length>0?'realSure sure':'sure'" @click="makeSuer">
+        确定 <span v-if="numPlus">({{numPlus}})</span>
+      </div>
+    </div>
+  </portal>
+</template>
+<script>
+  import api from '../utils/api.js';
+  import {mapState} from 'vuex';
+  export default {
+    props: ["num"],
+    data() {
+      return {
+        selecteds: [], //已选伴随症状
+        selectedsName:'',   //已选伴随症状名称
+        symptoms:[],      //症状
+        sure:false,
+        numPlus:0     //已选答案个数
+      };
+    },
+    computed:{
+      ...mapState({
+        activeModule: state => state.activeModule,
+        chooseSymp: state => state.symptom.choose,//已选症状
+        checkText: state => state.symptom.text,//症状情况文字
+        config: state => state.sysConfig,
+        pathInfo: state => state.pathInfo
+      }),
+    },
+    mounted() {
+      //this.numPlus = this.num
+      //this.result = this.symptomResult.questionDetailList;
+      this.getPush(this.chooseSymp.name);
+    },
+    methods: {
+      getSympText() {//推送使用医生端信息
+        const text = this.$store.state.symptom.text;
+        let msg = "";
+        for (let i in text) {
+          if(text[i] && text[i].text){
+            msg += text[i].text;
+          }
+        }
+        return trimDots(msg);
+      },
+      getPush(symptoms) {//推理
+        const param = {
+          "age": this.pathInfo.patientAge,
+          "hosCode": this.pathInfo.hospitalCode,
+          "sex": this.pathInfo.sexType,
+          "symptom": symptoms //症状+选择的明细,string
+        };
+        api.getPush(param).then((res) => {
+          const result = res.data;
+          if (result.code == 0&&result.data) {
+            this.symptoms = result.data.symptom;
+            //this.getSymptomLisCom(result)
+          }else{
+            //this.getSymptomLisCom()
+          }
+        }).catch((err)=>{
+
+        })
+      },
+      getSymptomLisCom(result){
+        let symp = (result&&result.data.symptom)||[];
+        let symped = JSON.parse(JSON.stringify(this.chooseSymp));//已选症状
+        let sympStic = JSON.parse(localStorage.getItem('staticSymp'))||[];//首次有无症状
+        let sympAll = sympStic.concat(symp);
+        var obj = {};
+        sympAll = sympAll.reduce(function(item, next) {
+          obj[next.name] ? '' : obj[next.name] = true && item.push(next);
+          return item;
+        }, []);
+        for(let i = 0;i < symped.length;i++){//去掉已选的已选症状
+          for(let j = 0;j < sympAll.length;j++){//去掉
+            if(sympAll[j].name == symped[i].name){
+              sympAll.splice(j,1)
+            }
+          }
+        }
+        this.symp = sympAll.slice(0,12);
+        this.$refs.showHide.style.height = 'auto'
+      },
+      makeSuer() {
+        if(!this.selecteds.length>0){return}
+        let number = this.num;
+        this.$emit("updataResult", '',this.selectedsName,++number);
+      },
+      selectResult(item) {
+        this.selectedsName = this.selectedsName?this.selectedsName+"、"+item.name:item.name;
+        this.selecteds.push(item);
+        this.getPush(this.chooseSymp.name+this.selectedsName);
+      },
+      delSelected(item){    //删除已选伴随症状
+        const selecteds = JSON.parse(JSON.stringify(this.selecteds));
+        const inx = selecteds.findIndex((it)=>{
+          return it.tagName === item.tagName;
+        });
+        if(inx!==-1){
+          this.selectedsName = this.selectedsName.replace(item.name,"").replace("、、","、");
+          selecteds.splice(inx,1);
+        }
+        this.selecteds = selecteds;
+      }
+    }
+  };
+</script>
+<style lang="less" scoped>
+  @import "../less/base.less";
+  .select{
+    background-color: #fff;
+    padding: 0.2rem 0 0 0;
+    position: fixed;
+    width: 100%;
+    bottom: 0;
+    box-sizing: border-box;
+  }
+  .selected-tags{
+    margin-bottom: .8rem;
+    .title{
+      color: #aaa;
+      font-size: .26rem;
+      margin-bottom: .4rem;
+      text-indent: .28rem;
+    }
+    li{
+      position: relative;
+      display:inline-block;
+      span{
+        display: inline-block;
+        padding: 0.14rem 0.2rem;
+        background-color: #colors[btn];
+        border:1px #colors[btn] solid;
+        border-radius: 0.36rem;
+        font-size: 0.26rem;
+        margin: 0.15rem;
+        float: left;
+        color: #fff;
+      }
+      img{
+        width: .3rem;
+        height: .3rem;
+        position: absolute;
+        right: .05rem;
+        top: .1rem;
+      }
+    }
+  }
+  .tags {
+  li {
+    padding: 0.14rem 0.2rem;
+    border:1px #DFE0E4 solid;
+    border-radius: 0.36rem;
+    font-size: 0.26rem;
+    margin: 0.15rem;
+    float: left;
+    color: #666;
+  }
+  .liSelect {
+    color: #fff;
+    background-color: #colors[btn];
+    border-color:  #colors[btn];
+  }
+  }
+</style>

+ 29 - 20
src/common/Radio.vue

@@ -9,7 +9,7 @@
         @click="selectResult(item,idx)"
       >
         <span v-if="((item.description||item.name).indexOf('${'))==-1">{{item.description||item.name}}</span>
-        <OptionInp v-else :item="item" @handleInp="inpVal($event,idx)" @handleSelec="handleClick(item,idx,false,true)"/>
+        <OptionInp v-else :item="item" @handleInp="inpVal" :inx="idx" @handleSelec="handleClick(item,idx,false,true)"/>
       </li>
     </ul>
     <div :class="sure?'realSure sure':'sure'" @click="makeSuer">
@@ -20,7 +20,7 @@
 </template>
 <script>
   import OptionInp from '../common/OptionInp.vue';
-  import {concatVal} from '../utils/tools.js';
+  import {concatVal,getExpStr} from '../utils/tools.js';
 export default {
   props: ["symptomResult","num"],
   data() {
@@ -63,11 +63,6 @@ export default {
       let detailList = this.result;
       let currItem = detailList[index];
       currItem.value = val;
-      // 输入框失焦重新拼接父级的value
-      let temp = concatVal(detailList);
-      /*this.datas.value = temp.value;
-      this.datas.valueP = temp.valueP;
-      this.$emit("updata",this.datas);*/
     },
     handleClick(it,index,flg,ipt){
       if(flg){
@@ -77,8 +72,7 @@ export default {
           document.activeElement.scrollIntoViewIfNeeded(true);
         },300)
       }
-      const list = this.datas;
-      let data = list.questionDetailList&&list.questionDetailList.slice(0); //数组深拷贝
+      /*let data = it.questionDetailList&&it.questionDetailList.slice(0); //数组深拷贝
       if(ipt){//输入框单选,输入了内容才算选中,删除内容算取消
         for(let i=0;i<data.length; i++){
           if(i==index){
@@ -94,19 +88,25 @@ export default {
           }else{
             data[i].select = 0
           }
-        }
-      }
+        }*/
+      /*}
       let temp = concatVal(data);
       const newData = Object.assign({},this.datas,{questionDetailList:data,value:temp.value,valueP:temp.valueP});
-      this.$emit("updata",newData);
+      this.$emit("updata",newData);*/
     },
     makeSuer() {
       if(!this.sure){return}
       let result = this.result;
       let number = this.numPlus,tmpResult='';
       for (let i = 0; i < result.length; i++) {
+          const text=result[i].description||result[i].name;
+          const msg = getExpStr(text);
           if(result[i].select){
-            tmpResult=result[i].description||result[i].name
+            if(result[i].name.indexOf("${input")!==-1){
+              tmpResult=msg.prefix+(result[i].value||"")+msg.suffix;
+            }else{
+              tmpResult=text
+            }
           }
         }
         this.contentResult = tmpResult;
@@ -114,8 +114,8 @@ export default {
     },
     selectResult(item,idx) {
       const { select } = item;
-      let result = JSON.parse(JSON.stringify(this.result))
-      if (select) {//判断是否选中,选中的取消,关联id删除,未选中判断是否互斥
+      let result = JSON.parse(JSON.stringify(this.result));
+      if (select) {//判断是否选中,选中的取消,关联id删除
         for (let i = 0; i < result.length; i++) {
           if(i == idx){
             result[i].select = false
@@ -124,8 +124,11 @@ export default {
       }else{
         for (let i = 0; i < result.length; i++) {
           if(i == idx){
-            result[i].select = true
+            result[i].select = true;
           }else{
+            /*if(result[i].name.indexOf("${input")!==-1){     //被取消的输入框有内容则
+
+            }*/
             result[i].select = false
           }
         }
@@ -155,15 +158,21 @@ export default {
     margin: 0.15rem;
     float: left;
     color: #666;
-    &.noBorder{
-      border: none;
-      width: 100%;
-     }
   }
   .liSelect {
     color: #fff;
     background-color: #colors[btn];
     border-color:  #colors[btn];
   }
+  .noBorder{
+    border: none;
+    width: 100%;
+    &.liSelect{
+       background: none;
+        span{
+          color: #DFE0E4;
+        }
+     }
+  }
 }
 </style>

+ 62 - 4
src/common/Select.vue

@@ -4,11 +4,12 @@
     <ul class="clearfix">
       <li
         v-for="(item,idx) in result"
-        :class="[{'liSelect':item.select}]"
+        :class="[{'liSelect':item.select,'noBorder':((item.description||item.name).indexOf('${'))!=-1}]"
         :key="item.id"
         @click="selectResult(item,idx)"
       >
-      {{item.description||item.name}}
+        <span v-if="((item.description||item.name).indexOf('${'))==-1">{{item.description||item.name}}</span>
+        <OptionInp v-else :item="item" @handleInp="inpVal" :inx="idx" @handleSelec="handleClick(item,idx,false,true)"/>
       </li>
     </ul>
     <div :class="sure?'realSure sure':'sure'" @click="makeSuer">
@@ -18,6 +19,8 @@
   </portal>
 </template>
 <script>
+  import OptionInp from '../common/OptionInp.vue';
+  import {concatVal,getExpStr} from '../utils/tools.js';
 export default {
   props: ["symptomResult","num"],
   data() {
@@ -58,15 +61,57 @@ export default {
     }
   },
   methods: {
+    inpVal(val,index){//输入框失焦处理
+      // 输入框回读
+      let detailList = this.result;
+      let currItem = detailList[index];
+      currItem.value = val;
+    },
+    handleClick(it,index,flg,ipt){
+      if(flg){
+        document.activeElement.blur();
+        document.activeElement.scrollIntoViewIfNeeded(true);
+        setTimeout(()=>{
+          document.activeElement.scrollIntoViewIfNeeded(true);
+        },300)
+      }
+      /*let data = it.questionDetailList&&it.questionDetailList.slice(0); //数组深拷贝
+      if(ipt){//输入框单选,输入了内容才算选中,删除内容算取消
+        for(let i=0;i<data.length; i++){
+          if(i==index){
+            data[i].select=data[i].value?1:0;
+          }else{
+            data[i].select = 0
+          }
+        }
+      }else{
+      for(let i=0;i<data.length; i++){
+        if(i==index){
+          data[i].select = data[i].select==1?0:1;
+        }else{
+          data[i].select = 0
+        }
+      }*/
+      /*}
+      let temp = concatVal(data);
+      const newData = Object.assign({},this.datas,{questionDetailList:data,value:temp.value,valueP:temp.valueP});
+      this.$emit("updata",newData);*/
+    },
     makeSuer() {
       if(!this.sure){return}
       let result = this.result;
       // if(this.numPlus == 1){
         let tmpResult=[];
         for (let i = 0; i < result.length; i++) {
+          const text=result[i].description||result[i].name;
+          const msg = getExpStr(text);
           if(result[i].select){
-            //tmpIds=tmpIds.concat(result[i].connectId)
-            tmpResult.push(result[i].description||result[i].name);
+            if(result[i].name.indexOf("${input")!==-1){
+              tmpResult.push(msg.prefix+(result[i].value||"")+msg.suffix);
+            }else {
+              //tmpIds=tmpIds.concat(result[i].connectId)
+              tmpResult.push(text);
+            }
           }
         }
         //tmpIds=tmpIds.concat(staticArr)
@@ -110,6 +155,9 @@ export default {
       }
       this.result = result
     }
+  },
+  components:{
+    OptionInp
   }
 };
 </script>
@@ -136,5 +184,15 @@ export default {
     background-color: #colors[btn];
     border-color:  #colors[btn];
   }
+  .noBorder{
+    border: none;
+    width: 100%;
+    &.liSelect{
+       background: none;
+      span{
+        color: #DFE0E4;
+      }
+    }
+  }
 }
 </style>

+ 8 - 2
src/components/MainPage.vue

@@ -54,6 +54,7 @@
     <Picker v-if="type==10" @confirm="updataResultSingle" :num="num" :defaultIndex = "defaultIndex"></Picker>
     <!--时间拨盘,拨盘内容写死-->
     <Picker v-if="type == 9" :columns="getTimeColumns()" :defaultVal="pickDVal" @confirm="updataResultSingle" :num="num" :defaultIndex = "defaultIndex"></Picker>
+    <PushSymptom v-if="type == 99" @updataResult="updataResultSingle" :num="num"></PushSymptom>
     <!-- 上传图片 -->
     <UploadImg v-if="type==4"
                :num="num"
@@ -90,10 +91,12 @@ import ComTextArea from '../common/ComTextArea.vue';
 import Input from '../common/Input.vue';
 import PickTime from '../common/PickTime.vue';
 import UploadImg from '../common/UploadImg.vue';
+import PushSymptom from '../common/PushSymptom.vue';
 import ConfirmBox from '../common/ConfirmBox'
 import UsualSymptom from '../common/UsualSymptom';
 import api from "../utils/api.js";
 import {mapState} from 'vuex';
+import {moduleCP} from '@utils/tools'
 
 export default {
   name:'MainPage',
@@ -211,8 +214,8 @@ export default {
       let tmpArr = JSON.parse(JSON.stringify(this[moduleName]));
       tmpArr[num-1].content = contentResult;
       this[moduleName] = tmpArr;
+      console.log(this.$store.state);   //最后一题答完
       if(+num===this[moduleName].length){
-        console.log(this.$store.state);   //最后一题答完
         if(this.activeTab>1){         //模块配置待修改
           this.showPreview=true;
           return;
@@ -256,6 +259,7 @@ export default {
     },
     selectUsual(sym){
       this.getSymptomQas(sym.questionId);     //获取症状下的关联问题
+      this.$store.commit('setChoose', { choose: sym, type: moduleCP['symp'] });
       this.selectedSymptom = sym;   //设置搜索选中症状
       this.showUsual=false; //关闭症状选择进入下一个问题
     },
@@ -277,7 +281,8 @@ export default {
           qaLis[0].show=true;   //第一题自动显示
           this.type = qaLis[0].controlType;
           this.symptomResult = qaLis[0];
-          this.allquestionLis = qaLis;
+          this.$store.commit('setSymptomDatas',qaLis);
+          this.allquestionLis = this.$store.state.symptom.origin;
         }else{
 
         }
@@ -297,6 +302,7 @@ export default {
     Input,
     PickTime,
     UploadImg,
+    PushSymptom,
     ConfirmBox,
     UsualSymptom
   }

+ 79 - 5
src/store.js

@@ -125,6 +125,10 @@ const store = new Vuex.Store({
     setSearchShow(state,flg){//搜索显示与否
       state.searchShow = flg;
     },
+    setSymptomDatas(state,data){
+      state.symptom.origin = formatSymptomData(data);
+      state.symptom.datas = formatSymptomData(data);
+    },
     setUsualSymptom(state,data){
       state.usualSymptom = data;
     },
@@ -156,11 +160,13 @@ const store = new Vuex.Store({
       state.allMoudles = param;
       for(let k in param){
         if(param[k].type == moduleCP['diagT']){
-          state.diagnose.origin = JSON.parse(JSON.stringify(param[k].moduleDetailDTOList))
-          state.diagnose.datas = JSON.parse(JSON.stringify(param[k].moduleDetailDTOList))
+          const arr = formatDiagUploadData(param[k].moduleDetailDTOList);
+          state.diagnose.origin = arr;
+          state.diagnose.datas = JSON.parse(JSON.stringify(arr));
         }else if(param[k].type == moduleCP['other']){
-          state.others.origin = JSON.parse(JSON.stringify(param[k].moduleDetailDTOList))
-          state.others.datas = JSON.parse(JSON.stringify(param[k].moduleDetailDTOList))
+          const org = param[k].moduleDetailDTOList;
+          state.others.origin = JSON.parse(JSON.stringify(org));
+          state.others.datas = JSON.parse(JSON.stringify(org));
         }
       }
     },
@@ -478,6 +484,74 @@ const store = new Vuex.Store({
       state.loadingShow = flg
     }
   }
-})
+});
+function formatDiagUploadData(data){
+  //上传图片类型处理,前面添加一个问题
+  const inx = data.findIndex((it)=>{
+    return it.controlType==4;
+  });
+  let newArr = JSON.parse(JSON.stringify(data));
+  if(inx!==-1){
+    newArr.splice(inx,0,{
+      id: 999999,
+      name: "有可以上传的最近一次诊疗记录吗?",
+      tagName: "有可以上传的最近一次诊疗记录吗?",
+      type: 51,
+      controlType: 1,
+      itemType: 0,
+      tagType: 1,
+      labelPrefix: "",
+      labelSuffix: "",
+      url: "",
+      description: "",
+      specFlag: 0,
+      required: 0,
+      explains: null,
+      exclusionType: null,
+      questionDetailList:[{id: 111110, name: "有,可以上传", description: "", questionId: 999999, orderNo: 1, exclusion: 0, remark: null}
+        ,{id: 111111, name: "没有", description: "", questionId: 999999, orderNo: 2, exclusion: 0, remark: null}],
+      questionMapping: [],
+      flag: "",
+      remark: null,
+      prefix: "",
+      suffix: "",
+      moduleId: 2,
+      questionId: 1191,
+      relationModule: null,
+      relationModuleName: null});
+  };
+  return newArr;
+};
+function formatSymptomData(data){
+  //症状详情后添加一个大数据推送其他症状
+  let newArr = JSON.parse(JSON.stringify(data));
+    newArr.push({
+      id: 999998,
+      name: "您还有其他不舒服吗?",
+      tagName: "您还有其他不舒服吗?",
+      type: 1,
+      controlType: 99,
+      itemType: 0,
+      tagType: 1,
+      labelPrefix: "",
+      labelSuffix: "",
+      url: "",
+      description: "",
+      specFlag: 0,
+      required: 0,
+      explains: null,
+      exclusionType: null,
+      questionDetailList:[],
+      questionMapping: [],
+      flag: "",
+      remark: null,
+      prefix: "",
+      suffix: "",
+      moduleId: 2,
+      questionId: 999998,
+      relationModule: null,
+      relationModuleName: null});
 
+  return newArr;
+};
 export default store;