diff --git a/platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyFmService.java b/platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyFmService.java index 8520340..733c179 100644 --- a/platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyFmService.java +++ b/platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyFmService.java @@ -927,219 +927,219 @@ public class QhdfyFmService { SimpleDateFormat fmt2 = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat fmt1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); MaternalDeliverResult maternalDeliverResult = new MaternalDeliverResult(); -// Connection conn = ConnTools.makeFmConnection(); -// QueryRunner queryRunner = new QueryRunner(); + Connection conn = ConnTools.makeFmConnection(); + QueryRunner queryRunner = new QueryRunner(); if(idCardNo != null){ try{ -// FmPatInfo patInfo = null; -// String sql = "SELECT syxh,hzxm as name,sfzh as cardNo,sex as sex,birth,lxrdh as phone, blh FROM THIS4_BASY WHERE sfzh = '"+idCardNo+"' "; -// List infoList = queryRunner.query(conn,sql,new BeanListHandler(FmPatInfo.class)); -// if(CollectionUtils.isNotEmpty(infoList)){ -// patInfo = infoList.get(0); -// -// String cloumns = " SYXH as syxh,\n" + -// " YEXH as yexh,\n" + -// " JLRQ as jlrq,\n" + -// " CSRQ as csrq,\n" + -// " SSRQ as ssrq,\n" + -// "SSJ as ssj,\n" + -// "yexb as yexb,\n" + -// "RC as rc,\n" + -// "JTS as jts,\n" + -// "DJT as djt,\n" + -// "CJC as cjc,\n" + -// "ZX as zx,\n" + -// "TZ as tz,\n" + -// "SC as sc,\n" + -// "SH as sh,\n" + -// "JX as jx,\n" + -// "YFZ as yfz,\n" + -// "WFZ as wfz,\n" + -// "SFZ as sfz,\n" + -// "PFZ as pfz,\n" + -// "CCQK as ccqk,\n" + -// "FMFS as fmfs,\n" + -// "TPMCFS as tpmcfs,\n" + -// "YEQK as yeqk,\n" + -// "SW as sw,\n" + -// "SFFQ as sffq,\n" + -// "FQYY as fqyy,\n" + -// "HYQK as hyqk,\n" + -// "HYQK1 as hyqk1,\n" + -// "YC as yc,\n" + -// "SFGW as sfgw,\n" + -// "MCTPSLXL as mctpslxl,\n" + -// "CHEXXSXL as chexxsxl,\n" + -// " QJQK as qjqk,\n" + -// " SRKS as srks,\n" + -// " JSZ as jsz"; -// -// String itemSql ="select "+cloumns+" from JHMK_FMJL_LYMS where " + -// " 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 <> '' " + -// " and (SFFZRSTDT = ' 是 ' or SFSTDT = ' 是 ')) and SYXH='"+patInfo.getSyxh()+"'"; -// -// List itemList = queryRunner.query(conn, itemSql, new BeanListHandler(FmItem.class)); -// -// -// //单胎 -// if(CollectionUtils.isNotEmpty(itemList)){ -// List babys = new ArrayList(); -// for(FmItem fmItem : itemList){ -// System.out.println("单胎:"+fmItem); -// try{ -// -// Map deliveryMode = new HashMap(); //分娩方式 -// if (!("活产".equals(fmItem.getCcqk()) || "死胎".equals(fmItem.getCcqk()))) -// { -// continue; -// } -// String cssj = fmItem.getCsrq().substring(0,3)+"-"+fmItem.getCsrq().substring(4,5)+"-"+fmItem.getCsrq().substring(6,7); -// maternalDeliverResult.setDueDate(cssj); -// maternalDeliverResult.setDueWeek(fmItem.getRc()); -// maternalDeliverResult.setTireNumber(Integer.parseInt(fmItem.getDjt())); -// //没有胎盘默认为1 -// maternalDeliverResult.setPlacenta("1"); -// String fmfs = ""; -// if (fmItem.getFmfs() != null && "剖宫产".equals(fmItem.getFmfs())) -// { -// fmfs = FmTypeEnums.O1.getId(); -// } -// else -// { -// fmfs = FmTypeEnums.O.getId(); -// } -// deliveryMode.put("fmfs",fmfs); -// maternalDeliverResult.setDeliveryMode(deliveryMode); -// -// if ("完好".equals(fmItem.getHyqk()) || "".equals(fmItem.getHyqk())) { -// maternalDeliverResult.setPerinealCondition("full"); -// } else if ("会阴切开".equals(fmItem.getHyqk()) || "侧切".equals(fmItem.getHyqk())) { -// maternalDeliverResult.setPerinealCondition("split"); -// } -// if ("一度裂伤".equals(fmItem.getHyqk())) { -// maternalDeliverResult.setSiLielevel(1); -// } else if ("二度裂伤".equals(fmItem.getHyqk())) { -// maternalDeliverResult.setSiLielevel(2); -// } else if ("三度裂伤".equals(fmItem.getHyqk())) { -// maternalDeliverResult.setSiLielevel(3); -// } -// if (StringUtils.isNotEmpty(fmItem.getChexxsxl())) { -// maternalDeliverResult.settHloseBloodL(Double.parseDouble(fmItem.getChexxsxl())); -// } -// -// //儿童 -// MaternalDeliverResult.Baby baby = maternalDeliverResult.new Baby(); -// Map as = new HashMap<>(); -// String pf1 = fmItem.getYfz(); -// String pf5 = fmItem.getWfz(); -// String pf10 = fmItem.getSfz(); -// if(pf1!=null){ -// as.put("pf1", pf1); -// } -// if(pf5!=null){ -// as.put("pf5", pf5); -// } -// if(pf10!=null){ -// as.put("pf10", pf10); -// } -// baby.setApgarScore(as); -// baby.setBabyGender("男".equals(fmItem.getYexb()) ? "1" : "0"); -// String babyHeight = fmItem.getSc(); -// String babyWeight = fmItem.getTz(); -// String baby_Asphyxiam = fmItem.getZx(); -// if(babyHeight!=null){ -// baby.setBabyHeight(babyHeight);//新生儿生长 -// } -// if(babyWeight!=null){ -// baby.setBabyWeight(babyWeight);//新生儿重量 -// } -// if(baby_Asphyxiam!=null){ -// baby.setAsphyxiaM(baby_Asphyxiam); //窒息分钟 -// } -// //baby.setDeformity((fmItem.getJx()==null?0:1)); //畸形 0非畸形 1畸形 -// -// String baby_Pregnancy_Out = fmItem.getCcqk(); -// if(baby_Pregnancy_Out!=null && StringUtils.isNotEmpty(baby_Pregnancy_Out)){ -// baby.setPregnancyOut(RenShenJieJuEnums.getIdByName(fmItem.getCcqk())); // 妊娠结局 -// } -// -// baby.setDueTime(cssj);//分娩时间 -// babys.add(baby); -// + FmPatInfo patInfo = null; + String sql = "SELECT syxh,hzxm as name,sfzh as cardNo,sex as sex,birth,lxrdh as phone, blh FROM THIS4_BASY WHERE sfzh = '"+idCardNo+"'"; + List infoList = queryRunner.query(conn,sql,new BeanListHandler(FmPatInfo.class)); + if(CollectionUtils.isNotEmpty(infoList)){ + patInfo = infoList.get(0); + + String cloumns = " SYXH as syxh,\n" + + " YEXH as yexh,\n" + + " JLRQ as jlrq,\n" + + " CSRQ as csrq,\n" + + " SSRQ as ssrq,\n" + + "SSJ as ssj,\n" + + "yexb as yexb,\n" + + "RC as rc,\n" + + "JTS as jts,\n" + + "DJT as djt,\n" + + "CJC as cjc,\n" + + "ZX as zx,\n" + + "TZ as tz,\n" + + "SC as sc,\n" + + "SH as sh,\n" + + "JX as jx,\n" + + "YFZ as yfz,\n" + + "WFZ as wfz,\n" + + "SFZ as sfz,\n" + + "PFZ as pfz,\n" + + "CCQK as ccqk,\n" + + "FMFS as fmfs,\n" + + "TPMCFS as tpmcfs,\n" + + "YEQK as yeqk,\n" + + "SW as sw,\n" + + "SFFQ as sffq,\n" + + "FQYY as fqyy,\n" + + "HYQK as hyqk,\n" + + "HYQK1 as hyqk1,\n" + + "YC as yc,\n" + + "SFGW as sfgw,\n" + + "MCTPSLXL as mctpslxl,\n" + + "CHEXXSXL as chexxsxl,\n" + + " QJQK as qjqk,\n" + + " SRKS as srks,\n" + + " JSZ as jsz"; + + String itemSql ="select "+cloumns+" from JHMK_FMJL_LYMS where " + + " 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 <> '' " + + " and (SFFZRSTDT = ' 是 ' or SFSTDT = ' 是 ')) and SYXH='"+patInfo.getSyxh()+"'"; + + List itemList = queryRunner.query(conn, itemSql, new BeanListHandler(FmItem.class)); + + //单胎 + if(CollectionUtils.isNotEmpty(itemList)){ + List babys = new ArrayList(); + for(FmItem fmItem : itemList){ + System.out.println("单胎:"+fmItem); + try{ + + Map deliveryMode = new HashMap(); //分娩方式 + if (!("活产".equals(fmItem.getCcqk()) || "死胎".equals(fmItem.getCcqk()))) + { + continue; + } + + Date dueDate = fmt.parse(fmItem.getCsrq()); + String dutTime = fmt1.format(dueDate); + + maternalDeliverResult.setDueDate(fmt2.format(dueDate)); + maternalDeliverResult.setDueWeek(fmItem.getRc()); + maternalDeliverResult.setTireNumber(Integer.parseInt(fmItem.getDjt())); + //没有胎盘默认为1 + maternalDeliverResult.setPlacenta("1"); + String fmfs = ""; + if (fmItem.getFmfs() != null && "剖宫产".equals(fmItem.getFmfs())) + { + fmfs = FmTypeEnums.O1.getId(); + } + else + { + fmfs = FmTypeEnums.O.getId(); + } + deliveryMode.put("fmfs",fmfs); + maternalDeliverResult.setDeliveryMode(deliveryMode); + + if ("完好".equals(fmItem.getHyqk()) || "".equals(fmItem.getHyqk())) { + maternalDeliverResult.setPerinealCondition("full"); + } else if ("会阴切开".equals(fmItem.getHyqk()) || "侧切".equals(fmItem.getHyqk())) { + maternalDeliverResult.setPerinealCondition("split"); + } + if ("一度裂伤".equals(fmItem.getHyqk())) { + maternalDeliverResult.setSiLielevel(1); + } else if ("二度裂伤".equals(fmItem.getHyqk())) { + maternalDeliverResult.setSiLielevel(2); + } else if ("三度裂伤".equals(fmItem.getHyqk())) { + maternalDeliverResult.setSiLielevel(3); + } + if (StringUtils.isNotEmpty(fmItem.getChexxsxl())) { + maternalDeliverResult.settHloseBloodL(Double.parseDouble(fmItem.getChexxsxl())); + } + + //儿童 + MaternalDeliverResult.Baby baby = maternalDeliverResult.new Baby(); + Map as = new HashMap<>(); + String pf1 = fmItem.getYfz(); + String pf5 = fmItem.getWfz(); + String pf10 = fmItem.getSfz(); + if(pf1!=null){ + as.put("pf1", pf1); + } + if(pf5!=null){ + as.put("pf5", pf5); + } + if(pf10!=null){ + as.put("pf10", pf10); + } + baby.setApgarScore(as); + baby.setBabyGender("男".equals(fmItem.getYexb()) ? "1" : "0"); + String babyHeight = fmItem.getSc(); + String babyWeight = fmItem.getTz(); + String baby_Asphyxiam = fmItem.getZx(); + if(babyHeight!=null){ + baby.setBabyHeight(babyHeight);//新生儿生长 + } + if(babyWeight!=null){ + baby.setBabyWeight(babyWeight);//新生儿重量 + } + if(baby_Asphyxiam!=null){ + baby.setAsphyxiaM(baby_Asphyxiam); //窒息分钟 + } + //baby.setDeformity((fmItem.getJx()==null?0:1)); //畸形 0非畸形 1畸形 + + String baby_Pregnancy_Out = fmItem.getCcqk(); + if(baby_Pregnancy_Out!=null && StringUtils.isNotEmpty(baby_Pregnancy_Out)){ + baby.setPregnancyOut(RenShenJieJuEnums.getIdByName(fmItem.getCcqk())); // 妊娠结局 + } + + baby.setDueTime(dutTime);//分娩时间 + babys.add(baby); + + + }catch (Exception e){ + e.printStackTrace(); + continue; + } + } + maternalDeliverResult.setBabies(babys); + } + //多胎 + else + { + String sql1="select "+cloumns+" 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 CCQK is not null and CCQK <> '' " + + " and SH is not null and (SFFZRSTDT = ' 是 ' or SFSTDT = ' 是 ') and SYXH='"+patInfo.getSyxh()+"'"; + + List duoTaiList = queryRunner.query(conn,sql1 + , new BeanListHandler(FmItem.class)); + + +// List duoTaiList = new ArrayList<>(); // -// }catch (Exception e){ -// e.printStackTrace(); -// continue; -// } +// FmItem fmItem1 = new FmItem(); +// fmItem1.setSyxh("10019988"); +// fmItem1.setJlrq("2017011217:52:00"); +// fmItem1.setSsj("2"); +// fmItem1.setSsrq("20170112"); +// fmItem1.setCsrq("2017011214:15:00"); +// fmItem1.setSrks("产二科"); +// fmItem1.setYexb("男"); +// fmItem1.setRc("37"); +// fmItem1.setDjt("2"); +// fmItem1.setCjc("2"); +// fmItem1.setJsz("王瑞华"); +// fmItem1.setTz("2730"); +// fmItem1.setSc("50"); +// fmItem1.setYfz("9"); +// fmItem1.setWfz("10"); +// fmItem1.setSfz("10"); +// fmItem1.setPfz("王瑞华"); +// fmItem1.setCcqk("活产"); +// fmItem1.setFmfs("剖宫产"); +// fmItem1.setTpmcfs("自然产出"); +// fmItem1.setYeqk("正常"); +// fmItem1.setJx("无"); // +// duoTaiList.add(fmItem1); // -// } -// maternalDeliverResult.setBabies(babys); -// } -// //多胎 -// else -// { -// String sql1="select "+cloumns+" 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 CCQK is not null and CCQK <> '' " + -// " and SH is not null and (SFFZRSTDT = ' 是 ' or SFSTDT = ' 是 ') and SYXH='"+patInfo.getSyxh()+"'"; +// FmItem fmItem2 = new FmItem(); +// fmItem2.setJx("无"); +// fmItem2.setSyxh("10019988"); +// fmItem2.setJlrq("2017011217:52:00"); +// fmItem2.setSsj("2"); +// fmItem2.setSsrq("20170112"); +// fmItem2.setCsrq("2017011214:15:00"); +// fmItem2.setSrks("产二科"); +// fmItem2.setYexb("女"); +// fmItem2.setRc("37"); +// fmItem2.setDjt("2"); +// fmItem2.setCjc("2"); +// fmItem2.setJsz("王瑞华"); +// fmItem2.setTz("3400"); +// fmItem2.setSc("50"); +// fmItem2.setYfz("9"); +// fmItem2.setWfz("10"); +// fmItem2.setSfz("10"); +// fmItem2.setPfz("王瑞华"); +// fmItem2.setCcqk("活产"); +// fmItem2.setFmfs("剖宫产"); +// fmItem2.setTpmcfs("自然产出"); +// fmItem2.setYeqk("正常"); // -// List duoTaiList = queryRunner.query(conn,sql1 -// , new BeanListHandler(FmItem.class)); - - - List duoTaiList = new ArrayList<>(); - - FmItem fmItem1 = new FmItem(); - fmItem1.setSyxh("10019988"); - fmItem1.setJlrq("2017011217:52:00"); - fmItem1.setSsj("2"); - fmItem1.setSsrq("20170112"); - fmItem1.setCsrq("2017011214:15:00"); - fmItem1.setSrks("产二科"); - fmItem1.setYexb("男"); - fmItem1.setRc("37"); - fmItem1.setDjt("2"); - fmItem1.setCjc("2"); - fmItem1.setJsz("王瑞华"); - fmItem1.setTz("2730"); - fmItem1.setSc("50"); - fmItem1.setYfz("9"); - fmItem1.setWfz("10"); - fmItem1.setSfz("10"); - fmItem1.setPfz("王瑞华"); - fmItem1.setCcqk("活产"); - fmItem1.setFmfs("剖宫产"); - fmItem1.setTpmcfs("自然产出"); - fmItem1.setYeqk("正常"); - fmItem1.setJx("无"); - - duoTaiList.add(fmItem1); - - FmItem fmItem2 = new FmItem(); - fmItem2.setJx("无"); - fmItem2.setSyxh("10019988"); - fmItem2.setJlrq("2017011217:52:00"); - fmItem2.setSsj("2"); - fmItem2.setSsrq("20170112"); - fmItem2.setCsrq("2017011214:15:00"); - fmItem2.setSrks("产二科"); - fmItem2.setYexb("女"); - fmItem2.setRc("37"); - fmItem2.setDjt("2"); - fmItem2.setCjc("2"); - fmItem2.setJsz("王瑞华"); - fmItem2.setTz("3400"); - fmItem2.setSc("50"); - fmItem2.setYfz("9"); - fmItem2.setWfz("10"); - fmItem2.setSfz("10"); - fmItem2.setPfz("王瑞华"); - fmItem2.setCcqk("活产"); - fmItem2.setFmfs("剖宫产"); - fmItem2.setTpmcfs("自然产出"); - fmItem2.setYeqk("正常"); - - duoTaiList.add(fmItem2); +// duoTaiList.add(fmItem2); if (CollectionUtils.isNotEmpty(duoTaiList)) { @@ -1258,12 +1258,12 @@ public class QhdfyFmService { } } } -// } -// } + } + } }catch (Exception e){ e.printStackTrace(); }finally { -// DbUtils.closeQuietly(conn); + DbUtils.closeQuietly(conn); } }