Explorar o código

药品临购以及药品账页维护优化

hsh hai 1 ano
pai
achega
a150e05a9d

+ 17 - 2
src/api/yp-dict/yp-dict-info.js

@@ -38,8 +38,9 @@ export function updateYpStopOrUsed(code, serial, delFlag) {
 
 /**
  * 根据code(药品编码)查询药品账页信息
- * @param {string} code 
- * @returns 
+ * @param {string} code
+ * @param serial serial
+ * @returns
  */
 export function selectYpDictByCode(code, serial) {
     return request({
@@ -115,4 +116,18 @@ export function updateYpJbFlag(code, serial, jbFlag) {
         method: 'get',
         params: { code, serial, jbFlag },
     })
+}
+
+/**
+ * 查询药品库存量
+ * @param code 编码
+ * @param groupNo 药库
+ * @returns {*}
+ */
+export function selectYpStorageInfo(code, groupNo) {
+    return request({
+        url: '/ypDict/selectYpStorageInfo',
+        method: 'get',
+        params: { code, groupNo },
+    })
 }

+ 148 - 56
src/views/yp-dict/YpDictInfo.vue

@@ -14,18 +14,19 @@
       </el-select>
       <el-button type="primary" icon="Search" @click="queryYpDict" style="margin-left: 5px">查询</el-button>
       <el-button type="primary" icon="Plus" @click="addYpDict" style="margin-left: 5px">新增</el-button>
+      <el-button type="primary" icon="Download" @click="exportData" style="margin-left: 5px">导出</el-button>
     </div>
     <div class="layout_display_flex_y layout_flex_1-y">
       <div class="layout_flex_1-y">
         <el-table :data="drugDictData.slice(pageSize * (currentPage - 1), pageSize * currentPage)" border
                   style="width: 100%" height="100%" stripe highlight-current-row>
           <el-table-column type="index" label="序号" width="60" />
-          <el-table-column prop="code" label="药品编码" width="70" />
+          <el-table-column prop="code" label="药品编码" width="80" />
           <el-table-column prop="serial" label="药品包装" width="70" />
-          <el-table-column prop="name" label="药品名称" width="300" show-overflow-tooltip />
+          <el-table-column prop="name" label="药品名称" width="240" show-overflow-tooltip />
           <el-table-column prop="specification" label="药品规格" width="180" show-overflow-tooltip />
           <el-table-column prop="packRetprice" label="药品零售价" width="100" />
-          <el-table-column prop="manuFactory" label="生产厂家" width="180" show-overflow-tooltip />
+          <el-table-column prop="manuFactory" label="生产厂家" width="200" show-overflow-tooltip />
           <el-table-column prop="delFlag" label="状态" width="70">
             <template #default="scope">
               <span v-if="scope.row.delFlag === '1'" style="color:#d12020;">停用</span>
@@ -39,7 +40,7 @@
             </template>
           </el-table-column>
           <el-table-column prop="pyCode" label="拼音码" width="150" />
-          <el-table-column prop="dcode" label="五笔码" width="150" />
+          <el-table-column prop="dCode" label="五笔码" width="150" />
           <el-table-column fixed="right" label="操作" min-width="400" width="400" center>
             <template #default="scope">
               <el-button type="primary" size="small" v-if="!scope.row.isEdit"
@@ -82,11 +83,19 @@
   </el-dialog>
 </template>
 <script setup name="YpDictInfo">
-import { ref, onMounted, nextTick } from 'vue'
-import { ElMessage, ElMessageBox } from 'element-plus'
+import {nextTick, onMounted, ref} from 'vue'
+import {ElMessage, ElMessageBox} from 'element-plus'
+import {clone} from '@/utils/clone'
+import {Export} from '@/utils/ExportExcel'
 import {
-    selectYpDict, updateYpStopOrUsed, selectYpDictByCode, selectYpGroupNameByYfFlag,
-    updateYpTempPurchase, updateYkYpStopOrUsed, updateYpJbFlag
+  selectYpDict,
+  selectYpDictByCode,
+  selectYpGroupNameByYfFlag,
+  selectYpStorageInfo,
+  updateYkYpStopOrUsed,
+  updateYpJbFlag,
+  updateYpStopOrUsed,
+  updateYpTempPurchase
 } from '@/api/yp-dict/yp-dict-info.js'
 import YpZdDict from '@/views/yp-dict/YpZdDict.vue'
 import YpPrintName from '@/views/yp-dict/YpPrintName.vue'
@@ -133,15 +142,12 @@ const queryYpGroupNameByYfFlag = (val) => {
 // 查询
 const queryYpDict = () => {
     isYk.value = !!groupNo.value;
+    if(groupNo.value === undefined){
+      groupNo.value = ''
+    }
     selectYpDict(text.value, groupNo.value)
         .then((res) => {
-            res.forEach(row => {
-                // 是否标记
-                row['isEdit'] = false
-                // 是否新增
-                row['isAdd'] = false
-            })
-            drugDictData.value = res
+          drugDictData.value = res
         })
         .catch(() => {
             drugDictData.value = []
@@ -192,30 +198,53 @@ const stopYpDict = (row) => {
         title = '请确认是否启用<span style="color:#d12020;">' + row.name + '</span>?'
     } else {
         delFlag = '1'
-        title = '请确认是否停用<span style="color:#d12020;">' + row.name + '</span>?'
+        title = '请确认是否停用<span style="color:#d12020;">(药房也全部停用)</span><span style="color:#d12020;">' + row.name + '</span>?'
     }
 
-    ElMessageBox.confirm(title, {
-        cancelButtonText: '取消',
-        confirmButtonText: '确定',
-        type: 'warning',
-        distinguishCancelAndClose: true,
-        dangerouslyUseHTMLString: true
-    }).then(() => {
-        updateYpStopOrUsed(row.code, row.serial, delFlag).then((res) => {
-            ElMessage({
-                type: "success",
-                message: res.cg,
-                duration: 2500,
-                showClose: true,
-            });
-            queryYpDict()
+    // 查询停用药品是否存在库存
+    if('1' !== row.delFlag) {
+      selectYpStorageInfo(row.code, '').then((res) => {
+        ElMessageBox.confirm(res.msg, {
+          cancelButtonText: '取消',
+          confirmButtonText: '确定',
+          type: 'warning',
+          distinguishCancelAndClose: true,
+          dangerouslyUseHTMLString: true
+        }).then(() => {
+          callSaveYpDict(title, row, delFlag)
+        }).catch((action) => {
+          if (action === 'cancel') {
+             queryYpDict()
+          }
         })
-    }).catch((action) => {
-        if (action === 'cancel') {
-            queryYpDict()
-        }
+      })
+    } else {
+      callSaveYpDict(title, row, delFlag)
+    }
+}
+
+const callSaveYpDict = (title, row, delFlag) => {
+  ElMessageBox.confirm(title, {
+    cancelButtonText: '取消',
+    confirmButtonText: '确定',
+    type: 'warning',
+    distinguishCancelAndClose: true,
+    dangerouslyUseHTMLString: true
+  }).then(() => {
+    updateYpStopOrUsed(row.code, row.serial, delFlag).then((res) => {
+      ElMessage({
+        type: "success",
+        message: res.cg,
+        duration: 2500,
+        showClose: true,
+      });
+      queryYpDict()
     })
+  }).catch((action) => {
+    if (action === 'cancel') {
+      queryYpDict()
+    }
+  })
 }
 
 // 设置成临购药品
@@ -276,27 +305,50 @@ const stopYkYpDict = (row) => {
         title = '请确认药库是否停用<span style="color:#d12020;">' + row.name + '</span>?'
     }
 
-    ElMessageBox.confirm(title, {
-        cancelButtonText: '取消',
-        confirmButtonText: '确定',
-        type: 'warning',
-        distinguishCancelAndClose: true,
-        dangerouslyUseHTMLString: true
-    }).then(() => {
-        updateYkYpStopOrUsed(groupNo.value, row.code, row.serial, delFlag).then((res) => {
-            ElMessage({
-                type: "success",
-                message: res.cg,
-                duration: 2500,
-                showClose: true,
-            });
+    // 查询药库停用药品是否存在库存
+    if('1' !== row.ykFlag) {
+      selectYpStorageInfo(row.code, groupNo.value).then((res) => {
+        ElMessageBox.confirm(res.msg, {
+          cancelButtonText: '取消',
+          confirmButtonText: '确定',
+          type: 'warning',
+          distinguishCancelAndClose: true,
+          dangerouslyUseHTMLString: true
+        }).then(() => {
+          callYkYpStopOrUsed(title, row, delFlag)
+        }).catch((action) => {
+          if (action === 'cancel') {
             queryYpDict()
+          }
         })
-    }).catch((action) => {
-        if (action === 'cancel') {
-            queryYpDict()
-        }
+      })
+    } else {
+      callYkYpStopOrUsed(title, row, delFlag)
+    }
+}
+
+const callYkYpStopOrUsed = (title, row, delFlag) => {
+  ElMessageBox.confirm(title, {
+    cancelButtonText: '取消',
+    confirmButtonText: '确定',
+    type: 'warning',
+    distinguishCancelAndClose: true,
+    dangerouslyUseHTMLString: true
+  }).then(() => {
+    updateYkYpStopOrUsed(groupNo.value, row.code, row.serial, delFlag).then((res) => {
+      ElMessage({
+        type: "success",
+        message: res.cg,
+        duration: 2500,
+        showClose: true,
+      });
+      queryYpDict()
     })
+  }).catch((action) => {
+    if (action === 'cancel') {
+      queryYpDict()
+    }
+  })
 }
 
 // 国家基本药物设置
@@ -333,12 +385,52 @@ const baseDrugConfirm = (row) => {
         }
     })
 }
+
+// 导出药品账页信息
+const exportData = () => {
+  if (drugDictData.value.length === 0) {
+    ElMessage({
+      message: "没有可以导出的数据!",
+      type: "warning",
+      duration: 2500,
+      showClose: true,
+    });
+  } else {
+    const title = {
+      code: "药品编码",
+      serial: "药品包装",
+      name: "药品名称",
+      specification: "药品规格",
+      packRetprice: "药品零售价",
+      manuFactory: '生产厂家',
+      delFlag: "状态",
+      ykFlag: "药库状态",
+      pyCode: "拼音码",
+      dCode: "五笔码",
+    };
+
+    const d = clone(drugDictData.value)
+    d.forEach(val => {
+      if (val.delFlag === '1') {
+        val.delFlag = '停用'
+      } else {
+        val.delFlag = ''
+      }
+      if (val.ykFlag === '1') {
+        val.ykFlag = '药库停用'
+      } else {
+        val.ykFlag = ''
+      }
+    });
+    Export(d, title, "药品账页信息")
+  }
+}
 </script>
 
 <style lang="scss">
 .yp-edit-dialog {
-    .el-dialog__body {
-        padding: 2px 5px !important;
-    }
+  .el-dialog__body {
+    padding: 2px 5px !important;
+  }
 }
 </style>

+ 21 - 14
src/views/yp-inventory/TempPurchaseAudit.vue

@@ -22,18 +22,18 @@
                 </el-form-item>
             </el-col>
             <el-col :span="6">
-                <el-form-item label="数量" prop="amount">
-                    <el-input v-model="ruleForm.amount" maxlength="10" show-word-limit
-                        placeholder="请填写数量" disabled />
-                </el-form-item>
+              <el-form-item label="厂家" prop="manuFactory">
+                <el-input v-model="ruleForm.manuFactory" maxlength="32" show-word-limit
+                          placeholder="厂家" disabled/>
+              </el-form-item>
             </el-col>
         </el-row>
         <el-row>
             <el-col :span="6">
-                <el-form-item label="申请人" prop="op">
-                    <el-input v-model="ruleForm.op" maxlength="40" show-word-limit placeholder="请填写申请人"
-                        disabled />
-                </el-form-item>
+              <el-form-item label="数量" prop="amount">
+                <el-input v-model="ruleForm.amount" maxlength="10" show-word-limit
+                          placeholder="请填写数量" disabled />
+              </el-form-item>
             </el-col>
             <el-col :span="6">
                 <el-form-item label="患者姓名" prop="name">
@@ -43,22 +43,28 @@
             </el-col>
             <el-col :span="6">
                 <el-form-item label="住院号" prop="inpatientNo">
-                    <el-input v-model="ruleForm.inpatientNo" maxlength="6" show-word-limit placeholder="请填写住院号"
+                    <el-input v-model="ruleForm.inpatientNo" maxlength="10" show-word-limit placeholder="请填写住院号"
                         disabled />
                 </el-form-item>
             </el-col>
             <el-col :span="6">
-                <el-form-item label="申请日期" prop="applyDate">
-                    <el-input v-model="ruleForm.applyDate" show-word-limit placeholder="请填写申请日期" disabled />
-                </el-form-item>
+              <el-form-item label="申请人" prop="op">
+                <el-input v-model="ruleForm.op" maxlength="40" show-word-limit placeholder="请填写申请人"
+                          disabled />
+              </el-form-item>
             </el-col>
         </el-row>
         <el-row>
-            <el-col :span="24">
+            <el-col :span="18">
                 <el-form-item label="使用理由" prop="useResult">
                     <el-input v-model="ruleForm.useResult" show-word-limit placeholder="请填写使用理由" disabled />
                 </el-form-item>
             </el-col>
+            <el-col :span="6">
+              <el-form-item label="申请日期" prop="applyDate">
+                <el-input v-model="ruleForm.applyDate" show-word-limit placeholder="请填写申请日期" disabled />
+              </el-form-item>
+            </el-col>
         </el-row>
         <el-row>
             <el-col :span="6">
@@ -135,10 +141,12 @@ const ruleForm = ref({
     applyDate: '', // 申请日期
     auditDate: now, // 审核日期
     result: '', // 未采购原因
+    manuFactory: '', // 厂家
 })
 
 onMounted(() => {
     nextTick(() => {
+      console.log(props.ypTempPurchaseDetail)
         ruleForm.value = props.ypTempPurchaseDetail
         ruleForm.value.auditDate = now
     })
@@ -179,7 +187,6 @@ const submitForm = async (formEl) => {
 
                     formEl.resetFields()
                     emit('closeTempPurchaseAudit', true)
-                    return
                 }
             });
         } else {

+ 21 - 13
src/views/yp-inventory/TempPurchaseEdit.vue

@@ -30,18 +30,18 @@
                   </el-form-item>
               </el-col>
               <el-col :span="6">
-                  <el-form-item label="数量" prop="amount">
-                      <el-input v-model="ruleForm.amount" maxlength="10" show-word-limit
-                          placeholder="请填写数量" />
-                  </el-form-item>
+                <el-form-item label="厂家" prop="manuFactory">
+                  <el-input v-model="ruleForm.manuFactory" maxlength="32" show-word-limit
+                            placeholder="厂家" disabled/>
+                </el-form-item>
               </el-col>
           </el-row>
           <el-row>
               <el-col :span="6">
-                  <el-form-item label="申请人" prop="op">
-                      <el-input v-model="ruleForm.op" maxlength="40" show-word-limit placeholder="请填写申请人"
-                          disabled />
-                  </el-form-item>
+                <el-form-item label="数量" prop="amount">
+                  <el-input v-model="ruleForm.amount" maxlength="10" show-word-limit
+                            placeholder="请填写数量" />
+                </el-form-item>
               </el-col>
               <el-col :span="6">
                   <el-form-item label="患者姓名" prop="name">
@@ -50,22 +50,28 @@
               </el-col>
               <el-col :span="6">
                   <el-form-item label="住院号" prop="inpatientNo">
-                      <el-input v-model="ruleForm.inpatientNo" maxlength="6" show-word-limit
+                      <el-input v-model="ruleForm.inpatientNo" maxlength="10" show-word-limit
                           placeholder="请填写住院号" />
                   </el-form-item>
               </el-col>
               <el-col :span="6">
-                  <el-form-item label="申请日期" prop="applyDate">
-                      <el-input v-model="ruleForm.applyDate" show-word-limit placeholder="请填写申请日期" disabled />
-                  </el-form-item>
+                <el-form-item label="申请人" prop="op">
+                  <el-input v-model="ruleForm.op" maxlength="40" show-word-limit placeholder="请填写申请人"
+                            disabled />
+                </el-form-item>
               </el-col>
           </el-row>
           <el-row>
-              <el-col :span="24">
+              <el-col :span="18">
                   <el-form-item label="使用理由" prop="useResult">
                       <el-input v-model="ruleForm.useResult" show-word-limit placeholder="请填写使用理由" />
                   </el-form-item>
               </el-col>
+              <el-col :span="6">
+                <el-form-item label="申请日期" prop="applyDate">
+                  <el-input v-model="ruleForm.applyDate" show-word-limit placeholder="请填写申请日期" disabled />
+                </el-form-item>
+              </el-col>
           </el-row>
           <el-row>
               <el-col :span="24">
@@ -119,6 +125,7 @@ const ruleForm = ref({
     applyDate: now, // 申请日期
     auditDate: '', // 审核日期
     result: '', // 未采购原因
+    manuFactory: '', // 厂家
 })
 
 onMounted(() => {
@@ -149,6 +156,7 @@ const ypChange = async () => {
         ruleForm.value.chargeName = dataF[0].chargeName
         ruleForm.value.serial = dataF[0].serial
         ruleForm.value.specification = dataF[0].specification
+        ruleForm.value.manuFactory = dataF[0].manuFactory
     }
 }
 

+ 12 - 3
src/views/yp-inventory/YpTempPurchase.vue

@@ -45,7 +45,7 @@
                 <el-table-column prop="name" label="患者姓名" width="100"/>
                 <el-table-column prop="inpatientNo" label="住院号" width="100"/>
                 <el-table-column prop="amount" label="数量" width="70"/>
-                <el-table-column prop="manuFactory" label="厂家" width="140" show-overflow-tooltip/>
+                <el-table-column prop="manuFactory" label="厂家" width="160" show-overflow-tooltip/>
                 <el-table-column prop="useResult" label="使用理由" width="200" show-overflow-tooltip/>
                 <el-table-column prop="op" label="申请人" width="100"/>
                 <el-table-column prop="applyDate" label="申请时间" width="140"/>
@@ -71,6 +71,9 @@
                   </template>
                 </el-table-column>
                 <el-table-column prop="result" label="采购情况" width="200" show-overflow-tooltip/>
+                <el-table-column prop="auditName" label="审核" width="100" />
+                <el-table-column prop="purchaseName" label="采购" width="100" />
+                <el-table-column prop="storageName" label="入库" width="100" />
                 <el-table-column fixed="right" label="操作" min-width="80" width="80" header-align="center"
                                  align="center">
                   <template #default="scope">
@@ -156,7 +159,7 @@
               </el-col>
               <el-col :span="6">
                 <el-form-item label="住院号" prop="inpatientNo">
-                  <el-input v-model="ruleForm.inpatientNo" maxlength="6" show-word-limit
+                  <el-input v-model="ruleForm.inpatientNo" maxlength="10" show-word-limit
                             placeholder="请填写住院号"/>
                 </el-form-item>
               </el-col>
@@ -331,7 +334,13 @@ const ruleForm = ref({
   applyDate: now, // 申请日期
   auditDate: '', // 审核日期
   result: '', // 未采购原因
-  manuFactory: '' // 厂家
+  manuFactory: '', // 厂家
+  auditId: '', // 审核人id
+  auditName: '', // 审核人
+  purchaseId: '', // 采购人id
+  purchaseName: '', // 采购人
+  storageId: '', // 入库人id
+  storageName: '', // 入库人
 })
 const rules = ref({
   chargeCode: [