Pārlūkot izejas kodu

知识图谱测试

morphone1995 4 gadi atpakaļ
vecāks
revīzija
4ea31e3536

+ 12 - 0
src/api/cdss.js

@@ -448,4 +448,16 @@ export default {
       responseType: 'blob',
     });
   },
+  criticalRuleTest(param) {
+    return axios.post(urls.criticalRuleTest, param, { timeout: 30 * 60 * 1000 });
+  },
+  getResultCriticalPage(param) {
+    return axios.post(urls.getResultCriticalPage, param);
+  },
+  highRiskRuleTest(param) {
+    return axios.post(urls.highRiskRuleTest, param, { timeout: 30 * 60 * 1000 });
+  },
+  getResultHighriskDrugPage(param) {
+    return axios.post(urls.getResultHighriskDrugPage, param);
+  },
 };

+ 4 - 0
src/api/config.js

@@ -490,6 +490,10 @@ export default {
     'getResultBillPage': '/api/cdssman/test/rule/getResultBillPage', 
     'exportRuleExcel': '/api/cdssman/test/rule/exportExcel', 
     'ruleAllTest': '/api/cdssman/test/rule/ruleTest', 
+    'getResultCriticalPage': '/api/cdssman/test/rule/getResultCriticalPage',   //危急值测试列表
+    'criticalRuleTest': '/api/cdssman/test/rule/criticalRuleTest',   //危急值规则测试
+    'getResultHighriskDrugPage': '/api/cdssman/test/rule/getResultHighriskDrugPage',   //高危药品测试列表
+    'highRiskRuleTest': '/api/cdssman/test/rule/highRiskRuleTest',   //高危药品、手术规则测试
 
   },
   menuIconList: { //菜单对应图标

+ 105 - 19
src/components/testManager/knowledgeMapRule/CriticalAuxTest.vue

@@ -1,28 +1,77 @@
 <template>
   <div>
     <crumbs
-      title="危急值提醒-辅助检查规则测试-失败条数"
+      :title="
+        type === 'success'
+          ? '危急值提醒-辅助检查规则测试-成功条数'
+          : '危急值提醒-辅助检查规则测试-失败条数'
+      "
       class="topBack"
       :param="$route.params"
       linkTo="KnowledgeMapRuleTest"
     >
       <el-form :inline="true" class="demo-form-inline">
-        <el-form-item style="marginBottom: 0px">
+        <el-form-item style="marginbottom: 0px">
           <el-button size="mini" @click="exportData">导出</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="gmtModified" label="测试时间"></el-table-column>
-        <el-table-column :resizable="false" prop="hisName" label="辅检名称(标准术语)" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="辅检名称(医院术语)" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="辅检结果描述" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="实际结果" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="预期结果" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="测试结果" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="失败原因" show-overflow-tooltip></el-table-column>
+      <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="gmtModified"
+          label="测试时间"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="criticalItemName"
+          label="辅检名称(标准术语)"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="criticalItemHisName"
+          label="辅检名称(医院术语)"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="inputValue"
+          label="辅检结果描述"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="output"
+          label="实际结果"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="expectedOutput"
+          label="预期结果"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column label="测试结果">
+          <template slot-scope="scope">
+            {{ scope.row.success === 1 ? '成功' : '失败' }}
+          </template>
+        </el-table-column>
+        <el-table-column
+          v-if="type !== 'success'"
+          :resizable="false"
+          prop="message"
+          label="失败原因"
+          show-overflow-tooltip
+        ></el-table-column>
       </el-table>
       <div class="pagination pagepage">
         <el-pagination
@@ -52,24 +101,41 @@ export default {
       pageSize: config.pageSize,
       pageSizeArr: config.pageSizeArr,
       pageLayout: config.pageLayout,
-      total: 0
+      total: 0,
+      type: '',
     };
   },
   created() {
-    this.getDataList()
+    const params = this.handleInitData();
+    this.getDataList();
     // 非首页 编辑页返回 设置 this.currentPage
     if (Object.keys(this.$route.params).length !== 0) {
       this.currentPage = this.$route.params.currentPage;
     }
   },
   beforeRouteEnter(to, from, next) {
-    next(vm => {
+    next((vm) => {
       //const pm = to.param;
       Object.assign(vm, to.params);
       vm.inCurrentPage = to.params.currentPage;
     });
   },
   methods: {
+    handleInitData() {
+      const { data, type } = this.$route.params;
+      this.type = type;
+      let criticalType; // 开单合理性规则类型  1  通用  2 输血
+      if (data && data.caseName === '危机值提醒_实验室检查规则') {
+        criticalType = 1;
+      } else if (data && data.caseName === '危机值提醒_辅助检查规则') {
+        criticalType = 2;
+      }
+      return {
+        criticalType,
+        resultId: data && data.resultId,
+        success: type === 'success' ? 1 : 0,
+      };
+    },
     indexMethod(index) {
       return (this.currentPage - 1) * this.pageSize + index + 1;
     },
@@ -87,12 +153,32 @@ export default {
       this.getDataList();
     },
 
-    getDataList(){
-
+    getDataList() {
+      const params = this.handleInitData();
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: 'Loading',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)',
+      });
+      api.getResultCriticalPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === '0') {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
     },
     // 导出
-    exportData() {}
-  }
+    exportData() {
+      
+    },
+  },
 };
 </script>
 

