Ver código fonte

增加住院汇总药单发药打印日志记录

hsh 1 ano atrás
pai
commit
86a70fb849

+ 19 - 0
src/main/java/cn/hnthyy/thmz/controller/yf/YfWardPrescriptionController.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.controller.yf;
 
 import cn.hnthyy.thmz.Utils.DateUtil;
+import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.MzException;
@@ -732,4 +733,22 @@ public class YfWardPrescriptionController {
             return resultMap;
         }
     }
+
+    /**
+     * @Description 打印数据之保存汇总信息核对
+     * @Author hsh
+     * @param vo 打印数据
+     * @return R
+     * @Date 2024/1/31 17:23
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/saveSummaryData", method = {RequestMethod.GET, RequestMethod.POST})
+    public R saveSummaryData(@RequestBody YpSummaryVo vo) {
+        Map<String, Object> result = yfWardPrescriptionService.checkYpSummaryDataByPageNo(vo);
+        String msg = String.valueOf(result.get("msg"));
+        if(StringUtils.isNotBlank(msg)){
+            return R.error(msg).put("msg", msg);
+        }
+        return R.ok("保存打印数据成功").put("msg", "保存打印数据成功");
+    }
 }

+ 35 - 0
src/main/java/cn/hnthyy/thmz/entity/his/yp/YpSummaryPrint.java

@@ -0,0 +1,35 @@
+package cn.hnthyy.thmz.entity.his.yp;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @ClassName YpSummaryPrint
+ * @Author hsh
+ * @Date 2024/2/1 16:04
+ * @Version 1.0
+ * @Description 药品汇总打印记录表
+ **/
+@Data
+public class YpSummaryPrint {
+
+    private String id;
+    private int sort;
+    private String chargeCode;
+    private String serial;
+    private String pageNo;
+    private String pageClass;
+    // 打印数据药单号
+    private String printPageNo;
+    // 打印数据药单类型
+    private String printPageClass;
+    private String submitFlag;
+    private String printFlag;
+    private String result;
+    private String createDate;
+    private BigDecimal amount;
+    private BigDecimal realAmount;
+
+}

+ 2 - 2
src/main/java/cn/hnthyy/thmz/mapper/his/yp/YpBaseMapper.java

@@ -65,7 +65,7 @@ public interface YpBaseMapper {
      * @return
      */
     @Select("<script>" +
-            "select top 30 * from (SELECT distinct c.charge_code," +
+            "select top 60 * from (SELECT distinct c.charge_code," +
             " c.serial," +
             " c.drugname," +
             " c.pack_size," +
@@ -86,7 +86,7 @@ public interface YpBaseMapper {
             "  <when test='ypBase.delFlag!=null'>" +
             "   and isnull(c.del_flag,0)=#{ypBase.delFlag}" +
             "  </when>" +
-            " and c.charge_code=b.charge_code)cc order by del_flag" +
+            " and c.charge_code=b.charge_code)cc order by cc.drugname" +
             "</script>")
     List<YpBase> selectYpBaseByLike(@Param("searchText") String searchText, @Param("ypBase") YpBase ypBase);
 

+ 15 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/zy/YpZyPatientMapper.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.mapper.his.zy;
 
+import cn.hnthyy.thmz.entity.his.yp.YpSummaryPrint;
 import cn.hnthyy.thmz.entity.his.yz.YzYpPageNo;
 import cn.hnthyy.thmz.entity.his.yz.YzYpZyOrder;
 import cn.hnthyy.thmz.entity.his.zy.YpZyPatient;
@@ -237,7 +238,7 @@ public interface YpZyPatientMapper {
                     "       confirm_time=a.confirm_time\n" +
                     "from yp_zy_patient a WITH(NOLOCK)" +
                     " where  a.page_no =#{pageNo} " +
-                    "order by a.inpatient_no,a.occ_time,a.admiss_times,a.charge_code"
+                    "order by a.inpatient_no,a.order_date,a.admiss_times,a.charge_code"
     })
     List<YzYpZyOrder> selectYpZyPatientFyDetail(@Param("pageNo") String pageNo);
 
@@ -330,5 +331,18 @@ public interface YpZyPatientMapper {
             " and inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} ")
     int updateYpZyPatientAmount(YpZyPatient ypZyPatient);
 
+    @Insert({"<script>" +
+            " insert into yp_summary_print (charge_code, serial, page_no, page_class, " +
+            " submit_flag, print_flag, result, amount, real_amount, create_date, " +
+            " id, sort, print_page_no, print_page_class) " +
+            " values " +
+            "<foreach collection='list' item='item' index='index' separator=',' >" +
+            "  (#{item.chargeCode},#{item.serial},#{item.pageNo},#{item.pageClass}," +
+            "  #{item.submitFlag},#{item.printFlag},#{item.result}," +
+            "  #{item.amount},#{item.realAmount},#{item.createDate}," +
+            "  #{item.id},#{item.sort},#{item.printPageNo},#{item.printPageClass})" +
+            "</foreach>" +
+            "</script>"})
+    void insertSummaryData(List<YpSummaryPrint> summaryData);
 
 }

