Browse Source

Merge branch '新的项目录入'

xiaochan 2 years ago
parent
commit
9cca886b86

+ 0 - 4
src/main/java/thyyxxk/webserver/controller/inpatient/XiangMuLuRuController.java

@@ -6,16 +6,12 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import thyyxxk.webserver.aop.interfaces.NeedYbCode;
-import thyyxxk.webserver.aop.interfaces.NoNeedRule;
 import thyyxxk.webserver.config.auth.PassToken;
-import thyyxxk.webserver.config.exception.BizException;
-import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
 import thyyxxk.webserver.entity.inpatient.ZyActpatient;
 import thyyxxk.webserver.service.inpatient.XiangMuLuRuService;
-import thyyxxk.webserver.utils.ResultVoUtil;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;

+ 50 - 5
src/main/java/thyyxxk/webserver/dao/his/inpatient/XiangMuLuRuDao.java

@@ -307,8 +307,8 @@ public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
             "       pay_percent, " +
             "       zj_flag, " +
             "       zfl, " +
-            "       charge_code_mx, " +
-            "       serial, " +
+            "       rtrim(charge_code_mx) as  charge_code_mx, " +
+            "       rtrim(serial) as serial, " +
             "       zy_serial_no, " +
             "       doctor_code, " +
             "       yb_self_flag, " +
@@ -378,7 +378,7 @@ public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
             "       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 ledger_sn = #{ledgerSn}  and detail_sn in " +
             "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
             "#{item.detailSn}" +
             "</foreach>" +
