Browse Source

医保接口

lighter 3 years ago
parent
commit
9d74f5a232

+ 49 - 0
src/main/java/thyyxxk/webserver/constants/sidicts/DrordDrProfttl.java

@@ -0,0 +1,49 @@
+package thyyxxk.webserver.constants.sidicts;
+
+import thyyxxk.webserver.utils.StringUtil;
+
+public enum DrordDrProfttl {
+    CHIEF_PHYSICIAN("231", "主任医师", "001"),
+
+    DEPUTY_CHIEF_PHYSICIAN("232", "副主任医师", "002"),
+
+    MAIN_PHYSICIAN("233", "主诊医师", "003"),
+
+    NORMAN_PHYSICIAN("234", "医师", "004"),
+
+    UNDER_PHYSICIAN("235", "医士", "005");
+
+    private final String code;
+    private final String name;
+    private final String hisCode;
+
+    DrordDrProfttl(String code, String name, String hisCode) {
+        this.code = code;
+        this.name = name;
+        this.hisCode = hisCode;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getHisCode() {
+        return hisCode;
+    }
+
+    public static String getCodeByHisCode(String hisCode) {
+        if (StringUtil.isBlank(hisCode)) {
+            return null;
+        }
+        for (DrordDrProfttl profttl : DrordDrProfttl.values()) {
+            if (hisCode.trim().equals(profttl.getHisCode())) {
+                return profttl.getCode();
+            }
+        }
+        return null;
+    }
+}

+ 10 - 4
src/main/java/thyyxxk/webserver/controller/medicalinsurance/SiManageController.java

@@ -2,10 +2,7 @@ package thyyxxk.webserver.controller.medicalinsurance;
 
 import org.springframework.beans.factory.annotation.Autowired;
 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.medicalinsurance.manage.*;
@@ -60,4 +57,13 @@ public class SiManageController {
         return service.selectSetlinfos(prm);
     }
 
+    @PassToken
+    @GetMapping("/detailAnalyse")
+    public ResultVo<String> detailAnalyse(@RequestParam("patNo") String patNo,
+                                          @RequestParam("times") int times,
+                                          @RequestParam("ledger") int ledger,
+                                          @RequestParam("type") int type) {
+        return service.detailAnalyse(patNo, times, ledger, type);
+    }
+
 }

+ 2 - 1
src/main/java/thyyxxk/webserver/dao/his/casefrontsheet/CaseFrontSheetDao.java

@@ -624,7 +624,8 @@ public interface CaseFrontSheetDao extends BaseMapper<CaseFrontsheetMain> {
     DisefamilyGrade selectDisefamilyGrade(@Param("code") String code);
 
     @Select("select yb_code from zd_icd9_cm3 where code in " +
-            "(select ssbm from ${table} with(nolock) where zyh=#{bah} and zycs=#{times} and isnull(ssbm,'')!='') ")
+            "(select ssbm from ${table} with(nolock) where zyh=#{bah} and zycs=#{times} and isnull(ssbm,'')!='') " +
+            "union select ssbm from ${table} with(nolock) where zyh=#{bah} and zycs=#{times} and isnull(ssbm,'')!=''")
     List<String> selectPatientSurgeryCodes(@Param("bah") String bah, @Param("times") Integer times, @Param("table") String table);
 
     @Select("select * from t_si_operation_disefamily with(nolock) where disefamily_code=#{code}")

+ 58 - 0
src/main/java/thyyxxk/webserver/dao/his/medicalinsurance/SiManageDao.java

@@ -5,6 +5,10 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 import thyyxxk.webserver.entity.medicalinsurance.manage.InstSetlLdgChkBrf;
+import thyyxxk.webserver.entity.medicalinsurance.manage.detailanalyse.FsiDiagnoseDtos;
+import thyyxxk.webserver.entity.medicalinsurance.manage.detailanalyse.FsiEncounterDtos;
+import thyyxxk.webserver.entity.medicalinsurance.manage.detailanalyse.FsiOrderDtos;
+import thyyxxk.webserver.entity.medicalinsurance.manage.detailanalyse.PatientDtos;
 import thyyxxk.webserver.entity.medicalinsurance.manage.frontsheet.Baseinfo;
 import thyyxxk.webserver.entity.medicalinsurance.manage.frontsheet.Diseinfo;
 import thyyxxk.webserver.entity.medicalinsurance.manage.orderinfo.ActOrder;
