Commit b08684e2fe04ebd1e99cba719ecd2d96cf82e153

Authored by gengxiaokai
1 parent 3484081d8d

秦皇岛妇幼根据身份证号查询分娩接口

Showing 1 changed file with 179 additions and 0 deletions

platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyFmService.java View file @ b08684e
... ... @@ -14,6 +14,7 @@
14 14 import com.lyms.platform.operate.web.facade.PatientServiceFacade;
15 15 import com.lyms.platform.operate.web.request.BabyBookbuildingAddRequest;
16 16 import com.lyms.platform.operate.web.request.MatDeliverAddRequest;
  17 +import com.lyms.platform.operate.web.result.MaternalDeliverResult;
17 18 import com.lyms.platform.permission.model.Users;
18 19 import com.lyms.platform.permission.model.UsersQuery;
19 20 import com.lyms.platform.permission.service.UsersService;
... ... @@ -913,6 +914,184 @@
913 914 }
914 915 return null;
915 916 }
  917 +
  918 + /**
  919 + * 通过身份证号码查询孕妇的分娩信息(GXK)
  920 + * @param idCardNo
  921 + * @return
  922 + */
  923 + public MaternalDeliverResult queryFmPatient(String idCardNo)
  924 + {
  925 + MaternalDeliverResult maternalDeliverResult = new MaternalDeliverResult();
  926 + Connection conn = ConnTools.makeFmConnection();
  927 + QueryRunner queryRunner = new QueryRunner();
  928 + if(idCardNo != null){
  929 + try{
  930 + SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMddHH:mm:ss");
  931 + SimpleDateFormat fmt2 = new SimpleDateFormat("yyyyMMdd");
  932 + SimpleDateFormat fmt1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  933 + FmPatInfo patInfo = null;
  934 + String sql = "SELECT syxh,hzxm as name,sfzh as cardNo,sex as sex,birth,lxrdh as phone, blh FROM THIS4_BASY WHERE sfzh = '"+idCardNo+"' ";
  935 + List<FmPatInfo> infoList = queryRunner.query(conn,sql,new BeanListHandler<FmPatInfo>(FmPatInfo.class));
  936 + if(CollectionUtils.isNotEmpty(infoList)){
  937 + patInfo = infoList.get(0);
  938 +
  939 + String cloumns = " SYXH as syxh,\n" +
  940 + " YEXH as yexh,\n" +
  941 + " JLRQ as jlrq,\n" +
  942 + " CSRQ as csrq,\n" +
  943 + " SSRQ as ssrq,\n" +
  944 + "SSJ as ssj,\n" +
  945 + "yexb as yexb,\n" +
  946 + "RC as rc,\n" +
  947 + "JTS as jts,\n" +
  948 + "DJT as djt,\n" +
  949 + "CJC as cjc,\n" +
  950 + "ZX as zx,\n" +
  951 + "TZ as tz,\n" +
  952 + "SC as sc,\n" +
  953 + "SH as sh,\n" +
  954 + "JX as jx,\n" +
  955 + "YFZ as yfz,\n" +
  956 + "WFZ as wfz,\n" +
  957 + "SFZ as sfz,\n" +
  958 + "PFZ as pfz,\n" +
  959 + "CCQK as ccqk,\n" +
  960 + "FMFS as fmfs,\n" +
  961 + "TPMCFS as tpmcfs,\n" +
  962 + "YEQK as yeqk,\n" +
  963 + "SW as sw,\n" +
  964 + "SFFQ as sffq,\n" +
  965 + "FQYY as fqyy,\n" +
  966 + "HYQK as hyqk,\n" +
  967 + "HYQK1 as hyqk1,\n" +
  968 + "YC as yc,\n" +
  969 + "SFGW as sfgw,\n" +
  970 + "MCTPSLXL as mctpslxl,\n" +
  971 + "CHEXXSXL as chexxsxl,\n" +
  972 + " QJQK as qjqk,\n" +
  973 + " SRKS as srks,\n" +
  974 + " JSZ as jsz";
  975 +
  976 + String itemSql ="select "+cloumns+" from JHMK_FMJL_LYMS where " +
  977 + " and SYXH not in (select SYXH from JHMK_FMJL_LYMS where JSZ is not null and SC is not null and TZ is not null and YFZ is not null and SH is not null and CCQK is not null and CCQK <> '' " +
  978 + " and (SFFZRSTDT = ' 是 ' or SFSTDT = ' 是 ')) and SYXH="+patInfo.getSyxh()+"";
  979 +
  980 + List<FmItem> itemList = queryRunner.query(conn, sql, new BeanListHandler<FmItem>(FmItem.class));
  981 + ExceptionUtils.catchException("size====" + itemList.size());
  982 +
  983 + if(CollectionUtils.isNotEmpty(itemList)){
  984 + List<MaternalDeliverResult.Baby> babys = new ArrayList<MaternalDeliverResult.Baby>();
  985 + for(FmItem fmItem : itemList){
  986 +
  987 + try{
  988 +
  989 + Map deliveryMode = new HashMap(); //分娩方式
  990 + if (!("活产".equals(fmItem.getCcqk()) || "死胎".equals(fmItem.getCcqk())))
  991 + {
  992 + continue;
  993 + }
  994 + String cssj = fmItem.getCsrq().substring(0,3)+"-"+fmItem.getCsrq().substring(4,5)+"-"+fmItem.getCsrq().substring(6,7);
  995 + maternalDeliverResult.setParentId(fmItem.getSyxh());
  996 + maternalDeliverResult.setDueDate(cssj);
  997 + maternalDeliverResult.setDueWeek(fmItem.getRc());
  998 + maternalDeliverResult.setTireNumber(Integer.parseInt(fmItem.getDjt()));
  999 + //没有胎盘默认为1
  1000 + maternalDeliverResult.setPlacenta("1");
  1001 + String fmfs = "";
  1002 + if (fmItem.getFmfs() != null && "剖宫产".equals(fmItem.getFmfs()))
  1003 + {
  1004 + fmfs = FmTypeEnums.O1.getId();
  1005 + }
  1006 + else
  1007 + {
  1008 + fmfs = FmTypeEnums.O.getId();
  1009 + }
  1010 + deliveryMode.put("fmfs",fmfs);
  1011 + maternalDeliverResult.setDeliveryMode(deliveryMode);
  1012 +
  1013 + if ("完好".equals(fmItem.getHyqk()) || "".equals(fmItem.getHyqk())) {
  1014 + maternalDeliverResult.setPerinealCondition("full");
  1015 + } else if ("会阴切开".equals(fmItem.getHyqk()) || "侧切".equals(fmItem.getHyqk())) {
  1016 + maternalDeliverResult.setPerinealCondition("split");
  1017 + }
  1018 + if ("一度裂伤".equals(fmItem.getHyqk())) {
  1019 + maternalDeliverResult.setSiLielevel(1);
  1020 + } else if ("二度裂伤".equals(fmItem.getHyqk())) {
  1021 + maternalDeliverResult.setSiLielevel(2);
  1022 + } else if ("三度裂伤".equals(fmItem.getHyqk())) {
  1023 + maternalDeliverResult.setSiLielevel(3);
  1024 + }
  1025 + if (StringUtils.isNotEmpty(fmItem.getChexxsxl())) {
  1026 + maternalDeliverResult.settHloseBloodL(Double.parseDouble(fmItem.getChexxsxl()));
  1027 + }
  1028 +
  1029 + //儿童
  1030 + MaternalDeliverResult.Baby baby = maternalDeliverResult.new Baby();
  1031 + Map<String, String> as = new HashMap<>();
  1032 + String pf1 = fmItem.getYfz();
  1033 + String pf5 = fmItem.getWfz();
  1034 + String pf10 = fmItem.getSfz();
  1035 + if(pf1!=null){
  1036 + as.put("pf1", pf1);
  1037 + }
  1038 + if(pf5!=null){
  1039 + as.put("pf5", pf5);
  1040 + }
  1041 + if(pf10!=null){
  1042 + as.put("pf10", pf10);
  1043 + }
  1044 + baby.setApgarScore(as);
  1045 + baby.setBabyGender("男".equals(fmItem.getYexb()) ? "1" : "0");
  1046 + String babyHeight = fmItem.getSc();
  1047 + String babyWeight = fmItem.getTz();
  1048 + String baby_Asphyxiam = fmItem.getZx();
  1049 + if(babyHeight!=null){
  1050 + baby.setBabyHeight(babyHeight);//新生儿生长
  1051 + }
  1052 + if(babyWeight!=null){
  1053 + baby.setBabyWeight(babyWeight);//新生儿重量
  1054 + }
  1055 + if(baby_Asphyxiam!=null){
  1056 + baby.setAsphyxiaM(baby_Asphyxiam); //窒息分钟
  1057 + }
  1058 + baby.setDeformity((fmItem.getJx()==null?0:1)); //畸形 0非畸形 1畸形
  1059 +
  1060 + String baby_Pregnancy_Out = fmItem.getCcqk();
  1061 + if(baby_Pregnancy_Out!=null && StringUtils.isNotEmpty(baby_Pregnancy_Out)){
  1062 + baby.setPregnancyOut(RenShenJieJuEnums.getIdByName(fmItem.getCcqk())); // 妊娠结局
  1063 + }
  1064 +
  1065 + baby.setDueTime(cssj);//分娩时间
  1066 + babys.add(baby);
  1067 +
  1068 +
  1069 + }catch (Exception e){
  1070 + e.printStackTrace();
  1071 + continue;
  1072 + }
  1073 +
  1074 +
  1075 + }
  1076 + maternalDeliverResult.setBabies(babys);
  1077 + }
  1078 +
  1079 +
  1080 + }else {
  1081 + return null;
  1082 + }
  1083 + }catch (SQLException e){
  1084 + e.printStackTrace();
  1085 + }finally {
  1086 + DbUtils.closeQuietly(conn);
  1087 + }
  1088 +
  1089 + }
  1090 +
  1091 + return maternalDeliverResult;
  1092 + }
  1093 +
  1094 +
916 1095  
917 1096 }