浏览代码

Merge branch 'bug0818' into test

1178232204@qq.com 2 年之前
父节点
当前提交
df25d8f525

+ 144 - 110
src/components/autoTest/AutoKnowledgeMapRuleTest.vue

@@ -3,7 +3,12 @@
     <crumbs title="规则测试" class="topBack">
       <el-form :inline="true" class="demo-form-inline">
         <el-form-item label class="selectMedicine" style="marginbottom: -1px">
-          <el-select size="mini" v-model="hospitalId" placeholder="选择医院" @change="handleChange">
+          <el-select
+            size="mini"
+            v-model="hospitalId"
+            placeholder="选择医院"
+            @change="handleChange"
+          >
             <el-option
               v-for="item in hospitalData"
               :label="item.name"
@@ -13,24 +18,47 @@
           </el-select>
         </el-form-item>
         <el-form-item style="marginbottom: 0px">
-          <el-button size="mini" @click="exportData">导出规则中未涉及到的医院术语</el-button>
+          <el-button size="mini" @click="exportData"
+            >导出规则中未涉及到的医院术语</el-button
+          >
         </el-form-item>
         <el-form-item style="marginbottom: 0px">
           <el-button
             size="mini"
             @click="handleAllTest"
             :disabled="!runningStatus || implement"
-          >所有规则测试</el-button>
+            >所有规则测试</el-button
+          >
         </el-form-item>
       </el-form>
     </crumbs>
     <div style="margin: 60px 20px 0">
       <el-table :data="list" border>
-        <el-table-column :resizable="false" type="index" :index="indexMethod" label="编号" width="80"></el-table-column>
-        <el-table-column :resizable="false" prop="caseName" label="规则类型" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="gmtModified" label="测试时间"></el-table-column>
+        <el-table-column
+          :resizable="false"
+          type="index"
+          :index="indexMethod"
+          label="编号"
+          width="80"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="caseName"
+          label="规则类型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="gmtModified"
+          label="测试时间"
+        ></el-table-column>
 
-        <el-table-column :resizable="false" prop="ruleNum" label="总条数" show-overflow-tooltip></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="ruleNum"
+          label="总条数"
+          show-overflow-tooltip
+        ></el-table-column>
         <el-table-column label="成功条数">
           <template slot-scope="scope">
             <el-button
@@ -38,7 +66,8 @@
               size="small"
               @click="goToFailedOrSuccessPage(scope.row, 'success')"
               :disabled="runningStatusArr[scope.$index] === 1"
-            >{{ scope.row.ruleSuccessNum }}</el-button>
+              >{{ scope.row.ruleSuccessNum }}</el-button
+            >
           </template>
         </el-table-column>
         <el-table-column label="失败条数">
@@ -48,7 +77,8 @@
               size="small"
               @click="goToFailedOrSuccessPage(scope.row, 'failed')"
               :disabled="runningStatusArr[scope.$index] === 1"
-            >{{ scope.row.ruleFailedNum }}</el-button>
+              >{{ scope.row.ruleFailedNum }}</el-button
+            >
           </template>
         </el-table-column>
         <el-table-column label="操作">
@@ -56,23 +86,25 @@
             <el-button
               type="text"
               size="small"
-              @click="handleTest(scope.row, scope.row.caseId-1)"
+              @click="handleTest(scope.row, scope.row.caseId - 1)"
               :disabled="!runningStatus || implement"
             >
               {{
-              runningStatusArr[scope.row.caseId-1] === 1
-              ? '执行测试中'
-              :implement?'执行测试'
-              : '执行测试'
+                runningStatusArr[scope.row.caseId - 1] === 1
+                  ? "执行测试中"
+                  : implement
+                  ? "执行测试"
+                  : "执行测试"
               }}
             </el-button>
-            <span v-if="runningStatusArr[scope.row.caseId-1] === 1">|</span>
+            <span v-if="runningStatusArr[scope.row.caseId - 1] === 1">|</span>
             <el-button
-              v-if="runningStatusArr[scope.row.caseId-1] === 1"
+              v-if="runningStatusArr[scope.row.caseId - 1] === 1"
               type="text"
               size="small"