@@ -145,4 +149,58 @@ public interface SiManageDao {
             "from yz_act_order a, zy_actpatient b where a.inpatient_no=#{patNo} and a.admiss_times=#{times} " +
             "and a.inpatient_no=b.inpatient_no and a.admiss_times=b.admiss_times")
     List<ActOrder> selectActOrders(@Param("patNo") String patNo, @Param("times") int times);
+
+    @Select("select psn_no as patnId, psn_name as patnName, gend, brdy, insuplc_admdvs as poolarea, mdtrt_id as currMdtrtId " +
+            "from t_si_pat_info where pat_no=#{patNo} and times=#{times}")
+    PatientDtos selectPatientDto(@Param("patNo") String patNo, @Param("times") int times);
+
+    @Select("select mdtrt_id,medinsAdmdvs='430105',medinsLv='03',begntime as adm_date,endtime as dscg_date,\n" +
+            "       dscgMainDiseCodg=(select rtrim(dis_diag) from zy_dis_diag_yb where inpatient_no=a.pat_no and\n" +
+            "                        admiss_times=a.times and dis_diag_no=1),\n" +
+            "       dscgMainDiseName=(select rtrim(dis_diag_comment) from zy_dis_diag_yb where inpatient_no=a.pat_no and\n" +
+            "                        admiss_times=a.times and dis_diag_no=1),\n" +
+            "       drCodg=(select rtrim(op_id_code) from zy_dis_diag_yb where inpatient_no=a.pat_no and\n" +
+            "               admiss_times=a.times and dis_diag_no=1),\n" +
+            "       admDeptCodg=(select rtrim(small_dept) from zy_inactpatient where inpatient_no=a.pat_no and admiss_times=a.times),\n" +
+            "       medMdtrtType=case when setl_type='11' then 1 else 2 end,med_type,medfee_sumamt,fulamt_ownpay_amt,\n" +
+            "       psn_cash_pay,insutype\n" +
+            "from t_si_setlinfo a where a.pat_no=#{patNo} and a.times=#{times} and a.revoked=0")
+    FsiEncounterDtos selectFsiEncounterDto(@Param("patNo") String patNo, @Param("times") int times);
+
+    @Select("select dise_id=rtrim(inpatient_no)+'_'+cast(admiss_times as varchar)+'_'+cast(dis_diag_no as varchar),\n" +
+            "       inout_dise_type='2',maindise_flag=case when dis_diag_no=1 then 1 else 0 end,\n" +
+            "       dis_diag_no as dias_srt_no,rtrim(dis_diag) as dise_codg,rtrim(dis_diag_comment) as dise_name,\n" +
+            "       op_diag_date as dise_date\n" +
+            "from zy_dis_diag_yb where inpatient_no=#{patNo} and admiss_times=#{times}")
+    List<FsiDiagnoseDtos> selectFsiDiagnoseDtos(@Param("patNo") String patNo, @Param("times") int times);
+
+    @Select("select\n" +
+            "    rxId=cast(cast(act_order_no as decimal) as varchar)+'_'+charge_code_mx,\n" +
+            "    rxno=cast(cast(act_order_no as decimal) as varchar),\n" +
+            "    longDrordFlag=case when frequ_code='ONCE' then 0 else 1 end,\n" +
+            "    listType=(select list_type from t_si_setl_fee_detl where setl_id=#{setlId} and feedetl_sn=a.detail_sn),\n" +
+            "    chrgType=(select med_chrgitm_type from t_si_setl_fee_detl where setl_id=#{setlId} and feedetl_sn=a.detail_sn),\n" +
+            "    drordBhvr=case when frequ_code='ONCE' then 1 else 2 end,\n" +
+            "    hilist_code=(select hilist_code from t_si_setl_fee_detl where setl_id=#{setlId} and feedetl_sn=a.detail_sn),\n" +
+            "    hilist_name=(select hilist_name from t_si_setl_fee_detl where setl_id=#{setlId} and feedetl_sn=a.detail_sn),\n" +
+            "    hilist_lv=(select chrgitm_lv from t_si_setl_fee_detl where setl_id=#{setlId} and feedetl_sn=a.detail_sn),\n" +
+            "    pric=(select pric from t_si_setl_fee_detl where setl_id=#{setlId} and feedetl_sn=a.detail_sn),\n" +
+            "    a.charge_code_mx as hosplist_code,a.charge_amount as cnt,\n" +
+            "    hosplistName=(select medins_list_name from t_si_setl_fee_detl where setl_id=#{setlId} and feedetl_sn=a.detail_sn),\n" +
+            "    a.charge_fee as sumamt,\n" +
+            "    ownpayAmt=(select fulamt_ownpay_amt from t_si_setl_fee_detl where setl_id=#{setlId} and feedetl_sn=a.detail_sn),\n" +
+            "    selfpayAmt=(select preselfpay_amt from t_si_setl_fee_detl where setl_id=#{setlId} and feedetl_sn=a.detail_sn),\n" +
+            "    b.start_time as drord_begn_date,b.end_time as drord_stop_date,\n" +
+            "    drord_dept_codg=(select bilg_dept_codg from t_si_setl_fee_detl where setl_id=#{setlId} and feedetl_sn=a.detail_sn),\n" +
+            "    drord_dept_name=(select bilg_dept_name from t_si_setl_fee_detl where setl_id=#{setlId} and feedetl_sn=a.detail_sn),\n" +
+            "    drord_dr_codg=(select bilg_dr_codg from t_si_setl_fee_detl where setl_id=#{setlId} and feedetl_sn=a.detail_sn),\n" +
+            "    drord_dr_name=(select bilg_dr_name from t_si_setl_fee_detl where setl_id=#{setlId} and feedetl_sn=a.detail_sn),\n" +
+            "    drord_dr_profttl=(select rtrim(emp_tit_code) from a_employee_mi where code=b.enter_oper),\n" +
+            "    curr_drord_flag='1'\n" +
+            "from zy_detail_charge a, yz_inact_order b where order_no>100 and a.inpatient_no=#{patNo} and a.admiss_times=#{times}\n" +
+            "and a.ledger_sn>0 and a.inpatient_no=b.inpatient_no and a.admiss_times=b.admiss_times")
+    List<FsiOrderDtos> selectFsiOrderDtos(@Param("patNo") String patNo, @Param("times") int times, @Param("setlId") String setlId);
+
+    @Select("select setl_id from t_si_setlinfo where pat_no=#{patNo} and times=#{times} and revoked=0")
+    String selectSetlId(@Param("patNo") String patNo, @Param("times") int times);
 }

