Преглед изворни кода

task-115 开方页左侧中医电子病历添加刷新按钮

cc12458 пре 1 година
родитељ
комит
197bdab75e
3 измењених фајлова са 46 додато и 4 уклоњено
  1. 14 0
      src/api/diagnosis.js
  2. 3 2
      src/utils/request.js
  3. 29 2
      src/views/diagnosis/Prescribing.vue

+ 14 - 0
src/api/diagnosis.js

@@ -60,6 +60,20 @@ export function getPatiensBasisM(data) {
     }).then(res => removeRedundantSemicolons(res));
 };
 
+// 刷新电子病历信息
+export function refreshElectronicInfo(data) {
+    return request({
+        url: '/test/outpatient/refreshElectronicInfo?patientId=' + data.patientId,
+        method: 'post',
+        ignoreErrorMessage: '请重试',
+    }).then(res => {
+        if (res.ResultCode !== 0) throw Error(res.ResultInfo || `请重试`);
+        if (res.Data == null) throw Error(`暂无新数据,请稍后刷新`);
+        const data = removeRedundantSemicolons(res.Data);
+        return data.outpatientElectronicmedicalrecord != null ? data : {outpatientElectronicmedicalrecord: data};
+    });
+}
+
 // 获取表格 药品列表
 export function getTableDrug(data, isPurposeType = false) {
     if (isPurposeType) {

+ 3 - 2
src/utils/request.js

@@ -66,6 +66,7 @@ service.interceptors.response.use(
     }
     // if the custom code is not 20000, it is judged as an error.
     if (res.ResultCode !== 0) {
+      const ignoreErrorMessage = response.config['ignoreErrorMessage'] || false;
       // if (res.code !== 200) {
       // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
       if (res.ResultCode === -5 || res.ResultCode === -9 || res.ResultCode == -8) {
@@ -94,7 +95,7 @@ service.interceptors.response.use(
 
 
 
-      } else {
+      } else if (ignoreErrorMessage === false) {
         Vue.prototype.$message({
           message: res.ResultInfo || `API 错误 (${res.ResultCode})`,
           type: 'error',
@@ -102,7 +103,7 @@ service.interceptors.response.use(
         })
 
       }
-      return Promise.reject(new Error(res.ResultInfo || 'Error'))
+      return Promise.reject(new Error(res.ResultInfo || (ignoreErrorMessage === true ? 'Error' : ignoreErrorMessage)))
     } else {
 
       return res

+ 29 - 2
src/views/diagnosis/Prescribing.vue

@@ -22,7 +22,11 @@
       <div class="pre-title mr-t10">
         <div class="flex-vertical-center-l title-container">
           <span></span>
-          <div>中医电子病历</div>
+          <div style="display: flex;justify-content: space-between; align-items: center; width: 100%">
+            中医电子病历
+            <el-button v-if="showRecordLoading" style="padding: 4px 8px; transform: translateY(2px)" size="mini" :loading="recordLoading" @click="loadRecord()">
+              {{ recordLoading ? '' : '刷新' }}</el-button>
+          </div>
         </div>
       </div>
       <div class="patiens-msg" v-if="patiensMsg.outpatientElectronicmedicalrecord">
@@ -1144,6 +1148,7 @@ import medAdress from "./components/medAddress.vue";
 import medAdressNew from "./components/medAddressNew.vue";
 import {
   getPatiensBasisM,
+  refreshElectronicInfo,
   getTongueAndFaceAnalysisRecords,
   addRecipe,
   getRecipeShowData,
@@ -1202,6 +1207,7 @@ export default {
   },
   data() {
     return {
+      recordLoading: false, // 中医电子病历
       tongueAndFaceLoading: false, // 舌面象加载
       tongueAndFaceAnalysis: null, // 舌面象数据
       showTongueAnalysis: false, // 舌象分析弹窗
@@ -1395,6 +1401,20 @@ export default {
     }
   },
   methods: {
+    async loadRecord() {
+      this.recordLoading = true;
+      try {
+        let data = await refreshElectronicInfo({
+          patientId: this.getPatiensInfo.pid
+        });
+        if (data.outpatientElectronicmedicalrecord) data.outpatientElectronicmedicalrecord.image1 = formatPicture(data.outpatientElectronicmedicalrecord.image1);
+        this.patiensMsg = {...this.patiensMsg, ...data};
+        this.$message.success('刷新成功');
+      } catch (e) {
+        this.$message.error(e.message);
+      }
+      this.recordLoading = false;
+    },
     // 处理路由参数
    async _processRouteQuery() {
       const query = this.$route.query || {};
@@ -4460,7 +4480,14 @@ export default {
         : 0
       ).toFixed(2);
     },
-    ...mapGetters(["getPatiensInfo", "getuserinfo", "getDrugInfo", "getIsSee", "getPreNo"])
+    ...mapGetters(["getPatiensInfo", "getuserinfo", "getDrugInfo", "getIsSee", "getPreNo"]),
+    showRecordLoading() {
+      try {
+        return !this.patiensMsg.outpatientElectronicmedicalrecord.image1.length
+      } catch (e) {
+        return true
+      }
+    },
   },
   filters: {
     ftsjj(value) {