Parcourir la source

初步完成草药医嘱

xiaochan il y a 3 ans
Parent
commit
337967b77d

+ 54 - 6
src/main/java/thyyxxk/webserver/controller/zhuyuanyizheng/CaoYaoYiZhuController.java

@@ -2,16 +2,20 @@ package thyyxxk.webserver.controller.zhuyuanyizheng;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import thyyxxk.webserver.config.auth.PassToken;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
+import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.CaoYaoChaXunTiaoJian;
 import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.YzActOrderCy;
-import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.caoYaoChaXunTiaoJian;
+import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.YzActOrderCyDetail;
+import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.YzOrderPatternCy;
+import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.YiZhuMingChen;
 import thyyxxk.webserver.service.zhuyuanyisheng.CaoYaoYiZhuServer;
 
+import java.math.BigDecimal;
+import java.util.List;
+
 /**
  * <p>
  * 描述: 草药医嘱
@@ -32,8 +36,52 @@ public class CaoYaoYiZhuController {
 
     @PostMapping("/huoQuCaoYaoShuJu")
     @PassToken
-    public ResultVo<IPage<YzActOrderCy>> huoQuCaoYaoShuJu(@RequestBody @Validated caoYaoChaXunTiaoJian param) {
+    public ResultVo<IPage<YzActOrderCy>> huoQuCaoYaoShuJu(@RequestBody @Validated CaoYaoChaXunTiaoJian param) {
         return server.huoQuCaoYaoShuJu(param);
     }
 
+    @GetMapping("/huoQuChaoYaoMingXi")
+    public ResultVo<List<YzActOrderCyDetail>> huoQuChaoYaoMingXi(@RequestParam("orderNo") BigDecimal orderNo) {
+        return server.huoQuChaoYaoMingXi(orderNo);
+    }
+
+    @GetMapping("/fuYongFangFa")
+    public ResultVo<List<GetDropdownBox>> fuYongFangFa() {
+        return server.fuYongFangFa();
+    }
+
+    @GetMapping("/huoQuCaoYao")
+    public ResultVo<IPage<YiZhuMingChen>> huoQuCaoYao(@RequestParam("queryName") String queryName,
+                                                      @RequestParam("groupNo") Integer groupNo,
+                                                      @RequestParam("currentPage") long currentPage,
+                                                      @RequestParam("pageSize") long pageSize,
+                                                      @RequestParam("total") long total) {
+        return server.huoQuCaoYao(queryName, groupNo, currentPage, pageSize, total);
+    }
+
+    @GetMapping("/huoQuMuBan")
+    public ResultVo<IPage<YzOrderPatternCy>> huoQuMuBan(@RequestParam("queryName") String queryName,
+                                                        @RequestParam("deptCode") String deptCode,
+                                                        @RequestParam("currentPage") long currentPage,
+                                                        @RequestParam("pageSize") long pageSize,
+                                                        @RequestParam("total") long total) {
+        return server.huoQuMuBan(queryName, deptCode, currentPage, pageSize, total);
+    }
+
+    @GetMapping("/chongFuMuBanMing")
+    public ResultVo<Boolean> chongFuMuBanMing(String name) {
+        return server.chongFuMuBanMing(name);
+    }
+
+    @GetMapping("/muBanXiangQing")
+    public ResultVo<List<YzOrderPatternCy>> muBanXiangQing(@RequestParam("name") String name,
+                                                           @RequestParam("deptCode") String deptCode) {
+        return server.muBanXiangQing(name, deptCode);
+    }
+
+    @PostMapping("/cunMuBan")
+    public ResultVo<String> cunMuBan(@RequestBody YzOrderPatternCy param) {
+        return server.cunMuBan(param);
+    }
+
 }

+ 111 - 1
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/CaoYaoYiZhuDao.java

@@ -1,12 +1,21 @@
 package thyyxxk.webserver.dao.his.zhuyuanyisheng;
 
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
+import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.YzActOrderCy;
+import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.YzActOrderCyDetail;
+import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.YzOrderPatternCy;
+import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.YiZhuMingChen;
+
+import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * <p>
@@ -27,10 +36,111 @@ public interface CaoYaoYiZhuDao {
             "       order_je_dj, " +
             "       quantity, " +
             "       quantity_dj, " +
-            "       order_code_dj " +
+            "       order_code_dj," +
+            "       input_date," +
+            "       exec_dept, " +
+            "       exec_dept_name = (select name from zd_unit_code where code = exec_dept) " +
             "from yz_act_order_cy " +
             "${ew.customSqlSegment} ")
     IPage<YzActOrderCy> huoQuCaoYaoShuJu(IPage<YzActOrderCy> page,
                                          @Param(Constants.WRAPPER) Wrapper<?> wp);
 
+    @Select("select isnull(charge_amount,0) from zd_charge_item where code = '008573' ")
+    BigDecimal huoQuDaiJianFei();
+
+
+    @Select("select chargeCodeName = (select rtrim(name) from view_yp_zd_dict_base_yf where code = charge_code)," +
+            "       group_no_name  = (select rtrim(group_name) " +
+            "                         from yp_zd_group_name " +
+            "                         where yz_act_order_cy_detail.group_no = yp_zd_group_name.group_no), " +
+            "       * " +
+            "from yz_act_order_cy_detail " +
+            "where order_no = #{orderNo}")
+    List<YzActOrderCyDetail> huoQuChaoYaoMingXi(BigDecimal orderNo);
+
+    @Select("SELECT code, name FROM mzysh_zd_fysm")
+    List<GetDropdownBox> fuYongFangFa();
+
+
+    @Select("SELECT            code as chargeCode, " +
+            "                  name as chargeCodeName, " +
+            "                  specification, " +
+            "                  'z'  as asorderType, " +
+            "                  serial, " +
+            "                  group_no, " +
+            "                  infusion_flag, " +
+            "                  drug_flag, " +
+            "                  group_name, " +
+            "                  pack_size, " +
+            "    order_class ='Y', " +
+            "    retprice=pack_retprice, " +
+            "    self_flag   = isnull(self_flag, '0'), " +
+            "                  suprice_flag " +
+            "FROM view_yp_zd_dict_base_yf " +
+            "${ew.customSqlSegment} AND isnull(visible_flag_zy, '') <> '1' ")
+    IPage<YiZhuMingChen> huoQuCaoYao(IPage<YiZhuMingChen> page,
+                                     @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
+
+
+    @Select("select pattern_name, " +
+            "       group_no =max(group_no), " +
+            "       dept_code=max(dept_code) " +
+            "from yz_order_pattern_cy " +
+            " ${ew.customSqlSegment} ")
+    IPage<YzOrderPatternCy> huoQuMuBan(IPage<YzOrderPatternCy> page,
+                                       @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper);
+
+
+    @Select("SELECT distinct charge_code=a.charge_code, " +
+            "                serial=a.serial, " +
+            "                group_no=a.group_no, " +
+            "                quantity=a.quantity, " +
+            "                retprice=b.pack_retprice, " +
+            "                supply_code=a.supply_code, " +
+            "                instruction=a.instruction, " +
+            "                charge_code_name=b.name," +
+            "                b.specification, " +
+            "                b.self_flag, " +
+            "                b.suprice_flag " +
+            "FROM yz_order_pattern_cy a, " +
+            "     yp_zd_dict b, " +
+            "     yp_base_yf c " +
+            "where a.charge_code = b.code " +
+            "  and a.serial = b.serial " +
+            "  and a.charge_code = c.charge_code " +
+            "  and a.serial = c.serial " +
+            "  and (case " +
+            "           when isnull(b.del_flag, '0') = '1' then '1' " +
+            "           when isnull(b.del_flag, '0') = '1' then '1' " +
+            "           when isnull(c.visible_flag_zy, '0') = '1' then '1' " +
+            "           else '0' end) <> 1 " +
+            "  and a.pattern_name = #{name} " +
+            "  and a.dept_code = #{deptCode} ")
+    List<YzOrderPatternCy> muBanXiangQing(@Param("name") String name,
+                                          @Param("deptCode") String deptCode);
+
+    @Select("select count(1) " +
+            "from yz_order_pattern_cy " +
+            "where pattern_name = #{name}")
+    Integer chongFuMuBanMing(String name);
+
+
+    @Insert("<script>" +
+            "insert into yz_order_pattern_cy (pattern_name, charge_code, serial, group_no, quantity, supply_code, instruction, " +
+            "                                 dept_code, create_id, py_code, d_code) " +
+            "values " +
+            "<foreach collection='list' item='item' separator=','>" +
+            "(#{name}, #{item.chargeCode}, #{item.serial}, #{item.groupNo}, " +
+            "#{item.quantity} , null, #{item.instruction}, #{deptCode}, " +
+            "        #{userCode}, #{pyCode}, #{dCode})" +
+            "</foreach>" +
+            "</script>")
+    void chaRuMuBan(@Param("list") List<YzOrderPatternCy> list,
+                    @Param("name") String name,
+                    @Param("userCode") String userCode,
+                    @Param("pyCode") String pyCode,
+                    @Param("dCode") String dCode,
+                    @Param("deptCode") String deptCode);
+
+
 }

+ 3 - 0
src/main/java/thyyxxk/webserver/entity/datamodify/GetDropdownBox.java

@@ -23,4 +23,7 @@ public class GetDropdownBox {
 
     @JsonInclude(JsonInclude.Include.NON_NULL)
     private String empTitName;
+
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    private String parentCode;
 }

+ 30 - 0
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/caoyaoyizhu/CaoYaoChaXunTiaoJian.java

@@ -0,0 +1,30 @@
+package thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * <p>
+ * 描述: 草药医嘱查询条件
+ * </p>
+ *
+ * @author xc
+ * @date 2022-02-26 11:09
+ */
+@Data
+public class CaoYaoChaXunTiaoJian {
+    @NotNull(message = "住院号不能为空")
+    @NotBlank(message = "住院号不能为空")
+    private String patNo;
+    @NotNull(message = "住院次数不能为空")
+    private Integer times;
+
+    private String startTime;
+    private String endTime;
+
+    private long currentPage;
+    private long pageSize;
+    private long total;
+}

