Kaynağa Gözat

医生商城处方开方逻辑

cgp 10 saat önce
ebeveyn
işleme
d70ab6379d

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

@@ -101,3 +101,15 @@ export function getCustomerQuestionAnswer(companyCustomerId) {
     method: 'get'
   })
 }
+
+/**
+ * 获取已保存的医生建议信息
+ * @param {number} prescribeId 处方ID
+ * @returns {Promise}
+ */
+export function getDoctorAdvice(prescribeId) {
+  return request({
+    url: `/his/prescribeDataScrm/getDoctorAdvice/${prescribeId}`,
+    method: 'get'
+  })
+}

+ 55 - 40
src/views/his/scrmPrescribe/DoctorAdviceDialog.vue

@@ -1,12 +1,12 @@
 <template>
   <el-dialog
-    title="完善处方"
+    :title="dialogTitle"
     :visible.sync="dialogVisible"
     width="800px"
     :close-on-click-modal="false"
     @close="handleClose"
   >
-    <!-- 客户问答信息展示区域 -->
+    <!-- 客户问答信息展示区域(保持不变) -->
     <div v-if="questionAnswers.length > 0" class="question-answer-section">
       <div class="section-title">患者病情</div>
       <div class="qa-list">
@@ -21,33 +21,33 @@
     <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-input v-model="formData.diagnose" type="textarea" :rows="2" placeholder="请输入诊断信息" :disabled="readonly" />
       </el-form-item>
       <!-- 舌诊、面诊、手诊 -->
       <el-form-item label="舌诊、面诊、手诊" prop="facialDiagnosis">
-        <el-input v-model="formData.facialDiagnosis" type="textarea" :rows="2" placeholder="请输入舌诊、面诊、手诊结果" />
+        <el-input v-model="formData.facialDiagnosis" type="textarea" :rows="2" placeholder="请输入舌诊、面诊、手诊结果" :disabled="readonly" />
       </el-form-item>
       <!-- 饮食运动建议 -->
       <el-form-item label="饮食运动建议" prop="foodAndExerciseGuidance">
-        <el-input v-model="formData.foodAndExerciseGuidance" type="textarea" :rows="2" placeholder="请输入饮食运动建议" />
+        <el-input v-model="formData.foodAndExerciseGuidance" type="textarea" :rows="2" placeholder="请输入饮食运动建议" :disabled="readonly" />
       </el-form-item>
       <!-- 治疗方面(动态表格) -->
       <el-form-item label="治疗方面" prop="healingList" required>
-        <div style="margin-bottom: 10px;">
+        <div style="margin-bottom: 10px;" v-if="!readonly">
           <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" />
+              <el-input v-model="scope.row.diagnosisContent" placeholder="请输入诊断内容" size="small" :disabled="readonly" />
             </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" />
+              <el-input v-model="scope.row.suggestTreatment" placeholder="请输入建议治疗" size="small" :disabled="readonly" />
             </template>
           </el-table-column>
-          <el-table-column label="操作" width="80" align="center">
+          <el-table-column label="操作" width="80" align="center" v-if="!readonly">
             <template slot-scope="scope">
               <el-button type="text" icon="el-icon-delete" style="color: #f56c6c;" @click="removeHealingRow(scope.$index)">删除</el-button>
             </template>
@@ -56,7 +56,7 @@
       </el-form-item>
       <!-- 注意禁忌 -->
       <el-form-item label="注意禁忌" prop="noteTaboos">
-        <el-input v-model="formData.noteTaboos" type="textarea" :rows="2" placeholder="请输入注意事项及禁忌" />
+        <el-input v-model="formData.noteTaboos" type="textarea" :rows="2" placeholder="请输入注意事项及禁忌" :disabled="readonly" />
       </el-form-item>
 
       <el-divider content-position="left">医生及药师信息</el-divider>
@@ -95,14 +95,14 @@
     </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>
+      <el-button @click="dialogVisible = false">关闭</el-button>
+      <el-button v-if="!readonly" type="primary" :loading="submitLoading" @click="submitAdvice">确 定</el-button>
     </div>
   </el-dialog>
 </template>
 
 <script>