+ 2 - 2
src/main/java/thyyxxk/webserver/dao/his/search/SearchDao.java

@@ -12,13 +12,13 @@ public interface SearchDao {
     @Select("select rtrim(code) as code,rtrim(name) name from a_employee_mi where isnull(del_flag,0)!=1 and ${method} like #{content}")
     IPage<PureCodeName> searchPhysician(IPage<PureCodeName> iPage, @Param("method") String method, @Param("content") String content);
 
-    @Select("select rtrim(yb_code) as code, rtrim(yb_name) as name from zd_icd_code_new where ${method} like #{content}")
+    @Select("select distinct rtrim(yb_code) as code, rtrim(yb_name) as name from zd_icd_code_new where ${method} like #{content}")
     IPage<PureCodeName> searchDiagnose(IPage<PureCodeName> iPage, @Param("method") String method, @Param("content") String content);
 
     @Select("select distinct new_code as code,new_name as name from ${tableName} where new_name like #{content}")
     IPage<PureCodeName> selectSlwSpcDiag(IPage<PureCodeName> iPage, @Param("content") String content, @Param("tableName") String tableName);
 
-    @Select("select code,name from t_zd_injury_icd where ${method} like #{content}")
+    @Select("select distinct code,name from t_zd_injury_icd where ${method} like #{content}")
     IPage<PureCodeName> searchInjurydiag(IPage<PureCodeName> iPage, @Param("method") String method, @Param("content") String content);
 
 }