+ 197 - 175
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/caoyaoyizhu/YzActOrderCy.java

@@ -1,182 +1,204 @@
 package thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu;
 
-import java.io.Serializable;
 import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 
 @Data
-public class YzActOrderCy  implements Serializable {
-
-	private static final long serialVersionUID =  1453078027541397715L;
-
-	/**
-	 * inpatientNo
-	 */
-	private String inpatientNo;
-
-	/**
-	 * admissTimes
-	 */
-	private Integer admissTimes;
-
-	/**
-	 * zySerialNo
-	 */
-	private String zySerialNo;
-
-	/**
-	 * 医嘱号
-	 */
-	private Integer orderNo;
-
-	/**
-	 * 01-小包装 99-大包装
-	 */
-	private Integer serialNo;
-
-	/**
-	 * 医嘱名,处方名
-	 */
-	private String orderName;
-
-	/**
-	 * 金额
-	 */
-	private Double orderJe;
-
-	/**
-	 * 单剂金额
-	 */
-	private Double orderJeDj;
-
-	/**
-	 * 数量
-	 */
-	private Double quantity;
-
-	/**
-	 * 单剂数量
-	 */
-	private Double quantityDj;
-
-	/**
-	 * orderCodeDj
-	 */
-	private String orderCodeDj;
-
-	/**
-	 * doctorCode
-	 */
-	private String doctorCode;
-
-	/**
-	 * inputId
-	 */
-	private String inputId;
-
-	/**
-	 * inputDate
-	 */
-	private Date inputDate;
-
-	/**
-	 * chargeId
-	 */
-	private String chargeId;
-
-	/**
-	 * chargeDate
-	 */
-	private Date chargeDate;
-
-	/**
-	 * confirmId
-	 */
-	private String confirmId;
-
-	/**
-	 * confirmDate
-	 */
-	private Date confirmDate;
-
-	/**
-	 * 药单号
-	 */
-	private Integer pageNo;
-
-	/**
-	 * statusFlag
-	 */
-	private String statusFlag;
-
-	/**
-	 * 申请科室
-	 */
-	private String deptCode;
-
-	/**
-	 * 申请病房
-	 */
-	private String wardCode;
-
-	/**
-	 * printId
-	 */
-	private String printId;
-
-	/**
-	 * cyMtjs
-	 */
-	private Integer cyMtjs;
-
-	/**
-	 * cyJsl
-	 */
-	private Integer cyJsl;
-
-	/**
-	 * cyZql
-	 */
-	private Integer cyZql;
-
-	/**
-	 * cyFj
-	 */
-	private Integer cyFj;
-
-	/**
-	 * cyFfcs
-	 */
-	private Integer cyFfcs;
-
-	/**
-	 * cyFysm
-	 */
-	private Integer cyFysm;
-
-	/**
-	 * cyJssm
-	 */
-	private String cyJssm;
-
-	/**
-	 * submitId
-	 */
-	private String submitId;
-
-	/**
-	 * submitDate
-	 */
-	private Date submitDate;
-
-	/**
-	 * execDept
-	 */
-	private String execDept;
-
-	/**
-	 * 药房 草药,中药颗粒
-	 */
-	private String groupNo;
-
+public class YzActOrderCy implements Serializable {
+
+    private static final long serialVersionUID = 1453078027541397715L;
+
+    /**
+     * inpatientNo
+     */
+    private String inpatientNo;
+
+    /**
+     * admissTimes
+     */
+    private Integer admissTimes;
+
+    /**
+     * zySerialNo
+     */
+    private String zySerialNo;
+
+    /**
+     * 医嘱号
+     */
+    private Integer orderNo;
+
+    /**
+     * 01-小包装 99-大包装
+     */
+    private Integer serialNo;
+
+    /**
+     * 医嘱名,处方名
+     */
+    private String orderName;
+
+    /**
+     * 金额
+     */
+    private BigDecimal orderJe;
+
+    /**
+     * 单剂金额
+     */
+    private BigDecimal orderJeDj;
+
+    /**
+     * 数量
+     */
+    private BigDecimal quantity;
+
+    /**
+     * 代煎数量
+     */
+    private BigDecimal quantityDj;
+
+    /**
+     * orderCodeDj
+     */
+    private String orderCodeDj;
+
+    /**
+     * doctorCode
+     */
+    private String doctorCode;
+    private String doctorCodeName;
+
+    /**
+     * inputId
+     */
+    private String inputId;
+
+    /**
+     * inputDate
+     */
+    private Date inputDate;
+
+    /**
+     * chargeId
+     */
+    private String chargeId;
+
+    /**
+     * chargeDate
+     */
+    private Date chargeDate;
+
+    /**
+     * 确认人
+     */
+    private String confirmId;
+
+    /**
+     * 确认时间
+     */
+    private Date confirmDate;
+
+    /**
+     * 药单号
+     */
+    private Integer pageNo;
+
+    /**
+     * 状态 1-录入 2-收费 3-提交
+     */
+    private String statusFlag;
+
+    /**
+     * 申请科室
+     */
+    private String deptCode;
+
+    /**
+     * 申请病房
+     */
+    private String wardCode;
+
+    /**
+     * printId
+     */
+    private String printId;
+
+    /**
+     * 每天剂数
+     */
+    private Integer cyMtjs;
+
+    /**
+     * 加水量
+     */
+    private Integer cyJsl;
+
+    /**
+     * 煮取量
+     */
+    private Integer cyZql;
+
+    /**
+     * 复煎次数
+     */
+    private Integer cyFj;
+
+    /**
+     * 分多少次
+     */
+    private Integer cyFfcs;
+
+    /**
+     * 服用说明
+     */
+    private Integer cyFysm;
+
+    /**
+     * 加水类型
+     */
+    private String cyJssm;
+
+    /**
+     * 确认人
+     */
+    private String submitId;
+
+    /**
+     * 确认时间
+     */
+    private Date submitDate;
+
+    /**
+     * 执行科室
+     */
+    private String execDept;
+    private String execDeptName;
+
+    /**
+     * 药房 81-草药,82-中药颗粒
+     */
+    private String groupNo;
+
+    /**
+     * 总价 剂数 * 代煎费 + 剂数 * 单剂金额
+     */
+    private BigDecimal zongJia;
+
+    /**
+     * 代煎费
+     */
+    private BigDecimal daiJianFei;
+
+    /**
+     * 这个不是总价是这个药品的总价
+     */
+    private BigDecimal jiaGe;
+
+    /*
+     * 95118
+     * */
 }

+ 59 - 0
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/caoyaoyizhu/YzActOrderCyDetail.java

@@ -0,0 +1,59 @@
+package thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class YzActOrderCyDetail implements Serializable {
+
+    private static final long serialVersionUID = 6741076521438977931L;
+
+    /**
+     * 医嘱号
+     */
+    private Integer orderNo;
+
+    /**
+     * 01-小包装 99-大包装
+     */
+    private Integer serialNo;
+
+    /**
+     * 项目编码
+     */
+    private String chargeCode;
+    private String chargeCodeName;
+
+    /**
+     * 01-小包装 99-大包装
+     */
+    private String serial;
+
+    /**
+     * 药房,草药,中药颗粒
+     */
+    private String groupNo;
+    private String groupNoName;
+
+    /**
+     * 数量
+     */
+    private Double quantity;
+
+    /**
+     * 金额
+     */
+    private Double unitPrice;
+
+    /**
+     * 给药方式
+     */
+    private String supplyCode;
+
+    /**
+     * 说明
+     */
+    private String instruction;
+
+}

+ 78 - 0
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/caoyaoyizhu/YzOrderPatternCy.java

@@ -0,0 +1,78 @@
+package thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+public class YzOrderPatternCy implements Serializable {
+
+    private static final long serialVersionUID = 4364609461765587910L;
+
+    /**
+     * patternName
+     */
+    private String patternName;
+    private String chargeCodeName;
+
+    /**
+     * chargeCode
+     */
+    private String chargeCode;
+
+    /**
+     * serial
+     */
+    private String serial;
+
+    /**
+     * groupNo
+     */
+    private String groupNo;
+
+    /**
+     * quantity
+     */
+    private BigDecimal quantity;
+    /**
+     * 草药医嘱用的 金额
+     */
+    private BigDecimal retprice;
+
+    /**
+     * supplyCode
+     */
+    private String supplyCode;
+
+    /**
+     * instruction
+     */
+    private String instruction;
+
+    /**
+     * deptCode
+     */
+    private String deptCode;
+
+    /**
+     * createId
+     */
+    private String createId;
+
+    /**
+     * pyCode
+     */
+    private String pyCode;
+
+    /**
+     * dCode
+     */
+    private String dCode;
+    private String selfFlag;
+    private String supriceFlag;
+
+    private List<YzOrderPatternCy> list;
+
+}

+ 2 - 0
src/main/java/thyyxxk/webserver/entity/zhuyuanyisheng/yizhuluru/YiZhuMingChen.java

@@ -39,6 +39,8 @@ public class YiZhuMingChen {
     private String ybType;
     private String fatherFlag;
     private String manuName;
+
+
     /**
      * 库存
      */

+ 15 - 3
src/main/java/thyyxxk/webserver/service/PublicServer.java

@@ -188,10 +188,22 @@ public class PublicServer {
      * @return 返回科室
      */
     public List<String> getKeShiLieBiaoList(String deptCode) {
-        if (StringUtil.isBlank(deptCode) || deptCode.equals("3100000")) {
-            return new ArrayList<>();
+        if (noNeedRule(new int[]{1})) {
+            Map<String, GetDropdownBox> map = dao.getKeShiLieBiao(deptCode).stream().collect(
+                    Collectors.toMap(GetDropdownBox::getCode, a -> a, (k1, k2) -> k1));
+            if (StringUtil.isBlank(map.get(deptCode).getParentCode())) {
+                return new ArrayList<>(map.keySet());
+            }
+
+            return new ArrayList<String>() {
+                private static final long serialVersionUID = 2312160342677560231L;
+
+                {
+                    add(deptCode);
+                }
+            };
         }
-        return dao.getKeShiLieBiao(deptCode);
+        return new ArrayList<>();
     }
 
     /**

+ 0 - 2
src/main/java/thyyxxk/webserver/service/casefrontsheet/JieShouHuiZhenService.java

@@ -45,8 +45,6 @@ public class JieShouHuiZhenService {
      */
     public ResultVo<Page<JieShouHuiZhenPojo>> getHuiZhenData(String deptCode, long currentPage, long pageSize, String startTime, String endTime) {
         List<String> deptList = publicServer.getKeShiLieBiaoList(deptCode);
-
-        log.info("科室列表:{}", deptList);
         QueryWrapper<?> qw = new QueryWrapper<>();
         qw.eq("status_flag", "1")
                 .ge("req_date", startTime)

+ 83 - 4
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/CaoYaoYiZhuServer.java

@@ -1,16 +1,28 @@
 package thyyxxk.webserver.service.zhuyuanyisheng;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.dao.his.zhuyuanyisheng.CaoYaoYiZhuDao;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
+import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.CaoYaoChaXunTiaoJian;
 import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.YzActOrderCy;
-import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.caoYaoChaXunTiaoJian;
+import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.YzActOrderCyDetail;
+import thyyxxk.webserver.entity.zhuyuanyisheng.caoyaoyizhu.YzOrderPatternCy;
+import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.YiZhuMingChen;
+import thyyxxk.webserver.service.PublicServer;
+import thyyxxk.webserver.utils.PingYinUtils;
 import thyyxxk.webserver.utils.ResultVoUtil;
 import thyyxxk.webserver.utils.StringUtil;
+import thyyxxk.webserver.utils.TokenUtil;
+
+import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * <p>
@@ -25,13 +37,15 @@ import thyyxxk.webserver.utils.StringUtil;
 public class CaoYaoYiZhuServer {
 
     private final CaoYaoYiZhuDao dao;
+    private final PublicServer publicServer;
 
-    public CaoYaoYiZhuServer(CaoYaoYiZhuDao dao) {
+    public CaoYaoYiZhuServer(CaoYaoYiZhuDao dao, PublicServer publicServer) {
         this.dao = dao;
+        this.publicServer = publicServer;
     }
 
-    public ResultVo<IPage<YzActOrderCy>> huoQuCaoYaoShuJu(caoYaoChaXunTiaoJian param) {
-        IPage<YzActOrderCy> page = new Page<>(param.getCurrentPage(), param.getPageSize(), param.getCurrentPage() == 1);
+    public ResultVo<IPage<YzActOrderCy>> huoQuCaoYaoShuJu(CaoYaoChaXunTiaoJian param) {
+        IPage<YzActOrderCy> page = new Page<>(param.getCurrentPage(), param.getPageSize(), param.getTotal() == 0);
         QueryWrapper<?> qw = new QueryWrapper<>();
         qw.eq("inpatient_no", param.getPatNo());
         qw.eq("admiss_times", param.getTimes());
@@ -41,6 +55,71 @@ public class CaoYaoYiZhuServer {
             qw.le("input_date", param.getEndTime());
         }
         dao.huoQuCaoYaoShuJu(page, qw);
+        BigDecimal daiJianFei = dao.huoQuDaiJianFei();
+        for (YzActOrderCy item : page.getRecords()) {
+            item.setDaiJianFei(item.getQuantityDj().multiply(daiJianFei));
+            item.setJiaGe(item.getQuantity().multiply(item.getOrderJe()));
+            item.setZongJia(item.getDaiJianFei().add(item.getJiaGe()));
+        }
+        return ResultVoUtil.success(page);
+    }
+
+    public ResultVo<List<YzActOrderCyDetail>> huoQuChaoYaoMingXi(BigDecimal orderNo) {
+        return ResultVoUtil.success(dao.huoQuChaoYaoMingXi(orderNo));
+    }
+
+    public ResultVo<List<GetDropdownBox>> fuYongFangFa() {
+        return ResultVoUtil.success(dao.fuYongFangFa());
+    }
+
+    public ResultVo<IPage<YiZhuMingChen>> huoQuCaoYao(String queryName, Integer groupNo, long currentPage, long pageSize, long total) {
+        IPage<YiZhuMingChen> page = new Page<>(currentPage, pageSize, total == 0);
+        String name = StringUtil.EnglishToCapital(queryName);
+        QueryWrapper<?> qw = new QueryWrapper<>();
+        qw.and(QueryWrapper -> QueryWrapper
+                .like("py_code", name)
+                .or()
+                .like("name", name)
+                .or()
+                .like("d_code", name))
+                .eq("group_no", groupNo);
+        dao.huoQuCaoYao(page, qw);
+        return ResultVoUtil.success(page);
+    }
+
+
+    public ResultVo<IPage<YzOrderPatternCy>> huoQuMuBan(String queryName, String deptCode, long currentPage, long pageSize, long total) {
+        IPage<YzOrderPatternCy> page = new Page<>(currentPage, pageSize, total == 0);
+        String name = StringUtil.EnglishToCapital(queryName);
+        QueryWrapper<?> qw = new QueryWrapper<>();
+        qw.and(QueryWrapper -> QueryWrapper
+                .like("py_code", name)
+                .or()
+                .like("d_code", name)
+                .or()
+                .like("pattern_name", name)
+        );
+        if (publicServer.noNeedRule(new int[]{1, 38})) {
+            qw.eq("dept_code", deptCode);
+        }
+        qw.groupBy("pattern_name");
+        dao.huoQuMuBan(page, qw);
         return ResultVoUtil.success(page);
     }
+
+    public ResultVo<List<YzOrderPatternCy>> muBanXiangQing(String name, String deptCode) {
+        return ResultVoUtil.success(dao.muBanXiangQing(name, deptCode));
+    }
+
+    public ResultVo<Boolean> chongFuMuBanMing(String name) {
+        return ResultVoUtil.success(dao.chongFuMuBanMing(name) > 1);
+    }
+
+    public ResultVo<String> cunMuBan(YzOrderPatternCy param) {
+        log.info("存模板数据:{}", JSON.toJSONString(param));
+        dao.chaRuMuBan(param.getList(), param.getPatternName(), TokenUtil.getTokenUserId(),
+                PingYinUtils.pyShouZiMuDaXie(param.getPatternName()), PingYinUtils.getWBCode(param.getPatternName()),
+                param.getDeptCode());
+        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION);
+    }
 }

+ 13 - 0
src/main/java/thyyxxk/webserver/utils/StringUtil.java

@@ -85,6 +85,19 @@ public class StringUtil {
         return "%" + str.toUpperCase() + "%";
     }
 
+    public static String EnglishToCapital(String str) {
+        if (isBlank(str)) {
+            return "";
+        }
+        Pattern p = Pattern.compile("[\u4E00-\u9FA5|\\!|\\,|\\。|\\(|\\)|\\《|\\》|\\“|\\”|\\?|\\:|\\;|\\【|\\】]");
+        Matcher m = p.matcher(str);
+        if (m.find()) {
+            return str;
+        }
+        return str.toUpperCase();
+    }
+
+
     /**
      * 分割字符串,如果开始位置大于字符串长度,返回空
      *