+ 117 - 21
src/components/testManager/knowledgeMapRule/CriticalLabTest.vue

@@ -1,30 +1,89 @@
 <template>
   <div>
     <crumbs
-      title="危急值提醒-实验室检查规则测试-失败条数"
+      :title="
+        type === 'success'
+          ? '危急值提醒-实验室检查规则测试-成功条数'
+          : '危急值提醒-实验室检查规则测试-失败条数'
+      "
       class="topBack"
       :param="$route.params"
       linkTo="KnowledgeMapRuleTest"
     >
       <el-form :inline="true" class="demo-form-inline">
-        <el-form-item style="marginBottom: 0px">
+        <el-form-item style="marginbottom: 0px">
           <el-button size="mini" @click="exportData">导出</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="gmtModified" label="测试时间"></el-table-column>
-        <el-table-column :resizable="false" prop="hisName" label="实验室检查名称(标准术语)" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="实验室检查名称(医院术语)" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="高危急值" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="低危急值" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="输入值" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="实际结果" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="预期结果" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="测试结果" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="失败原因" show-overflow-tooltip></el-table-column>
+      <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="gmtModified"
+          label="测试时间"
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="criticalItemName"
+          label="实验室检查名称(标准术语)"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="criticalItemHisName"
+          label="实验室检查名称(医院术语)"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="maxValue"
+          label="高危急值"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="minValue"
+          label="低危急值"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="inputValue"
+          label="输入值"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="output"
+          label="实际结果"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="expectedOutput"
+          label="预期结果"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column label="测试结果">
+          <template slot-scope="scope">
+            {{ scope.row.success === 1 ? '成功' : '失败' }}
+          </template>
+        </el-table-column>
+        <el-table-column
+          v-if="type !== 'success'"
+          :resizable="false"
+          prop="message"
+          label="失败原因"
+          show-overflow-tooltip
+        ></el-table-column>
       </el-table>
       <div class="pagination pagepage">
         <el-pagination