@@ -420,7 +420,8 @@ public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
      * @param list        正流水
      */
     @Update("<script>" +
-            "update zy_detail_charge set ori_detail_sn = -1 where  inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} " +
+            "update zy_detail_charge set ori_detail_sn = #{flag} where " +
+            "inpatient_no = #{inpatientNo} and admiss_times = #{admissTimes} " +
             "and ledger_sn = #{ledgerSn} " +
             "and charge_fee &gt; 0 and charge_amount &gt; 0  and detail_sn in " +
             "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
@@ -430,7 +431,51 @@ public interface XiangMuLuRuDao extends BaseMapper<ZyDetailCharge> {
     void genXinZhenShuTuiFeiLiuShui(@Param("inpatientNo") String inpatientNo,
                                     @Param("admissTimes") Integer admissTimes,
                                     @Param("ledgerSn") Integer ledgerSn,
-                                    @Param("list") List<Integer> list);
+                                    @Param("list") List<Integer> list,
+                                    @Param("flag") int flag);
+
+
+    /**
+     * 退药汇总单
+     */
+    @Insert("insert into yz_yp_page_no (page_no, dept_code, ward_code, submit_time, submit_name,\n" +
+            "                           submit_flag, page_class, page_name, group_no)\n" +
+            "values (#{pageNo}, #{wardCode}, #{wardCode}, getdate(), #{userCode}, 1, 'HT', '护士退药单', #{groupNo})")
+    void drugReturnForm(@Param("pageNo") Integer pageNo,
+                        @Param("wardCode") String wardCode,
+                        @Param("userCode") String userCode,
+                        @Param("groupNo") String groupNo);
+
+    @Insert("<script>" +
+            "insert into yz_yp_zy_order (inpatient_no, admiss_times, name, bed_no, dept_code, ward_code, charge_code, amount,\n" +
+            "                            retprice, charge_date, infant_flag, drawer, always_flag, status_flag, drug_class, serail,\n" +
+            "                            occ_time, act_order_no, serial, group_no, doctor_name, page_no_ty, page_class,page_no)\n" +
+            "values " +
+            "<foreach collection='list' item='item' separator=','>" +
+            "(#{patNo}, #{times}, #{name}, #{bedNo}, #{wardCode},  #{wardCode}, #{item.chargeCodeMx}, #{item.chargeAmount,jdbcType=REAL},\n" +
+            "        #{item.chargeFee,jdbcType=REAL}, getdate(), #{infantFlag}, #{userCode}, 'a', '1',\n" +
+            "        (select case infusion_flag\n" +
+            "                    when '1' then 'i'\n" +
+            "                    else\n" +
+            "                        (case\n" +
+            "                             when code &gt;= '30000' and code &lt; '50000' then 'd'\n" +
+            "                             else 'j' end) end\n" +
+            "         from yp_zd_dict\n" +
+            "         where rtrim(code) + rtrim(serial) = '${item.chargeCodeMx}${item.serial}'), #{item.detailSn}, getdate(), 0, #{item.serial}, #{groupNo},\n" +
+            "        #{item.doctorCode}, #{pageNo}, null,#{ledgerSn})" +
+            "</foreach>" +
+            "</script>")
+    void detailsOfDrugReturnForm(@Param("list") List<ZyDetailCharge> list,
+                                 @Param("patNo") String patNo,
+                                 @Param("times") Integer times,
+                                 @Param("name") String name,
+                                 @Param("bedNo") String bedNo,
+                                 @Param("wardCode") String wardCode,
+                                 @Param("infantFlag") Integer infantFlag,
+                                 @Param("groupNo") String groupNo,
+                                 @Param("userCode") String userCode,
+                                 @Param("pageNo") Integer pageNo,
+                                 @Param("ledgerSn") Integer ledgerSn);
 
     /**
      * 获取模板

+ 27 - 4
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/UpIdCollectionDao.java

@@ -399,8 +399,8 @@ public interface UpIdCollectionDao {
             " case when yb_name is null then rtrim(ssmc) else rtrim(yb_name) end  ssmc," +
             " rtrim(mzff) mzff, rtrim(qkjb) qkjb," +
             "rtrim(yhqk) yhqk, ssbfz, fhqk, ssjb, cut_heal," +
-            "(select top(1) yb_code from a_employee_mi where code = ssys) as oper_dr_code, " +
-            "(select top(1) yb_code from a_employee_mi where code = mzys) as anst_dr_code," +
+            "(select top(1) rtrim(yb_code) from a_employee_mi where code = ssys) as oper_dr_code, " +
+            "(select top(1) rtrim(yb_code) from a_employee_mi where code = mzys) as anst_dr_code," +
             "dept_code," +
             "(select name from zd_unit_code where code = dept_code) as dept_code_name " +
             "from ${tableName} left join zd_icd9_cm3 on (ssbm = zd_icd9_cm3.code)  " +
@@ -549,14 +549,30 @@ public interface UpIdCollectionDao {
                                                      @Param("times") Integer times,
                                                      @Param("ledgerSn") Integer ledgerSn);
 
+    @Select("select icd_code_new as diag_code " +
+            "from mz_visit_table " +
+            "where nullif(icd_code_new, '') is not null " +
+            "  and patient_id = #{patNo} and times = #{times}")
+    OpspdiseinfoUpld outpatientDiagnosis1(@Param("patNo") String patNo,
+                                          @Param("times") Integer times);
+
+    @Select("select yb_code  as diag_code,\n" +
+            "       yb_name  as diag_name,\n" +
+            "       '00000'  as oprn_oprt_name,\n" +
+            "       '无手术' as oprn_oprt_code\n" +
+            "from zd_icd_code_new\n" +
+            "where yb_code = #{ybCode} ")
+    OpspdiseinfoUpld outpatientSlowDiagnosis(String ybCode);
+
     @Select("select diag_code as diag_code, " +
             "       diag_name as diag_name, " +
             "       '00000'   as oprn_oprt_name, " +
             "       '无手术'  as oprn_oprt_code " +
             "from t_si_mz_diag\n" +
             "where pat_no = #{patNo} and times = #{times} ")
-    List<OpspdiseinfoUpld> outpatientDiagnosis(@Param("patNo") String patNo,
-                                               @Param("times") Integer times);
+    List<OpspdiseinfoUpld> outpatientDiagnosis2(@Param("patNo") String patNo,
+                                                @Param("times") Integer times);
+
 
     @Select("select top 1 rtrim(a.name)                                        as psnName, " +
             "       isnull(nullif(rtrim(b.occupation_code), " +
@@ -604,6 +620,13 @@ public interface UpIdCollectionDao {
     SetlinfoUpld mzPatInfo(@Param("patNo") String patNo,
                            @Param("times") Integer times);
 
+    @Select("select opsp_diag_caty = (select si_caty from zd_unit_code where code = visit_dept_code),\n" +
+            "                        visit_date as opsp_mdtrt_date\n" +
+            "from mz_visit_table\n" +
+            "where patient_id = #{patNo} and times = #{times}")
+    SetlinfoUpld mzPatInfo1(@Param("patNo") String patNo,
+                            @Param("times") Integer times);
+
     @Select("select setl_id,mdtrt_id,insuplc_admdvs " +
             "from t_si_setlinfo " +
             "where pat_no =  #{patNo} " +

+ 8 - 0
src/main/java/thyyxxk/webserver/entity/medicalinsurance/inpatient/BatjBa4.java

@@ -112,7 +112,15 @@ public class BatjBa4 implements Serializable {
     private String sszsName1;
     private String sszsName2;
     private String mzysName;
+    /**
+     * 术者医师代码
+     */
+    @JSONField(name = "oper_dr_code")
     private String operDrCode;
+    /**
+     * 麻醉医师姓名
+     */
+    @JSONField(name = "anst_dr_name")
     private String anstDrCode;
 
     //////////////// 以下是 4101A 新增数据 ///////////////////////////

+ 8 - 2
src/main/java/thyyxxk/webserver/service/PublicServer.java

@@ -466,11 +466,16 @@ public class PublicServer {
         return index;
     }
 
-    public Integer huoQuCaoYaoShenQingDanHao() {
+    /**
+     * 获取药品单号
+     *
+     * @return 药品单号
+     */
+    public Integer getTheDrugListNo() {
         dao.lockTable();
         Integer index = dao.caoYaoDanHao() + 1;
         dao.genXingCaoYaoDanHao(index);
-        return index;
+        return Integer.valueOf(DateUtil.formatDatetime(new Date(), "yyMMdd") + index);
     }
 
     public String getGroupNo() {
@@ -554,6 +559,7 @@ public class PublicServer {
                 sb.append(cuoWuXinXi(item.getZdCode(), "00".equals(item.getSerial().trim()) ? "医嘱名:" + item.getName() + " 项目名:" + item.getZdName() : "" + item.getName(), name + "没有匹配医保编码"));
             }
         }
+
         return sb.toString();
     }
 

+ 121 - 60
src/main/java/thyyxxk/webserver/service/inpatient/XiangMuLuRuService.java

@@ -17,10 +17,12 @@ import thyyxxk.webserver.dao.his.inpatient.XiangMuLuRuDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.datamodify.ZyDetailCharge;
-import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyPatientInfo;
 import thyyxxk.webserver.entity.inpatient.ZyActpatient;
+import thyyxxk.webserver.entity.login.UserInfo;
+import thyyxxk.webserver.entity.medicalinsurance.inpatient.ZyPatientInfo;
 import thyyxxk.webserver.service.PublicServer;
 import thyyxxk.webserver.service.medicalinsurance.SiZyService;
+import thyyxxk.webserver.service.redislike.RedisLikeService;
 import thyyxxk.webserver.utils.*;
 
 import javax.servlet.http.HttpServletResponse;
@@ -46,11 +48,14 @@ public class XiangMuLuRuService {
     private final PublicServer publicServer;
     private final SiZyService siZyService;
 
+    private final RedisLikeService redisLikeService;
+
     @Autowired
-    public XiangMuLuRuService(XiangMuLuRuDao dao, PublicServer publicServer, SiZyService siZyService) {
+    public XiangMuLuRuService(XiangMuLuRuDao dao, PublicServer publicServer, SiZyService siZyService, RedisLikeService redisLikeService) {
         this.dao = dao;
         this.publicServer = publicServer;
         this.siZyService = siZyService;
+        this.redisLikeService = redisLikeService;
     }
 
     /**
@@ -110,7 +115,9 @@ public class XiangMuLuRuService {
      */
     @Transactional(rollbackFor = Exception.class)
     public ResultVo<String> xiangMuTuiFei(ZyDetailCharge param, Boolean panDuanYaoPing) {
-        List<Integer> yongHuJueSe = dao.huoQuJueSe(TokenUtil.getTokenUserId());
+        UserInfo userInfo = redisLikeService.getUserInfoByToken();
+        List<Integer> yongHuJueSe = userInfo.getRoles();
+
         if (!yongHuJueSe.contains(36) && !yongHuJueSe.contains(1)) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您没有权限退费。");
         }
@@ -125,80 +132,134 @@ public class XiangMuLuRuService {
         if (dao.getHuanZheSFZaiYuan(param.getInpatientNo(), param.getAdmissTimes()) == 0) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该患者已出院");
         }
-
-        int infantFlag = 0;
-        // 判断是否为婴儿
-        if (param.getInpatientNo().contains("$")) {
-            param.setInpatientNo(param.getInpatientNo().split("\\$")[0]);
-            infantFlag = 1;
-        }
-        Integer ledgerSn = publicServer.getLedgerSn(param.getInpatientNo(), param.getAdmissTimes());
-        // 判断数据是否为 退费数据
-        List<ZyDetailCharge> chaKanSFtuiFei = dao.chaKanSFYiJingTuiFeiLe(param.getInpatientNo(), param.getAdmissTimes(), ledgerSn, param.getList());
-        for (ZyDetailCharge charge : chaKanSFtuiFei) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号为:【%s】已退费,请勿重复退费。", charge.getOriDetailSn()));
-        }
         if (dao.getHuanZheSFJieSuan(param.getInpatientNo(), param.getAdmissTimes()) == null || dao.getHuanZheSFJieSuan(param.getInpatientNo(), param.getAdmissTimes()) != 0) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "该患者已经结算了");
         }
