cgp 1 день назад
Родитель
Сommit
30b8399c47

+ 31 - 0
src/api/his/scrmPrescribe.js

@@ -19,3 +19,34 @@ export function waitOpenPrescribeList(query) {
     params: query
   })
 }
+
+/**
+ * 获取医生、药师签名及职称信息
+ * @param {Array<number>} doctorIds 医生ID和药师ID组成的数组,例如 [医生ID, 药师ID]
+ * @returns {Promise} 返回Promise,resolve时携带医生签名信息、职称等
+ */
+export function getDoctorSignInfo(doctorIds) {
+  return request({
+    url: '/his/prescribeDataScrm/getSignInfo',
+    method: 'post',
+    data: doctorIds  // 直接传数组
+  })
+}
+
+/**
+ * 医生提交开方前的建议信息(诊断、治疗方面、注意禁忌等)
+ * @param {Object} data 请求参数
+ * @param {number} data.prescribeId 处方ID
+ * @param {string} data.diagnose 诊断
+ * @param {string} data.facialDiagnosis 舌诊面诊手诊
+ * @param {string} data.healingAreaJson 治疗方面JSON字符串,格式:[{"diagnosisContent":"","suggestTreatment":""}]
+ * @param {string} data.noteTaboos 注意禁忌
+ * @returns {Promise}
+ */
+export function submitDoctorAdvice(data) {
+  return request({
+    url: '/his/prescribeDataScrm/addDoctorAdvice',
+    method: 'post',
+    data: data
+  })
+}

+ 262 - 0
src/views/his/scrmPrescribe/DoctorAdviceDialog.vue