@@ -54,24 +113,41 @@ export default {
       pageSize: config.pageSize,
       pageSizeArr: config.pageSizeArr,
       pageLayout: config.pageLayout,
-      total: 0
+      total: 0,
+      type: '',
     };
   },
   created() {
-    this.getDataList()
+    const params = this.handleInitData();
+    this.getDataList();
     // 非首页 编辑页返回 设置 this.currentPage
     if (Object.keys(this.$route.params).length !== 0) {
       this.currentPage = this.$route.params.currentPage;
     }
   },
   beforeRouteEnter(to, from, next) {
-    next(vm => {
+    next((vm) => {
       //const pm = to.param;
       Object.assign(vm, to.params);
       vm.inCurrentPage = to.params.currentPage;
     });
   },
   methods: {
+    handleInitData() {
+      const { data, type } = this.$route.params;
+      this.type = type;
+      let criticalType; // 开单合理性规则类型  1  通用  2 输血
+      if (data && data.caseName === '危机值提醒_实验室检查规则') {
+        criticalType = 1;
+      } else if (data && data.caseName === '危机值提醒_辅助检查规则') {
+        criticalType = 2;
+      }
+      return {
+        criticalType,
+        resultId: data && data.resultId,
+        success: type === 'success' ? 1 : 0,
+      };
+    },
     indexMethod(index) {
       return (this.currentPage - 1) * this.pageSize + index + 1;
     },
@@ -89,12 +165,32 @@ export default {
       this.getDataList();
     },
 
-    getDataList(){
-
+    getDataList() {
+      const params = this.handleInitData();
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: 'Loading',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)',
+      });
+      api.getResultCriticalPage(params).then((res) => {
+        loading.close();
+        if (res.data.code === '0') {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
     },
     // 导出
-    exportData() {}
-  }
+    exportData() {
+      
+    },
+  },
 };
 </script>
 

+ 92 - 15
src/components/testManager/knowledgeMapRule/HighRiskDrugTest.vue

@@ -1,7 +1,11 @@
 <template>
   <div>
     <crumbs
-      title="高风险提示-高危药品规则测试-失败条数"
+      :title="
+        type === 'success'
+          ? '高风险提示-高危药品规则测试-成功条数'
+          : '高风险提示-高危药品规则测试-失败条数'
+      "
       class="topBack"
       :param="$route.params"
       linkTo="KnowledgeMapRuleTest"
@@ -13,18 +17,56 @@
       </el-form>
     </crumbs>
     <div style="margin: 60px 20px 0">
-      <el-table :data="list" border >
+      <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="gmtModified" label="测试时间"></el-table-column>
-        <el-table-column :resizable="false" prop="hisName" label="药品通用名称(标准术语)" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="药品通用名称(医院术语)" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="药品注册名称" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="剂型" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="药品高危级别" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="实际结果" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="预期结果" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="测试结果" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="失败原因" show-overflow-tooltip></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="highriskItemName"
+          label="药品通用名称(标准术语)"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="highriskItemHisName"
+          label="药品通用名称(医院术语)"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="highriskItemRegName"
+          label="药品注册名称"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="highriskItemForm"
+          label="剂型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="highriskLevel"
+          label="药品高危级别"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column :resizable="false" prop="output" label="实际结果" show-overflow-tooltip></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="expectedOutput"
+          label="预期结果"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column label="测试结果">
+          <template slot-scope="scope">{{ scope.row.success === 1 ? '成功' : '失败' }}</template>
+        </el-table-column>
+        <el-table-column
+          v-if="type !== 'success'"
+          :resizable="false"
+          prop="message"
+          label="失败原因"
+          show-overflow-tooltip
+        ></el-table-column>
       </el-table>
       <div class="pagination pagepage">
         <el-pagination
@@ -54,11 +96,13 @@ export default {
       pageSize: config.pageSize,
       pageSizeArr: config.pageSizeArr,
       pageLayout: config.pageLayout,
-      total: 0
+      total: 0,
+      type: ''
     };
   },
   created() {
-    this.getDataList()
+    const params = this.handleInitData();
+    this.getDataList();
     // 非首页 编辑页返回 设置 this.currentPage
     if (Object.keys(this.$route.params).length !== 0) {
       this.currentPage = this.$route.params.currentPage;
@@ -72,6 +116,21 @@ export default {
     });
   },
   methods: {
+    handleInitData() {
+      const { data, type } = this.$route.params;
+      this.type = type;
+      let highriskType; // 开单合理性规则类型  1  通用  2 输血
+      if (data && data.caseName === '高风险提醒_高危药品规则') {
+        highriskType = 1;
+      } else if (data && data.caseName === '高风险提醒_高危手术规则') {
+        highriskType = 2;
+      }
+      return {
+        highriskType,
+        resultId: data && data.resultId,
+        success: type === 'success' ? 1 : 0
+      };
+    },
     indexMethod(index) {
       return (this.currentPage - 1) * this.pageSize + index + 1;
     },
@@ -89,8 +148,26 @@ export default {
       this.getDataList();
     },
 
-    getDataList(){
-
+    getDataList() {
+      const params = this.handleInitData();
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: 'Loading',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
+      api.getResultHighriskDrugPage(params).then(res => {
+        loading.close();
+        if (res.data.code === '0') {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
     },
     // 导出
     exportData() {}

+ 69 - 10
src/components/testManager/knowledgeMapRule/HighRiskOperationTest.vue

@@ -1,7 +1,11 @@
 <template>
   <div>
     <crumbs
-      title="高风险提示-高危手术整合规则测试-失败条数"
+      :title="
+        type === 'success'
+          ? '高风险提示-高危手术整合规则测试-成功条数'
+          : '高风险提示-高危手术整合规则测试-失败条数'
+      "
       class="topBack"
       :param="$route.params"
       linkTo="KnowledgeMapRuleTest"
@@ -13,16 +17,36 @@
       </el-form>
     </crumbs>
     <div style="margin: 60px 20px 0">
-      <el-table :data="list" border >
+      <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="gmtModified" label="测试时间"></el-table-column>
         <el-table-column :resizable="false" prop="hisName" label="手术名称(标准术语)" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="手术名称(医院术语)" show-overflow-tooltip></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="手术名称(医院术语)"
+          show-overflow-tooltip
+        ></el-table-column>
         <el-table-column :resizable="false" prop="uniqueName" label="手术级别" show-overflow-tooltip></el-table-column>
         <el-table-column :resizable="false" prop="uniqueName" label="禁忌项类型" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="禁忌项(标准术语)" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="禁忌项(医院术语)" show-overflow-tooltip></el-table-column>
-        <el-table-column :resizable="false" prop="uniqueName" label="禁忌项输入值/结果" show-overflow-tooltip></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="禁忌项(标准术语)"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="禁忌项(医院术语)"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="uniqueName"
+          label="禁忌项输入值/结果"
+          show-overflow-tooltip
+        ></el-table-column>
         <el-table-column :resizable="false" prop="uniqueName" label="实际结果" show-overflow-tooltip></el-table-column>
         <el-table-column :resizable="false" prop="uniqueName" label="预期结果" show-overflow-tooltip></el-table-column>
         <el-table-column :resizable="false" prop="uniqueName" label="测试结果" show-overflow-tooltip></el-table-column>
@@ -56,11 +80,13 @@ export default {
       pageSize: config.pageSize,
       pageSizeArr: config.pageSizeArr,
       pageLayout: config.pageLayout,
-      total: 0
+      total: 0,
+      type: ''
     };
   },
   created() {
-    this.getDataList()
+    const params = this.handleInitData();
+    this.getDataList();
     // 非首页 编辑页返回 设置 this.currentPage
     if (Object.keys(this.$route.params).length !== 0) {
       this.currentPage = this.$route.params.currentPage;
@@ -74,6 +100,21 @@ export default {
     });
   },
   methods: {
+    handleInitData() {
+      const { data, type } = this.$route.params;
+      this.type = type;
+      let highriskType; // 开单合理性规则类型  1  通用  2 输血
+      if (data && data.caseName === '高风险提醒_高危药品规则') {
+        highriskType = 1;
+      } else if (data && data.caseName === '高风险提醒_高危手术规则') {
+        highriskType = 2;
+      }
+      return {
+        highriskType,
+        resultId: data && data.resultId,
+        success: type === 'success' ? 1 : 0
+      };
+    },
     indexMethod(index) {
       return (this.currentPage - 1) * this.pageSize + index + 1;
     },
@@ -91,8 +132,26 @@ export default {
       this.getDataList();
     },
 
-    getDataList(){
-
+    getDataList() {
+      const params = this.handleInitData();
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: 'Loading',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      });
+      api.getResultHighriskDrugPage(params).then(res => {
+        loading.close();
+        if (res.data.code === '0') {
+          this.list = res.data.data && res.data.data.records;
+        }
+        this.total = res.data.data && res.data.data.total;
+        if (this.inCurrentPage !== undefined) {
+          this.currentPage = this.inCurrentPage;
+          this.inCurrentPage = undefined;
+        }
+      });
     },
     // 导出
     exportData() {}

+ 94 - 72
src/components/testManager/knowledgeMapRule/KnowledgeMapRuleTest.vue

@@ -2,17 +2,8 @@
   <div>
     <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-form-item label class="selectMedicine" style="marginbottom: -1px">
+          <el-select size="mini" v-model="hospitalId" placeholder="选择医院" @change="handleChange">
             <el-option
               v-for="item in hospitalData"
               :label="item.name"
@@ -22,9 +13,7 @@
           </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">所有规则测试</el-button>
@@ -33,39 +22,18 @@
     </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
               type="text"
               size="small"
               @click="goToFailedOrSuccessPage(scope.row, 'success')"
-              >{{ scope.row.ruleSuccessNum }}</el-button
-            >
+            >{{ scope.row.ruleSuccessNum }}</el-button>
           </template>
         </el-table-column>
         <el-table-column label="失败条数">
@@ -74,15 +42,12 @@
               type="text"
               size="small"
               @click="goToFailedOrSuccessPage(scope.row, 'failed')"
-              >{{ scope.row.ruleFailedNum }}</el-button
-            >
+            >{{ scope.row.ruleFailedNum }}</el-button>
           </template>
         </el-table-column>
         <el-table-column label="操作">
           <template slot-scope="scope">
-            <el-button type="text" size="small" @click="handleTest(scope.row)"
-              >执行测试</el-button
-            >
+            <el-button type="text" size="small" @click="handleTest(scope.row)">执行测试</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -100,12 +65,19 @@ export default {
     return {
       list: [],
       hospitalData: [],
-      hospitalId: '', //选中医院
+      hospitalId: '' //选中医院
     };
   },
   created() {
     this._getHospitalInfoCDSS();
     // this.getDataList();
+  },
+   beforeRouteEnter(to, from, next) {
+    next(vm => {
+      Object.assign(vm, to.params);     
+      vm.getDataList(to.params.hospitalId)
+      // vm.hospitalId = to.params.hospitalId;
+    });
   },
   methods: {
     indexMethod(index) {
@@ -114,19 +86,52 @@ export default {
     // 执行测试
     handleTest(row) {
       const { caseName, caseId } = row;
+      let params = {
+        caseId,
+        hospitalId: this.hospitalId
+      };
+      let requestAjax;
       let billType; // 开单合理性规则类型  1  通用  2 输血
+      let criticalType; //危急值测试规则类型(1:检验,2:检查)
+      let highriskType; //高危测试规则类型(1:药品,2:手术)
       if (caseName === '开单合理性提醒_通用规则') {
         billType = 1;
+        params = { ...params, billType };
+        requestAjax = 'billRuleTest';
       } else if (caseName === '开单类型提醒_输血规则') {
         billType = 2;
+        params = { ...params, billType };
+        requestAjax = 'billRuleTest';
+      } else if (caseName === '危机值提醒_实验室检查规则') {
+        criticalType = 1;
+        params = { ...params, criticalType };
+        requestAjax = 'criticalRuleTest';
+      } else if (caseName === '危机值提醒_辅助检查规则') {
+        criticalType = 2;
+        params = { ...params, criticalType };
+        requestAjax = 'criticalRuleTest';
+      } else if (caseName === '高风险提醒_高危药品规则') {
+        highriskType = 1;
+        params = { ...params, highriskType };
+        requestAjax = 'highRiskRuleTest';
+      } else if (caseName === '高风险提醒_高危手术规则') {
+        highriskType = 2;
+        params = { ...params, highriskType };
+        requestAjax = 'highRiskRuleTest';
       }
-      let params = {
-        caseId,
-        billType,
-        hospitalId: this.hospitalId,
-      };
-      api.billRuleTest(params).then((res) => {
-        console.log(res, '测试结果');
+
+      api[requestAjax](params).then(res => {
+        // console.log(res, '测试结果');
+        if (res.data.code === '0' && res.data.data) {
+          this.getDataList(this.hospitalId);
+          this.$message({
+            message: '测试成功',
+            type: 'success'
+          });
+        } else {
+          this.$message.error('测试失败');
+          this.getDataList(this.hospitalId);
+        }
       });
     },
     // 所有规则测试
@@ -134,38 +139,55 @@ export default {
       if (this.hospitalId === '') {
         this.$message({
           message: '请先选择医院',
-          type: 'warning',
+          type: 'warning'
         });
         return;
       }
-      api.ruleAllTest({ hospitalId: this.hospitalId }).then((res) => {
-        console.log(res, '所有规则测试测试结果');
+      api.ruleAllTest({ hospitalId: this.hospitalId }).then(res => {
+        if (res.data.code === '0' && res.data.data) {
+          this.getDataList(this.hospitalId);
+          this.$message({
+            message: '所有规则测试成功',
+            type: 'success'
+          });
+        } else {
+          this.$message.error('所有规则测试失败');
+          this.getDataList(this.hospitalId);
+        }
       });
     },
 
     // 跳转至失败/成功条数页面
     goToFailedOrSuccessPage(row, type) {
-      const page = this.handleGoPage(row.caseName)
+      const page = this.handleGoPage(row.caseName);
       this.$router.push({
         name: page,
-        params: { data: { ...row }, type },
+        params: { data: { ...row }, type,  hospitalId: this.hospitalId }
       });
     },
     // 处理跳转到的页面
-    handleGoPage(caseName){
-      switch(caseName){
+    handleGoPage(caseName) {
+      switch (caseName) {
         case '开单合理性提醒_通用规则':
-          return 'BillCommonTest'
+          return 'BillCommonTest';
         case '开单类型提醒_输血规则':
-          return 'BillFusionTest'
+          return 'BillFusionTest';
+        case '危机值提醒_实验室检查规则':
+          return 'CriticalLabTest';
+        case '危机值提醒_辅助检查规则':
+          return 'CriticalAuxTest';
+        case '高风险提醒_高危药品规则':
+          return 'HighRiskDrugTest';
+        case '高风险提醒_高危手术规则':
+          return 'HighRiskOperationTest';
         default:
-          return null
+          return null;
       }
     },
 
     // 获取医院信息
     _getHospitalInfoCDSS() {
-      api.getHospitalInfo().then((res) => {
+      api.getHospitalInfo().then(res => {
         if (res.data.code === '0') {
           this.hospitalData = res.data && res.data.data;
         }
@@ -181,16 +203,16 @@ 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)',
+        background: 'rgba(0, 0, 0, 0.7)'
       });
-      api.getCaseResultList(params).then((res) => {
+      api.getCaseResultList(params).then(res => {
         loading.close();
         if (res.data.code === '0') {
           this.list = res.data && res.data.data;
@@ -202,17 +224,17 @@ export default {
       if (this.hospitalId === '') {
         this.$message({
           message: '请先选择医院',
-          type: 'warning',
+          type: 'warning'
         });
         return;
       }
       this.$alert('确定要导出规则未使用映射关系吗?', '', {
         confirmButtonText: '确定',
         title: '提示',
-        type: 'warning',
+        type: 'warning'
       })
         .then(() => {
-          api.exportRuleExcel({ hospitalId: this.hospitalId }).then((res) => {
+          api.exportRuleExcel({ hospitalId: this.hospitalId }).then(res => {
             if (res.status === 200) {
               this.$message({ message: '导出成功', type: 'success' });
               utils.downloadExportedData(res.data, '规则未使用映射关系.xls');
@@ -220,8 +242,8 @@ export default {
           });
         })
         .catch(() => {});
-    },
-  },
+    }
+  }
 };
 </script>