+
+        // 判断是否为婴儿
+        int infantFlag = publicServer.getInfantFlag(param.getInpatientNo());
+        // 获取 患者的账页号
+        Integer ledgerSn = publicServer.getLedgerSn(param.getInpatientNo(), param.getAdmissTimes());
         // 获取原来的数据
         List<ZyDetailCharge> yuanTuiFeiList = dao.huoQuJuTiFeiYong(param.getInpatientNo(), param.getAdmissTimes(), ledgerSn, param.getList());
-        // 获取患者的总费用
-        BigDecimal sum = new BigDecimal(0);
-        // 退费的list
-        // 获取最大值
-        Integer maxDetailSn = publicServer.getMaxDetailSn(param.getInpatientNo(), param.getAdmissTimes());
-
-        List<ZyDetailCharge> yaoPingDan = new ArrayList<>();
-
-        List<Integer> genXingZhenShuTuiFeiLiuShui = new ArrayList<>();
-        List<ZyDetailCharge> tuiFeiList = new ArrayList<>();
-        // 获取到用户角色   管理员角色可以无视
+        // 获取当前用户 下面的科室
         List<String> zhiXinKeShi = dao.chaXunZhiZXinKeShi(param.getDeptCode());
 
-        for (ZyDetailCharge pojo : yuanTuiFeiList) {
-            // 判断患者的费用是否存在负数
-            if (pojo.getChargeFee().signum() == -1 || pojo.getChargeAmount().signum() == -1) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("患者费用存在负数,流水号:【%s】,该数据为退费数据。", pojo.getDetailSn()));
+        // 项目
+        List<ZyDetailCharge> xiangMu = new ArrayList<>();
+        // 药品
+        List<ZyDetailCharge> yaoPin = new ArrayList<>();
+        // 退费的list
+        List<ZyDetailCharge> tuiFeiList = new ArrayList<>();
+        // 医技科室退药单
+        List<ZyDetailCharge> yaoPingDan = new ArrayList<>();
+        // 把原来的更新 为 -1
+        List<Integer> updateItemTags = new ArrayList<>();
+        // 把 药品 改成 -1 代表已经退了 -2 代表申请 -3 代表拒绝
+        List<Integer> updateDrugLabel = new ArrayList<>();
+        // 患者最大的 detail_sn
+        int maxDetailSn = publicServer.getMaxDetailSn(param.getInpatientNo(), param.getAdmissTimes());
+
+        for (ZyDetailCharge item : yuanTuiFeiList) {
+            // 拒绝发药是可以重新申请的
+            if (item.getOriDetailSn() != null && item.getOriDetailSn().equals(-3)) {
+                item.setOriDetailSn(null);
             }
-            if (pojo.getChargeCode().startsWith("BILL")) {
-                yaoPingDan.add(pojo);
+            if (item.getOriDetailSn() != null && item.getOriDetailSn().equals(-2)) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号:【%s】,该药品在申请退药。", item.getDetailSn()));
             }
-            // 在这里判断执行科室
-            ResultVo<String> LOGICAL_ERROR = getStringResultVo(yongHuJueSe, zhiXinKeShi, param, pojo, panDuanYaoPing);
-            if (LOGICAL_ERROR != null) {
-                return LOGICAL_ERROR;
+            if (item.getOriDetailSn() != null) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号:【%s】,该数据为退费数据。", item.getDetailSn()));
+            }
+            if (BigUtils.bigXiaoYu(item.getChargeFee(), 0) || BigUtils.bigXiaoYu(item.getChargeAmount(), 0)) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号:【%s】,该数据为负数。", item.getDetailSn()));
+            }
+            if ("00".equals(item.getSerial()) && !zhiXinKeShi.contains(item.getExecUnit())) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号:【%s】,请对应的执行科室进行退费。", item.getDetailSn()));
             }
             // 数据库有个 触发器 如果带了医嘱号且有篆刻那么这里就需要改成 0
