소스 검색

结算单上传的时候查询诊断和手术的时候要带上入院和出院时间

xiaochan 3 년 전
부모
커밋
37dffc2106

+ 25 - 9
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/UpIdCollectionDao.java

@@ -145,10 +145,14 @@ public interface UpIdCollectionDao {
             "       rtrim(dis_diag_comment) as diag_name,  " +
             "       case when dis_diag_no = 1 then 1 else 0 end as maindiag_flag  " +
             "from ${tableName}  " +
-            "where inpatient_no = #{patNo} and admiss_times = #{times}")
+            "where inpatient_no = #{patNo} and admiss_times = #{times} " +
+            "and op_diag_date > #{admTime}  " +
+            "and op_diag_date < #{dscgTime}")
     List<DiseinfoUpld> diseinfo(@Param("patNo") String patNo,
                                 @Param("times") Integer times,
-                                @Param("tableName") String tableName);
+                                @Param("tableName") String tableName,
+                                @Param("admTime") String admTime,
+                                @Param("dscgTime") String dscgTime);
 
     // 这里是手术操作信息
     @Select("select case ssxh when 1 then 1 else  2 end oprn_oprt_type, " +
@@ -161,10 +165,14 @@ public interface UpIdCollectionDao {
             "       (select rtrim(name) from a_employee_mi where code = mzys) as  anst_dr_name, " +
             "       (select yb_code from a_employee_mi where code = mzys)  as anst_dr_code " +
             "       from ${tableName} " +
-            "where zyh = #{patNo} and zycs = #{times} and isnull(ssbm,'-') <> '-' ")
+            "where zyh = #{patNo} and zycs = #{times} and isnull(ssbm,'-') <> '-' " +
+            "and ssrq > #{admTime} " +
+            "and ssrq < #{dscgTime}")
     List<OprninfoUpld> oprninfoUplds(@Param("patNo") String patNo,
                                      @Param("times") Integer times,
-                                     @Param("tableName") String tableName);
+                                     @Param("tableName") String tableName,
+                                     @Param("admTime") String admTime,
+                                     @Param("dscgTime") String dscgTime);
 
     @Select("select insuplc_admdvs,insutype,med_type from t_si_pat_info " +
             "where pat_no = #{patNo} and times = #{times} and ledger_sn = #{ledgerSn}")
@@ -305,7 +313,7 @@ public interface UpIdCollectionDao {
             "<if test=\"auditFlag != 4 \">" +
             " and c.audit_flag = #{auditFlag} " +
             "</if>" +
-            "<if test=\"hiPaymtd != null \">" +
+            "<if test=\"hiPaymtd != null and hiPaymtd != 0 \">" +
             " and a.hi_paymtd = #{hiPaymtd} " +
             "</if>" +
             "<if test=\"referPhysician != null and  referPhysician != '' \">" +
@@ -417,10 +425,15 @@ public interface UpIdCollectionDao {
             "rtrim(inpatient_no) inpatient_no, admiss_times, dis_diag_no, dis_diag_type,rtrim(dis_diag) dis_diag," +
             "rtrim(dis_diag_comment) dis_diag_comment," +
             "op_id_code, op_diag_date, dis_diag_bzfx, dis_diag_status, operation, si_diag_type,admiss_cond  " +
-            "from ${tableName} where inpatient_no = #{patNo} and admiss_times = #{times} order by  dis_diag_no ")
+            "from ${tableName} where inpatient_no = #{patNo} and admiss_times = #{times} " +
+            "and op_diag_date > #{admTime}  " +
+            "and op_diag_date < #{dscgTime}" +
+            " order by  dis_diag_no ")
     List<YbZyDisDiag> zhenDuanXinXi(@Param("patNo") String patNo,
                                     @Param("times") Integer times,
-                                    @Param("tableName") String tableName);
+                                    @Param("tableName") String tableName,
+                                    @Param("admTime") String admTime,
+                                    @Param("dscgTime") String dscgTime);
 
 
     @Select("select ssys_name = (select top(1) rtrim(name) from a_employee_mi where code = ssys), " +
@@ -433,10 +446,13 @@ public interface UpIdCollectionDao {
             "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 " +
-            "from ${tableName} where zyh = #{patNo} and zycs = #{times} and isnull(ssbm,'-') <> '-'")
+            "from ${tableName} where zyh = #{patNo} and zycs = #{times} and isnull(ssbm,'-') <> '-' " +
+            "and ssrq > #{admTime} and ssrq < #{dscgTime}")
     List<BatjBa4> shouShuXinXi(@Param("patNo") String patNo,
                                @Param("times") Integer times,
-                               @Param("tableName") String tableName);
+                               @Param("tableName") String tableName,
+                               @Param("admTime") String admTime,
+                               @Param("dscgTime") String dscgTime);
 
 
     @Select("select rtrim(inpatient_no) inpatient_no,admiss_times,rtrim(name) name,admiss_date,dis_date,responce_type,operation, " +

+ 19 - 20
src/main/java/thyyxxk/webserver/service/medicalinsurance/SetlListUpldService.java

@@ -100,10 +100,10 @@ public class SetlListUpldService {
         }
         for (OprninfoUpld item : upldCollection.getData().getOprninfo()) {
             if (StringUtil.isBlank(item.getOperDrCode())) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医生:【%s】,没有医保编码请去职工字典数据维护中添加", item.getOperDrName()));
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医生:【%s】,没有医保编码请去职工字典数据维护中添加", null == item.getAnstDrName() ? "没有填写医生" : item.getAnstDrName()));
             }
-            if (StringUtil.isBlank(item.getAnstDrCode())) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医生:【%s】,没有医保编码请去职工字典数据维护中添加", item.getAnstDrName()));
+            if (StringUtil.notBlank(item.getAnstDrName()) && StringUtil.isBlank(item.getAnstDrCode())) {
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, String.format("医生:【%s】,没有医保编码请去职工字典数据维护中添加", null == item.getAnstDrName() ? "没有填写医生" : item.getAnstDrName()));
             }
         }
         JSONObject input = new JSONObject();
