Quellcode durchsuchen

益寿缘医生端增加常用药品\常用诊断页面

cgp vor 1 Woche
Ursprung
Commit
a2e6fde05d

+ 32 - 0
src/api/commonlyDiagnose.js

@@ -0,0 +1,32 @@
+import request from '@/utils/request'
+
+export function getCommonDiagnoseList(params) {
+  return request({
+    url: '/app/commonDiagnose/list',
+    method: 'get',
+    params
+  })
+}
+
+export function addCommonDiagnose(data) {
+  return request({
+    url: '/app/commonDiagnose/add',
+    method: 'post',
+    data
+  })
+}
+
+export function editCommonDiagnose(data) {
+  return request({
+    url: '/app/commonDiagnose/edit',
+    method: 'post',
+    data
+  })
+}
+
+export function deleteCommonDiagnose(id) {
+  return request({
+    url: `/app/commonDiagnose/delete/${id}`,
+    method: 'post'
+  })
+}

+ 36 - 0
src/api/commonlyDrug.js

@@ -0,0 +1,36 @@
+import request from '@/utils/request'
+
+// 获取常用药品列表(分页)
+export function getCommonDrugList(params) {
+  return request({
+    url: '/app/commonDrug/list',
+    method: 'get',
+    params
+  })
+}
+
+// 新增常用药品
+export function addCommonDrug(data) {
+  return request({
+    url: '/app/commonDrug/add',
+    method: 'post',
+    data
+  })
+}
+
+// 编辑常用药品
+export function editCommonDrug(data) {
+  return request({
+    url: '/app/commonDrug/edit',
+    method: 'post',
+    data
+  })
+}
+
+// 删除常用药品
+export function deleteCommonDrug(id) {
+  return request({
+    url: `/app/commonDrug/delete/${id}`,
+    method: 'post'
+  })
+}

+ 12 - 0
src/router/index.js

@@ -140,6 +140,18 @@ export const constantRoutes = [
     meta: { title: '我的药房', icon: 'nested', noCache: true, affix: false },
     redirect: 'noredirect',
     children: [
+      {
+        path: 'commonlyDrug',
+        component: (resolve) => require(['@/views/myDrugStore/commonlyDrug'], resolve),
+        name: '常用药品',
+        meta: { title: '常用药品', icon: 'link', affix: false }
+      },
+      {
+        path: 'commonlyDiagnose',
+        component: (resolve) => require(['@/views/myDrugStore/commonlyDiagnose'], resolve),
+        name: '常用诊断',
+        meta: { title: '常用诊断', icon: 'link', affix: false }
+      },
       {
         path: 'common',
         component: (resolve) => require(['@/views/myDrugStore/common'], resolve),

+ 111 - 147
src/views/his/prescribe/index.vue

@@ -16,15 +16,6 @@
       <el-form-item label="患者姓名" prop="patientName">
         <el-input v-model="queryParams.patientName" placeholder="请输入患者姓名" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
-<!--      <el-form-item label="患者电话" prop="patientTel">-->
-<!--        <el-input v-model="queryParams.patientTel" placeholder="请输入患者电话" clearable @keyup.enter.native="handleQuery" />-->
-<!--      </el-form-item>-->
-<!--      <el-form-item label="处方状态" prop="status">-->
-<!--        <el-select v-model="queryParams.status" placeholder="请选择处方状态" clearable>-->
-<!--          <el-option label="未开" :value="0"></el-option>-->
-<!--          <el-option label="已开" :value="1"></el-option>-->
-<!--        </el-select>-->
-<!--      </el-form-item>-->
       <el-form-item label="医生姓名" prop="doctorName">
         <el-input v-model="queryParams.doctorName" placeholder="请输入医生姓名" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
@@ -85,7 +76,7 @@
           icon="el-icon-delete"
           size="mini"
           :disabled="multiple"
-          @click="handleDelete"
+          @click=""
           v-hasPermi="['his:prescribe:remove']"
         >删除</el-button>
       </el-col>
@@ -123,18 +114,13 @@
       </el-table-column>
       <el-table-column label="订单编号" align="center" prop="orderCode" width="180" />
       <el-table-column label="患者姓名" align="center" prop="patientName" />
-<!--      <el-table-column label="患者电话" align="center" prop="patientTel" />-->
       <el-table-column label="医生姓名" align="center" prop="doctorName" />
       <el-table-column label="是否确认" align="center" prop="doctorConfirm" >
         <template slot-scope="scope">
           <dict-tag :options="doctorConfirmOptions" :value="scope.row.doctorConfirm"/>
         </template>
       </el-table-column>
-<!--      <el-table-column label="状态" align="center" prop="status">-->
-<!--        <template slot-scope="scope">-->
-<!--          <dict-tag :options="statusOptions" :value="scope.row.status"/>-->
-<!--        </template>-->
-<!--      </el-table-column>-->
+
       <el-table-column label="审核时间" align="center" prop="auditTime" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.auditTime, '{y}-{m}-{d}') }}</span>