-            if (BigUtils.bigDaYu(pojo.getOrderNo(), 10)) {
-                pojo.setOrderNo(new BigDecimal(0));
+            if (BigUtils.bigDaYu(item.getOrderNo(), 10)) {
+                item.setOrderNo(new BigDecimal(0));
             }
-            sum = sum.add(pojo.getChargeFee().multiply(pojo.getChargeAmount()));
-            pojo.setChargeFee(pojo.getChargeFee().negate());
-            pojo.setChargeAmount(pojo.getChargeAmount().negate());
-            pojo.setOpIdCode(TokenUtil.getTokenUserId());
-            pojo.setOriDetailSn(pojo.getDetailSn());
-            pojo.setDetailSn(maxDetailSn += 1);
-            pojo.setOldGenTime(DateUtil.formatDatetime(pojo.getGenTime(), DateUtil.DEFAULT_PATTERN));
-            // 向退费 list 里面添加
-            tuiFeiList.add(pojo);
-            genXingZhenShuTuiFeiLiuShui.add(pojo.getOriDetailSn());
-        }
-        // 执行退费的操作 20 条的退费
-        if (tuiFeiList.isEmpty()) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "查询不到患者原数据。");
-        } else {
-            log.info("操作项目退费 ==》 操作人:{},数据:{}", TokenUtil.getTokenUserId(), JSON.toJSONString(tuiFeiList));
-            List<List<ZyDetailCharge>> fenGe = ListUtils.partition(tuiFeiList, 20);
-            if (ListUtil.notBlank(yaoPingDan)) {
-                dao.shenQingYaoPing(param, yaoPingDan, infantFlag, publicServer.getLedgerSn(param.getInpatientNo(), param.getAdmissTimes()), TokenUtil.getTokenUserId());
+            if ("00".equals(item.getSerial())) {
+                maxDetailSn = setRefund(xiangMu, tuiFeiList, updateItemTags, maxDetailSn, item);
+            } else {
+                if (item.getOrderNo().equals(new BigDecimal(3))) {
+                    // todo 口服药不能退
+                    if (!zhiXinKeShi.contains(item.getExecUnit())) {
+                        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("流水号:【%s】,此药品为医技科室录入,请对应的医技科室退费。", item.getDetailSn()));
+                    } else {
+                        maxDetailSn = setRefund(xiangMu, tuiFeiList, updateItemTags, maxDetailSn, item);
+                        yaoPingDan.add(item);
+                    }
+                } else {
+                    // 数量变成负数
+                    item.setChargeAmount(item.getChargeAmount().negate());
+                    yaoPin.add(item);
+                    updateDrugLabel.add(item.getDetailSn());
+                }
+
             }
+        }
+
+        if (ListUtil.notBlank(xiangMu)) {
+            List<List<ZyDetailCharge>> fenGe = ListUtils.partition(xiangMu, 20);
             fenGe.forEach(dao::xiangMuTuiFei);
-            dao.genXinZhenShuTuiFeiLiuShui(param.getInpatientNo(), param.getAdmissTimes(), publicServer.getLedgerSn(param.getInpatientNo(), param.getAdmissTimes()), genXingZhenShuTuiFeiLiuShui);
-            return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "项目退费操作成功。乁( ˙ ω˙乁)");
+            dao.genXinZhenShuTuiFeiLiuShui(param.getInpatientNo(), param.getAdmissTimes(), ledgerSn, updateItemTags, -1);
+            log.info("项目录入==》项目退费,操作人:{},数据:{}", TokenUtil.getTokenUserId(), JSON.toJSONStringWithDateFormat(xiangMu, DateUtil.DEFAULT_PATTERN));
+        }
+
+        if (ListUtil.notBlank(yaoPingDan)) {
+            dao.shenQingYaoPing(param, yaoPingDan, infantFlag, ledgerSn, TokenUtil.getTokenUserId());
         }