@@ -0,0 +1,262 @@
+<template>
+  <el-dialog
+    title="医生建议及处置"
+    :visible.sync="dialogVisible"
+    width="800px"
+    :close-on-click-modal="false"
+    @close="handleClose"
+  >
+    <el-form :model="formData" :rules="formRules" ref="adviceForm" label-width="150px">
+      <!-- 诊断 -->
+      <el-form-item label="诊断" prop="diagnose">
+        <el-input v-model="formData.diagnose" type="textarea" :rows="2" placeholder="请输入诊断信息" />
+      </el-form-item>
+      <!-- 舌诊、面诊、手诊 -->
+      <el-form-item label="舌诊、面诊、手诊" prop="facialDiagnosis">
+        <el-input v-model="formData.facialDiagnosis" type="textarea" :rows="2" placeholder="请输入舌诊、面诊、手诊结果" />
+      </el-form-item>
+      <!-- 治疗方面(动态表格) -->
+      <el-form-item label="治疗方面" prop="healingList" required>
+        <div style="margin-bottom: 10px;">
+          <el-button type="primary" size="small" icon="el-icon-plus" @click="addHealingRow">新增一行</el-button>
+        </div>
+        <el-table :data="formData.healingList" border stripe>
+          <el-table-column label="诊断内容" prop="diagnosisContent" min-width="200">
+            <template slot-scope="scope">
+              <el-input v-model="scope.row.diagnosisContent" placeholder="请输入诊断内容" size="small" />
+            </template>
+          </el-table-column>
+          <el-table-column label="建议治疗" prop="suggestTreatment" min-width="200">
+            <template slot-scope="scope">
+              <el-input v-model="scope.row.suggestTreatment" placeholder="请输入建议治疗" size="small" />
+            </template>
+          </el-table-column>
+          <el-table-column label="操作" width="80" align="center">
+            <template slot-scope="scope">
+              <el-button type="text" icon="el-icon-delete" style="color: #f56c6c;" @click="removeHealingRow(scope.$index)">删除</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-form-item>
+      <!-- 注意禁忌 -->
+      <el-form-item label="注意禁忌" prop="noteTaboos">
+        <el-input v-model="formData.noteTaboos" type="textarea" :rows="2" placeholder="请输入注意事项及禁忌" />
+      </el-form-item>
+
+      <el-divider content-position="left">医生及药师信息</el-divider>
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="医生职称">
+            <el-input v-model="signInfo.doctorPosition" readonly disabled />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="执业医师证号">
+            <el-input :value="displayLicenseNumber" readonly disabled />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row :gutter="20">
+        <el-col :span="12">
+          <el-form-item label="药师签字">
+            <div v-if="signInfo.drugDoctorSignUrl" style="display: flex; align-items: center;">
+              <el-image :src="signInfo.drugDoctorSignUrl" style="width: 100px; height: 40px;" fit="contain" />
+              <span style="margin-left: 8px; color: #909399;">(药师:{{ signInfo.drugDoctorName || '' }})</span>
+            </div>
+            <el-input v-else :value="signInfo.drugDoctorName || '暂无药师签名'" readonly disabled />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="执业医师签字">
+            <div v-if="signInfo.doctorSignUrl" style="display: flex; align-items: center;">
+              <el-image :src="signInfo.doctorSignUrl" style="width: 100px; height: 40px;" fit="contain" />
+              <span style="margin-left: 8px; color: #909399;">(医生:{{ signInfo.doctorName || '' }})</span>
+            </div>
+            <el-input v-else :value="signInfo.doctorName || '暂无医生签名'" readonly disabled />
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <div slot="footer" class="dialog-footer">
+      <el-button @click="dialogVisible = false">取 消</el-button>
+      <el-button type="primary" :loading="submitLoading" @click="submitAdvice">确 定</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import { getDoctorSignInfo, submitDoctorAdvice } from "@/api/his/scrmPrescribe";
+
+export default {
+  name: "DoctorAdviceDialog",
+  props: {
+    visible: {
+      type: Boolean,
+      default: false
+    },
+    prescribeId: {
+      type: Number,
+      default: null
+    },
+    doctorId: {
+      type: Number,
+      default: null
+    },
+    drugDoctorId: {
+      type: Number,
+      default: null
+    }
+  },
+  data() {
+    return {
+      dialogVisible: false,
+      submitLoading: false,
+      formData: {
+        diagnose: '',
+        facialDiagnosis: '',
+        healingList: [],
+        noteTaboos: ''
+      },
+      formRules: {
+        diagnose: [{ required: true, message: '请输入诊断', trigger: 'blur' }],
+        facialDiagnosis: [{ required: true, message: '请输入舌诊、面诊、手诊信息', trigger: 'blur' }],
+        noteTaboos: [{ required: true, message: '请输入注意禁忌', trigger: 'blur' }],
+        healingList: [{ validator: (rule, value, callback) => {
+            if (!value || value.length === 0) {
+              callback(new Error('请至少添加一行治疗方面数据'));
+            } else {
+              const invalid = value.some(item => !item.diagnosisContent || !item.suggestTreatment);
+              if (invalid) {
+                callback(new Error('请完整填写治疗方面每行的诊断内容和建议治疗'));
+              } else {
+                callback();
+              }
+            }
+          }, trigger: 'change' }]
+      },
+      signInfo: {
+        doctorPosition: '',      // 职称
+        doctorPractiseCode: '',  // 执业证号
+        doctorCertificateCode: '', // 医师证号
+        doctorName: '',
+        drugDoctorName: '',
+        doctorSignUrl: '',
+        drugDoctorSignUrl: ''
+      }
+    };
+  },
+  computed: {
+    // 优先显示执业证号,若为空则显示医师证号
+    displayLicenseNumber() {
+      return this.signInfo.doctorPractiseCode || this.signInfo.doctorCertificateCode || '暂无证号';
+    }
+  },
+  watch: {
+    visible(val) {
+      this.dialogVisible = val;
+      if (val) {
+        if (!this.prescribeId) {
+          this.$message.error('处方ID无效,请刷新页面重试');
+          this.dialogVisible = false;
+          this.$emit('update:visible', false);
+          return;
+        }
+        this.resetFormData();
+        this.fetchSignInfo();
+      }
+    }
+  },
+  methods: {
+    resetFormData() {
+      this.formData = {
+        diagnose: '',
+        facialDiagnosis: '',
+        healingList: [],
+        noteTaboos: ''
+      };
+      this.addHealingRow();
+      this.$nextTick(() => {
+        if (this.$refs.adviceForm) {
+          this.$refs.adviceForm.clearValidate();
+        }
+      });
+    },
+    addHealingRow() {
+      this.formData.healingList.push({
+        diagnosisContent: '',
+        suggestTreatment: ''
+      });
+    },
+    removeHealingRow(index) {
+      if (this.formData.healingList.length === 1) {
+        this.$message.warning('至少保留一行治疗数据');
+        return;
+      }
+      this.formData.healingList.splice(index, 1);
+    },
+    fetchSignInfo() {
+      const ids = [];
+      if (this.doctorId) ids.push(this.doctorId);
+      if (this.drugDoctorId) ids.push(this.drugDoctorId);
+      if (ids.length === 0) {
+        this.$message.warning('缺少医生或药师信息,无法获取签名');
+        return;
+      }
+      getDoctorSignInfo(ids).then(response => {
+        const data = response.data;
+        this.signInfo = {
+          doctorPosition: data.position || '',
+          doctorPractiseCode: data.PractiseCode || '',
+          doctorCertificateCode: data.certificateCode || '',
+          doctorName: data.doctorName || '',
+          drugDoctorName: data.drugDoctorName || '',
+          doctorSignUrl: data.doctorSignUrl || '',
+          drugDoctorSignUrl: data.drugDoctorSignUrl || ''
+        };
+      }).catch(error => {
+        console.error('获取签名信息失败', error);
+        this.$message.error('获取医生签名信息失败');
+      });
+    },
+    submitAdvice() {
+      if (!this.prescribeId) {
+        this.$message.error('处方ID无效,无法提交');
+        return;
+      }
+      this.$refs.adviceForm.validate((valid) => {
+        if (!valid) return;
+        const healingAreaJson = JSON.stringify(this.formData.healingList);
+        const params = {
+          prescribeId: this.prescribeId,
+          diagnose: this.formData.diagnose,
+          facialDiagnosis: this.formData.facialDiagnosis,
+          healingAreaJson: healingAreaJson,
+          noteTaboos: this.formData.noteTaboos
+        };
+        this.submitLoading = true;
+        submitDoctorAdvice(params).then(() => {
+          this.$message.success('处方建议提交成功');
+          this.dialogVisible = false;
+          this.$emit('success');
+        }).catch(error => {
+          console.error('提交失败', error);
+          this.$message.error('提交失败,请重试');
+        }).finally(() => {
+          this.submitLoading = false;
+        });
+      });
+    },
+    handleClose() {
+      this.$emit('update:visible', false);
+      this.$emit('close');
+    }
+  }
+};
+</script>
+
+<style scoped>
+.dialog-footer {
+  text-align: right;
+}
+</style>

