Browse Source

主诉旁新增“引用患者症状描述”按钮

yanqiliang 2 months ago
parent
commit
0ef8203f67
1 changed files with 65 additions and 1 deletions
  1. 65 1
      src/pages/entryWrite/page/Entry/medicalRecord/medicalRecord.vue

+ 65 - 1
src/pages/entryWrite/page/Entry/medicalRecord/medicalRecord.vue

@@ -286,9 +286,15 @@
                 </mp-cells>
                 <!-- 信息采集表单 -->
                 <view class="info-collection" v-if="formData.length > 0">
-                    <view class="info-item" :class="{'info-item--required-input': isRequiredInput(item)}" v-for="(item, index) in formData" :key="index">
+                    <view class="info-item" :class="{'info-item--required-input': isRequiredInput(item) || isChiefComplaintField(item)}" v-for="(item, index) in formData" :key="index">
                         <view class="info-label" :class="{'required': item.state && item.state.includes('required')}">
                             {{ item.label }}
+                            <button
+                                v-if="isChiefComplaintField(item) && !isReadonlyField(item) && patientData.changeDataFlag != 'N'"
+                                class="info-symptom-button"
+                                :disabled="symptomReferenceLoading"
+                                @tap.stop="referencePatientSymptom(item)"
+                            >{{ symptomReferenceLoading ? '引用中...' : '引用患者症状描述' }}</button>
                             <button v-if="isRequiredInput(item) && !isReadonlyField(item)" class="info-expand-button" @tap="openInputEditor(item)">展开编辑</button>
                         </view>
                         <view class="info-control" :class="{'info-readonly': isReadonlyField(item)}">
@@ -514,6 +520,7 @@ export default {
             formData: [], //病历解析后的表单内容(下拉菜单数组调整为一维数组)
             dataKeyObj: {}, //存值对象
             inputEditor: null, // 必填输入框展开编辑的临时内容
+            symptomReferenceLoading: false, // 患者症状描述引用中
             birthDate: '', //出生日期
             admID: '', //就诊ID
             isInfoSubmitting: false, //信息采集提交中
@@ -1169,6 +1176,45 @@ export default {
     return item.type === 'input' && item.state && item.state.includes('required');
   },
 
+  isChiefComplaintField(item) {
+    return item && this.trimSpace(item.label) === '主诉';
+  },
+
+  referencePatientSymptom(item) {
+    if (this.symptomReferenceLoading || !this.isChiefComplaintField(item) || this.isReadonlyField(item) || this.patientData.changeDataFlag === 'N') return;
+    const patientData = Cache.get('patientData') || {};
+    const admID = this.patientData.admID || patientData.admID;
+    if (!admID) {
+      uni.showToast({ title: '缺少就诊ID,无法引用', icon: 'none' });
+      return;
+    }
+    this.symptomReferenceLoading = true;
+    $http.post('urlS', this, {
+      code: '03100070',
+      data: { params: [{ admID }] },
+      success: (res) => {
+        if (+res.errorCode !== 0) return;
+        const currentPatient = Cache.get('patientData') || {};
+        if (String(this.patientData.admID || currentPatient.admID) !== String(admID)) return;
+        const field = this.formData.find((field) => field.key === item.key);
+        if (!this.isChiefComplaintField(field) || this.isReadonlyField(field) || this.patientData.changeDataFlag === 'N') return;
+        const symptom = res.result && res.result.symptomRecord && res.result.symptomRecord.symptom;
+        if (typeof symptom !== 'string' || !symptom.trim()) {
+          uni.showToast({ title: '暂无患者症状描述', icon: 'none' });
+          return;
+        }
+        this.updateInputValue(item.key, symptom);
+        if (this.inputEditor && this.inputEditor.key === item.key) {
+          this.inputEditor.value = symptom;
+        }
+        uni.showToast({ title: '已引用患者症状描述', icon: 'none' });
+      },
+      complete: () => {
+        this.symptomReferenceLoading = false;
+      }
+    });
+  },
+
   openInputEditor(item) {
     if (!this.isRequiredInput(item) || this.isReadonlyField(item)) return;
     this.inputEditor = { key: item.key, label: item.label, value: this.dataKeyObj[item.key] || '' };
@@ -2217,10 +2263,28 @@ export default {
 }
 
 .info-expand-button::after,
+.info-symptom-button::after,
 .medical-input-editor__action::after {
     border: none;
 }
 
+.info-symptom-button {
+    display: inline-block;
+    margin: 0 0 0 16rpx;
+    padding: 0 12rpx;
+    border-radius: 6rpx;
+    background: #e6f4ff;
+    color: #1890ff;
+    font-size: 24rpx;
+    line-height: 48rpx;
+    vertical-align: middle;
+}
+
+.info-symptom-button[disabled] {
+    background: #f0f5fa;
+    color: #8a94a6;
+}
+
 .info-required-input-box {
     width: 100%;
     padding: 16rpx 20rpx;