-import { getDoctorSignInfo, submitDoctorAdvice,getCustomerQuestionAnswer } from "@/api/his/scrmPrescribe";
+import { getDoctorSignInfo, submitDoctorAdvice, getCustomerQuestionAnswer, getDoctorAdvice } from "@/api/his/scrmPrescribe";
 
 export default {
   name: "DoctorAdviceDialog",
@@ -112,12 +112,13 @@ export default {
     doctorId: Number,
     drugDoctorId: Number,
     companyCustomerId: Number,
+    readonly: { type: Boolean, default: false }
   },
   data() {
     return {
       dialogVisible: false,
       submitLoading: false,
-      questionAnswers: [], // 存储问答数据
+      questionAnswers: [],
       formData: {
         diagnose: '',
         facialDiagnosis: '',
@@ -135,18 +136,15 @@ export default {
               callback(new Error('请至少添加一行治疗方面数据'));
             } else {
               const invalid = value.some(item => !item.diagnosisContent || !item.suggestTreatment);
-              if (invalid) {
-                callback(new Error('请完整填写治疗方面每行的诊断内容和建议治疗'));
-              } else {
-                callback();
-              }
+              if (invalid) callback(new Error('请完整填写治疗方面每行的诊断内容和建议治疗'));
+              else callback();
             }
           }, trigger: 'change' }]
       },
       signInfo: {
-        doctorPosition: '',      // 职称
-        doctorPractiseCode: '',  // 执业证号
-        doctorCertificateCode: '', // 医师证号
+        doctorPosition: '',
+        doctorPractiseCode: '',
+        doctorCertificateCode: '',
         doctorName: '',
         drugDoctorName: '',
         doctorSignUrl: '',
@@ -155,9 +153,11 @@ export default {
     };
   },
   computed: {
-    // 优先显示执业证号,若为空则显示医师证号
     displayLicenseNumber() {
       return this.signInfo.doctorPractiseCode || this.signInfo.doctorCertificateCode || '暂无证号';
+    },
+    dialogTitle() {
+      return this.readonly ? "查看完善信息" : "医生建议及处置";
     }
   },
   watch: {
@@ -172,7 +172,8 @@ export default {
         }
         this.resetFormData();
         this.fetchSignInfo();
-        this.fetchQuestionAnswers(); //获取问答信息
+        this.fetchQuestionAnswers();
+        this.fetchDoctorAdvice(); // 新增:获取已保存的建议信息
       }
     }
   },
@@ -185,18 +186,13 @@ export default {
         healingList: [],
         noteTaboos: ''
       };
-      this.addHealingRow();
+      if (!this.readonly) this.addHealingRow();
       this.$nextTick(() => {
-        if (this.$refs.adviceForm) {
-          this.$refs.adviceForm.clearValidate();
-        }
+        if (this.$refs.adviceForm) this.$refs.adviceForm.clearValidate();
       });
     },
     addHealingRow() {
-      this.formData.healingList.push({
-        diagnosisContent: '',
-        suggestTreatment: ''
-      });
+      this.formData.healingList.push({ diagnosisContent: '', suggestTreatment: '' });
     },
     removeHealingRow(index) {
       if (this.formData.healingList.length === 1) {
@@ -229,20 +225,41 @@ export default {
         this.$message.error('获取医生签名信息失败');
       });
     },