@@ -238,25 +224,20 @@
                     slot="suffix"
                     class="el-icon-search el-input__icon"
                     style="cursor: pointer;"
-                    @click="handlePrescribeCommonWorlds('diagnose', 1)"
+                    @click="handleCommonlyDiagnoseWorlds"
                   ></i>
                 </el-input>
               </el-form-item>
 
-              <!-- 备注 -->
-              <el-form-item label="备注" prop="remark">
+              <!-- 医嘱 -->
+              <el-form-item label="医嘱" prop="remark">
                 <div style="display: flex; align-items: center;">
                   <el-input
                     v-model="form.remark"
                     type="textarea"
-                    placeholder="请输入备注"
+                    placeholder="请输入医嘱"
                     style="flex: 1;"
                   ></el-input>
-                  <i
-                    class="el-icon-search"
-                    style="margin-left: 8px; cursor: pointer; font-size: 18px; color: #909399;"
-                    @click="handlePrescribeCommonWorlds('remark', 2)"
-                  ></i>
                 </div>
               </el-form-item>
             </el-form>
@@ -280,7 +261,7 @@
                   size="mini"
                   @click="openCommonPrescribeDialog"
                   :disabled="!form.prescribeId"
-                >常用处方</el-button>
+                >常用药品</el-button>
               </el-col>
 
             </el-row>
@@ -300,13 +281,6 @@
                   {{ scope.row.usagePerUseCount }}{{ scope.row.usagePerUseUnit }}
                 </template>
               </el-table-column>
-<!--              <el-table-column label="天数" align="center" prop="usageDays" width="60" />-->
-<!--              <el-table-column label="单价" align="center" prop="drugPrice" width="80" />-->
-<!--              <el-table-column label="数量" align="center" width="100">-->
-<!--                <template slot-scope="scope">-->
-<!--                  {{ scope.row.drugNum }}{{ scope.row.drugUnit }}-->
-<!--                </template>-->
-<!--              </el-table-column>-->
               <el-table-column v-if="currentConfirm === 0" label="操作" align="center" class-name="small-padding fixed-width" width="150">
                 <template slot-scope="scope">
                   <el-button
@@ -480,7 +454,7 @@
         @row-click="handleSuggestRowClick"
       >
         <el-table-column type="index" width="50" />
-        <el-table-column label="内容" prop="textContent" show-overflow-tooltip />
+        <el-table-column label="内容" prop="diagnose" show-overflow-tooltip />
         <el-table-column label="操作" width="80" align="center">
           <template slot-scope="scope">
             <el-button type="text" size="small" @click.stop="handleAddSuggest(scope.row)">
@@ -499,9 +473,9 @@
       />
     </el-dialog>
 
-      <!-- 常用处方选择对话框 -->
+      <!-- 常用药品选择对话框 -->
       <el-dialog
-        title="选择常用处方"
+        title="选择常用药品"
         :visible.sync="commonPrescribeDialogVisible"
         width="800px"
         append-to-body
@@ -509,11 +483,11 @@
       >
 
         <!-- 搜索区域 -->
-        <el-form :model="commonPrescribeQuery" :inline="true" size="small" label-width="80px">
-          <el-form-item label="诊断内容" prop="diagnose">
+        <el-form :model="commonDrugQuery" :inline="true" size="small" label-width="80px">
+          <el-form-item label="药品名称" prop="diagnose">
             <el-input
-              v-model="commonPrescribeQuery.diagnose"
-              placeholder="请输入诊断内容"
+              v-model="commonDrugQuery.drugName"
+              placeholder="请输入药品名称"
               clearable
               @keyup.enter.native="handleCommonPrescribeQuery"
             />
@@ -527,26 +501,28 @@
         <!-- 表格 -->
         <el-table
           v-loading="commonPrescribeLoading"
-          :data="commonPrescribeList"
+          :data="commonDrugList"
           border
           style="width: 100%; margin-top: 10px;"
           max-height="400"
         >
-          <el-table-column label="诊断" align="center" prop="diagnose" show-overflow-tooltip />
-          <el-table-column label="药品名称" align="center" show-overflow-tooltip>
-            <template slot-scope="scope">
-        <span v-for="(drug, index) in scope.row.drugs" :key="drug.drugId || index">
-          {{ drug.drugName }}
-          <span v-if="index < scope.row.drugs.length - 1">, </span>
-        </span>
-            </template>
-          </el-table-column>
-          <el-table-column label="药品种类数量" align="center" width="120">
-            <template slot-scope="scope">
-              {{ scope.row.drugs.length || 0 }}
-            </template>
-          </el-table-column>
-          <el-table-column label="操作" align="center" width="120">
+          <!-- 药品名称 -->
+          <el-table-column label="药品名称" align="center" prop="drugName" show-overflow-tooltip />
+
+          <!-- 规格 -->
+          <el-table-column label="规格" align="center" prop="drugSpec" width="100" />
+
+          <!-- 用法 -->
+          <el-table-column label="用法" align="center" prop="usageMethod" width="100" />
+
+          <!-- 频次 -->
+          <el-table-column label="频次" align="center" prop="usageFrequencyUnit" width="100" />
+
+          <!-- 每次用药数量 -->
+          <el-table-column label="每次用量" align="center" prop="usagePerUseCount" width="100" />
+
+          <!-- 操作 -->
+          <el-table-column label="操作" align="center" width="100">
             <template slot-scope="scope">
               <el-button
                 size="mini"
