Kaynağa Gözat

商城处方医生开方交互页面

cgp 1 gün önce
ebeveyn
işleme
c679ec419f

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

@@ -50,3 +50,29 @@ export function submitDoctorAdvice(data) {
     data: data
   })
 }
+
+// 获取处方详情
+export function getPrescribeScrmDetail(prescribeId) {
+  return request({
+    url: `/his/prescribeDataScrm/${prescribeId}`,
+    method: 'get'
+  })
+}
+
+// 提交处方部分字段(如处方类型、诊断、医嘱等)
+export function submitBasicInfo(prescribeId, data) {
+  return request({
+    url: `/his/prescribeDataScrm/submitBasicInfo`,
+    method: 'put',
+    data: { prescribeId, ...data }
+  })
+}
+
+// 提交处方(最终确认)
+export function submitPrescribeScrm(data) {
+  return request({
+    url: '/his/prescribeDataScrm/submitPrescribe',
+    method: 'post',
+    data: data
+  })
+}

+ 36 - 0
src/api/his/scrmPrescribeDrug.js

@@ -0,0 +1,36 @@
+import request from '@/utils/request'
+
+// 查询药品列表
+export function listPrescribeDrug(query) {
+  return request({
+    url: '/his/prescribeDrugDataScrm/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 新增药品
+export function addPrescribeDrug(data) {
+  return request({
+    url: '/his/prescribeDrugDataScrm',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改药品
+export function updatePrescribeDrug(data) {
+  return request({
+    url: '/his/prescribeDrugDataScrm',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除药品
+export function deletePrescribeDrug(drugId) {
+  return request({
+    url: `/his/prescribeDrugDataScrm/${drugId}`,
+    method: 'delete'
+  })
+}

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

@@ -15,6 +15,10 @@
       <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="foodAndExerciseGuidance">
+        <el-input v-model="formData.foodAndExerciseGuidance" type="textarea" :rows="2" placeholder="请输入饮食运动建议" />
+      </el-form-item>
       <!-- 治疗方面(动态表格) -->
       <el-form-item label="治疗方面" prop="healingList" required>
         <div style="margin-bottom: 10px;">
@@ -115,12 +119,14 @@ export default {
       formData: {
         diagnose: '',
         facialDiagnosis: '',
+        foodAndExerciseGuidance: '',
         healingList: [],
         noteTaboos: ''
       },
       formRules: {
         diagnose: [{ required: true, message: '请输入诊断', trigger: 'blur' }],
         facialDiagnosis: [{ required: true, message: '请输入舌诊、面诊、手诊信息', trigger: 'blur' }],
+        foodAndExerciseGuidance: [{ required: true, message: '请输入饮食运动建议', trigger: 'blur' }],
         noteTaboos: [{ required: true, message: '请输入注意禁忌', trigger: 'blur' }],
         healingList: [{ validator: (rule, value, callback) => {
             if (!value || value.length === 0) {
@@ -172,6 +178,7 @@ export default {
       this.formData = {
         diagnose: '',
         facialDiagnosis: '',
+        foodAndExerciseGuidance: '',
         healingList: [],
         noteTaboos: ''
       };
@@ -231,6 +238,7 @@ export default {
           prescribeId: this.prescribeId,
           diagnose: this.formData.diagnose,
           facialDiagnosis: this.formData.facialDiagnosis,
+          foodAndExerciseGuidance: this.formData.foodAndExerciseGuidance,
           healingAreaJson: healingAreaJson,
           noteTaboos: this.formData.noteTaboos
         };

+ 764 - 0
src/views/his/scrmPrescribe/DoctorPrescribeDialog.vue

@@ -0,0 +1,764 @@
+<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-step title="选择处方类型" />
+      <el-step title="填写处方内容" />
+      <el-step v-if="isCombined && secondPartActive" title="填写另一部分处方" />
+    </el-steps>
+
+    <!-- 步骤1:选择处方类型 -->
+    <div v-show="activeStep === 0">
+      <el-form label-width="120px">
+        <el-form-item label="处方类型" required>
+          <el-radio-group v-model="selectedPrescribeType" @change="onPrescribeTypeChange">
+            <el-radio :label="1">西药处方</el-radio>
+            <el-radio :label="2">中药处方</el-radio>
+            <el-radio :label="3">中药+西药处方</el-radio>
+          </el-radio-group>
+        </el-form-item>
+      </el-form>
+    </div>
+
+    <!-- 步骤2:处方内容(基本信息 + 药品信息) -->
+    <div v-show="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">
+              <el-col :span="8">
+                <el-form-item label="患者姓名" prop="patientName">
+                  <el-input v-model="prescribeForm.patientName" disabled />
+                </el-form-item>
+              </el-col>
+              <el-col :span="8">
+                <el-form-item label="患者年龄" prop="patientAge">
+                  <el-input v-model="prescribeForm.patientAge" disabled />
+                </el-form-item>
+              </el-col>
+              <el-col :span="8">
+                <el-form-item label="患者性别" prop="patientGender">
+                  <el-select v-model="prescribeForm.patientGender" disabled>
+                    <el-option label="男" :value="1"/>
+                    <el-option label="女" :value="0"/>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+            </el-row>
+            <el-row :gutter="20">
+              <el-col :span="12">
+                <el-form-item label="是否有过敏史" prop="isHistoryAllergic">
+                  <el-radio-group v-model="prescribeForm.isHistoryAllergic" :disabled="isViewMode">
+                    <el-radio label="是">是</el-radio>
+                    <el-radio label="否">否</el-radio>
+                  </el-radio-group>
+                </el-form-item>
+              </el-col>
+            </el-row>
+            <el-form-item label="过敏史" prop="historyAllergic" v-if="prescribeForm.isHistoryAllergic === '是'">
+              <el-input v-model="prescribeForm.historyAllergic" type="textarea" :rows="2" :disabled="isViewMode" />
+            </el-form-item>
+          </el-form>
+        </el-tab-pane>
+
+        <!-- 2.2 处方药品信息 -->
+        <el-tab-pane label="处方药品信息" name="drug">
+          <div class="drug-split-layout">
+            <div class="drug-left-panel">
+              <el-form ref="drugForm" :model="prescribeForm" :rules="drugRules" label-width="80px">
+                <el-form-item label="诊断" prop="diagnose">
+                  <el-input v-model="prescribeForm.diagnose" type="textarea" :rows="2" :disabled="isViewMode">
+                    <i slot="suffix" class="el-icon-search el-input__icon" style="cursor: pointer;" @click="openCommonDiagnose" v-if="!isViewMode"></i>
+                  </el-input>
+                </el-form-item>
+                <el-form-item label="医嘱" prop="remark">
+                  <el-input v-model="prescribeForm.remark" type="textarea" :rows="2" :disabled="isViewMode" />
+                </el-form-item>
+              </el-form>
+              <div class="drug-actions" v-if="!isViewMode">
+                <el-button type="primary" icon="el-icon-plus" size="small" @click="handleAddDrug">新增药品</el-button>
+                <el-button type="success" icon="el-icon-search" size="small" @click="openCommonDrugDialog">常用药品</el-button>
+              </div>
+              <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-column label="操作" width="150" v-if="!isViewMode">
+                  <template slot-scope="scope">
+                    <el-button type="text" icon="el-icon-edit" @click="handleEditDrug(scope.row)">编辑</el-button>
+                    <el-button type="text" icon="el-icon-delete" @click="handleDeleteDrug(scope.row)">删除</el-button>
+                  </template>
+                </el-table-column>
+              </el-table>
+              <pagination v-show="drugTotal > 0" :total="drugTotal" :page.sync="drugQuery.pageNum" :limit.sync="drugQuery.pageSize" @pagination="getDrugList" />
+            </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-tabs>
+    </div>
+
+    <!-- 步骤3(组合处方专用) -->
+    <div v-show="activeStep === 2 && isCombined">
+      <el-tabs v-model="secondActiveTab" type="border-card">
+        <el-tab-pane label="另一部分处方" name="drugSecond">
+          <div class="drug-split-layout">
+            <div class="drug-left-panel">
+              <el-form label-width="80px">
+                <el-form-item label="诊断">
+                  <el-input v-model="prescribeForm.diagnose" type="textarea" :rows="2" disabled />
+                </el-form-item>
+                <el-form-item label="医嘱">
+                  <el-input v-model="prescribeForm.remark" type="textarea" :rows="2" disabled />
+                </el-form-item>
+              </el-form>
+              <div class="drug-actions">
+                <el-button type="primary" icon="el-icon-plus" size="small" @click="handleAddDrugSecond">新增药品</el-button>
+                <el-button type="success" icon="el-icon-search" size="small" @click="openCommonDrugDialogSecond">常用药品</el-button>
+              </div>
+              <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-column label="操作" width="150">
+                  <template slot-scope="scope">
+                    <el-button type="text" icon="el-icon-edit" @click="handleEditDrugSecond(scope.row)">编辑</el-button>
+                    <el-button type="text" icon="el-icon-delete" @click="handleDeleteDrugSecond(scope.row)">删除</el-button>
+                  </template>
+                </el-table-column>
+              </el-table>
+              <pagination :total="secondDrugTotal" :page.sync="secondDrugQuery.pageNum" :limit.sync="secondDrugQuery.pageSize" @pagination="getSecondDrugList" />
+            </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" 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>
+    </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>
+        <el-form-item label="规格" prop="drugSpec"><el-input v-model="currentDrug.drugSpec" /></el-form-item>
+        <el-form-item label="使用方法" prop="usageMethod"><el-input v-model="currentDrug.usageMethod" /></el-form-item>
+        <el-form-item label="频次" prop="usageFrequencyUnit"><el-input v-model="currentDrug.usageFrequencyUnit" /></el-form-item>
+        <el-form-item label="每次用量" prop="usagePerUseCount"><el-input v-model="currentDrug.usagePerUseCount" /></el-form-item>
+        <el-form-item label="用量单位" prop="usagePerUseUnit"><el-input v-model="currentDrug.usagePerUseUnit" /></el-form-item>
+      </el-form>
+      <span slot="footer">
+        <el-button @click="drugDialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="saveDrug">确定</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 常用诊断语对话框 -->
+    <el-dialog title="常用诊断" :visible.sync="diagnoseDialogVisible" width="600px" append-to-body>
+      <el-table :data="commonDiagnoseList" border @row-click="selectDiagnose">
+        <el-table-column label="诊断内容" prop="diagnose" show-overflow-tooltip />
+      </el-table>
+      <pagination :total="diagnoseTotal" :page.sync="diagnoseQuery.pageNum" :limit.sync="diagnoseQuery.pageSize" @pagination="getCommonDiagnoseList" />
+    </el-dialog>
+
+    <!-- 常用药品对话框 -->
+    <el-dialog title="常用药品" :visible.sync="commonDrugDialogVisible" width="800px" append-to-body>
+      <el-form :inline="true" size="small">
+        <el-form-item label="药品名称"><el-input v-model="commonDrugQuery.drugName" placeholder="请输入药品名称" /></el-form-item>
+        <el-form-item><el-button type="primary" @click="searchCommonDrug">搜索</el-button></el-form-item>
+      </el-form>
+      <el-table :data="commonDrugList" border>
+        <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-column label="操作" width="80">
+          <template slot-scope="scope">
+            <el-button type="text" @click="applyCommonDrug(scope.row)">应用</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination :total="commonDrugTotal" :page.sync="commonDrugQuery.pageNum" :limit.sync="commonDrugQuery.pageSize" @pagination="getCommonDrugList" />
+    </el-dialog>
+  </el-dialog>
+</template>
+
+<script>
+import { getPrescribeScrmDetail, updatePrescribeScrm, submitPrescribeScrm } from "@/api/his/scrmPrescribe";
+import { listPrescribeDrug, addPrescribeDrug, updatePrescribeDrug, deletePrescribeDrug } from "@/api/his/prescribeDrug";
+import { getCommonDrugList } from "@/api/commonlyDrug";
+import { getCommonDiagnoseList } from '@/api/commonlyDiagnose';
+
+export default {
+  name: "DoctorPrescribeDialog",
+  props: {
+    visible: Boolean,
+    prescribeId: Number,
+    doctorId: Number,
+    drugDoctorId: Number
+  },
+  data() {
+    return {
+      dialogVisible: false,
+      activeStep: 0,
+      selectedPrescribeType: null,
+      isCombined: false,
+      secondPartActive: false,
+      activeTab: 'basic',
+      secondActiveTab: 'drugSecond',
+      prescribeForm: {
+        prescribeId: null,
+        patientName: '',
+        patientAge: '',
+        patientGender: null,
+        isHistoryAllergic: '否',
+        historyAllergic: '',
+        diagnose: '',
+        remark: '',
+        prescribeCode: '',
+        userId: null,
+        thirdPartyUserId: null,
+        prescribeImgUrl: '',
+        prescribeImgStoreUrl: ''
+      },
+      basicRules: {
+        patientName: [{required: true, message: '请输入患者姓名', trigger: 'blur'}],
+        patientAge: [{required: true, message: '请输入患者年龄', trigger: 'blur'}],
+        patientGender: [{required: true, message: '请选择患者性别', trigger: 'change'}],
+        isHistoryAllergic: [{required: true, message: '请选择是否有过敏史', trigger: 'change'}]
+      },
+      drugRules: {
+        diagnose: [{required: true, message: '请输入诊断', trigger: 'blur'}],
+        remark: [{required: true, message: '请输入医嘱', trigger: 'blur'}]
+      },
+      drugList: [],
+      drugTotal: 0,
+      drugQuery: {pageNum: 1, pageSize: 10, prescribeId: null},
+      secondDrugList: [],
+      secondDrugTotal: 0,
+      secondDrugQuery: {pageNum: 1, pageSize: 10, prescribeId: null},
+      drugDialogVisible: false,
+      drugDialogTitle: '',
+      currentDrug: {},
+      isEditingSecond: false,
+      diagnoseDialogVisible: false,
+      commonDiagnoseList: [],
+      diagnoseTotal: 0,
+      diagnoseQuery: {pageNum: 1, pageSize: 10},
+      commonDrugDialogVisible: false,
+      commonDrugList: [],
+      commonDrugTotal: 0,
+      commonDrugQuery: {pageNum: 1, pageSize: 10, drugName: '', doctorId: null},
+      commonDrugForSecond: false,
+      submitLoading: false,
+      isViewMode: false
+    };
+  },
+  computed: {
+    patientGenderText() {
+      return this.prescribeForm.patientGender === 1 ? '男' : this.prescribeForm.patientGender === 0 ? '女' : '';
+    },
+    currentDrugList() {
+      return this.drugList;
+    }
+  },
+  watch: {
+    visible(val) {
+      this.dialogVisible = val;
+      if (val) this.initData();
+    }
+  },
+  methods: {
+    async initData() {
+      this.activeStep = 0;
+      this.selectedPrescribeType = null;
+      this.isCombined = false;
+      this.secondPartActive = false;
+      this.drugList = [];
+      this.secondDrugList = [];
+      try {
+        const res = await getPrescribeScrmDetail(this.prescribeId);
+        const data = res.data;
+        this.prescribeForm = {
+          prescribeId: data.prescribeId,
+          patientName: data.patientName || '',
+          patientAge: data.patientAge || '',
+          patientGender: data.patientGender !== undefined ? data.patientGender : null,
+          isHistoryAllergic: data.isHistoryAllergic === '是' ? '是' : '否',
+          historyAllergic: data.historyAllergic || '',
+          diagnose: data.diagnose || '',
+          remark: data.remark || '',
+          prescribeCode: data.prescribeCode || '',
+          userId: data.userId,
+          thirdPartyUserId: data.thirdPartyUserId,
+          prescribeImgUrl: data.prescribeImgUrl,
+          prescribeImgStoreUrl: data.prescribeImgStoreUrl
+        };
+        if (data.prescribeType) {
+          this.selectedPrescribeType = data.prescribeType;
+          this.isCombined = (this.selectedPrescribeType === 3);
+          this.activeStep = 1;
+          this.loadDrugsForCurrentPart();
+        }
+      } catch (error) {
+        console.error('获取处方详情失败', error);
+        this.$message.error('获取处方信息失败');
+      }
+    },
+    onPrescribeTypeChange(val) {
+      this.isCombined = (val === 3);
+      if (!this.isCombined) this.secondPartActive = false;
+    },
+    nextStep() {
+      if (this.activeStep === 0) {
+        if (!this.selectedPrescribeType) {
+          this.$message.warning('请选择处方类型');
+          return;
+        }
+        this.isCombined = (this.selectedPrescribeType === 3);
+        if (this.isCombined) this.secondPartActive = false;
+        this.activeStep = 1;
+        this.loadDrugsForCurrentPart();
+      }
+    },
+    prevStep() {
+      if (this.activeStep > 0) this.activeStep--;
+    },
+    loadDrugsForCurrentPart() {
+      if (!this.prescribeId) return;
+      if (this.isCombined && this.secondPartActive) {
+        this.getSecondDrugList();
+      } else {
+        this.getDrugList();
+      }
+    },
+    getDrugList() {
+      this.drugQuery.prescribeId = this.prescribeId;
+      listPrescribeDrug(this.drugQuery).then(res => {
+        this.drugList = res.rows || [];
+        this.drugTotal = res.total || 0;
+      });
+    },
+    getSecondDrugList() {
+      if (this.secondDrugQuery.prescribeId !== this.prescribeId) {
+        this.secondDrugQuery.prescribeId = this.prescribeId;
+      }
+      // TODO: 实际应调用带 drugType 参数的接口,此处简化
+    },
+    handleAddDrug() {
+      this.isEditingSecond = false;
+      this.currentDrug = {drugType: this.selectedPrescribeType === 1 ? 1 : 2};
+      this.drugDialogTitle = '新增药品';
+      this.drugDialogVisible = true;
+    },
+    handleEditDrug(row) {
+      this.isEditingSecond = false;
+      this.currentDrug = {...row};
+      this.drugDialogTitle = '编辑药品';
+      this.drugDialogVisible = true;
+    },
+    handleDeleteDrug(row) {
+      this.$confirm('确认删除该药品吗?').then(() => {
+        deletePrescribeDrug(row.drugId).then(() => {
+          this.$message.success('删除成功');
+          this.getDrugList();
+        });
+      });
+    },
+    saveDrug() {
+      this.currentDrug.prescribeId = this.prescribeId;
+      if (!this.currentDrug.drugName) {
+        this.$message.warning('请填写药品名称');
+        return;
+      }
+      const request = this.currentDrug.drugId ? updatePrescribeDrug(this.currentDrug) : addPrescribeDrug(this.currentDrug);
+      request.then(() => {
+        this.$message.success('保存成功');
+        this.drugDialogVisible = false;
+        if (!this.isEditingSecond) {
+          this.getDrugList();
+        } else {
+          this.getSecondDrugList();
+        }
+      }).catch(() => {
+        this.$message.error('保存失败');
+      });
+    },
+    handleAddDrugSecond() {
+      this.isEditingSecond = true;
+      this.currentDrug = {drugType: 2};
+      this.drugDialogTitle = '新增药品(另一部分)';
+      this.drugDialogVisible = true;
+    },
+    handleEditDrugSecond(row) {
+      this.isEditingSecond = true;
+      this.currentDrug = {...row};
+      this.drugDialogTitle = '编辑药品';
+      this.drugDialogVisible = true;
+    },
+    handleDeleteDrugSecond(row) {
+      this.$confirm('确认删除该药品吗?').then(() => {
+        deletePrescribeDrug(row.drugId).then(() => {
+          this.$message.success('删除成功');
+          this.getSecondDrugList();
+        });
+      });
+    },
+    openCommonDiagnose() {
+      this.getCommonDiagnoseList();
+      this.diagnoseDialogVisible = true;
+    },
+    getCommonDiagnoseList() {
+      getCommonDiagnoseList(this.diagnoseQuery).then(res => {
+        this.commonDiagnoseList = res.data.list || [];
+        this.diagnoseTotal = res.data.total || 0;
+      });
+    },
+    selectDiagnose(row) {
+      if (!this.prescribeForm.diagnose) this.prescribeForm.diagnose = '';
+      this.prescribeForm.diagnose += (this.prescribeForm.diagnose ? ',' : '') + row.diagnose;
+      this.diagnoseDialogVisible = false;
+    },
+    openCommonDrugDialog() {
+      this.commonDrugForSecond = false;
+      this.commonDrugQuery.doctorId = this.doctorId;
+      this.getCommonDrugList();
+      this.commonDrugDialogVisible = true;
+    },
+    openCommonDrugDialogSecond() {
+      this.commonDrugForSecond = true;
+      this.commonDrugQuery.doctorId = this.doctorId;
+      this.getCommonDrugList();
+      this.commonDrugDialogVisible = true;
+    },
+    searchCommonDrug() {
+      this.commonDrugQuery.pageNum = 1;
+      this.getCommonDrugList();
+    },
+    getCommonDrugList() {
+      getCommonDrugList(this.commonDrugQuery).then(res => {
+        this.commonDrugList = res.data.list || [];
+        this.commonDrugTotal = res.data.total || 0;
+      });
+    },
+    applyCommonDrug(drug) {
+      const newDrug = {
+        drugName: drug.drugName,
+        drugSpec: drug.drugSpec,
+        usageMethod: drug.usageMethod,
+        usageFrequencyUnit: drug.usageFrequencyUnit,
+        usagePerUseCount: drug.usagePerUseCount,
+        usagePerUseUnit: '',
+        prescribeId: this.prescribeId,
+        drugType: this.selectedPrescribeType === 1 ? 1 : 2
+      };
+      addPrescribeDrug(newDrug).then(() => {
+        this.$message.success('添加成功');
+        if (!this.commonDrugForSecond) {
+          this.getDrugList();
+        } else {
+          this.getSecondDrugList();
+        }
+        this.commonDrugDialogVisible = false;
+      }).catch(() => {
+        this.$message.error('添加失败');
+      });
+    },
+    async submitCurrentPart() {
+      let valid = true;
+      await this.$refs.basicForm.validate().catch(() => valid = false);
+      await this.$refs.drugForm.validate().catch(() => valid = false);
+      if (!valid) return;
+      if (this.drugList.length === 0) {
+        this.$message.warning('请至少添加一种药品');
+        return;
+      }
+      if (this.isCombined && !this.secondPartActive) {
+        this.submitLoading = true;
+        try {
+          await updatePrescribeScrm(this.prescribeId, {
+            diagnose: this.prescribeForm.diagnose,
+            remark: this.prescribeForm.remark,
+            isHistoryAllergic: this.prescribeForm.isHistoryAllergic,
+            historyAllergic: this.prescribeForm.historyAllergic
+          });
+          this.$message.success('第一部分信息已保存,请继续填写第二部分');
+          this.secondPartActive = true;
+          this.activeStep = 2;
+          this.getSecondDrugList();
+        } catch (error) {
+          this.$message.error('保存失败');
+        } finally {
+          this.submitLoading = false;
+        }
+      } else {
+        this.submitFullPrescribe();
+      }
+    },
+    submitSecondPart() {
+      if (this.secondDrugList.length === 0) {
+        this.$message.warning('请至少添加一种药品');
+        return;
+      }
+      this.submitFullPrescribe(true);
+    },
+    async submitFullPrescribe(isCombinedFinal = false) {
+      this.submitLoading = true;
+      try {
+        const params = {
+          prescribeId: this.prescribeId,
+          prescribeType: this.selectedPrescribeType,
+          patientName: this.prescribeForm.patientName,
+          patientAge: this.prescribeForm.patientAge,
+          patientGender: this.prescribeForm.patientGender,
+          isHistoryAllergic: this.prescribeForm.isHistoryAllergic,
+          historyAllergic: this.prescribeForm.historyAllergic,
+          diagnose: this.prescribeForm.diagnose,
+          remark: this.prescribeForm.remark,
+          drugs: this.isCombined ? [...this.drugList, ...this.secondDrugList] : this.drugList
+        };
+        await submitPrescribeScrm(params);
+        this.$message.success('处方提交成功');
+        this.dialogVisible = false;
+        this.$emit('success');
+      } catch (error) {
+        this.$message.error('提交失败');
+      } finally {
+        this.submitLoading = false;
+      }
+    },
+    handleClose() {
+      this.dialogVisible = false;
+      this.$emit('update:visible', false);
+    }
+  }
+};
+</script>
+
+<style scoped>
+/* 左右分栏布局 */
+.drug-split-layout {
+  display: flex;
+  gap: 20px;
+  min-height: 500px;
+}
+
+.drug-left-panel {
+  flex: 1;
+}
+
+.drug-right-panel {
+  flex: 1;
+  overflow-y: auto;
+  max-height: 70vh;
+}
+
+.prescription-scroll-wrapper {
+  width: 100%;
+  min-height: 100%;
+  overflow-y: auto;
+}
+
+.prescription-preview-container {
+  position: relative;
+  width: 100%;
+  background: #f5f5f5;
+  border-radius: 8px;
+  overflow: hidden;
+}
+
+.prescription-bg-image {
+  width: 100%;
+  display: block;
+}
+
+/* 覆盖层 - 绝对定位所有文字内容 */
+.prescription-overlay {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  padding: 20px;
+  box-sizing: border-box;
+  pointer-events: none;
+}
+
+/* 处方编号 */
+.prescription-overlay .prescribe-code {
+  position: absolute;
+  top: 5.6%;
+  left: 0;
+  width: 100%;
+  height: 4%;
+  display: flex;
+  align-items: center;
+  justify-content: flex-start;
+  padding-left: 15%;
+  font-size: clamp(10px, 1.5vw, 14px);
+  font-weight: bold;
+  color: #000;
+}
+
+/* 患者信息 */
+.patient-info {
+  position: absolute;
+  top: 10%; /* 相对于容器高度 */
+  left: 0;
+  width: 100%;
+  height: 4%; /* 估算高度 */
+  display: flex;
+}
+.prescribe-patientName {
+  flex: 2;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding-left: 2%;
+  font-size: clamp(10px, 1.5vw, 14px);
+}
+
+.prescribe-patientGender {
+  flex: 1;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  font-size: clamp(10px, 1.5vw, 14px);
+}
+
+.prescribe-patientAge {
+  flex: 3;
+  display: flex;
+  align-items: center;
+  justify-content: flex-start;
+  padding-left: 5%; /* 相对于容器宽度 */
+  font-size: clamp(10px, 1.5vw, 14px);
+}
+
+/* 诊断字段 */
+.prescription-overlay .diagnose {
+  position: absolute;
+  top: 19%;
+  left: 15%;
+  width: 70%;
+  height: 10%;
+  overflow: hidden;
+  font-size: clamp(10px, 1.5vw, 14px);
+  color: #000;
+  white-space: pre-line;
+  line-height: 1.4;
+}
+
+/* 药品列表字段 - 可滚动 */
+.prescription-overlay .drugs {
+  position: absolute;
+  top: 27%;
+  left: 10%;
+  width: 80%;
+  height: 45%;
+  overflow-y: auto;
+  font-size: clamp(9px, 1.2vw, 12px);
+  color: #000;
+}
+
+.prescription-overlay .drug-item {
+  margin-bottom: 1.5%;
+}
+
+.prescription-overlay .usage {
+  display: block;
+  font-size: clamp(9px, 1.2vw, 12px);
+  color: #666;
+}
+
+/* 医嘱字段 */
+.prescription-overlay .remark {
+  position: absolute;
+  top: 52%;
+  left: 12%;
+  width: 70%;
+  height: 10%;
+  overflow: hidden;
+  font-size: clamp(10px, 1.5vw, 14px);
+  color: #000;
+  white-space: pre-line;
+  line-height: 1.4;
+}
+
+/* 真实处方图片容器 */
+.real-prescription-wrapper {
+  width: 100%;
+  overflow: auto;
+}
+
+.real-prescription-wrapper img {
+  max-width: 100%;
+  height: auto;
+}
+
+.dialog-footer {
+  text-align: right;
+}
+</style>

+ 40 - 4
src/views/his/scrmPrescribe/index.vue

@@ -106,6 +106,12 @@
             icon="el-icon-edit"
             @click="handlePerfectPrescription(scope.row)"
           >完善处方</el-button>
+          <el-button
+            type="success"
+            size="small"
+            icon="el-icon-plus"
+            @click="handleOpenPrescribe(scope.row)"
+          >开方</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -119,11 +125,21 @@
       @pagination="getList"
     />
 
+    <!-- 完善处方弹窗 -->
     <doctor-advice-dialog
       :visible.sync="dialogVisible"
       :prescribe-id="currentPrescribeId"
       :doctor-id="currentDoctorId"
       :drug-doctor-id="currentDrugDoctorId"
+      @success="handleAdviceSuccess"
+    />
+
+    <!-- 开方弹窗 -->
+    <doctor-prescribe-dialog
+      :visible.sync="prescribeDialogVisible"
+      :prescribe-id="currentPrescribeId"
+      :doctor-id="currentDoctorId"
+      :drug-doctor-id="currentDrugDoctorId"
       @success="getList"
     />
   </div>
@@ -132,10 +148,10 @@
 <script>
 import { waitOpenPrescribeList } from "@/api/his/scrmPrescribe";
 import DoctorAdviceDialog from "./DoctorAdviceDialog.vue";
-
+import DoctorPrescribeDialog from "./DoctorPrescribeDialog.vue";
 export default {
   name: "PrescribeList",
-  components: { DoctorAdviceDialog },
+  components: { DoctorAdviceDialog, DoctorPrescribeDialog },
   data() {
     return {
       loading: true,
@@ -156,10 +172,12 @@ export default {
         { dictLabel: "中药", dictValue: 2 },
         { dictLabel: "中药+西药", dictValue: 3 }
       ],
-      dialogVisible: false,
+      dialogVisible: false,//完善处方弹窗
+      prescribeDialogVisible: false, // 开方弹窗
       currentPrescribeId: null,
       currentDoctorId: null,
       currentDrugDoctorId: null,
+
     };
   },
   created() {
@@ -184,12 +202,30 @@ export default {
       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;
+    },
+    // 直接开方
+    handleOpenPrescribe(row) {
+      this.currentPrescribeId = row.prescribeId;
+      this.currentDoctorId = row.doctorId;
+      this.currentDrugDoctorId = row.drugDoctorId;
+      this.prescribeDialogVisible = true;
+    },
+    // 完善处方成功后的回调(询问是否开方)
+    handleAdviceSuccess() {
+      this.getList(); // 刷新列表
+      this.$confirm('是否前往开方?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'info'
+      }).then(() => {
+        this.prescribeDialogVisible = true;
+      }).catch(() => {});
     }
   }
 };