-    // 获取问答信息
     fetchQuestionAnswers() {
-      if (!this.companyCustomerId) {
-        console.warn('companyCustomerId 为空,跳过获取问答信息');
-        return;
-      }
+      if (!this.companyCustomerId) return;
       getCustomerQuestionAnswer(this.companyCustomerId).then(response => {
         this.questionAnswers = response.data || [];
       }).catch(error => {
         console.error('获取问答信息失败', error);
-        // 不阻断流程,仅提示
+      });
+    },
+    // 新增:获取已保存的医生建议
+    fetchDoctorAdvice() {
+      getDoctorAdvice(this.prescribeId).then(response => {
+        const data = response.data;
+        if (data) {
+          this.formData.diagnose = data.diagnose || '';
+          this.formData.facialDiagnosis = data.facialDiagnosis || '';
+          this.formData.foodAndExerciseGuidance = data.foodAndExerciseGuidance || '';
+          this.formData.noteTaboos = data.noteTaboos || '';
+          // 解析 healingAreaJson
+          if (data.healingAreaJson) {
+            try {
+              const list = JSON.parse(data.healingAreaJson);
+              if (Array.isArray(list) && list.length > 0) {
+                this.formData.healingList = list;
+              }
+            } catch (e) {
+              console.error('解析治疗方面JSON失败', e);
+            }
+          }
+        }
+      }).catch(error => {
+        console.error('获取医生建议信息失败', error);
       });
     },
     submitAdvice() {
+      if (this.readonly) return;
       if (!this.prescribeId) {
         this.$message.error('处方ID无效,无法提交');
         return;
@@ -283,8 +300,6 @@ export default {
 .dialog-footer {
   text-align: right;
 }
-
-/* 新增样式 */
 .question-answer-section {
   margin-bottom: 20px;
   background-color: #f9f9f9;

+ 171 - 66
src/views/his/scrmPrescribe/DoctorPrescribeDialog.vue

@@ -1,7 +1,15 @@
 <template>
-  <el-dialog title="医生开方" :visible.sync="dialogVisible" width="95%" top="5vh" :close-on-click-modal="false" @close="handleClose" append-to-body>
-    <!-- 步骤导航,带类型提示 -->
-    <el-steps :active="activeStep" finish-status="success" align-center style="margin-bottom: 30px;">
+  <el-dialog
+    :title="dialogTitle"
+    :visible.sync="dialogVisible"
+    width="95%"
+    top="5vh"
+    :close-on-click-modal="false"
+    @close="handleClose"
+    append-to-body
+  >
+    <!-- 步骤导航(仅编辑模式显示) -->
+    <el-steps v-if="!readonly" :active="activeStep" finish-status="success" align-center style="margin-bottom: 30px;">
       <el-step title="选择处方类型" />
       <el-step title="填写处方内容">
         <template slot="title" v-if="isCombined && activeStep === 1">
@@ -15,8 +23,8 @@
       </el-step>
     </el-steps>
 
-    <!-- 步骤1:选择处方类型 -->
-    <div v-show="activeStep === 0">
+    <!-- 步骤1:选择处方类型(仅编辑模式显示) -->
+    <div v-if="!readonly && activeStep === 0">
       <el-form label-width="120px">
         <el-form-item label="处方类型" required>
           <el-radio-group v-model="selectedPrescribeType" @change="onPrescribeTypeChange">
@@ -26,12 +34,17 @@
           </el-radio-group>
         </el-form-item>
       </el-form>
+      <!-- 新增红色提示文字 -->
+      <div style="color: #f56c6c; font-size: 12px; margin-top: 8px; text-align: center;">
+        处方类型选择后不可修改,请谨慎选择!
+      </div>
     </div>
 
     <!-- 步骤2:处方内容(基本信息 + 药品信息) -->
-    <div v-show="activeStep === 1">
+    <!-- 编辑模式:按步骤显示;只读模式:直接显示所有内容(无步骤按钮) -->
+    <div v-if="!readonly && activeStep === 1">
       <el-tabs v-model="activeTab" type="border-card">
-        <!-- 2.1 基本信息 -->
+        <!-- 基本信息 -->
         <el-tab-pane label="基本信息" name="basic">
           <el-form ref="basicForm" :model="prescribeForm" :rules="basicRules" label-width="120px">
             <el-row :gutter="20">
@@ -70,7 +83,7 @@
           </el-form>
         </el-tab-pane>
 
-        <!-- 2.2 处方药品信息 -->
+        <!-- 处方药品信息 -->
         <el-tab-pane label="处方药品信息" name="drug">
           <div class="drug-split-layout">
             <div class="drug-left-panel">
@@ -136,8 +149,8 @@
       </el-tabs>
     </div>
 
-    <!-- 步骤3(组合处方专用:中药处方) -->
-    <div v-show="activeStep === 2 && isCombined">
+    <!-- 步骤3(组合处方专用:中药处方) - 仅编辑模式显示 -->
+    <div v-if="!readonly && activeStep === 2 && isCombined">
       <el-tabs v-model="secondActiveTab" type="border-card">
         <el-tab-pane label="中药处方" name="drugSecond">
           <div class="drug-split-layout">
@@ -197,17 +210,126 @@
       </el-tabs>
     </div>
 
+    <!-- 只读模式:直接展示所有内容(无步骤导航) -->
+    <div v-if="readonly" class="readonly-content">
+      <el-tabs v-model="activeTab" type="border-card">
+        <el-tab-pane label="基本信息" name="basic">
+          <el-form label-width="120px">
+            <el-row :gutter="20">
+              <el-col :span="8"><el-form-item label="患者姓名">{{ prescribeForm.patientName }}</el-form-item></el-col>
+              <el-col :span="8"><el-form-item label="患者年龄">{{ prescribeForm.patientAge }}岁</el-form-item></el-col>
+              <el-col :span="8"><el-form-item label="患者性别">{{ patientGenderText }}</el-form-item></el-col>
+            </el-row>
+            <el-row :gutter="20">
+              <el-col :span="12"><el-form-item label="是否有过敏史">{{ prescribeForm.isHistoryAllergic }}</el-form-item></el-col>
+            </el-row>
+            <el-form-item label="过敏史" v-if="prescribeForm.isHistoryAllergic === '是'">
+              {{ prescribeForm.historyAllergic }}
+            </el-form-item>
+          </el-form>
+        </el-tab-pane>
+        <el-tab-pane label="处方药品信息" name="drug">
+          <div class="drug-split-layout">
+            <div class="drug-left-panel">
+              <el-form label-width="80px">
+                <el-form-item label="诊断">{{ prescribeForm.diagnose }}</el-form-item>
+                <el-form-item label="医嘱">{{ prescribeForm.remark }}</el-form-item>
+              </el-form>
+              <el-table :data="currentDrugList" border stripe max-height="400">
+                <el-table-column label="药品名称" prop="drugName" />
+                <el-table-column label="规格" prop="drugSpec" width="100" />
+                <el-table-column label="使用方法" prop="usageMethod" width="100" />
+                <el-table-column label="频次" prop="usageFrequencyUnit" width="80" />
+                <el-table-column label="每次用量" prop="usagePerUseCount" width="100" />
+              </el-table>
+            </div>
+            <div class="drug-right-panel">
+              <!-- 处方图片展示 -->
+              <div class="prescription-scroll-wrapper">
+                <div v-if="prescribeForm.prescribeImgUrl" class="real-prescription-wrapper">
+                  <img :src="prescribeForm.prescribeImgUrl" class="prescription-image" alt="处方图片" />
+                </div>
+                <div v-else class="prescription-preview-container">
+                  <img src="/ysy_prescribe.jpg" class="prescription-bg-image" alt="处方背景" />
+                  <div class="prescription-overlay">
+                    <div class="prescribe-code">{{ prescribeForm.prescribeCode }}</div>
+                    <div class="patient-info">
+                      <div class="prescribe-patientName">{{ prescribeForm.patientName }}</div>
+                      <div class="prescribe-patientGender">{{ patientGenderText }}</div>
+                      <div class="prescribe-patientAge">{{ prescribeForm.patientAge }}岁</div>
+                    </div>
+                    <div class="diagnose">{{ prescribeForm.diagnose }}</div>
+                    <div class="drugs">
+                      <div v-for="(drug, idx) in currentDrugList" :key="idx" class="drug-item">
+                        {{ drug.drugName }} {{ drug.drugSpec }}
+                        <span class="usage">用法:{{ drug.usageMethod }} {{ drug.usageFrequencyUnit }} {{ drug.usagePerUseCount }}{{ drug.usagePerUseUnit || '' }}</span>
+                      </div>
+                    </div>
+                    <div class="remark">{{ prescribeForm.remark }}</div>
+                  </div>
+                </div>
+              </div>
+            </div>
+          </div>
+        </el-tab-pane>
+        <!-- 如果是组合处方,单独显示中药部分 -->
+        <el-tab-pane v-if="isCombined" label="中药处方" name="drugSecondReadonly">
+          <div class="drug-split-layout">
+            <div class="drug-left-panel">
+              <el-form label-width="80px">
+                <el-form-item label="诊断">{{ prescribeForm.diagnose }}</el-form-item>
+                <el-form-item label="医嘱">{{ prescribeForm.remark }}</el-form-item>
+              </el-form>
+              <el-table :data="secondDrugList" border stripe max-height="400">
+                <el-table-column label="药品名称" prop="drugName" />
+                <el-table-column label="规格" prop="drugSpec" />
+                <el-table-column label="使用方法" prop="usageMethod" />
+                <el-table-column label="频次" prop="usageFrequencyUnit" />
+                <el-table-column label="每次用量" prop="usagePerUseCount" />
+              </el-table>
+            </div>
+            <div class="drug-right-panel">
+              <div class="prescription-scroll-wrapper">
+                <div class="prescription-preview-container">
+                  <img :src="prescribeForm.prescribeImgStoreUrl || '/ysy_prescribe.jpg'" class="prescription-bg-image" alt="处方背景" />
+                  <div class="prescription-overlay">
+                    <div class="prescribe-code">{{ prescribeForm.prescribeCode }}</div>
+                    <div class="patient-info">
+                      <div class="prescribe-patientName">{{ prescribeForm.patientName }}</div>
+                      <div class="prescribe-patientGender">{{ patientGenderText }}</div>
+                      <div class="prescribe-patientAge">{{ prescribeForm.patientAge }}岁</div>
+                    </div>
+                    <div class="diagnose">{{ prescribeForm.diagnose }}</div>
+                    <div class="drugs">
+                      <div v-for="(drug, idx) in secondDrugList" :key="idx" class="drug-item">
+                        {{ drug.drugName }} {{ drug.drugSpec }}
+                        <span class="usage">用法:{{ drug.usageMethod }} {{ drug.usageFrequencyUnit }} {{ drug.usagePerUseCount }}{{ drug.usagePerUseUnit || '' }}</span>
+                      </div>
+                    </div>
+                    <div class="remark">{{ prescribeForm.remark }}</div>
+                  </div>
+                </div>
+              </div>
+            </div>
+          </div>
+        </el-tab-pane>
+      </el-tabs>
+    </div>
+
     <!-- 底部按钮 -->
     <div slot="footer" class="dialog-footer">
-      <el-button @click="dialogVisible = false">取消</el-button>
-      <el-button v-if="activeStep === 0" type="primary" @click="nextStep" :disabled="!selectedPrescribeType">下一步</el-button>
-      <el-button v-if="activeStep === 1 && isCombined" type="primary" @click="goToSecondPart" :loading="submitLoading">下一步</el-button>
-      <el-button v-if="activeStep === 1 && !isCombined" type="primary" @click="submitCurrentPart" :loading="submitLoading">确认处方</el-button>
-      <el-button v-if="activeStep === 2 && isCombined" type="primary" @click="submitSecondPart" :loading="submitLoading">确认中药处方</el-button>
-      <el-button v-if="activeStep > 0" @click="prevStep">上一步</el-button>
+      <el-button @click="dialogVisible = false">关闭</el-button>
+      <!-- 编辑模式下的操作按钮 -->
+      <template v-if="!readonly">
+        <el-button v-if="activeStep === 0" type="primary" @click="nextStep" :disabled="!selectedPrescribeType">下一步</el-button>
+        <el-button v-if="activeStep === 1 && isCombined" type="primary" @click="goToSecondPart" :loading="submitLoading">下一步</el-button>
+        <el-button v-if="activeStep === 1 && !isCombined" type="primary" @click="submitCurrentPart" :loading="submitLoading">确认处方</el-button>
+        <el-button v-if="activeStep === 2 && isCombined" type="primary" @click="submitSecondPart" :loading="submitLoading">确认中药处方</el-button>
+        <el-button v-if="activeStep > 0" @click="prevStep">上一步</el-button>
+      </template>
     </div>
 
-    <!-- 药品新增/编辑对话框 -->
+    <!-- 药品新增/编辑对话框(只读模式下不会弹出,因为按钮已隐藏,可保留) -->
     <el-dialog :title="drugDialogTitle" :visible.sync="drugDialogVisible" width="600px" append-to-body>
       <el-form ref="drugFormRef" :model="currentDrug" label-width="120px">
         <el-form-item label="药品名称" prop="drugName"><el-input v-model="currentDrug.drugName" /></el-form-item>
@@ -256,7 +378,7 @@
 
 <script>
 import { getPrescribeScrmDetail, submitBasicInfo, submitPrescribeScrm } from "@/api/his/scrmPrescribe";
-import { listScrmPrescribeDrug,addScrmPrescribeDrug,updateScrmPrescribeDrug,deleteScrmPrescribeDrug } from "@/api/his/scrmPrescribeDrug";
+import { listScrmPrescribeDrug, addScrmPrescribeDrug, updateScrmPrescribeDrug, deleteScrmPrescribeDrug } from "@/api/his/scrmPrescribeDrug";
 import { getCommonDrugList } from "@/api/commonlyDrug";
 import { getCommonDiagnoseList } from '@/api/commonlyDiagnose';
 
@@ -266,7 +388,8 @@ export default {
     visible: Boolean,
     prescribeId: Number,
     doctorId: Number,
-    drugDoctorId: Number
+    drugDoctorId: Number,
+    readonly: { type: Boolean, default: false }
   },
   data() {
     return {
@@ -331,6 +454,9 @@ export default {
     },
     currentDrugList() {
       return this.drugList;
+    },
+    dialogTitle() {
+      return this.readonly ? "查看处方" : "医生开方";
     }
   },
   watch: {
@@ -368,7 +494,8 @@ export default {
         if (data.prescribeType) {
           this.selectedPrescribeType = data.prescribeType;
           this.isCombined = (this.selectedPrescribeType === 3);
-          this.activeStep = 1;
+          // 只读模式下不需要步骤,直接加载数据即可
+          this.activeStep = this.readonly ? 1 : 1; // 只读模式也设置 activeStep 以便展示内容
           this.loadDrugsForCurrentPart();
         }
       } catch (error) {
@@ -376,21 +503,13 @@ export default {
         this.$message.error('获取处方信息失败');
       }
     },
-    // 获取当前步骤对应的药品类型(1:西药, 2:中药)
     getCurrentDrugType() {
-      if (this.commonDrugForSecond) {
-        return 2; // 组合处方的第二部分(中药)
-      }
-      if (this.isCombined && !this.secondPartActive && this.activeStep === 1) {
-        return 1; // 组合处方第一步(西药)
-      }
-      if (this.isCombined && this.secondPartActive && this.activeStep === 2) {
-        return 2; // 组合处方第二步(中药)
-      }
-      // 非组合处方
+      if (this.commonDrugForSecond) return 2;
+      if (this.isCombined && !this.secondPartActive && this.activeStep === 1) return 1;
+      if (this.isCombined && this.secondPartActive && this.activeStep === 2) return 2;
       if (this.selectedPrescribeType === 1) return 1;
       if (this.selectedPrescribeType === 2) return 2;
-      return 1; // 默认西药
+      return 1;
     },
     onPrescribeTypeChange(val) {
       this.isCombined = (val === 3);
@@ -425,25 +544,17 @@ export default {
       }
     },
     getDrugList() {
-      // 确定当前要查询的药品类型
       let drugType = null;
-      if (this.isCombined && !this.secondPartActive) {
-        drugType = 1; // 组合处方第一步,西药
-      } else if (this.selectedPrescribeType === 1) {
-        drugType = 1;
-      } else if (this.selectedPrescribeType === 2) {
-        drugType = 2;
-      } else {
-        drugType = this.selectedPrescribeType;
-      }
+      if (this.isCombined && !this.secondPartActive) drugType = 1;
+      else if (this.selectedPrescribeType === 1) drugType = 1;
+      else if (this.selectedPrescribeType === 2) drugType = 2;
+      else drugType = this.selectedPrescribeType;
       this.drugQuery.prescribeId = this.prescribeId;
       this.drugQuery.drugType = drugType;
       listScrmPrescribeDrug(this.drugQuery).then(res => {
         this.drugList = res.rows || [];
         this.drugTotal = res.total || 0;
-      }).catch(() => {
-        this.$message.error('获取药品列表失败');
-      });
+      }).catch(() => this.$message.error('获取药品列表失败'));
     },
     getSecondDrugList() {
       this.secondDrugQuery.prescribeId = this.prescribeId;
@@ -451,14 +562,19 @@ export default {
       listScrmPrescribeDrug(this.secondDrugQuery).then(res => {
         this.secondDrugList = res.rows || [];
         this.secondDrugTotal = res.total || 0;
-      }).catch(() => {
-        this.$message.error('获取中药列表失败');
-      });
+      }).catch(() => this.$message.error('获取中药列表失败'));
     },
     async goToSecondPart() {
       let valid = true;
       await this.$refs.basicForm.validate().catch(() => valid = false);
-      await this.$refs.drugForm.validate().catch(() => valid = false);
+      await this.$refs.drugForm.validate().catch((errors) => {
+        valid = false;
+        if (errors && errors[0] && errors[0].message) {
+          this.$message.warning(errors[0].message);
+        } else {
+          this.$message.warning('请完整填写表单信息');
+        }
+      });
       if (!valid) return;
       if (this.drugList.length === 0) {
         this.$message.warning('请至少添加一种西药药品');
@@ -499,9 +615,7 @@ export default {
         deleteScrmPrescribeDrug(row.drugId).then(() => {
           this.$message.success('删除成功');
           this.getDrugList();
-        }).catch(() => {
-          this.$message.error('删除失败');
-        });
+        }).catch(() => this.$message.error('删除失败'));
       });
     },
     saveDrug() {
@@ -514,14 +628,9 @@ export default {
       request.then(() => {
         this.$message.success('保存成功');
         this.drugDialogVisible = false;
-        if (!this.isEditingSecond) {
-          this.getDrugList();
-        } else {
-          this.getSecondDrugList();
-        }
-      }).catch(() => {
-        this.$message.error('保存失败');
-      });
+        if (!this.isEditingSecond) this.getDrugList();
+        else this.getSecondDrugList();
+      }).catch(() => this.$message.error('保存失败'));
     },
     handleAddDrugSecond() {
       this.isEditingSecond = true;
@@ -540,9 +649,7 @@ export default {
         deleteScrmPrescribeDrug(row.drugId).then(() => {
           this.$message.success('删除成功');
           this.getSecondDrugList();
-        }).catch(() => {
-          this.$message.error('删除失败');
-        });
+        }).catch(() => this.$message.error('删除失败'));
       });
     },
     openCommonDiagnose() {
@@ -583,7 +690,6 @@ export default {
       });
     },
     applyCommonDrug(drug) {
-      // 明确当前药品类型
       const drugType = this.getCurrentDrugType();
       const newDrug = {
         drugName: drug.drugName,
@@ -597,7 +703,6 @@ export default {
       };
       addScrmPrescribeDrug(newDrug).then(() => {
         this.$message.success('添加成功');
-        // 添加成功后重置分页为第一页并刷新对应列表
         if (!this.commonDrugForSecond) {
           this.drugQuery.pageNum = 1;
           this.getDrugList();
@@ -606,7 +711,7 @@ export default {
           this.getSecondDrugList();
         }
         this.commonDrugDialogVisible = false;
-      }).catch((error) => {
+      }).catch(error => {
         console.error('添加常用药品失败', error);
         this.$message.error('添加药品失败,请重试');
       });

+ 73 - 22
src/views/his/scrmPrescribe/index.vue

@@ -16,7 +16,6 @@
       <el-form-item label="处方状态" prop="doctorConfirm">
         <el-select v-model="queryParams.doctorConfirm" placeholder="处方状态" clearable size="small">
           <el-option label="待开方" :value="0" />
-          <el-option label="待审核" :value="1" />
           <el-option label="已拒方" :value="-1" />
         </el-select>
       </el-form-item>
@@ -67,8 +66,16 @@
       <el-table-column label="处方状态" align="center" prop="doctorConfirm" width="120">
         <template slot-scope="scope">
           <span v-if="scope.row.doctorConfirm === 0" class="warning">待开方</span>
-          <span v-else-if="scope.row.doctorConfirm === 1" class="success">待审核</span>
-          <span v-else-if="scope.row.doctorConfirm === -1" class="danger">已拒方</span>
+          <span v-else-if="scope.row.status === 0" class="success">待审核</span>
+          <span v-else-if="scope.row.status === 1" class="default">已完成</span>
+          <span v-else-if="scope.row.status === 2" class="danger">已拒方</span>
+          <span v-else>-</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="制单状态" align="center" prop="isDocument" width="120">
+        <template slot-scope="scope">
+          <span v-if="scope.row.isDocument === 0" class="success">未制单</span>
+          <span v-else-if="scope.row.isDocument === 1" class="error">已制单</span>
           <span v-else>-</span>
         </template>
       </el-table-column>
@@ -97,7 +104,7 @@
           <span v-else class="empty-text">无</span>
         </template>
       </el-table-column>
-      <el-table-column label="拒方原因" align="center" prop="auditReason" width="80">
+      <el-table-column label="回退原因" align="center" prop="auditReason" width="80">
         <template slot-scope="scope">
           <span v-if="scope.row.status===2" class="danger">{{ scope.row.auditReason }}</span>
           <span v-else class="empty-text">无</span>
@@ -107,10 +114,27 @@
       <el-table-column
         label="操作"
         align="center"
-        width="220"
+        width="320"
         class-name="small-padding fixed-width"
       >
         <template slot-scope="scope">
+          <!-- 查看完善信息(只读) -->
+          <el-button
+            v-if="scope.row.recipeType === 1"
+            type="text"
+            size="mini"
+            icon="el-icon-view"
+            @click="handleViewAdvice(scope.row)"
+          >查看完善信息</el-button>
+          <!-- 查看处方(只读) -->
+          <el-button
+            v-if="scope.row.doctorConfirm === 1"
+            type="text"
+            size="mini"
+            icon="el-icon-view"
+            @click="handleViewPrescribe(scope.row)"
+          >查看处方</el-button>
+          <!-- 完善处方(编辑) -->
           <el-button
             v-if="scope.row.doctorConfirm === 0 && scope.row.status!==2 && scope.row.isDocument===0"
             type="text"
@@ -118,6 +142,7 @@
             icon="el-icon-edit"
             @click="handlePerfectPrescription(scope.row)"
           >完善信息</el-button>
+          <!-- 开方(编辑) -->
           <el-button
             v-if="scope.row.recipeType === 1 && (scope.row.doctorConfirm === 0 || scope.row.status===1) && scope.row.isDocument===0"
             type="text"
@@ -125,6 +150,7 @@
             icon="el-icon-plus"
             @click="handleOpenPrescribe(scope.row)"
           >开方</el-button>
+          <!-- 拒方 -->
           <el-button
             v-if="scope.row.doctorConfirm === 0 && scope.row.isDocument===0"
             type="text"
@@ -145,31 +171,34 @@
       @pagination="getList"
     />
 
-    <!-- 完善处方弹窗 -->
+    <!-- 完善处方弹窗(支持只读) -->
     <doctor-advice-dialog
       :visible.sync="dialogVisible"
       :prescribe-id="currentPrescribeId"
       :doctor-id="currentDoctorId"
       :drug-doctor-id="currentDrugDoctorId"
       :company-customer-id="currentCompanyCustomerId"
+      :readonly="isReadonlyAdvice"
       @success="handleAdviceSuccess"
     />
 
-    <!-- 开方弹窗 -->
+    <!-- 开方弹窗(支持只读) -->
     <doctor-prescribe-dialog
       :visible.sync="prescribeDialogVisible"
       :prescribe-id="currentPrescribeId"
       :doctor-id="currentDoctorId"
       :drug-doctor-id="currentDrugDoctorId"
+      :readonly="isReadonlyPrescribe"
       @success="getList"
     />
   </div>
 </template>
 
 <script>
-import { waitOpenPrescribeList,doctorRejectPrescribe } from "@/api/his/scrmPrescribe";
+import { waitOpenPrescribeList, doctorRejectPrescribe } from "@/api/his/scrmPrescribe";
 import DoctorAdviceDialog from "./DoctorAdviceDialog.vue";
 import DoctorPrescribeDialog from "./DoctorPrescribeDialog.vue";
+
 export default {
   name: "PrescribeList",
   components: { DoctorAdviceDialog, DoctorPrescribeDialog },
@@ -193,13 +222,14 @@ export default {
         { dictLabel: "中药", dictValue: "2" },
         { dictLabel: "中药+西药", dictValue: "3" }
       ],
-      dialogVisible: false,//完善处方弹窗
-      prescribeDialogVisible: false, // 开方弹窗
+      dialogVisible: false,
+      prescribeDialogVisible: false,
       currentPrescribeId: null,
       currentDoctorId: null,
       currentDrugDoctorId: null,
       currentCompanyCustomerId: null,
-
+      isReadonlyAdvice: false,
+      isReadonlyPrescribe: false
     };
   },
   created() {
@@ -224,31 +254,52 @@ export default {
       this.$refs.queryForm.resetFields();
       this.handleQuery();
     },
-    // 完善处方
+    // 查看完善信息(只读)
+    handleViewAdvice(row) {
+      this.currentPrescribeId = row.prescribeId;
+      this.currentDoctorId = row.doctorId;
+      this.currentDrugDoctorId = row.drugDoctorId;
+      this.currentCompanyCustomerId = row.companyCustomerId;
+      this.isReadonlyAdvice = true;
+      this.dialogVisible = true;
+    },
+    // 查看处方(只读)
+    handleViewPrescribe(row) {
+      this.currentPrescribeId = row.prescribeId;
+      this.currentDoctorId = row.doctorId;
+      this.currentDrugDoctorId = row.drugDoctorId;
+      this.isReadonlyPrescribe = true;
+      this.prescribeDialogVisible = true;
+    },
+    // 编辑完善处方
     handlePerfectPrescription(row) {
       this.currentPrescribeId = row.prescribeId;
       this.currentDoctorId = row.doctorId;
       this.currentDrugDoctorId = row.drugDoctorId;
       this.currentCompanyCustomerId = row.companyCustomerId;
+      this.isReadonlyAdvice = false;
       this.dialogVisible = true;
     },
-    // 直接开方
+    // 编辑开方
     handleOpenPrescribe(row) {
       this.currentPrescribeId = row.prescribeId;
       this.currentDoctorId = row.doctorId;
       this.currentDrugDoctorId = row.drugDoctorId;
+      this.isReadonlyPrescribe = false;
       this.prescribeDialogVisible = true;
     },
     // 完善处方成功后的回调(询问是否开方)
     handleAdviceSuccess() {
-      this.getList(); // 刷新列表
-      this.$confirm('是否前往开方?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'info'
-      }).then(() => {
-        this.prescribeDialogVisible = true;
-      }).catch(() => {});
+      this.getList();
+      if (!this.isReadonlyAdvice) {
+        this.$confirm('是否前往开方?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'info'
+        }).then(() => {
+          this.prescribeDialogVisible = true;
+        }).catch(() => {});
+      }
     },
     // 拒方
     handleRejectPrescribe(row) {
@@ -266,7 +317,7 @@ export default {
           auditReason: value
         }).then(() => {
           this.$message.success('拒方成功');
-          this.getList(); // 刷新列表
+          this.getList();
         }).catch(error => {
           this.$message.error(error.message || '拒方失败');
         });