+
+        if (ListUtil.notBlank(yaoPin)) {
+            ZyActpatient 患者信息 = publicServer.huoQuHuanZheXinXi(param.getInpatientNo());
+            Integer pageNo = publicServer.getTheDrugListNo();
+            // 药品单号
+            String groupNo = publicServer.getGroupNo();
+            // 退药单汇总
+            dao.drugReturnForm(pageNo, 患者信息.getWard(), TokenUtil.getTokenUserId(), groupNo);
+            // 退药明细
+            dao.detailsOfDrugReturnForm(yaoPin, 患者信息.getInpatientNo(), 患者信息.getAdmissTimes(),
+                    患者信息.getName(), 患者信息.getBedNo(), 患者信息.getWard(),
+                    infantFlag, groupNo, TokenUtil.getTokenUserId(), pageNo, ledgerSn);
+            dao.genXinZhenShuTuiFeiLiuShui(param.getInpatientNo(), param.getAdmissTimes(), ledgerSn, updateDrugLabel, -2);
+            log.info("项目录入==》药品退费,操作人:{},数据:{}", TokenUtil.getTokenUserId(), JSON.toJSONStringWithDateFormat(yaoPin, DateUtil.DEFAULT_PATTERN));
+        }
+
+        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "退费成功。");
+
     }
 
