LIJU 2 weeks ago
parent
commit
09073a5286

+ 15 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/MzPharmacyController.java

@@ -616,6 +616,21 @@ public class MzPharmacyController {
                 resultMap.put("message", "次数不能为空");
                 return resultMap;
             }
+
+            // ================= 新增:处理药品追溯码数据 =================
+            if (chargeDetailPharmacyVo.getDrugTracCodgList() != null && !chargeDetailPharmacyVo.getDrugTracCodgList().isEmpty()) {
+                // 过滤掉空的追溯码
+                List<MzDrugTracCodg> validTracCodgList = chargeDetailPharmacyVo.getDrugTracCodgList().stream()
+                    .filter(item -> StringUtils.isNotBlank(item.getDrugTracCodg()))
+                    .collect(java.util.stream.Collectors.toList());
+
+                if (!validTracCodgList.isEmpty()) {
+                    // 保存追溯码数据
+                    mzDrugTracCodgService.saveMzDrugTracCodgData(validTracCodgList, tokenUser);
+                }
+            }
+            // ================= 新增结束 =================
+
             resultMap = mzPharmacyService.sendMedicineProcessing(mzChargeDetail, tokenUser,httpServletRequest,true);
             if(ypZdGroupNameService.isXyf(mzChargeDetail.getGroupNo())){
                 dispensingSocketService.sendToMedicine(mzChargeDetail.getPatientId(),chargeDetailPharmacyVo.getWinNo());

+ 11 - 0
src/main/java/cn/hnthyy/thmz/vo/ChargeDetailPharmacyVo.java

@@ -4,6 +4,8 @@ import cn.hnthyy.thmz.entity.his.mz.MzChargeDetail;
 import lombok.Data;
 
 import java.util.Date;
+import cn.hnthyy.thmz.entity.his.mz.MzDrugTracCodg;
+import java.util.List;
 
 /**
  * 门诊药房发药查询条件
@@ -21,4 +23,13 @@ public class ChargeDetailPharmacyVo {
     private MzChargeDetail mzChargeDetail;
     // 血透室打印处方
     private String xtsPrint;
+    private List<MzDrugTracCodg> drugTracCodgList;
+
+    public List<MzDrugTracCodg> getDrugTracCodgList() {
+        return drugTracCodgList;
+    }
+
+    public void setDrugTracCodgList(List<MzDrugTracCodg> drugTracCodgList) {
+        this.drugTracCodgList = drugTracCodgList;
+    }
 }

+ 98 - 2
src/main/resources/static/js/mz/west_pharmacy_send.js

@@ -253,6 +253,32 @@ function sendRefundButtonChange(object, realIndex) {
 function sendMedicineProcessing(realNo, orderNo, receiptNo, times, patientId, name) {
     $("#sendDispose").attr("disabled", true);
     $("#sendDrug").attr("disabled", true);
+    
+    // 收集药品追溯码数据
+    let tableData = $("#tb_table_right").bootstrapTable('getData');
+    let drugTracCodgData = [];
+    for (let i = 0; i < tableData.length; i++) {
+        if (!isEmpty(tableData[i].drugTracCodg)) {
+            drugTracCodgData.push({
+                drugTracCodg: tableData[i].drugTracCodg,
+                patientId: tableData[i].patientId,
+                times: tableData[i].times,
+                receiptNo: tableData[i].receiptNo,
+                orderNo: tableData[i].orderNo,
+                itemNo: tableData[i].itemNo,
+                chargeItemCode: tableData[i].chargeItemCode,
+                serial: tableData[i].serial,
+                groupNo: tableData[i].groupNo,
+                realNo: tableData[i].realNo,
+                specification: tableData[i].specification,
+                drugName: tableData[i].drugname,
+                abbrName: tableData[i].abbrName,
+                unitPrice: tableData[i].unitPrice,
+                flag: '0'
+            });
+        }
+    }
+    
     var temp = {
         winNo: winNo,
         mzChargeDetail: {
@@ -264,7 +290,8 @@ function sendMedicineProcessing(realNo, orderNo, receiptNo, times, patientId, na
             patientId: patientId,
             name: name,
             windowsNoYf: winNo
-        }
+        },
+        drugTracCodgList: drugTracCodgData // 添加药品追溯码数据
     };
     $.ajax({
         type: "POST",
@@ -1360,7 +1387,7 @@ function prescriptionDetail(realNo, orderNo, receiptNo, times, patientId, confir
                         return '<span style="color: red">麻</span>'
                     } else if (value == 3) {
                         return '<span style="color: red">精神1</span>'
-                    } else if (value == 3) {
+                    } else if (value == 4) {
                         return '<span style="color: red">精神2</span>'
                     } else {
                         return '<span style="color: red">-</span>'
@@ -1389,7 +1416,34 @@ function prescriptionDetail(realNo, orderNo, receiptNo, times, patientId, confir
                     return value == null ? "-" : value;
                 }
             }
+            , {
+                field: 'drugTracCodg',
+                title: '药品追溯码',
+                width: '270',
+                align: "left",
+                valign: 'middle',
+                formatter: function (value, row, index) {
+                    return isEmpty(value)?'':value
+                }
+            }
         ],
+        /**
+         * @param {点击列的 field 名称} field
+         * @param {点击列的 value 值} value
+         * @param {点击列的整行数据} row
+         * @param {td 元素} $element
+         */
+        onClickCell: function (field, value, row, $element) {
+            if (field === 'drugTracCodg') {
+                $element.attr('contenteditable', true);
+                $element.focus();
+                $element.blur(function () {
+                    let index = $element.parent().data('index');
+                    let tdValue = $element.html();
+                    saveCellData($('#tb_table_right'), index, field, tdValue);
+                })
+            }
+        },
         responseHandler: function (res) {
             if (res == '401' || res == 401) {
                 window.location.href = '/thmz/login/view'
@@ -2587,4 +2641,46 @@ function requestAs (url, method, data = {},async, contentType, back){
             return typeof back == "function" && back(null);
         }
     });
+}
+
+/**
+ * 新的requestAs函数,用于药品追溯码功能
+ * @param url 请求URL
+ * @param method 请求方法
+ * @param data 请求数据
+ * @param async 是否异步
+ * @param contentType 内容类型
+ * @param back 回调函数
+ */
+function requestAsNew (url, method, data = {},async, contentType, back){
+    $.ajax({
+        type: method,
+        url: url,
+        contentType: contentType,
+        dataType: "json",
+        async: async,
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        data: data,
+        success: function (res) {
+            back(res);
+        },
+        error: function () {
+            back(null);
+        }
+    });
+}
+
+/**
+ * 保存单元格数据
+ * @param table 表格对象
+ * @param index 行索引
+ * @param field 字段名
+ * @param value 新值
+ */
+function saveCellData(table, index, field, value) {
+    table.bootstrapTable('updateCell', {
+        index: index,
+        field: field,
+        value: value
+    });
 }