Bladeren bron

项目录入

xiaochan 4 jaren geleden
bovenliggende
commit
e978e53040

+ 13 - 2
src/main/java/thyyxxk/webserver/controller/yibao/XiangMuLuRuController.java

@@ -53,9 +53,20 @@ public class XiangMuLuRuController {
         return service.getMuBanXinXi(patternName, opIdCode);
     }
 
+    @GetMapping("/getDept")
+    public ResultVo<List<GetDropdownBox>> getDept() {
+        return service.getDept();
+    }
+
+    @GetMapping("/getWard")
+    public ResultVo<List<GetDropdownBox>> getWard() {
+        return service.getWard();
+    }
+
     @GetMapping("/queryXiangMu")
-    public ResultVo<List<ZyDetailCharge>> queryXiangMu(@RequestParam("pyCode") String pyCode) {
-        return service.queryXiangMu(pyCode);
+    public ResultVo<List<ZyDetailCharge>> queryXiangMu(@RequestParam("pyCode") String pyCode,
+                                                       @RequestParam("xiangMuHuoYaoPinFlag") Integer xiangMuHuoYaoPinFlag) {
+        return service.queryXiangMu(pyCode, xiangMuHuoYaoPinFlag);
     }
 
 

+ 48 - 0
src/main/java/thyyxxk/webserver/controller/zhuyuanyiji/YiJiFeiYongLuRuController.java

@@ -0,0 +1,48 @@
+package thyyxxk.webserver.controller.zhuyuanyiji;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
+import thyyxxk.webserver.entity.yibao.ZyActpatient;
+import thyyxxk.webserver.service.zhuyuanyiji.YiJiFeiYongLuRuServer;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 描述: 医技科室的项目录入
+ * </p>
+ *
+ * @author xc
+ * @date 2021-09-13 15:39
+ */
+@RequestMapping("/yiJiFeiYongLuRu")
+@RestController
+public class YiJiFeiYongLuRuController {
+
+    @Autowired
+    private final YiJiFeiYongLuRuServer server;
+
+    public YiJiFeiYongLuRuController(YiJiFeiYongLuRuServer server) {
+        this.server = server;
+    }
+
+    @GetMapping("/getHuanZheXinXi")
+    public ResultVo<ZyActpatient> getHuanZheXinXi(@RequestParam("inpatientNo") String inpatientNo,
+                                                  @RequestParam("zaiYuanChuYuan") Integer zaiYuanChuYuan,
+                                                  @RequestParam("admissTimes") Integer admissTimes) {
+        return server.getHuanZheXinXi(inpatientNo, zaiYuanChuYuan, admissTimes);
+    }
+
+    @GetMapping("/getHuanZheFeiYong")
+    public ResultVo<List<ZyDetailCharge>> getHuanZheFeiYong(@RequestParam("inpatientNo") String inpatientNo,
+                                                            @RequestParam("admissTimes") Integer admissTimes,
+                                                            @RequestParam("dept") String dept,
+                                                            @RequestParam("chargeCode") String chargeCode) {
+        return server.getHuanZheFeiYong(inpatientNo, admissTimes, dept, chargeCode);
+    }
+}

+ 31 - 10
src/main/java/thyyxxk/webserver/dao/his/yibao/XiangMuLuRuDao.java

@@ -62,6 +62,9 @@ public interface XiangMuLuRuDao {
             "<if test=\"chargeCode !=null and chargeCode != '' \">" +
             " a.charge_code_mx = #{chargeCode} and" +
             "</if>" +
+            "<if test=\"dept != null and dept != '' \"> " +
+            "  a.exec_unit=#{dept} and  " +
+            "</if>" +
             "        a.charge_code=b.code and " +
             "<if test=\"startTime != null and startTime!= '' \">" +
             " convert(varchar(100),a.charge_date,23) = #{startTime} and " +
@@ -121,6 +124,9 @@ public interface XiangMuLuRuDao {
             "<if test=\"startTime != null and startTime!= '' \">" +
             " convert(varchar(100),a.charge_date,23) = #{startTime} and " +
             "</if>" +
+            "<if test=\"dept != null and dept != '' \"> " +
+            "  a.exec_unit=#{dept} and  " +
+            "</if>" +
             "<if test=\"orderNo !=null\">" +
             "<choose>" +
             "<when test=\"orderNo == 1\">" +
@@ -142,7 +148,14 @@ public interface XiangMuLuRuDao {
                                            @Param("chargeCode") String chargeCode,
                                            @Param("infantFlag") int infantFlag,
                                            @Param("startTime") String startTime,
-                                           @Param("orderNo") BigDecimal orderNo);
+                                           @Param("orderNo") BigDecimal orderNo,
+                                           @Param("dept") String dept);
+
+
+    @Select("select detail_sn,ori_detail_sn from zy_detail_charge where  inpatient_no=#{inpatientNo} and admiss_times = #{admissTimes} " +
+            "and charge_fee <= 0 and ori_detail_sn is not null")
+    List<ZyDetailCharge> tuiFeiList(@Param("inpatientNo") String inpatientNo,
+                                    @Param("admissTimes") Integer admissTimes);
 
     /**
      * @param pyCode 拼音编码
@@ -200,14 +213,13 @@ public interface XiangMuLuRuDao {
             "       refer_physician, " +
             "       consult_physician, " +
             "       ori_detail_sn" +
-            " from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and detail_sn in " +
+            " from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes}  and detail_sn in " +
             "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
             "#{item.detailSn}" +
             "</foreach>" +
             "</script>")
     List<ZyDetailCharge> huoQuJuTiFeiYong(@Param("inpatientNo") String inpatientNo,
                                           @Param("admissTimes") Integer admissTimes,
-                                          @Param("ledgerSn") Integer ledgerSn,
                                           @Param("list") List<ZyDetailCharge> list);
 
     /**
@@ -259,14 +271,13 @@ public interface XiangMuLuRuDao {
             "       refer_physician, " +
             "       consult_physician, " +
             "       ori_detail_sn" +
-            " from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} and ledger_sn = #{ledgerSn} and ori_detail_sn in " +
+            " from zy_detail_charge where inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes}  and ori_detail_sn in " +
             "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
             "#{item.detailSn}" +
             "</foreach>" +
             "</script>")
     List<ZyDetailCharge> chaKanSFYiJingTuiFeiLe(@Param("inpatientNo") String inpatientNo,
                                                 @Param("admissTimes") Integer admissTimes,
-                                                @Param("ledgerSn") Integer ledgerSn,
                                                 @Param("list") List<ZyDetailCharge> list);
 
 
@@ -313,10 +324,12 @@ public interface XiangMuLuRuDao {
             "<if test=\"deptCode != '3100000' \">" +
             "   and  op_dept=#{deptCode}  " +
             "</if>" +
+            "<if test=\"defaultNo == 0\">" +
+            "and default_no &gt; 0 " +
+            "</if>" +
             "group by a.pattern_name,a.op_dept, b.name" +
             "</script>")
-    List<ZyDetailCharge> getMuBan(@Param("deptCode") String deptCode);
-
+    List<ZyDetailCharge> getMuBan(@Param("deptCode") String deptCode, @Param("defaultNo") Integer defaultNo);
 
     /**
      * 这个是获取模板下面的那些项目具体信息
@@ -407,7 +420,8 @@ public interface XiangMuLuRuDao {
      * @param pyCode 拼音码
      * @return 返回模板信息
      */
-    @Select("SELECT a.code charge_code, " +
+    @Select("SELECT a.code charge_code," +
+            "       a.code charge_code_mx, " +
             "       a.exec_unit dept_code," +
             "       rtrim(a.yb_comment) yb_comment, " +
             "       RTRIM(a.name) charge_name, " +
@@ -449,11 +463,11 @@ public interface XiangMuLuRuDao {
             "  , zy_serial_no, charge_code_mx, serial)  " +
             "VALUES " +
             "<foreach collection='list' item='item' separator=','>" +
-            "(#{zyDetailCharge.inpatientNo}, #{zyDetailCharge.admissTimes}, #{zyDetailCharge.ledgerSn}, #{item.detailSn}, getdate()  " +
+            "(#{zyDetailCharge.inpatientNo}, #{zyDetailCharge.admissTimes}, 1, #{item.detailSn}, getdate()  " +
             "  , #{zyDetailCharge.opIdCode}, #{item.chargeCode}, #{infantFlag}, '2', cast(#{item.chargeAmount,jdbcType=DECIMAL} as decimal(14,5))  " +
             "  , '0', '0', NULL, #{zyDetailCharge.ward}, #{zyDetailCharge.dept}  " +
             "  , 0, '0', #{item.deptCode}, cast(#{item.amount,jdbcType=DECIMAL} as decimal(14,5)), getdate()  " +
-            "  , #{zyDetailCharge.zySerialNo}, #{item.chargeCode}, '00')" +
+            "  , #{zyDetailCharge.zySerialNo}, #{item.chargeCodeMx}, '00')" +
             "</foreach>" +
             "</script>")
     void chaRuFeiYong(@Param("zyDetailCharge") ZyDetailCharge zyDetailCharge,
@@ -668,4 +682,11 @@ public interface XiangMuLuRuDao {
     @Select("select role_id from dj_user_role where  user_code = #{code}")
     List<Integer> huoQuJueSe(@Param("code") String code);
 
+
+    @Select("select code,rtrim(name) name from zd_unit_code where code not like '8%'")
+    List<GetDropdownBox> getDpet();
+
+    @Select("select code,rtrim(name) name from zd_unit_code where code  like '8%'")
+    List<GetDropdownBox> getWard();
+
 }

+ 142 - 0
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyiji/YiJiFeiYongLuRuDao.java

@@ -0,0 +1,142 @@
+package thyyxxk.webserver.dao.his.zhuyuanyiji;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
+import thyyxxk.webserver.entity.yibao.ZyActpatient;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 描述:住院以及费用录入
+ * </p>
+ *
+ * @author xc
+ * @date 2021-09-13 15:43
+ */
+@Mapper
+public interface YiJiFeiYongLuRuDao {
+
+    @Select("<script>" +
+            "SELECT rtrim(inpatient_no) inpatient_no," +
+            "       admiss_times," +
+            "       admiss_dept," +
+            "       rtrim(name) name," +
+            "       rtrim(bed_no) bed_no," +
+            "       ward," +
+            "       ward_name=(select rtrim(name) name from zd_unit_code where zd_unit_code.code = ward)," +
+            "       responce_type," +
+            "       responce_type_name=(select rtrim(name) name from zy_zd_responce_type where responce_type = zy_zd_responce_type.code)," +
+            "       balance," +
+            "       dept," +
+            "       total_charge," +
+            "       rtrim(charge_type) charge_type," +
+            "       times_billed," +
+            "       rtrim(admiss_diag_str) admiss_diag_str," +
+            "       rtrim(admiss_diag) admiss_diag," +
+            "       admiss_date," +
+            "       sex," +
+            "       zy_serial_no," +
+            "       mz_no," +
+            "       rtrim(intern_code) intern_code," +
+            "       zk_ward " +
+            "FROM ${tableName} " +
+            "WHERE  inpatient_no = #{inpatientNo} " +
+            "<if test=\"admissTimes != 0 \">" +
+            "and admiss_times = #{admissTimes} " +
+            "</if>" +
+            "</script>")
+    ZyActpatient getHuanZheXinXi(@Param("inpatientNo") String inpatientNo,
+                                 @Param("tableName") String tableName,
+                                 @Param("admissTimes") Integer admissTimes);
+
+
+    @Select("<script>" +
+            "SELECT a.admiss_times, " +
+            "       a.inpatient_no, " +
+            "       a.ledger_sn, " +
+            "       a.detail_sn, " +
+            "       a.charge_date, " +
+            "       a.op_id_code, " +
+            "       a.charge_code, " +
+            "       a.charge_fee, " +
+            "       a.charge_status  , " +
+            "       bill_item_code=b.bill_item_zy, " +
+            "       charge_name=b.name, " +
+            "       spec=c.specification, " +
+            "       a.charge_code_mx, " +
+            "       a.serial, " +
+            "       price=0.0000, " +
+            "       amount=a.charge_amount, " +
+            "       a.exec_unit, " +
+            "       a.ward_code, " +
+            "       self_flag=isnull(a.self_flag,0), " +
+            "       suppress_flag=a.suppress_flag, " +
+            "       group_no='00', " +
+            "       separate_flag=a.separate_flag, " +
+            "       ope_flag=a.ope_flag, " +
+            "       drugname=c.name, " +
+            "       ybcomment=c.yb_comment, " +
+            "       a.yb_self_flag, " +
+            "       doctor_code " +
+            "FROM zy_detail_charge a  ,zd_charge_item b,yp_zd_dict c " +
+            "where    a.inpatient_no=#{inpatientNo} and " +
+            "        a.admiss_times=#{admissTimes} and " +
+            "        a.charge_code=b.code and " +
+            "<if test=\"chargeCode != null and chargeCode != '' \">" +
+            "        a.charge_code = #{chargeCode} and " +
+            "</if>" +
+            "        a.order_no =  0    and " +
+            "        c.code= a.charge_code_mx and " +
+            "        a.serial=c.serial and a.charge_code like 'BILL%' " +
+            "<if test=\"dept != 3100000\"> " +
+            " and  a.exec_unit=#{dept} " +
+            "</if>" +
+            "union " +
+            "SELECT a.admiss_times, " +
+            "       a.inpatient_no, " +
+            "       a.ledger_sn, " +
+            "       a.detail_sn, " +
+            "       a.charge_date, " +
+            "       a.op_id_code, " +
+            "       a.charge_code, " +
+            "       a.charge_fee, " +
+            "       a.charge_status  , " +
+            "       bill_item_code=b.bill_item_zy, " +
+            "       charge_name=b.name, " +
+            "       spec=b.charge_unit, " +
+            "       a.charge_code_mx, " +
+            "       a.serial, " +
+            "       price=0.0000, " +
+            "       amount=a.charge_amount, " +
+            "       a.exec_unit, " +
+            "       a.ward_code, " +
+            "       self_flag=a.self_flag, " +
+            "       suppress_flag=a.suppress_flag, " +
+            "       group_no='00', " +
+            "       separate_flag=a.separate_flag, " +
+            "       ope_flag=a.ope_flag, " +
+            "       drugname=b.name, " +
+            "       ybcomment='', " +
+            "       ybzf=a.yb_self_flag, " +
+            "       doctor_code " +
+            "FROM zy_detail_charge a  ,zd_charge_item b " +
+            "where    a.inpatient_no=#{inpatientNo} and " +
+            "        a.admiss_times=#{admissTimes} and " +
+            "        a.charge_code=b.code and " +
+            "        a.order_no =  0    and " +
+            "<if test=\"chargeCode != null and chargeCode != '' \">" +
+            "        a.charge_code = #{chargeCode} and " +
+            "</if>" +
+            "        a.charge_code not like 'BILL%' " +
+            "<if test=\"dept != 3100000\"> " +
+            " and  a.exec_unit=#{dept} " +
+            "</if>" +
+            "</script>")
+    List<ZyDetailCharge> getHuanZheFeiYong(@Param("inpatientNo") String inpatientNo,
+                                           @Param("admissTimes") Integer admissTimes,
+                                           @Param("dept") String dept,
+                                           @Param("chargeCode") String chargeCode);
+}

+ 39 - 0
src/main/java/thyyxxk/webserver/entity/datamodify/ZyDetailCharge.java

@@ -141,6 +141,45 @@ public class ZyDetailCharge implements Serializable {
 
     private Integer oriDetailSn;
 
+    /**
+     * 医保类型
+     */
+    private String responceType;
+
+    /**
+     * 床位
+     */
+    private String bedNo;
+
+    /**
+     * 余额
+     */
+    private BigDecimal balance;
+
+    /**
+     * 总费用
+     */
+    private BigDecimal totalCharge;
+
+    private BigDecimal chargeType;
+
+    private Integer timesBilled;
+
+    /**
+     * 入院诊断名称
+     */
+    private String admissDiagStr;
+
+    /**
+     * 入院诊断编码
+     */
+    private String admissDiag;
+
+    /**
+     * 入院时间
+     */
+    private Date admissDate;
+
     /**
      * 这里面是 存放需要退费 小丑竟是我自己
      */

+ 61 - 28
src/main/java/thyyxxk/webserver/service/yibao/XiangMuLuRuService.java

@@ -50,8 +50,8 @@ public class XiangMuLuRuService {
      * @return 返回患者费用
      */
     public ResultVo<List<ZyDetailCharge>> getHuanZheFeiYong(ZyDetailCharge param) {
-        log.info("查询患者费用==》住院号{},住院次数:{},项目名称:{},录入日期:{},费用类型:{}", param.getInpatientNo(), param.getAdmissTimes(),
-                param.getChargeCode(), param.getStartTime(), param.getOrderNo());
+        log.info("查询患者费用==》住院号{},住院次数:{},项目名称:{},录入日期:{},费用类型:{},科室:{}", param.getInpatientNo(), param.getAdmissTimes(),
+                param.getChargeCode(), param.getStartTime(), param.getOrderNo(), param.getDept());
         int infantFlag = 0;
         // 如果是婴儿的话那么就需要截取 字符串了 在通过婴儿标识来判断
         if (param.getInpatientNo().contains("$")) {
@@ -59,18 +59,19 @@ public class XiangMuLuRuService {
             infantFlag = 1;
         }
         List<ZyDetailCharge> list = dao.getHuanZheFeiYong(param.getInpatientNo(), param.getAdmissTimes(), param.getChargeCode(), infantFlag,
-                param.getStartTime(), param.getOrderNo());
+                param.getStartTime(), param.getOrderNo(), param.getDept());
+        List<ZyDetailCharge> tuiFeiList = dao.tuiFeiList(param.getInpatientNo(), param.getAdmissTimes());
         Map<Integer, Integer> map = new HashMap<>();
-        for (int i = 0; i < list.size(); i++) {
-            // 判断一下这一条数据 是否为 退费数据 再把原数据和 本身添加一个退费的 flag
-            if (map.containsKey(list.get(i).getOriDetailSn())) {
-                // 把当前的数据 添加一个有 退费标志的
-                list.get(i).setTuiFeiFlag(1);
-                // 在吧 对应退费的原数据 也添加一个
-                list.get(map.get(list.get(i).getOriDetailSn())).setTuiFeiFlag(1);
-            } else {
-                // 保存下标
-                map.put(list.get(i).getDetailSn(), i);
+        for (ZyDetailCharge zyDetailCharge : tuiFeiList) {
+            map.put(zyDetailCharge.getOriDetailSn(), zyDetailCharge.getDetailSn());
+        }
+        for (ZyDetailCharge zyDetailCharge : list) {
+            // 判断 退费的数据
+            if (map.containsKey(zyDetailCharge.getDetailSn())) {
+                zyDetailCharge.setTuiFeiFlag(1);
+            }
+            if (zyDetailCharge.getOriDetailSn() != null) {
+                zyDetailCharge.setTuiFeiFlag(1);
             }
         }
         return ResultVoUtil.success(list);
@@ -92,14 +93,16 @@ public class XiangMuLuRuService {
      */
     @Transactional(rollbackFor = Exception.class)
     public ResultVo<String> xiangMuTuiFei(ZyDetailCharge param) {
-        if (param.getList().size() > 100) {
+        if (param.getList().isEmpty()) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请先选择需要退费的数据,一次性退费不得超过100条");
+        } else if (param.getList().size() > 100) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "项目退费一次性大于100条数据");
         }
-        if (StringUtil.isBlank(param.getInpatientNo()) || param.getAdmissTimes() == null || param.getLedgerSn() == null || param.getList().size() == 0) {
+        if (StringUtil.isBlank(param.getInpatientNo()) || param.getAdmissTimes() == null || param.getList().size() == 0) {
             return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "患者信息不全");
         }
         // 判断数据是否为 退费数据
-        List<ZyDetailCharge> chaKanSFtuiFei = dao.chaKanSFYiJingTuiFeiLe(param.getInpatientNo(), param.getAdmissTimes(), param.getLedgerSn(), param.getList());
+        List<ZyDetailCharge> chaKanSFtuiFei = dao.chaKanSFYiJingTuiFeiLe(param.getInpatientNo(), param.getAdmissTimes(), param.getList());
 
         for (ZyDetailCharge charge : chaKanSFtuiFei) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为:【%s】已退费,请勿重复退费", charge.getOriDetailSn()));
@@ -115,7 +118,7 @@ public class XiangMuLuRuService {
         List<String> zhiXinKeShi = dao.chaXunZhiZXinKeShi(param.getDeptCode());
 
         // 获取原来的数据
-        List<ZyDetailCharge> yuanTuiFeiList = dao.huoQuJuTiFeiYong(param.getInpatientNo(), param.getAdmissTimes(), param.getLedgerSn(), param.getList());
+        List<ZyDetailCharge> yuanTuiFeiList = dao.huoQuJuTiFeiYong(param.getInpatientNo(), param.getAdmissTimes(), param.getList());
         // 获取患者的总费用
         BigDecimal sum = new BigDecimal(0);
         // 退费的list
@@ -129,14 +132,19 @@ public class XiangMuLuRuService {
             }
             // 管理员角色可以无视
             if (!yongHuJueSe.contains(1)) {
-                if (!zhiXinKeShi.contains(pojo.getExecUnit())) {
+                // 人员角色为 3 就不是医技科室 只有医技科室可以退药品
+                if (yongHuJueSe.contains(3)) {
+                    if (!zhiXinKeShi.contains(pojo.getExecUnit())) {
+                        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为【%s】,请对应的执行科室进行退费。", pojo.getDetailSn()));
+                    }
+                    // 护士是不可以退药品的
+                    if (pojo.getChargeCode().equals("BILL01") || pojo.getChargeCode().equals("BILL02")) {
+                        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为【%s】,中草药费或西药费,无法退费。", pojo.getDetailSn()));
+                    }
+                } else if (!param.getDeptCode().equals(pojo.getExecUnit())) {
                     return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为【%s】,请对应的执行科室进行退费。", pojo.getDetailSn()));
                 }
             }
-            // 判断如果这个药品的医嘱号 大于0 那么就不能退
-            if (pojo.getChargeCode().equals("BILL01") || pojo.getChargeCode().equals("BILL02")) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为【%s】,中草药费或西药费,无法退费。", pojo.getDetailSn()));
-            }
             sum = sum.add(pojo.getChargeFee().multiply(pojo.getChargeAmount()));
             pojo.setChargeFee(pojo.getChargeFee().negate());
             pojo.setChargeAmount(pojo.getChargeAmount().negate());
@@ -170,7 +178,7 @@ public class XiangMuLuRuService {
      * @return 返回模板
      */
     public ResultVo<List<ZyDetailCharge>> getMuBan(String deptCode) {
-        return ResultVoUtil.success(dao.getMuBan(deptCode));
+        return ResultVoUtil.success(dao.getMuBan(deptCode, 1));
     }
 
     /**
@@ -184,14 +192,36 @@ public class XiangMuLuRuService {
         return ResultVoUtil.success(dao.getMuBanXinXi(patternName, opIdCode));
     }
 
+    /**
+     * 获取科室
+     *
+     * @return 返回科室信息
+     */
+    public ResultVo<List<GetDropdownBox>> getDept() {
+        return ResultVoUtil.success(dao.getDpet());
+    }
+
+    /**
+     * 获取科室
+     *
+     * @return 返回科室信息
+     */
+    public ResultVo<List<GetDropdownBox>> getWard() {
+        return ResultVoUtil.success(dao.getWard());
+    }
+
     /**
      * 通过拼音码 来搜索项目
      *
-     * @param pyCode 拼音码
+     * @param pyCode               拼音码
+     * @param xiangMuHuoYaoPinFlag 判断是查询项目还是药品 0 - 项目 1- 药品
      * @return 返回项目
      */
-    public ResultVo<List<ZyDetailCharge>> queryXiangMu(String pyCode) {
-        return ResultVoUtil.success(dao.queryXiangMu(pyCode.toUpperCase() + "%"));
+    public ResultVo<List<ZyDetailCharge>> queryXiangMu(String pyCode, Integer xiangMuHuoYaoPinFlag) {
+        if (xiangMuHuoYaoPinFlag == 0) {
+            return ResultVoUtil.success(dao.queryXiangMu(pyCode.toUpperCase() + "%"));
+        }
+        return ResultVoUtil.success();
     }
 
     /**
@@ -205,7 +235,7 @@ public class XiangMuLuRuService {
         if (param.getList().size() > 50) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "一次性项目录入大于50条");
         }
-        if (StringUtil.isBlank(param.getInpatientNo()) || param.getAdmissTimes() == null || param.getLedgerSn() == null || param.getList().size() == 0
+        if (StringUtil.isBlank(param.getInpatientNo()) || param.getAdmissTimes() == null || param.getList().size() == 0
                 || StringUtil.isBlank(param.getWard()) || StringUtil.isBlank(param.getDept()) || StringUtil.isBlank(param.getZySerialNo())) {
             return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "患者信息不全。");
         }
@@ -231,7 +261,7 @@ public class XiangMuLuRuService {
                 return ResultVoUtil.fail(ExceptionEnum.EXIST_NEGATIVE_FEES);
             }
             sum = sum.add(zyDetailCharge.getChargeAmount().multiply(zyDetailCharge.getAmount()));
-            // 这里不会保存
+            // 这里不会保存单价 只会总价
             zyDetailCharge.setChargeAmount(zyDetailCharge.getChargeAmount().multiply(zyDetailCharge.getAmount()));
             if (StringUtil.isBlank(zyDetailCharge.getChargeCode())) {
                 return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "项目编码空值。");
@@ -239,6 +269,9 @@ public class XiangMuLuRuService {
             if (StringUtil.isBlank(zyDetailCharge.getDeptCode())) {
                 return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "执行科室为空。");
             }
+            if (zyDetailCharge.getChargeCodeMx() == null) {
+                zyDetailCharge.setChargeCodeMx(zyDetailCharge.getChargeCode());
+            }
         }
         FeiYongLeiXin fy = JiSuanFeiYong.jiSuan(param.getList(), true);
         fy.setTotalCharge(sum);

+ 75 - 0
src/main/java/thyyxxk/webserver/service/zhuyuanyiji/YiJiFeiYongLuRuServer.java

@@ -0,0 +1,75 @@
+package thyyxxk.webserver.service.zhuyuanyiji;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
+import thyyxxk.webserver.dao.his.zhuyuanyiji.YiJiFeiYongLuRuDao;
+import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
+import thyyxxk.webserver.entity.yibao.ZyActpatient;
+import thyyxxk.webserver.utils.ResultVoUtil;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 描述: 住院医技项目录入
+ * </p>
+ *
+ * @author xc
+ * @date 2021-09-13 15:42
+ */
+@Service
+@Slf4j
+public class YiJiFeiYongLuRuServer {
+
+    @Autowired
+    private final YiJiFeiYongLuRuDao dao;
+
+    public YiJiFeiYongLuRuServer(YiJiFeiYongLuRuDao dao) {
+        this.dao = dao;
+    }
+
+    /**
+     * @param inpatientNo    住院号
+     * @param zaiYuanChuYuan 出院号
+     * @return 返回患者信息
+     */
+    public ResultVo<ZyActpatient> getHuanZheXinXi(String inpatientNo, Integer zaiYuanChuYuan, Integer admissTimes) {
+        log.info("医技查询患者信息:住院号{},是否在院{},住院次数:{}", inpatientNo, zaiYuanChuYuan, admissTimes);
+        String tableName;
+        if (zaiYuanChuYuan == 0) {
+            tableName = "zy_actpatient";
+        } else {
+            if (admissTimes == 0) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "出院病人的住院次数不能为0");
+            }
+            tableName = "zy_inactpatient";
+        }
+        ZyActpatient zyActpatient = dao.getHuanZheXinXi(inpatientNo, tableName, admissTimes);
+        if (zyActpatient == null) {
+            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
+        }
+        return ResultVoUtil.success(zyActpatient);
+    }
+
+    /**
+     * 获取患者费用
+     *
+     * @param inpatientNo 住院号
+     * @param admissTimes 住院次数
+     * @param dept        科室
+     * @param chargeCode  项目编码
+     * @return 返回是由医技录入的信息
+     */
+    public ResultVo<List<ZyDetailCharge>> getHuanZheFeiYong(String inpatientNo, Integer admissTimes, String dept, String chargeCode) {
+        log.info("查询患者的费用==》住院号:{},住院次数:{},科室:{},项目编码:{}", inpatientNo, admissTimes, dept, chargeCode);
+        List<ZyDetailCharge> list = dao.getHuanZheFeiYong(inpatientNo, admissTimes, dept, chargeCode);
+        if (list.isEmpty()) {
+            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
+        }
+        return ResultVoUtil.success(list);
+    }
+
+}