lihong преди 2 седмици
родител
ревизия
6ee6e42b1e

+ 7 - 1
src/main/java/thyyxxk/webserver/dao/his/executeItem/YzYpZyOrderDao.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Update;
+import thyyxxk.webserver.entity.executeItem.YpZyPatient;
 import thyyxxk.webserver.entity.executeItem.YzYpZyOrder;
 
 import java.util.List;
@@ -62,6 +63,11 @@ public interface YzYpZyOrderDao extends BaseMapper<YzYpZyOrder> {
           "</script>")
   int batchInsertData(List<YzYpZyOrder> list);
 
-
+  @Insert("<script> insert into yp_zy_patient (order_date,out_seri,dept_code,ward_code,inpatient_no,name,bed_no,charge_code,serial,amount,drawer,retprice, infant_flag,always_flag,drug_class,acct_sign,total_flag, admiss_times,supply_code,act_order_no,page_no,pay_self,self_flag,separate_flag,suprice_flag,drug_flag,group_no) values  " +
+          " <foreach collection='list' item='item'  separator=','>  " +
+          " (#{item.orderDate,jdbcType=TIMESTAMP},#{item.outSeri},#{item.deptCode},#{item.wardCode},#{item.inpatientNo},#{item.name},#{item.bedNo},#{item.chargeCode},#{item.serial},#{item.amount,jdbcType=DECIMAL},#{item.drawer},#{item.retprice,jdbcType=DECIMAL},#{item.infantFlag},#{item.alwaysFlag},#{item.drugClass},#{item.acctSign},#{item.totalFlag},#{item.admissTimes},#{item.supplyCode},${item.actOrderNoStr},#{item.pageNo},#{item.paySelf},#{item.selfFlag},#{item.separateFlag},#{item.supriceFlag},#{item.drugFlag},#{item.groupNo}) " +
+          " </foreach>  " +
+          " </script> ")
+  int batchInsertYpZyPatient(List<YpZyPatient> list);
 }
 

+ 182 - 0
src/main/java/thyyxxk/webserver/entity/executeItem/YpZyPatient.java

@@ -0,0 +1,182 @@
+package thyyxxk.webserver.entity.executeItem;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 住院病人发药明细表
+ */
+@Data
+@Accessors(chain = true)
+public class YpZyPatient {
+  /**
+   * 发药日期
+   */
+  @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+  private Date orderDate;
+  /**
+   * 序号
+   */
+  private long outSeri;
+  /**
+   * 科室编码
+   */
+  private String deptCode;
+  /**
+   * 病房编码
+   */
+  private String wardCode;
+  /**
+   * 科室编码
+   */
+  private String sectionCode;
+  /**
+   * 病案号
+   */
+  private String inpatientNo;
+  /**
+   * 姓名
+   */
+  private String name;
+  /**
+   * 床位号
+   */
+  private String bedNo;
+  /**
+   * 药品编码
+   */
+  private String chargeCode;
+  /**
+   * 拆零价
+   */
+  private BigDecimal retprice;
+  /**
+   * 数量
+   */
+  private BigDecimal amount;
+  /**
+   * 婴儿用药 1 婴儿  0 成年人
+   */
+  private String infantFlag;
+  /**
+   * 请领人
+   */
+  private String drawer;
+  /**
+   * 经发人
+   */
+  private String keeper;
+  /**
+   * 起始日期
+   */
+  private Date date1;
+  /**
+   * 终止日期
+   */
+  private Date date2;
+  /**
+   * 长期,临时标志
+   */
+  private String alwaysFlag;
+  /**
+   * i_大输液, d_口服,, j_其他
+   */
+  private String drugClass;
+  /**
+   * 0 未结帐 1 已结帐 2 住院接收
+   */
+  private String acctSign;
+  /**
+   *  0 会计未结帐 1 会计已结帐
+   */
+  private String totalFlag;
+  /**
+   * 住院次数
+   */
+  private Integer admissTimes;
+  /**
+   * 给药方式 c_出院带药,q__其他
+   */
+  private String supplyCode;
+  /**
+   * 医嘱号
+   */
+  private BigDecimal actOrderNo;
+  /**
+   * 药单号
+   */
+  private Integer pageNo;
+  /**
+   * 自费标志 1_自费
+   */
+  private String selfFlag;
+  /**
+   * 单列标志
+   */
+  private String separateFlag;
+  /**
+   * 贵重标志1_贵重
+   */
+  private String supriceFlag;
+  /**
+   * 毒麻标志
+   */
+  private String drugFlag;
+  /**
+   * 审批标志 0_无需审批 1_需审批 2_已审批已付费 3_已审批
+   */
+  private String paySelf;
+  /**
+   * 药房编码
+   */
+  private String groupNo;
+  /**
+   * 发药时间
+   */
+  private Date confirmTime;
+  /**
+   * 药品包装序号
+   */
+  private String serial;
+  /**
+   * 医生姓名
+   */
+  private String doctorName;
+  /**
+   *
+   */
+  private String countryFlag;
+  /**
+   * 住院流水号
+   */
+  private String zySerialNo;
+  /**
+   * 药品单类别
+   */
+  private String pageType;
+  /**
+   * 1:节余药品
+   */
+  private String jyFlag;
+  /**
+   * 发药批号
+   */
+  private String manuNo;
+
+  private String actOrderNoStr;
+  public String getActOrderNoStr() {
+    if(actOrderNo != null){
+      actOrderNoStr = actOrderNo.toPlainString();
+    }
+    return actOrderNoStr;
+  }
+
+
+}

