Browse Source

添加口服药发药打印日志

hsh 2 years ago
parent
commit
e9c20e4a6f

+ 82 - 0
src/main/java/cn/hnthyy/thmz/entity/his/yp/YpYzSendRecord.java

@@ -0,0 +1,82 @@
+package cn.hnthyy.thmz.entity.his.yp;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * @Description: 药品发药医嘱记录表: 记录发药或打印时药品明细信息
+ * @Author: hsh
+ * @CreateTime: 2023-08-02  09:57
+ * @Version: 1.0
+ */
+@Data
+public class YpYzSendRecord {
+
+    private String nbId;
+    /**
+     * 病案号
+     */
+    private String inpatientNo;
+    /**
+     * 住院次数
+     */
+    private Integer admissTimes;
+    /**
+     * 医嘱序列号
+     */
+    private Integer actOrderNo;
+    /**
+     * 页号
+     */
+    private Integer pageNo;
+    /**
+     * 收费码
+     */
+    private String chargeCode;
+    /**
+     * 药序列号
+     */
+    private String serial;
+    /**
+     * 数量
+     */
+    private double amount;
+    /**
+     * 费用产生日期
+     */
+    private Date chargeDate;
+    /**
+     * 执行时间
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private Date occTime;
+    /**
+     * 0 已经发药或退药 1 初始值 2 拒绝发药 3 基数药 4 已生成发药记录,药房未确认(大输液)
+     */
+    private String statusFlag;
+    /**
+     * 药库号
+     */
+    private String groupNo;
+    /**
+     * 药单类别
+     */
+    private String pageClass;
+    /**
+     * 记录类别(1: 发药记录  2: 打印标签记录)
+     */
+    private String recordType;
+    /**
+     * 退药单号
+     */
+    private Integer pageNoTy;
+    /**
+     * 创建日期(发药时间)
+     */
+    private Date sysDate;
+
+}

+ 24 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/yp/YpYzSendRecordMapper.java

@@ -0,0 +1,24 @@
+package cn.hnthyy.thmz.mapper.his.yp;
+
+import cn.hnthyy.thmz.entity.his.yp.YpYzSendRecord;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface YpYzSendRecordMapper {
+
+    @Insert({"<script>" +
+            " insert into yp_yz_send_record (nb_id, inpatient_no, admiss_times, act_order_no, " +
+            " page_no, charge_code, serial, amount, charge_date, occ_time, " +
+            " status_flag, group_no, page_class, record_type, page_no_ty, sys_date) " +
+            " values " +
+            "<foreach collection='list' item='item' index='index' separator=',' >" +
+            "  (#{item.nbId},#{item.inpatientNo},#{item.admissTimes},#{item.actOrderNo}," +
+            "  #{item.pageNo},#{item.chargeCode},#{item.serial},#{item.amount},#{item.chargeDate},#{item.occTime}," +
+            "  #{item.statusFlag},#{item.groupNo},#{item.pageClass},#{item.recordType},#{item.pageNoTy},#{item.sysDate})" +
+            "</foreach>" +
+            "</script>"})
+    int insertYpYzSendRecordList(@Param("list") List<YpYzSendRecord> list);
+
+}

+ 64 - 1
src/main/java/cn/hnthyy/thmz/service/impl/his/yf/YfWardPrescriptionServiceImpl.java

@@ -5,6 +5,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.YpYzSendRecord;
 import cn.hnthyy.thmz.entity.his.yp.YpZdDict;
 import cn.hnthyy.thmz.entity.his.yz.*;
 import cn.hnthyy.thmz.entity.his.zd.ZdCommon;
@@ -15,6 +16,7 @@ import cn.hnthyy.thmz.mapper.his.mz.EmployeeMapper;
 import cn.hnthyy.thmz.mapper.his.mz.MzPharmacyMapper;
 import cn.hnthyy.thmz.mapper.his.yp.YpBaseYfMapper;
 import cn.hnthyy.thmz.mapper.his.yp.YpMzFytjMapper;
