Browse Source

开单 测试代码提交

Morphone0429 4 years ago
parent
commit
7c26112b1c

+ 18 - 0
src/api/cdss.js

@@ -430,4 +430,22 @@ export default {
   BatchUpdateHasInfoStatus(param) {
     return request({ method: 'post', url: urls.BatchUpdateHasInfoStatus, data: param });
   },
+
+  getCaseResultList(param) {
+    return axios.post(urls.getCaseResultList, param);
+  },
+  billRuleTest(param) {
+    return axios.post(urls.billRuleTest, param, { timeout: 30 * 60 * 1000 });
+  },
+  getResultBillPage(param) {
+    return axios.post(urls.getResultBillPage, param);
+  },
+  ruleAllTest(param) {
+    return axios.post(urls.ruleAllTest, param);
+  },
+  exportRuleExcel(param) {
+    return axios.post(urls.exportRuleExcel, param, {
+      responseType: 'blob',
+    });
+  },
 };

+ 6 - 0
src/api/config.js

@@ -485,6 +485,12 @@ export default {
     'getKlmEnumsDataCDSS': '/api/cdssman/getKlmEnumsData',   //枚举数据获取
 
 
+    'getCaseResultList': '/api/cdssman/test/rule/getCaseResultList', 
+    'billRuleTest': '/api/cdssman/test/rule/billRuleTest',   
+    'getResultBillPage': '/api/cdssman/test/rule/getResultBillPage', 
+    'exportRuleExcel': '/api/cdssman/test/rule/exportExcel', 
+    'ruleAllTest': '/api/cdssman/test/rule/ruleTest', 
+
   },
   menuIconList: { //菜单对应图标
     'YH-KZT': 'el-icon-menu',

+ 132 - 23
src/components/testManager/knowledgeMapRule/BillCommonTest.vue

@@ -1,32 +1,102 @@
 <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="hisDetailName" 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 :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="billItemType"
+          label="开单项类型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="billItemName"
+          label="开单项(标准术语)"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="billItemHisName"
+          label="开单项(医院术语)"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="conflictItemType"
+          label="禁忌项类型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="conflictItemName"
+          label="禁忌项(标准术语)"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="conflictItemHisName"
+          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
@@ -56,24 +126,43 @@ 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() {
+      console.log(this.$route.params);
+      const { data, type } = this.$route.params;
+      this.type = type;
+      console.log(this.type, '111');
+      let billType; // 开单合理性规则类型  1  通用  2 输血
+      if (data && data.caseName === '开单合理性提醒_通用规则') {
+        billType = 1;
+      } else if (data && data.caseName === '开单类型提醒_输血规则') {
+        billType = 2;
+      }
+      return {
+        billType,
+        resultId: data && data.resultId,
+        success: type === 'success' ? 1 : 0,
+      };
+    },
     indexMethod(index) {
       return (this.currentPage - 1) * this.pageSize + index + 1;
     },
@@ -91,12 +180,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.getResultBillPage(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>
 

+ 119 - 21
src/components/testManager/knowledgeMapRule/BillFusionTest.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="billItemType"
+          label="输注类型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="conflictItemType"
+          label="禁忌项类型"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="conflictItemName"
+          label="禁忌项(标准术语)"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          :resizable="false"
+          prop="conflictItemHisName"
+          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,43 @@ 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() {
+      console.log(this.$route.params);
+      const { data, type } = this.$route.params;
+      this.type = type;
+      console.log(this.type, '111');
+      let billType; // 开单合理性规则类型  1  通用  2 输血
+      if (data && data.caseName === '开单合理性提醒_通用规则') {
+        billType = 1;
+      } else if (data && data.caseName === '开单类型提醒_输血规则') {
+        billType = 2;
+      }
+      return {
+        billType,
+        resultId: data && data.resultId,
+        success: type === 'success' ? 1 : 0,
+      };
+    },
     indexMethod(index) {
       return (this.currentPage - 1) * this.pageSize + index + 1;
     },
@@ -89,12 +167,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.getResultBillPage(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>
 

+ 128 - 66
src/components/testManager/knowledgeMapRule/KnowledgeMapRuleTest.vue

@@ -9,15 +9,15 @@
         >
           <el-select
             size="mini"
-            v-model="hospitalName"
+            v-model="hospitalId"
             placeholder="选择医院"
-            clearable
+            @change="handleChange"
           >
             <el-option
               v-for="item in hospitalData"
               :label="item.name"
-              :value="item.val"
-              :key="item.orderNo"
+              :value="item.id"
+              :key="item.id"
             ></el-option>
           </el-select>
         </el-form-item>
@@ -42,8 +42,8 @@
         ></el-table-column>
         <el-table-column
           :resizable="false"
-          prop="hisName"
-          label="测试类型"
+          prop="caseName"
+          label="规则类型"
           show-overflow-tooltip
         ></el-table-column>
         <el-table-column
@@ -54,23 +54,27 @@
 
         <el-table-column
           :resizable="false"
-          prop="uniqueName"
+          prop="ruleNum"
           label="总条数"
           show-overflow-tooltip
         ></el-table-column>
-        <el-table-column
-          :resizable="false"
-          prop="uniqueName"
-          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
+            >
+          </template>
+        </el-table-column>
         <el-table-column label="失败条数">
           <template slot-scope="scope">
             <el-button
               type="text"
               size="small"
-              @click="goToErrorPage(scope.row)"
-              >5</el-button
+              @click="goToFailedOrSuccessPage(scope.row, 'failed')"
+              >{{ scope.row.ruleFailedNum }}</el-button
             >
           </template>
         </el-table-column>
@@ -82,18 +86,6 @@
           </template>
         </el-table-column>
       </el-table>
-      <div class="pagination pagepage">
-        <el-pagination
-          :current-page.sync="currentPage"
-          @current-change="currentChange"
-          background
-          :page-size="pageSize"
-          :page-sizes="pageSizeArr"
-          @size-change="handleSizeChange"
-          :layout="pageLayout"
-          :total="total"
-        ></el-pagination>
-      </div>
     </div>
   </div>
 </template>
@@ -107,62 +99,132 @@ export default {
   data() {
     return {
       list: [],
-      currentPage: 1,
-      pageSize: config.pageSize,
-      pageSizeArr: config.pageSizeArr,
-      pageLayout: config.pageLayout,
-      total: 0,
       hospitalData: [],
-      hospitalName: '', //选中医院
+      hospitalId: '', //选中医院
     };
   },
   created() {
-    this.getDataList();
-    // 非首页 编辑页返回 设置 this.currentPage
-    if (Object.keys(this.$route.params).length !== 0) {
-      this.currentPage = this.$route.params.currentPage;
-    }
-  },
-  beforeRouteEnter(to, from, next) {
-    next((vm) => {
-      //const pm = to.param;
-      Object.assign(vm, to.params);
-      vm.inCurrentPage = to.params.currentPage;
-    });
+    this._getHospitalInfoCDSS();
+    // this.getDataList();
   },
   methods: {
     indexMethod(index) {
-      return (this.currentPage - 1) * this.pageSize + index + 1;
-    },
-    currentChange(next) {
-      this.currentPage = next;
-      this.getDataList(true);
-    },
-    handleSizeChange(val) {
-      this.pageSize = val;
-      this.currentPage = utils.getCurrentPage(
-        this.currentPage,
-        this.total,
-        this.pageSize
-      );
-      this.getDataList();
+      return index + 1;
     },
     // 执行测试
-    handleTest() {},
+    handleTest(row) {
+      const { caseName, caseId } = row;
+      let billType; // 开单合理性规则类型  1  通用  2 输血
+      if (caseName === '开单合理性提醒_通用规则') {
+        billType = 1;
+      } else if (caseName === '开单类型提醒_输血规则') {
+        billType = 2;
+      }
+      let params = {
+        caseId,
+        billType,
+        hospitalId: this.hospitalId,
+      };
+      api.billRuleTest(params).then((res) => {
+        console.log(res, '测试结果');
+      });
+    },
     // 所有规则测试
-    handleAllTest() {},
+    handleAllTest() {
+      if (this.hospitalId === '') {
+        this.$message({
+          message: '请先选择医院',
+          type: 'warning',
+        });
+        return;
+      }
+      api.ruleAllTest({ hospitalId: this.hospitalId }).then((res) => {
+        console.log(res, '所有规则测试测试结果');
+      });
+    },
+
+    // 跳转至失败/成功条数页面
+    goToFailedOrSuccessPage(row, type) {
+      const page = this.handleGoPage(row.caseName)
+      this.$router.push({
+        name: page,
+        params: { data: { ...row }, type },
+      });
+    },
+    // 处理跳转到的页面
+    handleGoPage(caseName){
+      switch(caseName){
+        case '开单合理性提醒_通用规则':
+          return 'BillCommonTest'
+        case '开单类型提醒_输血规则':
+          return 'BillFusionTest'
+        default:
+          return null
+      }
+    },
 
-    // 跳转至失败条数页面
-    goToErrorPage() {},
+    // 获取医院信息
+    _getHospitalInfoCDSS() {
+      api.getHospitalInfo().then((res) => {
+        if (res.data.code === '0') {
+          this.hospitalData = res.data && res.data.data;
+        }
+      });
+    },
+
+    // 选中医院
+    handleChange(val) {
+      if (val === '') return;
+      this.getDataList(val);
+    },
 
-    getDataList() {},
+    // 获取列表数据
+    getDataList(id) {
+      const params = {
+        hospitalId: id,
+      };
+      this.searched = true;
+      const loading = this.$loading({
+        lock: true,
+        text: 'Loading',
+        spinner: 'el-icon-loading',
+        background: 'rgba(0, 0, 0, 0.7)',
+      });
+      api.getCaseResultList(params).then((res) => {
+        loading.close();
+        if (res.data.code === '0') {
+          this.list = res.data && res.data.data;
+        }
+      });
+    },
     // 导出
-    exportData() {},
+    exportData() {
+      if (this.hospitalId === '') {
+        this.$message({
+          message: '请先选择医院',
+          type: 'warning',
+        });
+        return;
+      }
+      this.$alert('确定要导出规则未使用映射关系吗?', '', {
+        confirmButtonText: '确定',
+        title: '提示',
+        type: 'warning',
+      })
+        .then(() => {
+          api.exportRuleExcel({ hospitalId: this.hospitalId }).then((res) => {
+            if (res.status === 200) {
+              this.$message({ message: '导出成功', type: 'success' });
+              utils.downloadExportedData(res.data, '规则未使用映射关系.xls');
+            }
+          });
+        })
+        .catch(() => {});
+    },
   },
 };
 </script>
 
 <style lang="less" scored>
 @import '../../../less/admin.less';
-
 </style>