Browse Source

诊断依据导入

zhangxc 5 years ago
parent
commit
3ae8a126ee
1 changed files with 135 additions and 4 deletions
  1. 135 4
      src/components/diagBase/AddDiagBase.vue

+ 135 - 4
src/components/diagBase/AddDiagBase.vue

@@ -147,6 +147,9 @@
             </table>
              <div class="btn clearfix">
                      <div class="btnBox">
+                        <!-- <el-button size="mini" @click="uploadClick">导入</el-button>
+                        <input type="file" name="uploadfile " id="upFile" @change="uploadFile($event)" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
+                          -->
                          <el-button
                                 type="primary"
                                 :disabled = "isReady"
@@ -320,6 +323,94 @@
                 this.disFormulaList.splice(index, 1)
             }
         },
+        //导入
+        // uploadClick() {
+        //     let inp = document.getElementById("upFile");
+        //     inp.click();
+        // },
+        // uploadFile(e){
+        //     let fileInfo = e.target.files[0];
+        //     e.preventDefault();
+        //     let formData = new FormData();
+        //     formData.append('uploadfile', fileInfo);
+        //     const header = {
+        //         headers:{
+        //         'Content-Type': 'multipart/form-data'
+        //         }
+        //     }
+        //     api.importDiagnosticBasis(formData,header).then((res)=>{
+        //         console.log('ress', res)
+        //         if(res.data.code==0){
+        //             const data = res.data.data
+        //             this.warning('上传成功','success')
+        //             let feature = data.feature
+        //             let equation = data.equation
+        //             const featureList = []
+        //             const formulaList = []
+
+        //             if(feature&&feature.length > 0) {
+        //                for(let i = 1; i <feature.length; i++) {
+        //                    const item = {}
+        //                    item.type = '';
+        //                    for (let j = 0; j < this.featureTypeList.length; j++) {
+        //                        if(feature[i].type.indexOf(this.featureTypeList[j].name) > -1) {
+        //                            item.type = this.featureTypeList[j].key
+        //                            break;
+        //                        }
+        //                    }
+                           
+        //                    item.code = feature[i].code
+        //                    item.standard = feature[i].standard
+        //                    item.relation = feature[i].associated
+        //                    if(item.type === 4) {
+        //                        item.result = ''
+        //                    } else {
+        //                         item.result = feature[i].result
+        //                    }
+        //                    featureList.push(item)
+        //                }
+        //             }
+        //             if(equation&&equation.length > 0) {
+        //                for(let i = 1; i <equation.length; i++) {
+        //                    const item = {}
+        //                    item.type = '';
+        //                    for (let j = 0; j < this.formulaTypeList.length; j++) {
+        //                        if(equation[i].type.indexOf(this.formulaTypeList[j].name) > -1) {
+        //                            item.type = this.formulaTypeList[j].key
+        //                            break;
+        //                        }
+        //                    }
+        //                    item.formula = equation[i].associated
+                           
+        //                    formulaList.push(item)
+        //                }
+        //             }
+        //             this.disFeatureList = featureList
+        //             this.disFormulaList = formulaList
+        //             console.log(' this.disFormulaListResult',  this.disFormulaListResult)
+        //         }else{
+        //         /*this.$message({
+        //             dangerouslyUseHTMLString: true,
+        //             message:res.data.msg,
+        //             type:'warning'
+        //         });*/
+        //         this.$alert(res.data.msg,'错误信息',{
+        //             dangerouslyUseHTMLString: true,
+        //             confirmButtonText: '确定',
+        //             callback: action => {
+        //             /*this.$message({
+        //                 type: 'info',
+        //                 message: `action: ${ action }`
+        //             });*/
+        //             }
+        //         });
+        //         }
+        //     })
+            
+        //     //解决上传相同文件不触发change
+        //     let inp = document.getElementById("upFile");
+        //     inp.value = "";   
+        // },
         updateNeo() {
             this.submitForm('updateNeo').then(() => {
                 if(this.hasQuestion == 0) {
@@ -431,11 +522,26 @@
                     errStrList.push(errStr)
                 }
                
+                //导入后判断
+                // let regexPause = new RegExp(`、`)      //判断标准词是否有顿号
+                //  if(disFeatureList[i].standard &&regexPause.test(disFeatureList[i].standard)) {
+                //     disFeatureList[i].verifyStandard ='数据异常'
+                //     const errStr = "疾病特征第" + (i+ 1) +"行标准词数据异常"
+                //     errStrList.push(errStr)
+                // }
+
+                // if(disFeatureList[i].type == '3'&&regexPause.test(disFeatureList[i].relation)) {
+                //     disFeatureList[i].verifyRelation ='数据异常'
+                //     const errStr = "疾病特征第" + (i+ 1) +"行化验关联词数据异常"
+                //     errStrList.push(errStr)
+                // }
+                //导入后判断
+
+
                 if(disFeatureList[i].type == '3' && !disFeatureList[i].result ) { //化验项下面诊断公式如果有用到,判断是否填写结果项
                     const regex2 = new RegExp(`(?<=\\D|\\s?)${disFeatureList[i].code}(?=\\D|\\s?)`)
                     //  const regex2 = new RegExp(`、\\s*、{1,}`) 
                     //  const regex2 = new RegExp(`([^0-9]|\\s{0,1})${disFeatureList[i].code}([^0-9]|\\s{0,1})`)
-                    console.log(disFormulaList)
                     let hasError = disFormulaList.find(item => {return regex2.test(item.formula)})
                     if(hasError) {
                         if(!disFeatureList[i].relation) {
@@ -469,6 +575,7 @@
                 }
                 
                 
+                
             }
             this.disFeatureList = JSON.parse(JSON.stringify(disFeatureList))
             let formulaListErrNum = 0
@@ -484,6 +591,28 @@
                         errStrList.push(errStr)
                         formulaListErrNum++;
                    }
+                    
+                    //导入后判断
+                    // if(disFormulaList[i].type == 91) { //确诊中有没有包含其他不可输入内容
+                    //     let regexDisFormula = /[^\u4EFB\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u5341\u62df\u8bca0-9\/\.+\(\)\(\)]/g
+                    //     if(regexDisFormula.test(disFormulaList[i].formula)) {
+                    //          disFormulaList[i].verifyFormula = "公式格式错误"
+                    //          const errStr = "诊断公式第" + (i+ 1) +"行公式格式错误,"
+                    //         errStrList.push(errStr)
+                    //         formulaListErrNum++;
+                    //     }
+                    // } else {   //其他诊断中有没有包含其他不可输入内容
+                    // //计算公式只能输入以下内容: 任、一、二、三、四、五、六、七、八、九、十、0-9、/、.、(、)、(、)
+                    //     let regexDisFormula = /[^\u4EFB\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u53410-9\/\.+\(\)\(\)]/g
+                    //     if(regexDisFormula.test(disFormulaList[i].formula)) {
+                    //          disFormulaList[i].verifyFormula = "公式格式错误"
+                    //          const errStr = "诊断公式第" + (i+ 1) +"行公式格式错误。"
+                    //         errStrList.push(errStr)
+                    //         formulaListErrNum++;
+                    //     }
+                    // }
+                    //导入后判断
+
                    if(disFormulaList[i].type == 91 && disFormulaList[i].formula.indexOf("拟诊") > -1) { //确诊项如果有拟诊这两个字,判断公式列表中有没有拟诊这项
                        const noError = disFormulaList.filter(item => item.type == 92).length > 0
                        if(!noError) {
@@ -491,10 +620,9 @@
                             const errStr = "诊断公式第" + (i+ 1) +"行公式格式错误"
                             errStrList.push(errStr)
                             formulaListErrNum++;
-                       } else {
-                            disFormulaList[i].verifyFormula = ""
-                       }
+                       } 
                    }
+
             }
             if(disFormulaList.length) {
                 this.disFormulaList = JSON.parse(JSON.stringify(disFormulaList))
@@ -891,6 +1019,9 @@
             color: red;
             margin-bottom: 10px;
         }
+        #upFile{
+            display: none
+        }
     }
     
 </style>