+ 10 - 0
src/main/java/cn/hnthyy/thmz/service/his/yf/YfWardPrescriptionService.java

@@ -6,6 +6,7 @@ import cn.hnthyy.thmz.entity.his.yz.YzYpZyOrder;
 import cn.hnthyy.thmz.entity.his.zy.Prescription;
 import cn.hnthyy.thmz.entity.his.zy.YpZyPatient;
 import cn.hnthyy.thmz.vo.YfWardVo;
+import cn.hnthyy.thmz.vo.YpSummaryVo;
 import cn.hnthyy.thmz.vo.YzActOrderCyDetailVo;
 import cn.hnthyy.thmz.vo.YzActOrderCyVo;
 import cn.hnthyy.thmz.vo.YzYpPageNoVo;
@@ -182,4 +183,13 @@ public interface YfWardPrescriptionService {
      **/
     List<Prescription> selectByjByPageNo(Integer pageNo);
 
+    /**
+     * @Description 打印数据之保存汇总信息核对
+     * @Author hsh
+     * @param
+     * @return
+     * @Date 2024/2/1 9:36
+     */
+    Map<String, Object> checkYpSummaryDataByPageNo(YpSummaryVo vo);
+
 }

+ 63 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/yf/YfWardPrescriptionServiceImpl.java

@@ -6,6 +6,7 @@ import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.YzActOrder;
 import cn.hnthyy.thmz.entity.his.mz.Employee;
 import cn.hnthyy.thmz.entity.his.yp.YpBaseYf;
+import cn.hnthyy.thmz.entity.his.yp.YpSummaryPrint;
 import cn.hnthyy.thmz.entity.his.yp.YpYzSendRecord;
 import cn.hnthyy.thmz.entity.his.yp.YpZdDict;
 import cn.hnthyy.thmz.entity.his.yz.*;
@@ -27,9 +28,11 @@ import cn.hnthyy.thmz.mapper.his.zy.*;
 import cn.hnthyy.thmz.service.his.yf.YfWardPrescriptionService;
 import cn.hnthyy.thmz.service.his.yz.YzSequenceService;
 import cn.hnthyy.thmz.vo.YfWardVo;
+import cn.hnthyy.thmz.vo.YpSummaryVo;
 import cn.hnthyy.thmz.vo.YzActOrderCyDetailVo;
 import cn.hnthyy.thmz.vo.YzActOrderCyVo;
 import cn.hnthyy.thmz.vo.YzYpPageNoVo;
+import cn.hutool.core.date.DateUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.json.JSONObject;
@@ -1101,4 +1104,64 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
         String hisId = String.valueOf(pageNo);
         return prescriptionMapper.selectByjByPageNo(hisId);
     }
+
+    @Override
+    public Map<String, Object> checkYpSummaryDataByPageNo(YpSummaryVo vo) {
+        Map<String, Object> resultMap = new HashMap<>();
+        List<YpSummaryPrint> summaryData = vo.getSummaryData();
+        if(null == summaryData || summaryData.isEmpty()){
+            return resultMap;
+        }
+        List<YfWardVo> yfWardVos;
+        if ("A".equals(vo.getPageClass())) {//医技科室领药
+            yfWardVos = queryZyDrug(vo.getPageNo(), vo.getSubmitFlag());
+        } else {
+            yfWardVos = queryYzYpOrder(vo.getPageNo(), vo.getPageClass(), vo.getSubmitFlag());
+        }
+        String msg = "";
+        boolean flag = false;
+        int pid = 1;
+        for(YpSummaryPrint ypPrint : summaryData){
+            String chargeCode = ypPrint.getChargeCode();
+            String serial = ypPrint.getSerial();
+            BigDecimal amount = ypPrint.getAmount();
+            for (YfWardVo yf : yfWardVos){
+                if(chargeCode.equals(yf.getChargeCode()) && serial.equals(yf.getSerial())){
+                    if(amount.doubleValue() == yf.getAmount()){
+                        ypPrint.setResult("正常");
+                    } else {
+                        if(StringUtils.isBlank(msg)){
+                            msg += "有误差,实际发药数量: " + yf.getAmount() + ", 打印数量: " + amount + " 。。。";
+                        }
+                        ypPrint.setResult("有误差,实际发药数量: " + yf.getAmount() + ", 打印数量: " + amount);
+                        if(!flag){
+                            flag = true;
+                        }
+                    }
+                    ypPrint.setId(String.valueOf(System.currentTimeMillis()));
+                    ypPrint.setSort(pid);
+                    ypPrint.setPageNo(vo.getPageNo());
+                    ypPrint.setPageClass(vo.getPageClass());
+                    ypPrint.setSubmitFlag(String.valueOf(vo.getSubmitFlag()));
+                    ypPrint.setPrintFlag(vo.getPrintFlag());
+                    // 医嘱实际发药量
+                    ypPrint.setRealAmount(BigDecimal.valueOf(yf.getAmount()));
+                    ypPrint.setCreateDate(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
+                    pid ++;
+                    break;
+                }
+            }
+        }
+        if(StringUtils.isNotBlank(msg)) {
+            vo.setMessage(msg);
+        }
+        if(flag){
+            List<List<YpSummaryPrint>> result = ListSizeControlUtil.splitList(summaryData, 70);
+            for (List<YpSummaryPrint> record: result) {
+                ypZyPatientMapper.insertSummaryData(record);
+            }
+        }
+        resultMap.put("msg", msg);
+        return resultMap;
+    }
 }