@@ -170,16 +170,13 @@ public class SetlListUpldService {
         // 医保机构经办人
         setlinfoUpld.setHsorgOpter("未知");
         setlinfoUpld.setBillNo(dao.billNo(patNo, times, ledgerSn));
-        // 手术 ssxh 为1 的是主手术
-        List<OprninfoUpld> oprninfoUpld = dao.oprninfoUplds(patNo, times, flag == 1 ? "batj_ba4_modify" : "batj_ba4");
-        // 手术计数
-        setlinfoUpld.setOprnOprtCodeCnt(String.valueOf(oprninfoUpld.size()));
-
         EntityCopy.Copy(dao.setlinfo2(patNo), setlinfoUpld);
-
-
         EntityCopy.Copy(dao.setlinfo3(patNo, times), setlinfoUpld);
         EntityCopy.Copy(dao.setlinfo4(patNo, times), setlinfoUpld);
+        List<OprninfoUpld> oprninfoUpld = dao.oprninfoUplds(patNo, times, flag == 1 ? "batj_ba4_modify" : "batj_ba4",
+                DateUtil.formatDatetime(setlinfoUpld.getAdmTime()), DateUtil.formatDatetime(setlinfoUpld.getDscgTime()));
+        // 手术计数
+        setlinfoUpld.setOprnOprtCodeCnt(String.valueOf(oprninfoUpld.size()));
 
         // 离院方式 我们是从 0 开始的所以要加 1
         setlinfoUpld.setDscgWay(DecimalUtil.add1(setlinfoUpld.getDscgWay(), "1"));
@@ -262,7 +259,8 @@ public class SetlListUpldService {
             }
         }
         List<PayinfoUpld> payinfo = dao.payinfoUpld(patNo, times, ledgerSn);
-        List<DiseinfoUpld> diseinfos = dao.diseinfo(patNo, times, flag == 1 ? "zy_dis_diag_yb_modify" : "zy_dis_diag_yb");
+        List<DiseinfoUpld> diseinfos = dao.diseinfo(patNo, times, flag == 1 ? "zy_dis_diag_yb_modify" : "zy_dis_diag_yb",
+                DateUtil.formatDatetime(setlinfoUpld.getAdmTime()), DateUtil.formatDatetime(setlinfoUpld.getDscgTime()));
         setlinfoUpld.setDiagCodeCnt(String.valueOf(diseinfos.size()));
 
         UpldCollection upldCollection = new UpldCollection();