+    /**
+     * 退费
+     *
+     * @param xiangMu
+     * @param tuiFeiList
+     * @param updateItemTags
+     * @param maxDetailSn
+     * @param item
+     * @return
+     */
+    private static int setRefund(List<ZyDetailCharge> xiangMu, List<ZyDetailCharge> tuiFeiList, List<Integer> updateItemTags, int maxDetailSn, ZyDetailCharge item) {
+        // 取负数的费用
+        item.setChargeFee(item.getChargeFee().negate());
+        item.setChargeAmount(item.getChargeAmount().negate());
+        // 执行人
+        item.setOpIdCode(TokenUtil.getTokenUserId());
+        item.setOriDetailSn(item.getDetailSn());
+        item.setOldGenTime(DateUtil.formatDatetime(item.getGenTime(), DateUtil.DEFAULT_PATTERN));
+        // 设置 流水号
+        item.setDetailSn(maxDetailSn += 1);
+        // 向退费 list 里面添加
+        tuiFeiList.add(item);
+        xiangMu.add(item);
+        updateItemTags.add(item.getOriDetailSn());
+        return maxDetailSn;
+    }
+
+
     private ResultVo<String> getStringResultVo(List<Integer> yongHuJueSe, List<String> zhiXinKeShi, ZyDetailCharge xuYaoTuiDeShuJu, ZyDetailCharge piPeiDeShuJu, Boolean panDuanYaoPin) {
         // 获取到用户角色   管理员角色可以无视
         if (!yongHuJueSe.contains(1) && !yongHuJueSe.contains(8)) {

+ 18 - 1
src/main/java/thyyxxk/webserver/service/medicalinsurance/SetlListUpldService.java

@@ -434,6 +434,7 @@ public class SetlListUpldService {
 
         // 手术 也是一样的
         temp.setOprninfo(EntityCopy.CopyList(dao.shouShuXinXi(patNo, times, flag == 1 ? "batj_ba4_modify" : "batj_ba4"), OprninfoUpldTemp.class));
+
         temp.setIcuinfo(EntityCopy.CopyList(uploadInfo.getData().getIcuinfo(), IcuinfoUpldTemp.class));
         // 国籍
         temp.getSetlinfo().setNtlyName(dao.getNtlyName(temp.getSetlinfo().getNtly()));
@@ -921,6 +922,7 @@ public class SetlListUpldService {
 
         zy.setPatientBldInfos(dao.shuXueXinXi(patNo, times));
 
+        // todo 在这里要返回患者的分值和科室盈亏
         for (YbZyDisDiag item : zy.getYbZyDisDiag()) {
             item.setSsfz(caseFrontSheetMainService.fetchSsfz(item.getDisDiag().trim(), patNo, times).getData());
         }
@@ -1141,11 +1143,25 @@ public class SetlListUpldService {
             Exception {
         UpldCollection upldCollection = new UpldCollection();
         SetlinfoUpld mzPatient = dao.mzPatInfo(patNo, times);
+        EntityCopy.Copy(dao.mzPatInfo1(patNo, times), mzPatient);
         EntityCopy.Copy(dao.mzJieSuanXinXi(patNo, times), mzPatient);
+
         upldCollection.setSetlinfo(mzPatient);
         mzPatient.setMedcasno(patNo + "_" + times);
         // 门诊慢特病
-        upldCollection.setOpspdiseinfo(dao.outpatientDiagnosis(patNo, times));
+        OpspdiseinfoUpld opspdiseinfoUpld = dao.outpatientDiagnosis1(patNo, times);
+
+        if (opspdiseinfoUpld != null) {
+            String[] str = opspdiseinfoUpld.getDiagCode().split(",");
+            List<OpspdiseinfoUpld> opspdiseinfoUpldList = new ArrayList<>();
+            for (String s : str) {
+                opspdiseinfoUpldList.add(dao.outpatientSlowDiagnosis(s));
+            }
+            upldCollection.setOpspdiseinfo(opspdiseinfoUpldList);
+        } else {
+            upldCollection.setOpspdiseinfo(dao.outpatientDiagnosis2(patNo, times));
+        }
+
 
         mzPatient.setHsorg("长沙市医疗保障事务中心");
         mzPatient.setHsorgOpter("长沙市医疗保障事务中心");
@@ -1198,6 +1214,7 @@ public class SetlListUpldService {
         return ResultVoUtil.success(upldCollection);
     }
 
+
     /**
      * 修改患者的医疗类别
      *

+ 1 - 2
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/CaoYaoYiZhuServer.java

@@ -23,7 +23,6 @@ import thyyxxk.webserver.utils.*;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 
 /**
@@ -147,7 +146,7 @@ public class CaoYaoYiZhuServer {
         param.setOrderJe(sum);
         param.setInputId(TokenUtil.getTokenUserId());
         param.setOrderJeDj(dao.huoQuDaiJianFei());
-        param.setPageNo(Integer.valueOf(DateUtil.formatDatetime(new Date(), "yyMMdd") + publicServer.huoQuCaoYaoShenQingDanHao()));
+        param.setPageNo(publicServer.getTheDrugListNo());
         XinZhenYiZhu huanZheXinXi = yiZhuLuRuDao.huoQuHuanZheXinXi(param.getInpatientNo(), param.getAdmissTimes());
         param.setOrderNo(BigDecimal.valueOf(publicServer.getActOrderNo()));
         dao.chaRuCaoYaoYiZhu(param, huanZheXinXi.getDeptCode(), huanZheXinXi.getDeptCode(), huanZheXinXi.getSmallDept());

+ 8 - 3
src/main/java/thyyxxk/webserver/utils/EntityCopy.java

@@ -4,15 +4,12 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 
 import java.beans.BeanInfo;
 import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
-import java.util.ArrayList;
 import java.util.List;
-import java.util.Objects;
 
 /**
  * <p>
@@ -62,6 +59,14 @@ public class EntityCopy {
         return StringUtils.isBlank(value.toString());
     }
 
+    /**
+     * 注意  如果使用  @JSONField(name = xxx) 那么两个实体类都要有
+     *
+     * @param list  源对象
+     * @param clazz class
+     * @param <T>
+     * @return
+     */
     public static <T> List<T> CopyList(List<?> list, Class<T> clazz) {
         String oldOb = JSON.toJSONString(list);
         return JSON.parseArray(oldOb, clazz);