Browse Source

新医保。

lighter 4 years ago
parent
commit
a08bc41324

+ 6 - 0
src/main/java/thyyxxk/webserver/controller/medicalinsurance/SiZyController.java

@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import thyyxxk.webserver.entity.ResultVo;
+import thyyxxk.webserver.entity.medicalinsurance.GeneralRevoke;
 import thyyxxk.webserver.entity.medicalinsurance.ZyPatientInfo;
 import thyyxxk.webserver.entity.yibao.patient.Overview;
 import thyyxxk.webserver.service.medicalinsurance.SiZyService;
@@ -41,6 +42,11 @@ public class SiZyController {
         return service.uploadFeeDetail(o);
     }
 
+    @PostMapping("/revokeUploadFees")
+    public ResultVo<String> revokeUploadFees(@RequestBody GeneralRevoke r) {
+        return service.revokeUploadFees(r);
+    }
+
     @PostMapping("/hospitalizationPreSettlement")
     public ResultVo<String> hospitalizationPreSettlement(@RequestBody ZyPatientInfo p) {
         return service.hospitalizationPreSettlement(p);

+ 31 - 15
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiZyDao.java

@@ -1,6 +1,7 @@
 package thyyxxk.webserver.dao.his.medicalinsurance;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.sun.xml.bind.v2.TODO;
 import org.apache.ibatis.annotations.*;
 import thyyxxk.webserver.entity.medicalinsurance.SiZyInfo;
 import thyyxxk.webserver.entity.medicalinsurance.ZyPatientInfo;
@@ -86,11 +87,9 @@ public interface SiZyDao {
             "admiss_times=rtrim(isnull(a.admiss_times, b.admiss_times)), " +
             "social_no=rtrim(isnull(a.social_no, c.social_no)), " +
             "name=rtrim(isnull(a.name, b.name)), " +
-            "yb_type=rtrim(isnull(a.yb_type, b.yb_type)), " +
-            "total_charge=(select rtrim(isnull(total_charge, '0.00')) from zy_ledger_file where inpatient_no=#{inpatientNo} " +
-            "and admiss_times=b.admiss_times and ledger_sn=a.ledger_sn), " +
-            "hic_no=rtrim((select hic_no_new from a_patient_mi where inpatient_no = #{inpatientNo})), " +
-            "yb_jlh=rtrim(b.yb_jlh) FROM a_patient_mi c, zy_actpatient b " +
+            "total_charge=(select rtrim(isnull(total_charge, '0.00')) from zy_ledger_file " +
+            "where inpatient_no=#{inpatientNo} " +
+            "and admiss_times=b.admiss_times and ledger_sn=a.ledger_sn) FROM a_patient_mi c, zy_actpatient b " +
             "LEFT JOIN yb_zy_review_record a ON b.inpatient_no = a.inpatient_no " +
             "AND b.admiss_times = a.admiss_times WHERE b.inpatient_no = #{inpatientNo} " +
             "AND b.inpatient_no = c.inpatient_no ")
@@ -105,16 +104,33 @@ public interface SiZyDao {
      * @param ledgerSn    账页号
      * @return 费用明细
      */
-    @Select("select detail_sn,order_no,charge_date,charge_code_mx,charge_fee,charge_amount,ward_code, " +
-            "nationalCode=(case when charge_code in ('BILL01','BILL02','BILL28') then " +
-            "(select max(national_code) from yp_zd_dict where code=charge_code_mx) " +
-            "else (select national_code from zd_charge_item where code=charge_code_mx) end), " +
-            "wardName=(select name from zd_unit_code where code=ward_code), " +
-            "doctor_code,doctorName=(select rtrim(name) from a_employee_mi where code=doctor_code), " +
-            "refer_physician,referName=(select rtrim(name) from a_employee_mi where code=refer_physician), " +
-            "op_id_code,opName=(select rtrim(name) from a_employee_mi where code=op_id_code) " +
-            "from zy_detail_charge where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes} and " +
-            "ledger_sn=#{ledgerSn} and isnull(trans_flag_yb,0) in ('',0)")
+//    @Select("select detail_sn,order_no,charge_date,charge_code_mx,charge_fee,charge_amount,ward_code, " +
+//            "nationalCode=(case when charge_code in ('BILL01','BILL02','BILL28') then " +
+//            "(select max(national_code) from yp_zd_dict where code=charge_code_mx) " +
+//            "else (select national_code from zd_charge_item where code=charge_code_mx) end), " +
+//            "wardName=(select name from zd_unit_code where code=ward_code), " +
+//            "doctor_code,doctorName=(select rtrim(name) from a_employee_mi where code=doctor_code), " +
+//            "refer_physician,referName=(select rtrim(name) from a_employee_mi where code=refer_physician), " +
+//            "op_id_code,opName=(select rtrim(name) from a_employee_mi where code=op_id_code) " +
+//            "from zy_detail_charge where inpatient_no=#{inpatientNo} and admiss_times=#{admissTimes} and " +
+//            "ledger_sn=#{ledgerSn} and isnull(trans_flag_yb,0) in ('',0)")
+//    IPage<SiChargeDetail> selectNotUploadedFees(IPage<SiChargeDetail> iPage,
+//                                                @Param("inpatientNo") String inpatientNo,
+//                                                @Param("admissTimes") int admissTimes,
+//                                                @Param("ledgerSn") int ledgerSn);
+
+    // TODO 下面是测试用的,要删除
+    @Select("select * from (select detail_sn,order_no,charge_date,charge_code_mx,charge_fee,charge_amount,ward_code,\n" +
+            "            nationalCode=(case when charge_code in ('BILL01','BILL02','BILL28') then\n" +
+            "            (select max(national_code) from yp_zd_dict where code=charge_code_mx)\n" +
+            "            else (select national_code from zd_charge_item where code=charge_code_mx) end),\n" +
+            "    wardName=(select name from zd_unit_code where code=ward_code),\n" +
+            "    doctor_code,doctorName=(select rtrim(name) from a_employee_mi where code=doctor_code),\n" +
+            "    refer_physician,referName=(select rtrim(name) from a_employee_mi where code=refer_physician),\n" +
+            "    op_id_code,opName=(select rtrim(name) from a_employee_mi where code=op_id_code)\n" +
+            "    from zy_detail_charge where inpatient_no='0394356' and admiss_times=1 and\n" +
+            "            ledger_sn=1 and isnull(trans_flag_yb,0) in ('',0)\n" +
+            "            ) temp where temp.nationalCode is not null")
     IPage<SiChargeDetail> selectNotUploadedFees(IPage<SiChargeDetail> iPage,
                                                 @Param("inpatientNo") String inpatientNo,
                                                 @Param("admissTimes") int admissTimes,

+ 2 - 2
src/main/java/thyyxxk/webserver/entity/medicalinsurance/ZyPatientInfo.java

@@ -11,14 +11,13 @@ import java.util.Date;
  **/
 @Data
 public class ZyPatientInfo {
+    private String sid;
     private String inpatientNo;
     private Integer admissTimes;
     private Integer ledgerSn;
     private Date admissDate;
     private String referPhysician;
     private String referPhysicianName;
-    private String icdCode;
-    private String icdText;
     private String smallDept;
     private String smallDeptName;
     private String socialNo;
@@ -29,6 +28,7 @@ public class ZyPatientInfo {
     private String deptName;
     private String bedNo;
     private Integer dismissWay;
+    private boolean isDbg;
 
     private String psnNo;
     private String insuplcAdmdvs;

+ 1 - 3
src/main/java/thyyxxk/webserver/service/medicalinsurance/ExecService.java

@@ -137,10 +137,8 @@ public class ExecService {
         data.put("psn_type", p.getPsnType());
         data.put("psn_name", p.getName());
         data.put("medfee_sumamt", p.getTotalCharge());
-        // TODO: 2021-06-15 个人结算方式  01-按项目结算    02-按定额结算
-        data.put("psn_setlway", "01");
+        data.put("psn_setlway", p.isDbg() ? "02" : "01");
         data.put("mdtrt_id", p.getMdtrtId());
-        // TODO: 2021-06-15 险种类型
         data.put("insutype", p.getInsuType());
         // TODO: 2021-06-15 中途结算标志  0-否 1-是
         data.put("mid_setl_flag", "0");

+ 8 - 3
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiQueryService.java

@@ -10,6 +10,7 @@ import thyyxxk.webserver.dao.his.medicalinsurance.SiZyDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.medicalinsurance.GeneralRevoke;
 import thyyxxk.webserver.entity.medicalinsurance.QuerySiInfo;
+import thyyxxk.webserver.entity.medicalinsurance.SiZyInfo;
 import thyyxxk.webserver.entity.medicalinsurance.ZyPatientInfo;
 import thyyxxk.webserver.utils.*;
 
@@ -87,13 +88,17 @@ public class SiQueryService {
     }
 
     public ResultVo<JSONObject> queryVisitInfo(ZyPatientInfo p) {
+        SiZyInfo siZyInfo = dao.selectSiZyInfo(p.getInpatientNo(), p.getAdmissTimes(), p.getLedgerSn());
+        if (null == siZyInfo || StringUtil.isBlank(siZyInfo.getMdtrtId())) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保在院信息!");
+        }
         JSONObject input = exec.makeTradeHeader(SiFunction.QUERY_VISIT_INFO);
         JSONObject data = new JSONObject();
-        data.put("psn_no", p.getPsnNo());
+        data.put("psn_no", siZyInfo.getPsnNo());
         data.put("begntime", DateUtil.formatDatetime(p.getAdmissDate()));
         data.put("endtime", DateUtil.now());
-        data.put("med_type", p.getMedType());
-        data.put("mdtrt_id", p.getMdtrtId());
+        data.put("med_type", siZyInfo.getMedType());
+        data.put("mdtrt_id", siZyInfo.getMdtrtId());
         input.getJSONObject("input").put("data", data);
         JSONObject result = exec.executeTrade(input, SiFunction.QUERY_VISIT_INFO);
         log.info("【操作员:{}】,查询就诊信息:参数:{},结果:{}", TokenUtil.getTokenUserId(), input, result);

+ 23 - 10
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiZyService.java

@@ -73,12 +73,13 @@ public class SiZyService {
         mdtrtinfo.put("ipt_no", p.getInpatientNo());
         mdtrtinfo.put("atddr_no", p.getReferPhysician());
         mdtrtinfo.put("chfpdr_name", p.getReferPhysicianName());
-        mdtrtinfo.put("adm_diag_dscr", p.getIcdText());
+        mdtrtinfo.put("adm_diag_dscr", zyInYbDiags.get(0).getIcdText());
         mdtrtinfo.put("adm_dept_codg", p.getSmallDept());
         mdtrtinfo.put("adm_dept_name", p.getSmallDeptName());
         mdtrtinfo.put("adm_bed", p.getBedNo());
         mdtrtinfo.put("dscg_maindiag_code", zyInYbDiags.get(0).getIcdCode());
         mdtrtinfo.put("dscg_maindiag_name", zyInYbDiags.get(0).getIcdText());
+        mdtrtinfo.put("dise_codg", zyInYbDiags.get(0).getIcdCode());
         // 手术操作代码,日间手术病种时必填
         mdtrtinfo.put("oprn_oprt_code", "");
         input.getJSONObject("input").put("mdtrtinfo", mdtrtinfo);
@@ -113,12 +114,12 @@ public class SiZyService {
         adminfo.put("ipt_otp_no", p.getInpatientNo());
         adminfo.put("atddr_no", p.getReferPhysician());
         adminfo.put("chfpdr_name", p.getReferPhysicianName());
-        adminfo.put("adm_diag_dscr", p.getIcdText());
+        adminfo.put("adm_diag_dscr", zyInYbDiags.get(0).getIcdText());
         adminfo.put("adm_dept_codg", p.getSmallDept());
         adminfo.put("adm_dept_name", p.getSmallDeptName());
         adminfo.put("adm_bed", p.getBedNo());
-        adminfo.put("dscg_maindiag_code", p.getIcdCode());
-        adminfo.put("dscg_maindiag_name", p.getIcdText());
+        adminfo.put("dscg_maindiag_code", zyInYbDiags.get(0).getIcdCode());
+        adminfo.put("dscg_maindiag_name", zyInYbDiags.get(0).getIcdText());
         input.getJSONObject("input").put("adminfo", adminfo);
         putDiseInfo(zyInYbDiags, input, p.getPsnNo(), p.getSmallDeptName());
         JSONObject result = exec.executeTrade(input, SiFunction.MODIFY_ADMISSION_INFO);
@@ -172,8 +173,10 @@ public class SiZyService {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保在院信息!");
         }
         dao.hisRecount(o.getInpatientNo(), o.getAdmissTimes(), o.getLedgerSn());
+        o.setStaffId(TokenUtil.getTokenUserId());
         settleService.posNegOffset(o);
         ZyPatientInfo p = dao.selectPatientInfo(o.getInpatientNo());
+        p.setSid(o.getSid());
         p.setLedgerSn(o.getLedgerSn());
         p.setMdtrtId(siZyInfo.getMdtrtId());
         p.setPsnNo(siZyInfo.getPsnNo());
@@ -253,8 +256,14 @@ public class SiZyService {
         if (null != result) {
             if (result.getIntValue(RESULT_CODE) == 0) {
                 dao.updateTransFlag(p.getInpatientNo(), p.getAdmissTimes(), detailSns);
-                JSONObject output = result.getJSONObject(OUTPUT);
-                JSONObject uploadResult = output.getJSONObject("result");
+            } else {
+                String message = result.getString(ERROR_MESSAGE);
+                JSONObject socketMsg = new JSONObject();
+                socketMsg.put("name", "uploadFeeResponse");
+                socketMsg.put("inpatientNo", p.getInpatientNo());
+                socketMsg.put("patientName", p.getName());
+                socketMsg.put("msg", message);
+                WebSocketServer.sendMessage(p.getSid(), socketMsg.toJSONString());
             }
         }
     }
@@ -296,20 +305,24 @@ public class SiZyService {
     }
 
     public ResultVo<String> revokeUploadFees(GeneralRevoke r) {
+        SiZyInfo siZyInfo = dao.selectSiZyInfo(r.getInpatientNo(), r.getAdmissTimes(), r.getLedgerSn());
+        if (null == siZyInfo || StringUtil.isBlank(siZyInfo.getMdtrtId())) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者没有有效的医保在院信息!");
+        }
         JSONObject input = exec.makeTradeHeader(SiFunction.REVOKE_HOSPITALIZATION_FEE_DETAILS);
         JSONArray data = new JSONArray();
         if (null == r.getDetailSns() || r.getDetailSns().isEmpty()) {
             JSONObject item = new JSONObject();
             item.put("feedetl_sn", "0000");
-            item.put("mdtrt_id", r.getMdtrtId());
-            item.put("psn_no", r.getPsnNo());
+            item.put("mdtrt_id", siZyInfo.getMdtrtId());
+            item.put("psn_no", siZyInfo.getPsnNo());
             data.add(item);
         } else {
             r.getDetailSns().forEach(detailSn -> {
                 JSONObject item = new JSONObject();
                 item.put("feedetl_sn", detailSn);
-                item.put("mdtrt_id", r.getMdtrtId());
-                item.put("psn_no", r.getPsnNo());
+                item.put("mdtrt_id", siZyInfo.getMdtrtId());
+                item.put("psn_no", siZyInfo.getPsnNo());
                 data.add(item);
             });
         }