@@ -351,8 +349,9 @@ public class SetlListUpldService {
         temp.setOpspdiseinfo(EntityCopy.CopyList(uploadInfo.getData().getOpspdiseinfo(), OpspdiseinfoUpldTemp.class));
 
         // 诊断 有申请且成功的 就用 新的诊断
-        temp.setDiseinfo(EntityCopy.CopyList(flag == 1 ? dao.zhenDuanXinXi(patNo, times, "zy_dis_diag_yb_modify") :
-                dao.zhenDuanXinXi(patNo, times, "zy_dis_diag_yb"), DiseinfoUpldTemp.class));
+        temp.setDiseinfo(EntityCopy.CopyList(dao.zhenDuanXinXi(patNo, times, flag == 1 ? "zy_dis_diag_yb_modify" : "zy_dis_diag_yb",
+                DateUtil.formatDatetime(temp.getSetlinfo().getAdmTime()),
+                DateUtil.formatDatetime(temp.getSetlinfo().getDscgTime())), DiseinfoUpldTemp.class));
         // 费用类型
         temp.setIteminfo(EntityCopy.CopyList(uploadInfo.getData().getIteminfo(), IteminfoUpldTemp.class));
         // 计算费用的总和
@@ -373,8 +372,8 @@ public class SetlListUpldService {
         }
 
         // 手术 也是一样的
-        temp.setOprninfo(EntityCopy.CopyList(flag == 1 ? dao.shouShuXinXi(patNo, times, "batj_ba4_modify") :
-                dao.shouShuXinXi(patNo, times, "batj_ba4"), OprninfoUpldTemp.class));
+        temp.setOprninfo(EntityCopy.CopyList(dao.shouShuXinXi(patNo, times, flag == 1 ? "batj_ba4_modify" : "batj_ba4",
+                DateUtil.formatDatetime(temp.getSetlinfo().getAdmTime()), DateUtil.formatDatetime(temp.getSetlinfo().getDscgTime())), OprninfoUpldTemp.class));
         temp.setIcuinfo(EntityCopy.CopyList(uploadInfo.getData().getIcuinfo(), IcuinfoUpldTemp.class));
         // 国籍
         temp.getSetlinfo().setNtlyName(dao.getNtlyName(temp.getSetlinfo().getNtly()));
@@ -746,7 +745,7 @@ public class SetlListUpldService {
         // 在这里带出 患者病案首页的 入院病情
         Map<String, YbZyDisDiag> zhenDuanMap = dao.huanZheBingAnShouYeZhenDuanRuYuanBingQing(patNo, times).stream().collect(
                 Collectors.toMap(YbZyDisDiag::getDisDiag, a -> a, (k1, k2) -> k1));
-        List<YbZyDisDiag> laoZhenDuan = dao.zhenDuanXinXi(patNo, times, "zy_dis_diag_yb");
+        List<YbZyDisDiag> laoZhenDuan = dao.zhenDuanXinXi(patNo, times, "zy_dis_diag_yb", DateUtil.formatDatetime(zy.getAdmissDate()), DateUtil.formatDatetime(zy.getDisDate()));
         List<YbZyDisDiag> xuYaoGenXinDeZhenDuan = new ArrayList<>();
 
         for (YbZyDisDiag item : laoZhenDuan) {
@@ -763,11 +762,11 @@ public class SetlListUpldService {
             dao.genXingLaoZhenDuan(xuYaoGenXinDeZhenDuan);
         }
         // 新老一起查
-        zy.setBatjBa4(dao.shouShuXinXi(patNo, times, "batj_ba4"));
-        zy.setNewBatjBa4(dao.shouShuXinXi(patNo, times, "batj_ba4_modify"));
+        zy.setBatjBa4(dao.shouShuXinXi(patNo, times, "batj_ba4", DateUtil.formatDatetime(zy.getAdmissDate()), DateUtil.formatDatetime(zy.getDisDate())));
+        zy.setNewBatjBa4(dao.shouShuXinXi(patNo, times, "batj_ba4_modify", DateUtil.formatDatetime(zy.getAdmissDate()), DateUtil.formatDatetime(zy.getDisDate())));
         // 诊断编码
-        zy.setYbZyDisDiag(dao.zhenDuanXinXi(patNo, times, "zy_dis_diag_yb"));
-        zy.setNewYbZyDisDiag(dao.zhenDuanXinXi(patNo, times, "zy_dis_diag_yb_modify"));
+        zy.setYbZyDisDiag(dao.zhenDuanXinXi(patNo, times, "zy_dis_diag_yb", DateUtil.formatDatetime(zy.getAdmissDate()), DateUtil.formatDatetime(zy.getDisDate())));
+        zy.setNewYbZyDisDiag(dao.zhenDuanXinXi(patNo, times, "zy_dis_diag_yb_modify", DateUtil.formatDatetime(zy.getAdmissDate()), DateUtil.formatDatetime(zy.getDisDate())));
         return ResultVoUtil.success(zy);
     }