+import cn.hnthyy.thmz.mapper.his.yp.YpYzSendRecordMapper;
 import cn.hnthyy.thmz.mapper.his.yp.YpZdDictMapper;
 import cn.hnthyy.thmz.mapper.his.yp.YpZdManufactoryMapper;
 import cn.hnthyy.thmz.mapper.his.yz.*;
@@ -125,6 +127,9 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
     @SuppressWarnings("all")
     @Autowired
     private YzSequenceService yzSequenceService;
+    @SuppressWarnings("all")
+    @Autowired
+    private YpYzSendRecordMapper ypYzSendRecordMapper;
 
     @Override
     public List<YzYpPageNoVo> queryYzYpPageNo(YzYpPageNoVo yzYpPageNoVo) {
@@ -364,7 +369,7 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
                 .collect(Collectors.toMap(YzYpZyOrder::getChargeCode,YzYpZyOrder::getManuNo,(k1,k2)->k2));
         Date now = new Date();
         String[] pageNos = pageNo.split("/");
-        List<YzYpZyOrder> yyzos;
+        List<YzYpZyOrder> yyzos = null;
         int count = 0;
         for (int j = 0; j < pageNos.length; j++) {
             List<YpZyPatient> ypZyPatients = new ArrayList<>();
@@ -576,11 +581,50 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
                 resultMap.put("data", ypZyPatients);
             }
         }
+
+        // 发药记录存根日志,以备查验记录
+        if(yyzos != null && yyzos.size() > 0){
+            // 目前开放长期,临时医嘱单存放日志
+            if("5".equals(yyzos.get(0).getPageClass()) || "6".equals(yyzos.get(0).getPageClass())){
+                List<YzYpZyOrder> yzYpList = new ArrayList<>(yyzos);
+                try {
+                    callSaveSendOrPrintYpYzDetail(yzYpList, "1");
+                } catch (Exception e) {
+                    log.error("发药记录存根日志出错--1");
+                }
+            }
+        }
         resultMap.put("code", 0);
         resultMap.put("message", "保存领药单发药数据成功");
         return resultMap;
     }
 
+    /**
+     * @description: 药品发药医嘱记录表: 记录发药或打印时药品明细信息
+     * @author: hsh 
+     * @date: 2023/8/2 10:15
+     * @param: [yzYpList, status] status: 1 发药  2 打印
+     * @return: void
+     **/
+    public void callSaveSendOrPrintYpYzDetail(List<YzYpZyOrder> yzYpList, String status) {
+        if(yzYpList != null && yzYpList.size() > 0){
+            List<YpYzSendRecord> list = new ArrayList<>();
+            for(YzYpZyOrder yzYpZyOrder : yzYpList){
+                String uuid = UUID.randomUUID().toString();
+                Date now = new Date();
+                YpYzSendRecord record = new YpYzSendRecord();
+                BeanUtils.copyProperties(yzYpZyOrder, record);
+                record.setNbId(uuid);
+                record.setSysDate(now);
+                record.setRecordType(status);
+                // 已发药
+                record.setStatusFlag("0");
+                list.add(record);
+            }
+            ypYzSendRecordMapper.insertYpYzSendRecordList(list);
+        }
+    }
+
     @Override
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
     public Map<String, Object> sendZyWard(String pageNo, String userCode, Integer isTy) throws MzException {
@@ -935,6 +979,25 @@ public class YfWardPrescriptionServiceImpl implements YfWardPrescriptionService
                 i--;
             }
         }
+
+        // 保存口服药打印查询记录信息
+        if(yfWardVos.size() > 0){
+            // 目前开放长期,临时医嘱单存放日志
+            if("5".equals(yfWardVos.get(0).getPageClass()) || "6".equals(yfWardVos.get(0).getPageClass())){
+                List<YzYpZyOrder> yzYpList = new ArrayList<>();
+                for (YfWardVo vo: yfWardVos) {
+                    YzYpZyOrder yz = new YzYpZyOrder();
+                    BeanUtils.copyProperties(vo, yz);
+                    yzYpList.add(yz);
+                }
+                try {
+                    callSaveSendOrPrintYpYzDetail(yzYpList, "2");
+                } catch (Exception e) {
+                    log.error("发药打印存根日志出错--2");
+                }
+            }
+        }
+
         return yfWardVos;
     }