@@ -562,8 +538,8 @@
         <pagination
           v-show="commonPrescribeTotal > 0"
           :total="commonPrescribeTotal"
-          :page.sync="commonPrescribeQuery.pageNum"
-          :limit.sync="commonPrescribeQuery.pageSize"
+          :page.sync="commonDrugQuery.pageNum"
+          :limit.sync="commonDrugQuery.pageSize"
           @pagination="getCommonPrescribeList"
           style="margin-top: 10px;"
         />
@@ -572,17 +548,16 @@
   </div>
 </template>
 <script>
-import { getDoctorPrescribeList} from "@/api/prescribe";
+import {getCommonDrugList} from '@/api/commonlyDrug';
+import {getCommonDiagnoseList} from '@/api/commonlyDiagnose';
 import collectionDetail from '@/views/components/collection/collectionDetail.vue';
 import {listPrescribe,
   getPrescribe,
-  delPrescribe,
   addPrescribe,
   updatePrescribe,
   exportPrescribe,
   exportMessageFeedback,
-  confirmPrescribe,
-  getPrescribeCommonList
+  confirmPrescribe
 } from '@/api/his/prescribe'
 import { listPrescribeDrug, addPrescribeDrug, updatePrescribeDrug, deletePrescribeDrug } from "@/api/his/prescribeDrug";
 export default {
@@ -599,8 +574,7 @@ export default {
       suggestQuery: {    // 建议查询参数
         pageNum: 1,
         pageSize: 10,
-        commonType: null,
-        textContent: ''
+        diagnose: null
       },
       suggestSource: '', // 记录来源字段 'diagnose' 或 'remark'
       suggestRow: null,  // 如果是备注,记录具体行
@@ -628,15 +602,15 @@ export default {
         { dictValue: '0', dictLabel: "未开" },
         { dictValue: '1', dictLabel: "已开" }
       ],
-      // 常用处方弹窗相关
+      // 常用药品弹窗相关
       commonPrescribeDialogVisible: false,
       commonPrescribeLoading: false,
-      commonPrescribeList: [],
+      commonDrugList: [],
       commonPrescribeTotal: 0,
-      commonPrescribeQuery: {
+      commonDrugQuery: {
         pageNum: 1,
         pageSize: 10,
-        diagnose: undefined
+        drugName: undefined
       },
       queryParams: {
         pageNum: 1,
@@ -660,7 +634,7 @@ export default {
         patientName: [{ required: true, message: "患者姓名不能为空", trigger: "blur" }],
         patientAge: [{ required: true, message: "患者年龄不能为空", trigger: "blur" }],
         patientGender: [{ required: true, message: "患者性别不能为空", trigger: "change" }],
-        diagnose: [{ required: true, message: "诊断不能为空", trigger: "blur" }],
+        diagnose: [{ required: true, message: "诊断不能为空", trigger: ["blur", "change"]  }],
         doctorId: [{ required: true, message: "医生ID不能为空", trigger: "blur" }],
         status: [{ required: true, message: "处方状态不能为空", trigger: "change" }]
       },
@@ -714,7 +688,7 @@ export default {
   },
   methods: {
     /**
-     * 打开常用处方对话框,并打印当前医生ID
+     * 打开常用药品对话框,并打印当前医生ID
      */
     openCommonPrescribeDialog() {
       // 获取当前医生ID(假设医生ID在 form.doctorId 或从 store 中获取)
@@ -726,35 +700,35 @@ export default {
       this.commonPrescribeDialogVisible = true;
     },
 
-    /** 打开常用处方对话框时加载数据 */
+    /** 打开常用药品对话框时加载数据 */
     handleOpenCommonPrescribeDialog() {
-      this.commonPrescribeQuery.pageNum = 1;
+      this.commonDrugQuery.pageNum = 1;
       this.getCommonPrescribeList();
     },
 
-    /** 搜索常用处方 */
+    /** 搜索常用药品 */
     handleCommonPrescribeQuery() {
-      this.commonPrescribeQuery.pageNum = 1;
+      this.commonDrugQuery.pageNum = 1;
       this.getCommonPrescribeList();
     },
 
-    /** 重置常用处方搜索 */
+    /** 重置常用药品搜索 */
     resetCommonPrescribeQuery() {
-      this.commonPrescribeQuery.diagnose = undefined;
+      this.commonDrugQuery.drugName = undefined;
       this.handleCommonPrescribeQuery();
     },
 
-    /** 获取常用处方列表 */
+    /** 获取常用药品列表 */
     getCommonPrescribeList() {
       this.commonPrescribeLoading = true;
       // 获取当前医生ID
       const doctorId = this.form.doctorId || this.$store.state.user.userId?.replace('D-', '');
       const params = {
-        ...this.commonPrescribeQuery,
+        ...this.commonDrugQuery,
         doctorId: doctorId
       };
-      getDoctorPrescribeList(params).then(response => {
-        this.commonPrescribeList = response.data.list || [];
+      getCommonDrugList(params).then(response => {
+        this.commonDrugList = response.data.list || [];
         this.commonPrescribeTotal = response.data.total || 0;
         this.commonPrescribeLoading = false;
       }).catch(() => {
@@ -762,61 +736,41 @@ export default {
       });
     },
 
-    /** 应用选中的常用处方到当前表单 */
+    /** 应用选中的常用药品到当前表单 */
     async applyCommonPrescribe(row) {
-      // 1. 回填诊断和备注(如果应用的值为null或者空就不回填)
-      if (row.diagnose) {
-        this.form.diagnose = row.diagnose;
-      }
-      if (row.remark) {
-        this.form.remark = row.remark || '';
-      }
-      // 2. 检查是否已保存处方(必须有 prescribeId 才能加药品)
       if (!this.form.prescribeId) {
-        this.$message.warning('请先保存处方基本信息,再应用常用处方药品');
+        this.$message.warning('请先保存处方基本信息,再应用常用药品');
         this.commonPrescribeDialogVisible = false;
         return;
       }
 
-      // 3. 如果没有药品,直接关闭
-      if (!row.drugs || row.drugs.length === 0) {
-        this.$message.success('已应用诊断信息,无药品数据');
-        this.commonPrescribeDialogVisible = false;
-        return;
-      }
-
-      // 4. 显示 loading
+      // 显示 loading
       this.drugLoading = true;
-      this.$message.info(`正在添加 ${row.drugs.length} 条药品...`);
+      this.$message.info(`正在添加药品: ${row.drugName}...`);
 
       try {
-        // 5. 逐个添加药品(可考虑并发,但为避免后端压力,建议串行)
-        for (const drug of row.drugs) {
-          const drugData = {
-            prescribeId: this.form.prescribeId,
-            drugName: drug.drugName,
-            drugSpec: drug.drugSpec,
-            usageMethod: drug.usageMethod,
-            usageFrequencyUnit: drug.usageFrequencyUnit,
-            usagePerUseCount: drug.usagePerUseCount,
-            usagePerUseUnit: drug.usagePerUseUnit,
-            usageDays: drug.usageDays,
-            drugPrice: drug.drugPrice,
-            drugNum: drug.drugNum,
-            drugUnit: drug.drugUnit,
-            instructions: drug.instructions
-            // 注意:确保字段名与后端 API 一致!
-          };
-          await addPrescribeDrug(drugData);
-        }
-
-        // 6. 全部成功后刷新药品列表
-        await this.getDrugList();
-        this.$message.success(`成功添加 ${row.drugs.length} 条药品`);
+        // 构造药品数据(注意字段名要和 addPrescribeDrug 接口一致)
+        const drugData = {
+          prescribeId: this.form.prescribeId,
+          drugName: row.drugName,
+          drugSpec: row.drugSpec,
+          usageMethod: row.usageMethod,
+          usageFrequencyUnit: row.usageFrequencyUnit,
+          usagePerUseCount: row.usagePerUseCount,
+          usagePerUseUnit: '', // 或根据业务补充
+          usageDays: '',
+          drugPrice: '',
+          drugNum: '',
+          drugUnit: '',
+          instructions: ''
+        };
 
+        await addPrescribeDrug(drugData);
+        await this.getDrugList(); // 刷新药品列表
+        this.$message.success(`成功添加药品: ${row.drugName}`);
       } catch (error) {
-        console.error('应用常用处方药品失败:', error);
-        this.$message.error('部分药品添加失败,请检查后重试');
+        console.error('应用常用药品失败:', error);
+        this.$message.error('药品添加失败,请检查后重试');
       } finally {
         this.drugLoading = false;
         this.commonPrescribeDialogVisible = false;
@@ -825,24 +779,20 @@ export default {
 
 
     /**
-     * 搜索关键词常用语方法 - 支持不同来源和类型
-     * @param {string} type - 字段类型: 'diagnose' | 'remark'
-     * @param {number} commonType - 1=病情诊断,2=备注
+     * 诊断常用语列表方法
      */
-    handlePrescribeCommonWorlds(type, commonType) {
-      const value = type === 'diagnose' ? this.form.diagnose : this.form.remark;
-      if (!value || !value.trim()) {
-        this.showSuggestDialog = false;
-        return;
-      }
-
-      this.suggestQuery.commonType = commonType;
-      this.suggestQuery.textContent = value.trim();
+    handleCommonlyDiagnoseWorlds() {
+      // 设置来源,用于后续填充
+      this.suggestSource = 'diagnose';
+      // 设置查询参数
       this.suggestQuery.pageNum = 1;
-      this.suggestSource = type;
-
+      // 获取建议列表
       this.getSuggestList().then(() => {
-        this.showSuggestDialog = this.suggestList.length > 0;
+        if (this.suggestList.length > 0) {
+          this.showSuggestDialog = true;
+        } else {
+          this.$message.info('未找到相关常用诊断');
+        }
       });
     },
 
@@ -851,7 +801,7 @@ export default {
      */
     async getSuggestList() {
       try {
-        const response = await getPrescribeCommonList(this.suggestQuery);
+        const response = await getCommonDiagnoseList(this.suggestQuery);
         if (response && response.data && Array.isArray(response.data.list)) {
           this.suggestList = response.data.list;
           this.suggestTotal = response.data.total;
@@ -860,7 +810,6 @@ export default {
           this.suggestTotal = 0;
         }
       } catch (error) {
-        console.error("获取常用语失败:", error);
         this.$message.warning("获取常用语失败");
         this.suggestList = [];
         this.suggestTotal = 0;
@@ -875,15 +824,28 @@ export default {
     },
 
     /**
-     * 添加建议内容到对应字段
+     * 添加建议内容到对应字段(拼接而非覆盖)
+     */
+    /**
+     * 添加建议内容到对应字段(拼接而非覆盖,使用英文逗号分隔)
      */
     handleAddSuggest(row) {
-      const text = row.textContent;
-      console.log("当前入参suggestSource:", this.suggestSource)
-      if (this.suggestSource === 'diagnose') {
+      const text = row.diagnose;
+      if (!text) return;
+
+      // 获取当前已输入的内容,去除首尾空格
+      let current = (this.form.diagnose || '').trim();
+
+      // 如果已有内容,且不以逗号结尾,则添加英文逗号 + 空格
+      if (current) {
+        // 避免重复逗号:如果结尾已经是逗号(或逗号+空格),就不再加
+        if (!current.endsWith(',')) {
+          current += ', ';
+        }
+        this.form.diagnose = current + text;
+      } else {
+        // 如果为空,直接赋值
         this.form.diagnose = text;
-      } else if (this.suggestSource === 'remark') {
-        this.form.remark = text;
       }
 
       // 关闭对话框
@@ -999,6 +961,8 @@ export default {
       confirmPrescribe(this.form).then(response => {
         if(response.code === 200) {
           this.$message.success("确认成功!");
+          //确认处方的同时保存处方
+          this.submitForm();
           this.open = false;
         } else {
           this.$message.error(response.message);

+ 4 - 28
src/views/myDrugStore/common.vue

@@ -1,16 +1,6 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
-<!--      <el-form-item label="处方类型" prop="prescribeType">-->
-<!--        <el-select v-model="queryParams.prescribeType" placeholder="请选择处方类型" clearable size="small">-->
-<!--          <el-option-->
-<!--            v-for="dict in prescribeTypeOptions"-->
-<!--            :key="dict.dictValue"-->
-<!--            :label="dict.dictLabel"-->
-<!--            :value="dict.dictValue"-->
-<!--          />-->
-<!--        </el-select>-->
-<!--      </el-form-item>-->
       <el-form-item label="诊断内容" prop="diagnose">
         <el-input
           v-model="queryParams.diagnose"
@@ -36,24 +26,10 @@
           @click="handleAdd(1)"
         >新建常用处方</el-button>
       </el-col>
-<!--      <el-col :span="1.5">-->
-<!--        <el-button-->
-<!--          type="success"-->
-<!--          plain-->
-<!--          icon="el-icon-plus"-->
-<!--          size="mini"-->
-<!--          @click="handleAdd(2)"-->
-<!--        >新建中药处方</el-button>-->
-<!--      </el-col>-->
     </el-row>
 
     <el-table v-loading="loading"  border :data="prescribeList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
-<!--      <el-table-column label="处方类型" align="center" prop="prescribeType" width="100px">-->
-<!--        <template slot-scope="scope">-->
-<!--          <dict-tag :options="prescribeTypeOptions" :value="scope.row.prescribeType"/>-->
-<!--        </template>-->
-<!--      </el-table-column>-->
       <el-table-column label="诊断" align="center" prop="diagnose" />
       <el-table-column label="药品名称" align="center">
         <template slot-scope="scope">
@@ -132,8 +108,8 @@
           <el-table-column prop="drugName" label="药品名称" align="center" />
           <el-table-column prop="drugSpec" label="规格" align="center" />
           <el-table-column prop="usageMethod" label="使用方法" align="center" />
-          <el-table-column prop="usageFrequencyUnit" label="药品频次" align="center" />
           <el-table-column prop="usagePerUseCount" label="每次用药数量" align="center" />
+          <el-table-column prop="usageFrequencyUnit" label="药品频次" align="center" />
           <el-table-column label="操作" align="center" width="160">
             <template slot-scope="scope">
               <el-button
@@ -151,9 +127,9 @@
             </template>
           </el-table-column>
         </el-table>
-      <!-- 备注-->
-          <el-form-item label="备注" prop="remark">
-            <el-input v-model="form.remark" placeholder="请输入备注" :rows="10" type="text" />
+      <!-- 医嘱-->
+          <el-form-item label="医嘱" prop="remark">
+            <el-input v-model="form.remark" placeholder="请输入医嘱" :rows="10" type="text" />
           </el-form-item>
 
       </el-form>

+ 248 - 0
src/views/myDrugStore/commonlyDiagnose.vue

@@ -0,0 +1,248 @@
+<template>
+  <div class="common-diagnose-page">
+    <!-- 搜索区域 -->
+    <el-card shadow="never" class="search-card">
+      <el-form :inline="true" :model="searchForm" @submit.native.prevent>
+        <el-form-item label="诊断内容">
+          <el-input
+            v-model="searchForm.diagnose"
+            placeholder="请输入诊断内容关键词"
+            clearable
+            @keyup.enter.native="fetchList"
+          />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" @click="fetchList">搜索</el-button>
+          <el-button @click="resetSearch">重置</el-button>
+        </el-form-item>
+      </el-form>
+    </el-card>
+
+    <!-- 操作按钮 -->
+    <div class="toolbar">
+      <el-button type="primary" @click="handleAdd">新增常用诊断</el-button>
+    </div>
+
+    <!-- 诊断列表 -->
+    <el-card shadow="never" class="table-card">
+      <el-table
+        :data="tableData"
+        v-loading="loading"
+        border
+        style="width: 100%"
+      >
+        <el-table-column type="index" label="序号" width="60" align="center"></el-table-column>
+        <el-table-column prop="diagnose" label="诊断内容" min-width="300" show-overflow-tooltip></el-table-column>
+
+        <el-table-column label="操作" width="160" fixed="right" align="center">
+          <template slot-scope="{ row }">
+            <el-button type="text" size="small" @click="handleEdit(row)">编辑</el-button>
+            <el-button type="text" size="small" style="color: #f56c6c" @click="handleDelete(row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <!-- 分页 -->
+      <el-pagination
+        v-if="total > 0"
+        class="pagination"
+        background
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="total"
+        :page-size.sync="pageSize"
+        :current-page.sync="pageNum"
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+      >
+      </el-pagination>
+    </el-card>
+
+    <!-- 新增/编辑弹窗 -->
+    <el-dialog
+      :title="dialogTitle"
+      :visible.sync="dialogVisible"
+      width="600px"
+      @close="resetForm"
+    >
+      <el-form
+        ref="diagnoseForm"
+        :model="form"
+        :rules="rules"
+        label-width="100px"
+      >
+        <el-form-item label="诊断内容" prop="diagnose">
+          <el-input
+            type="textarea"
+            :rows="4"
+            v-model="form.diagnose"
+            placeholder="请输入诊断内容,如:急性上呼吸道感染,建议休息、多饮水..."
+            maxlength="500"
+            show-word-limit
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer">
+        <el-button @click="dialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="submitForm">确定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  getCommonDiagnoseList,
+  addCommonDiagnose,
+  editCommonDiagnose,
+  deleteCommonDiagnose
+} from '@/api/commonlyDiagnose'
+
+export default {
+  name: 'CommonDiagnose',
+  data() {
+    return {
+      // 分页
+      pageNum: 1,
+      pageSize: 10,
+      total: 0,
+      loading: false,
+      tableData: [],
+
+      // 搜索
+      searchForm: {
+        diagnose: ''
+      },
+
+      // 弹窗
+      dialogVisible: false,
+      isEdit: false,
+      form: {
+        commonDiagnoseId: null,
+        diagnose: ''
+      },
+      rules: {
+        diagnose: [
+          { required: true, message: '请输入诊断内容', trigger: 'blur' },
+          { max: 500, message: '最多500个字符', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  computed: {
+    dialogTitle() {
+      return this.isEdit ? '编辑常用诊断' : '新增常用诊断'
+    }
+  },
+  created() {
+    this.fetchList()
+  },
+  methods: {
+    async fetchList() {
+      this.loading = true
+      try {
+        const res = await getCommonDiagnoseList({
+          pageNum: this.pageNum,
+          pageSize: this.pageSize,
+          diagnose: this.searchForm.diagnose || undefined
+        })
+        const page = res.data
+        this.tableData = Array.isArray(page.list) ? page.list : []
+        this.total = page.total || 0
+      } catch (error) {
+        this.tableData = []
+        this.total = 0
+      } finally {
+        this.loading = false
+      }
+    },
+
+    resetSearch() {
+      this.searchForm.diagnose = ''
+      this.pageNum = 1
+      this.fetchList()
+    },
+
+    handleSizeChange(val) {
+      this.pageSize = val
+      this.fetchList()
+    },
+    handleCurrentChange(val) {
+      this.pageNum = val
+      this.fetchList()
+    },
+
+    handleAdd() {
+      this.isEdit = false
+      this.dialogVisible = true
+      this.$nextTick(() => {
+        this.$refs.diagnoseForm.resetFields()
+      })
+    },
+
+    handleEdit(row) {
+      this.isEdit = true
+      this.form = { ...row }
+      this.dialogVisible = true
+    },
+
+    handleDelete(row) {
+      this.$confirm(`确定删除该诊断?`, '提示', {
+        type: 'warning'
+      }).then(async () => {
+        await deleteCommonDiagnose(row.commonDiagnoseId)
+        this.$message.success('删除成功')
+        this.fetchList()
+      }).catch(() => {})
+    },
+
+    submitForm() {
+      this.$refs.diagnoseForm.validate(async (valid) => {
+        if (!valid) return
+        try {
+          if (this.isEdit) {
+            await editCommonDiagnose(this.form)
+            this.$message.success('编辑成功')
+          } else {
+            await addCommonDiagnose(this.form)
+            this.$message.success('新增成功')
+          }
+          this.dialogVisible = false
+          this.fetchList()
+        } catch (error) {
+          console.error(error)
+        }
+      })
+    },
+
+    resetForm() {
+      this.$refs.diagnoseForm.resetFields()
+      this.form = {
+        commonDiagnoseId: null,
+        diagnose: ''
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+.common-diagnose-page {
+  padding: 20px;
+}
+.search-card {
+  margin-bottom: 16px;
+}
+.toolbar {
+  margin-bottom: 16px;
+  display: flex;
+  justify-content: flex-start;
+}
+.table-card {
+  margin-bottom: 20px;
+}
+.pagination {
+  margin-top: 16px;
+  display: flex;
+  justify-content: flex-end;
+}
+</style>

+ 271 - 0
src/views/myDrugStore/commonlyDrug.vue

@@ -0,0 +1,271 @@
+<template>
+  <div class="commonly-drug-page">
+    <!-- 搜索区域 -->
+    <el-card shadow="never" class="search-card">
+      <el-form :inline="true" :model="searchForm" @submit.native.prevent>
+        <el-form-item label="药品名称">
+          <el-input
+            v-model="searchForm.drugName"
+            placeholder="请输入药品名称"
+            clearable
+            @keyup.enter.native="fetchList"
+          />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" @click="fetchList">搜索</el-button>
+          <el-button @click="resetSearch">重置</el-button>
+        </el-form-item>
+      </el-form>
+    </el-card>
+
+    <!-- 操作按钮 -->
+    <div class="toolbar">
+      <el-button type="primary" @click="handleAdd">新增常用药品</el-button>
+    </div>
+
+    <!-- 药品列表 -->
+    <el-card shadow="never" class="table-card">
+      <el-table
+        :data="tableData"
+        v-loading="loading"
+        border
+        style="width: 100%"
+      >
+        <el-table-column type="index" label="序号" width="60" align="center"></el-table-column>
+        <el-table-column prop="drugName" label="药品名称" min-width="120"></el-table-column>
+        <el-table-column prop="drugSpec" label="规格" min-width="100"></el-table-column>
+        <el-table-column prop="usageMethod" label="用法" min-width="100"></el-table-column>
+        <el-table-column prop="usageFrequencyUnit" label="频次" min-width="80"></el-table-column>
+        <el-table-column prop="usagePerUseCount" label="每次用药数量" min-width="90"></el-table-column>
+
+        <el-table-column label="操作" width="160" fixed="right" align="center">
+          <template slot-scope="{ row }">
+            <el-button type="text" size="small" @click="handleEdit(row)">编辑</el-button>
+            <el-button type="text" size="small" style="color: #f56c6c" @click="handleDelete(row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <!-- 分页 -->
+      <el-pagination
+        v-if="total > 0"
+        class="pagination"
+        background
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="total"
+        :page-size.sync="pageSize"
+        :current-page.sync="pageNum"
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+      >
+      </el-pagination>
+    </el-card>
+
+    <!-- 新增/编辑弹窗 -->
+    <el-dialog
+      :title="dialogTitle"
+      :visible.sync="dialogVisible"
+      width="500px"
+      @close="resetForm"
+    >
+      <el-form
+        ref="drugForm"
+        :model="form"
+        :rules="rules"
+        label-width="100px"
+      >
+        <el-form-item label="药品名称" prop="drugName">
+          <el-input v-model="form.drugName" placeholder="请输入药品名称"></el-input>
+        </el-form-item>
+        <el-form-item label="规格" prop="drugSpec">
+          <el-input v-model="form.drugSpec" placeholder="请输入规格"></el-input>
+        </el-form-item>
+        <el-form-item label="用法" prop="usageMethod">
+          <el-input v-model="form.usageMethod" placeholder="如:口服、外用等"></el-input>
+        </el-form-item>
+        <el-form-item label="频次" prop="usageFrequencyUnit">
+          <el-input v-model="form.usageFrequencyUnit" placeholder="如:每日3次"></el-input>
+        </el-form-item>
+        <el-form-item label="每次用药数量" prop="usagePerUseCount">
+          <el-input v-model="form.usagePerUseCount" placeholder="请输入数量"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer">
+        <el-button @click="dialogVisible = false">取消</el-button>
+        <el-button type="primary" @click="submitForm">确定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {
+  getCommonDrugList,
+  addCommonDrug,
+  editCommonDrug,
+  deleteCommonDrug
+} from '@/api/commonlyDrug'
+
+export default {
+  name: 'CommonlyDrug',
+  data() {
+    return {
+      // 分页
+      pageNum: 1,
+      pageSize: 10,
+      total: 0,
+      loading: false,
+      tableData: [],
+
+      // 搜索
+      searchForm: {
+        drugName: ''
+      },
+
+      // 弹窗
+      dialogVisible: false,
+      isEdit: false,
+      form: {
+        commonDrugId: null,
+        drugName: '',
+        drugSpec: '',
+        usageMethod: '',
+        usageFrequencyUnit: '',
+        usagePerUseCount: ''
+      },
+      rules: {
+        drugName: [{ required: true, message: '请输入药品名称', trigger: 'blur' }],
+        usageMethod: [{ required: true, message: '请输入用法', trigger: 'blur' }]
+      }
+    }
+  },
+  computed: {
+    dialogTitle() {
+      return this.isEdit ? '编辑常用药品' : '新增常用药品'
+    }
+  },
+  created() {
+    this.fetchList()
+  },
+  methods: {
+    // 获取列表
+    async fetchList() {
+      this.loading = true
+      try {
+        const res = await getCommonDrugList({
+          pageNum: this.pageNum,
+          pageSize: this.pageSize,
+          drugName: this.searchForm.drugName || undefined
+        })
+        const page = res.data
+        this.tableData = page.list || []
+        this.total = page.total || 0
+      } catch (error) {
+        this.tableData = []
+        this.total = 0
+      } finally {
+        this.loading = false
+      }
+    },
+
+    // 重置搜索
+    resetSearch() {
+      this.searchForm.drugName = ''
+      this.pageNum = 1
+      this.fetchList()
+    },
+
+    // 分页事件
+    handleSizeChange(val) {
+      this.pageSize = val
+      this.fetchList()
+    },
+    handleCurrentChange(val) {
+      this.pageNum = val
+      this.fetchList()
+    },
+
+    // 新增
+    handleAdd() {
+      this.isEdit = false
+      this.dialogVisible = true
+      this.$nextTick(() => {
+        this.$refs.drugForm.resetFields()
+      })
+    },
+
+    // 编辑
+    handleEdit(row) {
+      this.isEdit = true
+      this.form = { ...row }
+      this.dialogVisible = true
+    },
+
+    // 删除
+    handleDelete(row) {
+      this.$confirm(`确定删除【${row.drugName}】?`, '提示', {
+        type: 'warning'
+      }).then(async () => {
+        await deleteCommonDrug(row.commonDrugId)
+        this.$message.success('删除成功')
+        this.fetchList()
+      }).catch(() => {})
+    },
+
+    // 提交表单
+    submitForm() {
+      this.$refs.drugForm.validate(async (valid) => {
+        if (!valid) return
+        try {
+          if (this.isEdit) {
+            await editCommonDrug(this.form)
+            this.$message.success('编辑成功')
+          } else {
+            await addCommonDrug(this.form)
+            this.$message.success('新增成功')
+          }
+          this.dialogVisible = false
+          this.fetchList()
+        } catch (error) {
+          console.error(error)
+        }
+      })
+    },
+
+    // 重置表单
+    resetForm() {
+      this.$refs.drugForm.resetFields()
+      this.form = {
+        commonDrugId: null,
+        drugName: '',
+        drugSpec: '',
+        usageMethod: '',
+        usageFrequencyUnit: '',
+        usagePerUseCount: ''
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+.commonly-drug-page {
+  padding: 20px;
+}
+.search-card {
+  margin-bottom: 16px;
+}
+.toolbar {
+  margin-bottom: 16px;
+  display: flex;
+  justify-content: flex-start;
+}
+.table-card {
+  margin-bottom: 20px;
+}
+.pagination {
+  margin-top: 16px;
+  display: flex;
+  justify-content: flex-end;
+}
+</style>