+ 64 - 1
src/main/java/thyyxxk/webserver/service/executeItem/GenerateYzService.java

@@ -191,7 +191,18 @@ public class GenerateYzService {
         }
         if(CollUtil.isNotEmpty(param.getYzYpZyOrders())){
             log.info("最终生成的药品医嘱:{}",param.getYzYpZyOrders());
-            yzYpZyOrderDao.insert(param.getYzYpZyOrders());
+            List<YpZyPatient> ypZyPatientList = createYpZyPatient(param.getYzYpZyOrders());
+            if(CollUtil.isNotEmpty(ypZyPatientList)){
+                log.info("自动上账的医嘱:{}",ypZyPatientList);
+                List<List<YpZyPatient>> tempYpZyPatientList = CollUtil.split(ypZyPatientList, 50);
+                for(List<YpZyPatient> temp : tempYpZyPatientList){
+                    yzYpZyOrderDao.batchInsertYpZyPatient(temp);
+                }
+            }
+            List<List<YzYpZyOrder>> tempYzYpZyOrder = CollUtil.split(param.getYzYpZyOrders(),50);
+            for(List<YzYpZyOrder> temp : tempYzYpZyOrder){
+                yzYpZyOrderDao.batchInsertData(temp);
+            }
         }
         //修改状态
         if(CollUtil.isNotEmpty(param.getUpdateStatusYzActOrders())) {
@@ -616,6 +627,58 @@ public class GenerateYzService {
     }
 
 
+    private List<YpZyPatient> createYpZyPatient(List<YzYpZyOrder> yzYpZyOrders){
+        List<YpZyPatient> list = new ArrayList<>();
+        for(YzYpZyOrder yzYpZyOrder : yzYpZyOrders){
+            //基数药自动上账
+            if(NumberEnum.ThREE.getCode().equals(yzYpZyOrder.getStatusFlag()) && !NumberEnum.ONE.getCode().equals(yzYpZyOrder.getPaySelf())){
+                YpZyPatient ypZyPatient = convert2YpZyPatient(yzYpZyOrder,"j");
+                list.add(ypZyPatient);
+                yzYpZyOrder.setStatusFlag(NumberEnum.FOUR.getCode());
+            }
+            //大输液自动上账
+            if(DSY.equals(yzYpZyOrder.getDrugClass()) && NumberEnum.ONE.getCode().equals(yzYpZyOrder.getStatusFlag()) && !NumberEnum.ONE.getCode().equals(yzYpZyOrder.getPaySelf()) && yzYpZyOrder.getAmount().compareTo(BigDecimal.ZERO) > 0){
+                YpZyPatient ypZyPatient = convert2YpZyPatient(yzYpZyOrder,"d");
+                list.add(ypZyPatient);
+                yzYpZyOrder.setStatusFlag(NumberEnum.FOUR.getCode());
+            }
+        }
+        return list;
+    }
+
+    private YpZyPatient convert2YpZyPatient(YzYpZyOrder yzYpZyOrder,String supplyCode){
+        YpZyPatient ypZyPatient = new YpZyPatient();
+        ypZyPatient.setOrderDate(yzYpZyOrder.getOccTime());
+        ypZyPatient.setOutSeri(1);
+        ypZyPatient.setDeptCode(yzYpZyOrder.getDeptCode());
+        ypZyPatient.setWardCode(yzYpZyOrder.getWardCode());
+        ypZyPatient.setInpatientNo(yzYpZyOrder.getInpatientNo());
+        ypZyPatient.setName(yzYpZyOrder.getName());
+        ypZyPatient.setBedNo(yzYpZyOrder.getBedNo());
+        ypZyPatient.setChargeCode(yzYpZyOrder.getChargeCode());
+        ypZyPatient.setSerial(yzYpZyOrder.getSerial());
+        ypZyPatient.setAmount(yzYpZyOrder.getAmount());
+        ypZyPatient.setDrawer(yzYpZyOrder.getDrawer());
+        ypZyPatient.setRetprice(yzYpZyOrder.getRetprice());
+        ypZyPatient.setInfantFlag(yzYpZyOrder.getInfantFlag());
+        ypZyPatient.setAlwaysFlag(yzYpZyOrder.getAlwaysFlag());
+        ypZyPatient.setDrugClass(yzYpZyOrder.getDrugClass());
+        ypZyPatient.setAcctSign("0");
+        ypZyPatient.setTotalFlag("0");
+        ypZyPatient.setAdmissTimes(yzYpZyOrder.getAdmissTimes());
+        ypZyPatient.setSupplyCode(supplyCode);
+        ypZyPatient.setActOrderNo(yzYpZyOrder.getActOrderNo());
+        ypZyPatient.setPageNo(Convert.toInt(yzYpZyOrder.getPageNo()));
+        ypZyPatient.setPaySelf(yzYpZyOrder.getPaySelf());
+        ypZyPatient.setSelfFlag(yzYpZyOrder.getSelfFlag());
+        ypZyPatient.setSeparateFlag(yzYpZyOrder.getSeparateFlag());
+        ypZyPatient.setSupriceFlag(yzYpZyOrder.getSupriceFlag());
+        ypZyPatient.setDrugFlag(yzYpZyOrder.getDrugFlag());
+        ypZyPatient.setGroupNo(yzYpZyOrder.getGroupNo());
+        return ypZyPatient;
+    }
+
+
     /**
      * @description: 获取周几执行  1表示周日,2表示周一  1,7  2,1 3,2  4,3  5,4 6,5 7,6
      * @author: lihong