+ 3 - 1
src/main/java/thyyxxk/webserver/entity/medicalinsurance/manage/detailanalyse/FsiDiagnoseDtos.java

@@ -3,6 +3,8 @@ package thyyxxk.webserver.entity.medicalinsurance.manage.detailanalyse;
 import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Data;
 
+import java.util.Date;
+
 @Data
 public class FsiDiagnoseDtos {
     @JSONField(name = "dise_id")
@@ -24,5 +26,5 @@ public class FsiDiagnoseDtos {
     private String diseName;
 
     @JSONField(name = "dise_date")
-    private String diseDate;
+    private Date diseDate;
 }

+ 3 - 2
src/main/java/thyyxxk/webserver/entity/medicalinsurance/manage/detailanalyse/FsiEncounterDtos.java

@@ -3,6 +3,7 @@ package thyyxxk.webserver.entity.medicalinsurance.manage.detailanalyse;
 import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Data;
 
+import java.util.Date;
 import java.util.List;
 
 @Data
@@ -35,10 +36,10 @@ public class FsiEncounterDtos {
     private String bedno;
 
     @JSONField(name = "adm_date")
-    private String admDate;
+    private Date admDate;
 
     @JSONField(name = "dscg_date")
-    private String dscgDate;
+    private Date dscgDate;
 
     @JSONField(name = "dscg_main_dise_codg")
     private String dscgMainDiseCodg;

+ 1 - 0
src/main/java/thyyxxk/webserver/entity/medicalinsurance/manage/detailanalyse/FsiOrderDtos.java

@@ -94,4 +94,5 @@ public class FsiOrderDtos {
 
     @JSONField(name = "curr_drord_flag")
     private String currDrordFlag;
+
 }

+ 7 - 1
src/main/java/thyyxxk/webserver/entity/medicalinsurance/manage/detailanalyse/PatientDtos.java

@@ -1,7 +1,11 @@
 package thyyxxk.webserver.entity.medicalinsurance.manage.detailanalyse;
 
 import com.alibaba.fastjson.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
 
 @Data
 public class PatientDtos {
@@ -15,7 +19,9 @@ public class PatientDtos {
     private String gend;
 
     @JSONField(name = "brdy")
-    private String brdy;
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date brdy;
 
     @JSONField(name = "poolarea")
     private String poolarea;

+ 1 - 1
src/main/java/thyyxxk/webserver/service/examinations/CovidExamService.java

@@ -47,7 +47,7 @@ public class CovidExamService {
         List<Integer> parentList = new ArrayList<>();
         for (int i = 0; i < list.size(); i ++) {
             CovidExamResult itm = list.get(i);
-            if (StringUtil.notBlank(itm.getPtntNo()) && itm.getPtntNo().endsWith("-J")) {
+            if (StringUtil.notBlank(itm.getPtntName()) && itm.getPtntName().startsWith("核酸混检")) {
                 parentList.add(i);
                 Map<String, Object> childrenMap = thmz.getPatientIdByParentId(itm.getPtntNo());
                 if ((int) childrenMap.get("code") == 0) {

+ 36 - 3
src/main/java/thyyxxk/webserver/service/medicalinsurance/SiManageService.java

@@ -20,7 +20,7 @@ import thyyxxk.webserver.entity.medicalinsurance.manage.*;
 import thyyxxk.webserver.entity.medicalinsurance.manage.deptmanage.DeptInfo;
 import thyyxxk.webserver.entity.medicalinsurance.manage.deptmanage.DeptInfoQuery;
 import thyyxxk.webserver.entity.medicalinsurance.manage.deptmanage.DrInfoQuery;
-import thyyxxk.webserver.entity.medicalinsurance.manage.detailanalyse.MainPart;
+import thyyxxk.webserver.entity.medicalinsurance.manage.detailanalyse.*;
 import thyyxxk.webserver.entity.medicalinsurance.manage.examination.BilgItemInfo;
 import thyyxxk.webserver.entity.medicalinsurance.manage.frontsheet.Baseinfo;
 import thyyxxk.webserver.entity.medicalinsurance.manage.frontsheet.Diseinfo;
@@ -28,6 +28,7 @@ import thyyxxk.webserver.entity.medicalinsurance.manage.goods.*;
 import thyyxxk.webserver.entity.medicalinsurance.manage.orderinfo.ActOrder;
 import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
 import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SlctSetlPrm;
+import thyyxxk.webserver.service.redislike.RedisLikeService;
 import thyyxxk.webserver.utils.*;
 
 import java.io.IOException;
@@ -53,16 +54,18 @@ public class SiManageService {
     private final SiManageDao dao;
     private final SiSetlinfoDao setlinfoDao;
     private final SiLogDao logDao;
+    private final RedisLikeService redis;
 
     @Autowired
     public SiManageService(ExecService exec, SiUploadService upldServcie,
-                           SiDownloadService dldService, SiManageDao dao, SiSetlinfoDao setlinfoDao, SiLogDao logDao) {
+                           SiDownloadService dldService, SiManageDao dao, SiSetlinfoDao setlinfoDao, SiLogDao logDao, RedisLikeService redis) {
         this.exec = exec;
         this.upldServcie = upldServcie;
         this.dldService = dldService;
         this.dao = dao;
         this.setlinfoDao = setlinfoDao;
         this.logDao = logDao;
+        this.redis = redis;
     }
 
     public ResultVo<String> uploadCatalogueContrast(CatalogueContrast prm) {
@@ -347,7 +350,37 @@ public class SiManageService {
         String logpart = type == 1 ? "明细审核事前分析" : "明细审核事中分析";
         JSONObject input = exec.makeTradeHeader(function);
         MainPart mainPart = new MainPart();
-        String ref = JSONObject.toJSONString(mainPart);
+        mainPart.setSyscode("csthyy");
+        mainPart.setTaskId(SnowFlakeId.instance().nextId());
+        mainPart.setTrigScen("1");
+
+        PatientDtos patientDtos = dao.selectPatientDto(patNo, times);
+        FsiEncounterDtos fsiEncounterDtos = dao.selectFsiEncounterDto(patNo, times);
+        fsiEncounterDtos.setAdmDeptName(redis.getDeptName(fsiEncounterDtos.getAdmDeptCodg()));
+        fsiEncounterDtos.setDscgDeptCodg(fsiEncounterDtos.getAdmDeptCodg());
+        fsiEncounterDtos.setDscgDeptName(fsiEncounterDtos.getAdmDeptName());
+
+        List<FsiDiagnoseDtos> fsiDiagnoseDtos = dao.selectFsiDiagnoseDtos(patNo, times);
+        fsiEncounterDtos.setFsiDiagnoseDtos(fsiDiagnoseDtos);
+
+        String setlId = dao.selectSetlId(patNo, times);
+        List<FsiOrderDtos> tempFsiOrderDtos = dao.selectFsiOrderDtos(patNo, times, setlId);
+        Map<String, Integer> distinctOrderMap = new HashMap<>();
+        List<FsiOrderDtos> fsiOrderDtos = new ArrayList<>();
+        tempFsiOrderDtos.forEach(item -> {
+            if (!distinctOrderMap.containsKey(item.getRxId())) {
+                distinctOrderMap.put(item.getRxId(), 1);
+                item.setDrordDrProfttl(DrordDrProfttl.getCodeByHisCode(item.getDrordDrProfttl()));
+                fsiOrderDtos.add(item);
+            }
+        });
+
+        fsiEncounterDtos.setFsiOrderDtos(fsiOrderDtos);
+
+        patientDtos.setFsiEncounterDtos(fsiEncounterDtos);
+        mainPart.setPatientDtos(patientDtos);
+
+        String ref = JSONObject.toJSONStringWithDateFormat(mainPart, "yyyy-MM-dd HH:mm:ss");
         input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
         JSONObject result = exec.executeTrade(input, function);
         log.info("【操作员:{}】,{}:\n参数:{},\n结果:{}", TokenUtil.getTokenUserId(), logpart, input, result);