Parcourir la source

选项问题关联

zhouna il y a 5 ans
Parent
commit
c4a051fba4

+ 1 - 1
config/index.js

@@ -5,7 +5,7 @@
 const path = require('path')
 // const proxy_path = 'http://192.168.2.236:80';
 // const proxy_path = 'http://192.168.2.236:5050';
-const proxy_path = 'http://192.168.2.241:5050';
+const proxy_path = 'http://192.168.2.236:5050';
 // const proxy_path = 'http://223.93.170.82:23650';
 
 module.exports = {

+ 1 - 0
src/common/ComTextArea.vue

@@ -85,6 +85,7 @@ export default {
     background:#fff;
     padding:0.28rem 0 4%;
     box-shadow: 0 0 30px -10px rgba(104, 124, 189, 0.25);
+    text-align: center;
     textarea {
       color: #4F50FF;
       resize: none;

+ 27 - 1
src/common/Radio.vue

@@ -21,6 +21,7 @@
 <script>
   import OptionInp from '../common/OptionInp.vue';
   import {concatVal,getExpStr} from '../utils/tools.js';
+  import api from '@utils/api.js';
 export default {
   props: ["symptomResult","num"],
   data() {
@@ -73,7 +74,20 @@ export default {
         },300)
       }
     },*/
-    makeSuer() {
+    getExtQa(ids){
+      const userInfo = this.$store.state.pathInfo;
+      const param = {
+        age:userInfo.patientAge,
+        ids:ids,
+        sexType:userInfo.sexType
+      };
+      return new Promise((resolve,reject)=>{
+        api.getByIds(param).then((res)=>{
+          resolve(res);
+        });
+      })
+    },
+    async makeSuer() {
       if(!this.sure){return}
       let result = this.result;
       let number = this.numPlus,tmpResult='',tmpResultp='';
@@ -83,6 +97,12 @@ export default {
           const msg = getExpStr(text);
           const msgp = getExpStr(textp);
           if(result[i].select){
+            const subQ=result[i].subQuestion;
+            if(subQ){
+              await this.getExtQa(subQ.split(",")).then((res)=>{
+                this.$emit("getExtQa",res.data.data,this.num);
+              });
+            }
             if(result[i].name.indexOf("${")!==-1){
               tmpResult=msg.prefix+(result[i].value||"")+msg.suffix;
               tmpResultp=msgp.prefix+(result[i].value||"")+msgp.suffix;
@@ -92,6 +112,12 @@ export default {
             }
           }
         }
+        if(+this.symptomResult.flag===1){   //为时间控件
+          const orgChoose = this.$store.state.symptom.choose;
+          orgChoose[0].special = tmpResult;
+          orgChoose[0].specialP = tmpResultp;
+          this.$store.commit('setChoose', { choose: orgChoose, type: 1 });
+        }
         if(+this.symptomResult.flag===2){   //为诱因控件
           const orgChoose = this.$store.state.symptom.choose;
           orgChoose[0].reason = tmpResult||"无";

+ 29 - 2
src/common/Select.vue

@@ -21,6 +21,7 @@
 <script>
   import OptionInp from '../common/OptionInp.vue';
   import {concatVal,getExpStr} from '../utils/tools.js';
+  import api from '@utils/api.js';
 export default {
   props: ["symptomResult","num"],
   data() {
@@ -76,17 +77,31 @@ export default {
         },300)
       }
     },*/
-    makeSuer() {
+    getExtQa(ids){
+      const userInfo = this.$store.state.pathInfo;
+      const param = {
+        age:userInfo.patientAge,
+        ids:ids,
+        sexType:userInfo.sexType
+      };
+      return new Promise((resolve,reject)=>{
+        api.getByIds(param).then((res)=>{
+          resolve(res);
+        });
+      })
+    },
+    async makeSuer() {
       if(!this.sure){return}
       let result = this.result;
       // if(this.numPlus == 1){
-        let tmpResult=[],tmpResultp=[];
+        let tmpResult=[],tmpResultp=[],subQas='';
         for (let i = 0; i < result.length; i++) {
           const text=result[i].name;
           const textp=result[i].description||result[i].name;
           const msg = getExpStr(text);
           const msgp = getExpStr(text);
           if(result[i].select){
+            subQas = subQas+","+result[i].subQuestion;
             if(result[i].name.indexOf("${")!==-1){
               tmpResult.push(msg.prefix+(result[i].value||"")+msg.suffix);
               tmpResultp.push(msgp.prefix+(result[i].value||"")+msgp.suffix);
@@ -97,12 +112,24 @@ export default {
             }
           }
         }
+        subQas=subQas.replace(/^,|,$/g,'').replace(/,+/g,',');
+        if(subQas){
+          await this.getExtQa(subQas.split(",")).then((res)=>{
+            this.$emit("getExtQa",res.data.data,this.num);
+          });
+        }
         //tmpIds=tmpIds.concat(staticArr)
         //this.connectResult = tmpIds
         //this.contentResult = tmpResult.join('、')
       // }else{
 
       // }
+      if(+this.symptomResult.flag===2){   //为诱因控件
+        const orgChoose = this.$store.state.symptom.choose;
+        orgChoose[0].reason = tmpResult||"无";
+        orgChoose[0].reasonP = tmpResultp||"无";
+        this.$store.commit('setChoose', { choose: orgChoose, type: 1 });
+      }
       let number = this.num;
       this.$emit("updataResult", this.symptomResult,  {val:tmpResult.join('、'),valp:tmpResultp.join('、')},++number);
     },

+ 16 - 2
src/components/MainPage.vue

@@ -51,8 +51,8 @@
       </div>
     </div>
     <MultSelect @updataResult="updataResultSingle" :num="num" :symptomResult="symptomResult" v-if="type==3"></MultSelect>
-    <Select @updataResult="updataResultSingle" :num="num" :symptomResult="symptomResult" v-if="type == 2"></Select>
-    <Radio @updataResultSingle="updataResultSingle" :num="num" :symptomResult="symptomResult" v-if="type == 1"></Radio>
+    <Select @updataResult="updataResultSingle" :num="num" @getExtQa="addExtQa" :symptomResult="symptomResult" v-if="type == 2"></Select>
+    <Radio @updataResultSingle="updataResultSingle" @getExtQa="addExtQa" :num="num" :symptomResult="symptomResult" v-if="type == 1"></Radio>
     <!--普通单列拨盘-->
     <Picker v-if="type==10" @confirm="updataResultSingle" :columns="getColumns()" :num="num" :defaultIndex = "defaultIndex"></Picker>
     <!--时间拨盘,拨盘内容写死-->
@@ -269,6 +269,20 @@ export default {
       });
       this.canceledQa=this.num;     //记录被修改过的题目,只可修改一次
     },
+    formatQaArr(obj){
+      let arr = [],nobj=JSON.parse(JSON.stringify(obj));
+      for(let i in nobj){
+        arr.push(nobj[i]);
+      }
+      return arr;
+    },
+    addExtQa(obj,i){
+      const mName=this.moduleMap[this.activeTab];
+      let moduleName = mName+'QasList';
+      const dataArr = this.formatQaArr(obj);
+      this[moduleName].splice(i+1,0,...dataArr);
+      this.$store.commit("setModuleDatas",{data:this[moduleName],mName});
+    },
     updataResultSingle(result,contentResult,num){
       this.num = num;
       this.type = -1;

+ 1 - 1
src/components/Preview.vue

@@ -196,7 +196,7 @@ export default {
       }
     }
   },
-  mounted() {
+  mounted() {console.log(this.$store.state);
     let scroll = setScroll(BScroll,true,'.previewper');
     this.scroll = scroll;
     this.formatSymText();     //拼出现病史规则句型

+ 4 - 0
src/store.js

@@ -240,6 +240,10 @@ const store = new Vuex.Store({
           break;
       }
     },
+    setModuleDatas(state,param){
+      const {data,mName} = param;
+      state[mName].datas = JSON.parse(JSON.stringify(data));
+    },
     setDatas(state,param){
       // ppId--每一道题的id;pId--每个选项的id
       const type = parseInt(param.type);

+ 5 - 1
src/utils/api.js

@@ -8,6 +8,7 @@ const urls = {
   getAll:'/api/prec/moduleInfo/getAll',//获取模板
   getSymptom:'/api/prec/questionUsual/getQuestionUsual',//常用症状
   getById:'/api/prec/questionInfo/getById',//常标签详情
+  getByIds:'/api/prec/questionInfo/getByIds',// 获取多个问题
   push:'/api/prec/push/pushInner',//症状推送
   saveInquiry:'/api/prec/inquiryInfo/saveInquiry',//保存问诊记录
   uploadImageThum:'/api/prec/file/uploadImageThum',//单个文件上传同时生成缩略图
@@ -48,6 +49,9 @@ export default {
   getById(param){
     return axios.post(urls.getById,param)
   },
+  getByIds(param){
+    return axios.post(urls.getByIds,param)
+  },
   getPush(param){
     return axios.post(urls.push,param)
   },
@@ -66,4 +70,4 @@ export default {
   signIn(param){
     return axios.post(urls.signIn,param)
   },
-}
+}