+ 27 - 0
src/main/java/cn/hnthyy/thmz/vo/YpSummaryVo.java

@@ -0,0 +1,27 @@
+package cn.hnthyy.thmz.vo;
+
+import cn.hnthyy.thmz.entity.his.yp.YpSummaryPrint;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName SummaryData
+ * @Author hsh
+ * @Date 2024/2/1 9:14
+ * @Version 1.0
+ * @Description 药品汇总单打印数据
+ **/
+@Data
+public class YpSummaryVo {
+
+    private String pageNo;
+    private String pageClass;
+    private Integer submitFlag;
+    // 0:手动打印 1:保存后自动打印
+    private String printFlag;
+    private String message;
+    private List<YpSummaryPrint> summaryData;
+
+}

+ 2 - 0
src/main/resources/static/js/fy_config.js

@@ -80,6 +80,8 @@ function getLastDispensingWindowsByCurrentUser() {
     $('#groupNo').selectpicker('refresh');
     $('#groupYk').selectpicker('val',getLocalStorage("groupYk"));
     $('#groupYk').selectpicker('refresh');
+    $('#xtsPrint').selectpicker('val',getLocalStorage("xtsPrint"));
+    $('#xtsPrint').selectpicker('refresh');
 }
 
 //延迟加载方法

+ 44 - 0
src/main/resources/static/js/yf/ward_prescription.js

@@ -1186,8 +1186,16 @@ function printXyCount(flag) {
     let totalMoney = 0;
     $('.sjh').remove();
     let datas = getJQAllData("tb_summarizing_table");
+    let summaryData = [];
     for (var i = 0; i < datas.length; i++) {
         let data = datas[i];
+        let summaryInfo = {chargeCode:'', serial: '',amount:0, printPageNo:'', printPageClass:'' };
+        summaryInfo.chargeCode = data.chargeCode;
+        summaryInfo.serial = data.serial;
+        summaryInfo.amount = data.amount;
+        summaryInfo.printPageNo = data.pageNo;
+        summaryInfo.printPageClass = data.pageClass;
+        summaryData.push(summaryInfo)
         let handle = data.fybz;
         if (pageClass === "T" || pageClass === "HT") {
             if (data.tybz == 0) {
@@ -1208,6 +1216,7 @@ function printXyCount(flag) {
         html += '<td class="xtd" style="text-align: center;">' + data.totalMoney + '</td>';
         html += '</tr>';
         totalMoney += parseFloat(data.totalMoney);
+        summaryInfo = {chargeCode:'', serial: '',amount:0, printPageNo:'', printPageClass:''};
     }
     html += '<tr class="sjh">';
     html += '<td colspan="8" style="text-align: right;font-weight: 700;">总计:' + keepTwoDecimal(parseFloat(totalMoney)) + '</td>';
@@ -1234,6 +1243,9 @@ function printXyCount(flag) {
     $(".pageNo").text($("#pageNoSearch").val() == '' ? pageNos : $("#pageNoSearch").val());
     $(".printDate").html(format(new Date(), "yyyy-MM-dd HH:mm"));
     print("hzdy_table_div");
+    // 保存打印数据记录以供数据核对
+    saveSummaryData(flag, summaryData);
+
 }
 
 /**
@@ -1962,3 +1974,35 @@ function callByj(){
 
 }
 
+function saveSummaryData(printFlag, summaryData) {
+    if(summaryData.length === 0){
+        return;
+    }
+    $.ajax({
+        type: "POST",
+        url: '/thmz/saveSummaryData',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        data: JSON.stringify({
+            pageNo: $("#pageNoSearch").val(),
+            pageClass: pageClass,
+            submitFlag: $("#submitFlagSearch").val(),
+            printFlag: printFlag,
+            summaryData: summaryData
+        }),
+        success: function (res) {
+            if (res === '401' || res === 401) {
+                window.location.href = '/thmz/login/view';
+                return;
+            }
+            if (res.code === 0) {
+                // 提示药单不一致的情况
+                // successMesage(res);
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
+}
+