+ 33 - 11
src/views/his/scrmPrescribe/index.vue

@@ -98,6 +98,16 @@
         </template>
       </el-table-column>
       <el-table-column label="创建时间" align="center" prop="createTime" width="160" />
+      <el-table-column label="操作" align="center" width="120">
+        <template slot-scope="scope">
+          <el-button
+            type="primary"
+            size="small"
+            icon="el-icon-edit"
+            @click="handlePerfectPrescription(scope.row)"
+          >完善处方</el-button>
+        </template>
+      </el-table-column>
     </el-table>
 
     <!-- 分页组件 -->
@@ -108,25 +118,30 @@
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
+
+    <doctor-advice-dialog
+      :visible.sync="dialogVisible"
+      :prescribe-id="currentPrescribeId"
+      :doctor-id="currentDoctorId"
+      :drug-doctor-id="currentDrugDoctorId"
+      @success="getList"
+    />
   </div>
 </template>
 
 <script>
 import { waitOpenPrescribeList } from "@/api/his/scrmPrescribe";
+import DoctorAdviceDialog from "./DoctorAdviceDialog.vue";
 
 export default {
   name: "PrescribeList",
+  components: { DoctorAdviceDialog },
   data() {
     return {
-      // 遮罩层
       loading: true,
-      // 显示搜索条件
       showSearch: true,
-      // 处方列表数据
       prescribeList: [],
-      // 总条数
       total: 0,
-      // 查询参数
       queryParams: {
         pageNum: 1,
         pageSize: 10,
@@ -136,19 +151,21 @@ export default {
         orderCode: null,
         prescribeCode: null
       },
-      // 处方类型字典
       prescribeTypeOptions: [
         { dictLabel: "西药", dictValue: 1 },
         { dictLabel: "中药", dictValue: 2 },
         { dictLabel: "中药+西药", dictValue: 3 }
-      ]
+      ],
+      dialogVisible: false,
+      currentPrescribeId: null,
+      currentDoctorId: null,
+      currentDrugDoctorId: null,
     };
   },
   created() {
     this.getList();
   },
   methods: {
-    /** 查询处方列表 */
     getList() {
       this.loading = true;
       waitOpenPrescribeList(this.queryParams).then(response => {
@@ -159,15 +176,20 @@ export default {
         this.loading = false;
       });
     },
-    /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.pageNum = 1;
       this.getList();
     },
-    /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm("queryForm");
+      this.$refs.queryForm.resetFields(); // 修复:使用 resetFields 方法
       this.handleQuery();
+    },
+    handlePerfectPrescription(row) {
+      console.log('prescribeId:', row.prescribeId);
+      this.currentPrescribeId = row.prescribeId;
+      this.currentDoctorId = row.doctorId;
+      this.currentDrugDoctorId = row.drugDoctorId;
+      this.dialogVisible = true;
     }
   }
 };