-              @click="handleUpdateStatus(scope.row, scope.row.caseId-1)"
-            >重置</el-button>
+              @click="handleUpdateStatus(scope.row, scope.row.caseId - 1)"
+              >重置</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
@@ -81,29 +113,29 @@
 </template>
 
 <script>
-import api from '@api/knowledgeTree.js';
-import config from '@api/config.js';
-import utils from '@api/utils.js';
+import api from "@api/knowledgeTree.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
 export default {
-  name: 'AutoKnowledgeMapRuleTest',
+  name: "AutoKnowledgeMapRuleTest",
   data() {
     return {
       list: [],
       hospitalData: [],
-      hospitalId: '', //选中医院
+      hospitalId: "", //选中医院
       runningStatusArr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //知识图谱规则 测试状态
-      implement: false
+      implement: false,
     };
   },
   computed: {
     runningStatus() {
-      return this.runningStatusArr.every(item => {
+      return this.runningStatusArr.every((item) => {
         return item === 0;
       });
-    }
+    },
   },
   created() {
-    this.reminder()
+    this.reminder();
     this._getHospitalInfoCDSS();
     this.zskgetDict();
     // this._getRunningStatus()   // 进入页面立即确认状态
@@ -114,7 +146,7 @@ export default {
     clearInterval(this.timer);
   },
   beforeRouteEnter(to, from, next) {
-    next(vm => {
+    next((vm) => {
       Object.assign(vm, to.params);
       if (Object.keys(to.params).length === 0) return;
       vm.getDataList(to.params.hospitalId);
@@ -125,13 +157,15 @@ export default {
   methods: {
     reminder() {
       api
-        .reminder({caseGroup:1})
+        .reminder({ caseGroup: 1 })
         .then((res) => {
           if (res.data.code == "0") {
-            this.$message({
-              message: res.data.data,
-              type: "error",
-            });
+            if (res.data.data) {
+              this.$message({
+                message: res.data.data,
+                type: "error",
+              });
+            }
           }
         })
         .catch((error) => {
@@ -141,34 +175,34 @@ export default {
     getRunningState() {
       api
         .getRunningState({ caseGroup: 1 })
-        .then(res => {
-          if (res.data.code == '0') {
+        .then((res) => {
+          if (res.data.code == "0") {
             this.implement = res.data.data;
           }
         })
-        .catch(error => {
+        .catch((error) => {
           console.log(error);
         });
     },
     zskgetDict() {
       api
         .zskgetDict()
-        .then(res => {
-          if (res.data.code == '0') {
+        .then((res) => {
+          if (res.data.code == "0") {
             const data = res.data.data;
-            const arr = data['31'];
-            localStorage.setItem('zskDicts', JSON.stringify(arr));
+            const arr = data["31"];
+            localStorage.setItem("zskDicts", JSON.stringify(arr));
           }
         })
-        .catch(error => {
+        .catch((error) => {
           console.log(error);
         });
     },
     _getRunningStatus() {
       const { hospitalId } = this;
-      if (this.hospitalId === '') return;
-      api.getRunningStatusByHospitalId({ hospitalId }).then(res => {
-        if (res.data.code === '0' && res.data.data) {
+      if (this.hospitalId === "") return;
+      api.getRunningStatusByHospitalId({ hospitalId }).then((res) => {
+        if (res.data.code === "0" && res.data.data) {
           this.runningStatusArr = Object.values(res.data.data).slice(0, 15);
         }
       });
@@ -183,18 +217,18 @@ export default {
         .updateRunningStatus({
           hospitalId: this.hospitalId,
           caseId,
-          status: 0
+          status: 0,
         })
-        .then(res => {
-          if (res.data.code === '0' && res.data.data) {
+        .then((res) => {
+          if (res.data.code === "0" && res.data.data) {
             this.$message({
-              message: '重置成功',
-              type: 'success'
+              message: "重置成功",
+              type: "success",
             });
             this.getDataList(this.hospitalId); // 重新获取列表
             this.getRunningState();
           } else {
-            this.$message.error(res.data.msg || '重置失败');
+            this.$message.error(res.data.msg || "重置失败");
             this.getDataList(this.hospitalId); // 重新获取列表
             this.getRunningState();
           }
@@ -217,18 +251,18 @@ export default {
       const { caseName, caseId } = row;
       let params = {
         caseId,
-        hospitalId: this.hospitalId
+        hospitalId: this.hospitalId,
       };
 
-      api.autoRuleTest(params).then(res => {
-        if (res.data.code === '0' && res.data.data) {
+      api.autoRuleTest(params).then((res) => {
+        if (res.data.code === "0" && res.data.data) {
           this.getDataList(this.hospitalId);
           this.$message({
-            message: '测试成功',
-            type: 'success'
+            message: "测试成功",
+            type: "success",
           });
         } else {
-          this.$message.error('测试失败');
+          this.$message.error("测试失败");
           this.getDataList(this.hospitalId);
         }
         this.runningStatusArr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
@@ -236,24 +270,24 @@ export default {
     },
     // 所有规则测试
     handleAllTest() {
-      if (this.hospitalId === '') {
+      if (this.hospitalId === "") {
         this.$message({
-          message: '请先选择医院',
-          type: 'warning'
+          message: "请先选择医院",
+          type: "warning",
         });
         return;
       }
       this.runningStatusArr = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
-      api.allRuleTest({ hospitalId: this.hospitalId }).then(res => {
+      api.allRuleTest({ hospitalId: this.hospitalId }).then((res) => {
         this.runningStatusArr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
-        if (res.data.code === '0' && res.data.data) {
+        if (res.data.code === "0" && res.data.data) {
           this.getDataList(this.hospitalId);
           this.$message({
-            message: '所有规则测试成功',
-            type: 'success'
+            message: "所有规则测试成功",
+            type: "success",
           });
         } else {
-          this.$message.error('所有规则测试失败');
+          this.$message.error("所有规则测试失败");
           this.getDataList(this.hospitalId);
         }
       });
@@ -263,47 +297,47 @@ export default {
     goToFailedOrSuccessPage(row, type) {
       const page = this.handleGoPage(row.caseName);
       let hospital = this.hospitalData.find(
-        item => item.id === this.hospitalId
+        (item) => item.id === this.hospitalId
       );
       let hospitalName = hospital.name;
       let localAuto = {
         resultId: row.resultId,
         type,
         hospitalName,
-        caseName: row.caseName.replace(/\_/, '-')
+        caseName: row.caseName.replace(/\_/, "-"),
       };
-      localStorage.setItem('localAuto', JSON.stringify(localAuto));
+      localStorage.setItem("localAuto", JSON.stringify(localAuto));
       this.$router.push({
-        name: 'AutoBillCommonTest',
+        name: "AutoBillCommonTest",
         params: {
           data: { ...row },
           type,
           hospitalId: this.hospitalId,
-          hospitalName
-        }
+          hospitalName,
+        },
       });
     },
     // 处理跳转到的页面
     handleGoPage(caseName) {
       switch (caseName) {
-        case '开单合理性提醒_通用规则':
-          return 'BillCommonTest';
-        case '开单类型提醒_输血规则':
-          return 'BillFusionTest';
-        case '危机值提醒_实验室检查规则':
-          return 'CriticalLabTest';
-        case '危机值提醒_辅助检查规则':
-          return 'CriticalAuxTest';
-        case '高风险提醒_高危药品规则':
-          return 'HighRiskDrugTest';
-        case '高风险提醒_高危手术规则':
-          return 'HighRiskOperationTest';
-        case '其他提醒_化验规则':
-          return 'OtherAssayRuleTest';
-        case '其他提醒_输血规则':
-          return 'OtherFusionRuleTest';
-        case '其他提醒_辅检规则':
-          return 'OtherAuxRuleTest';
+        case "开单合理性提醒_通用规则":
+          return "BillCommonTest";
+        case "开单类型提醒_输血规则":
+          return "BillFusionTest";
+        case "危机值提醒_实验室检查规则":
+          return "CriticalLabTest";
+        case "危机值提醒_辅助检查规则":
+          return "CriticalAuxTest";
+        case "高风险提醒_高危药品规则":
+          return "HighRiskDrugTest";
+        case "高风险提醒_高危手术规则":
+          return "HighRiskOperationTest";
+        case "其他提醒_化验规则":
+          return "OtherAssayRuleTest";
+        case "其他提醒_输血规则":
+          return "OtherFusionRuleTest";
+        case "其他提醒_辅检规则":
+          return "OtherAuxRuleTest";
         default:
           return null;
       }
@@ -311,8 +345,8 @@ export default {
 
     // 获取医院信息
     _getHospitalInfoCDSS() {
-      api.getRecordHopitalList().then(res => {
-        if (res.data.code === '0') {
+      api.getRecordHopitalList().then((res) => {
+        if (res.data.code === "0") {
           this.hospitalData = res.data && res.data.data;
         }
       });
@@ -320,7 +354,7 @@ export default {
 
     // 选中医院
     handleChange(val) {
-      if (val === '') return;
+      if (val === "") return;
       this.getDataList(val);
       this._getRunningStatus(); // 选中后立即请求状态
       this.getRunningState();
@@ -329,50 +363,50 @@ export default {
     // 获取列表数据
     getDataList(id) {
       const params = {
-        hospitalId: id
+        hospitalId: id,
       };
       this.searched = true;
       const loading = this.$loading({
         lock: true,
-        text: 'Loading',
-        spinner: 'el-icon-loading',
-        background: 'rgba(0, 0, 0, 0.7)'
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
       });
-      api.autoGetCaseResultList(params).then(res => {
+      api.autoGetCaseResultList(params).then((res) => {
         loading.close();
-        if (res.data.code === '0') {
+        if (res.data.code === "0") {
           this.list = res.data && res.data.data;
         }
       });
     },
     // 导出
     exportData() {
-      if (this.hospitalId === '') {
+      if (this.hospitalId === "") {
         this.$message({
-          message: '请先选择医院',
-          type: 'warning'
+          message: "请先选择医院",
+          type: "warning",
         });
         return;
       }
-      this.$alert('确定要导出规则未使用映射关系吗?', '', {
-        confirmButtonText: '确定',
-        title: '提示',
-        type: 'warning'
+      this.$alert("确定要导出规则未使用映射关系吗?", "", {
+        confirmButtonText: "确定",
+        title: "提示",
+        type: "warning",
       })
         .then(() => {
-          api.autoExportExcel({ hospitalId: this.hospitalId }).then(res => {
+          api.autoExportExcel({ hospitalId: this.hospitalId }).then((res) => {
             if (res.status === 200) {
-              this.$message({ message: '导出成功', type: 'success' });
-              utils.downloadExportedData(res.data, '规则未使用映射关系.xls');
+              this.$message({ message: "导出成功", type: "success" });
+              utils.downloadExportedData(res.data, "规则未使用映射关系.xls");
             }
           });
         })
         .catch(() => {});
-    }
-  }
+    },
+  },
 };
 </script>
 
 <style lang="less" scoped>
-@import '../../less/admin.less';
+@import "../../less/admin.less";
 </style>

+ 8 - 6
src/components/testManager/staticKnowledgeMap/StaticKnowledgeMapTest.vue

@@ -154,13 +154,15 @@ export default {
   methods: {
     reminder() {
       api
-        .reminder({caseGroup:2})
+        .reminder({ caseGroup: 2 })
         .then((res) => {
           if (res.data.code == "0") {
-            this.$message({
-              message: res.data.data,
-              type: "error",
-            });
+            if (res.data.data) {
+              this.$message({
+                message: res.data.data,
+                type: "error",
+              });
+            }
           }
         })
         .catch((error) => {
@@ -186,7 +188,7 @@ export default {
         if (res.data.code === "0" && res.data.data) {
           const arr1 = Object.values(res.data.data).slice(9, 14);
           const arr2 = Object.values(res.data.data).slice(15, 17);
-          this.runningStatusArr = arr1.concat(arr2)
+          this.runningStatusArr = arr1.concat(arr2);
         }
       });
     },