diff --git a/platform-operate-api/src/main/java/com/lyms/hospitalapi/zcfy/ZcfyFmService.java b/platform-operate-api/src/main/java/com/lyms/hospitalapi/zcfy/ZcfyFmService.java index fb1c88e..88cd581 100644 --- a/platform-operate-api/src/main/java/com/lyms/hospitalapi/zcfy/ZcfyFmService.java +++ b/platform-operate-api/src/main/java/com/lyms/hospitalapi/zcfy/ZcfyFmService.java @@ -116,6 +116,31 @@ public class ZcfyFmService { public void queryFmPatient(String start,String end,String phone) { + Fm fm1 = new Fm(); + fm1.setBHNUM("1801520"); + fm1.setNAME("何蒙蒙"); + fm1.setPHONE("10279889449"); + fm1.setIDCARD("451023198706122487"); + fm1.setADDR("河北省秦皇岛市海港区西港镇地址"); + fm1.setDUE_WEEK("38"); + fm1.setDUE_DAY(""); + fm1.setFETUS_NUM(1); + fm1.setDELIVERY_MODE("剖宫产"); + fm1.setDELIVER_HOSPITAL("诸城市妇幼保健院"); + fm1.setDELIVER_DOCTOR("王芳萍"); + fm1.setBABY_SEX("女"); + fm1.setBABY_DELIVERY_TIME("2018/1/4 14:54:25"); + fm1.setBABY_PREGNANCY_OUT("活胎"); + fm1.setBABY_WEIGHT(4300); + fm1.setBABY_HEIGHT(56); + fm1.setBABY_APGAR_SCORE_ONE(10); + fm1.setBABY_APGAR_SCORE_FIVE(10); + fm1.setBABY_APGAR_SCORE_TEN(10); + + + + + String cloumns = " 住院编号 as BHNUM,\n" + " PHONE as PHONE,\n" + " NAME as NAME,\n" + @@ -123,53 +148,45 @@ public class ZcfyFmService { " CREATED as CREATED,\t\n" + " to_char(BABY_DELIVERY_TIME,'yyyy-mm-dd hh24:mi:ss') as BABY_DELIVERY_TIME,\n" + " BABY_SEX as BABY_SEX,\n" + - " DUE_WEEK as DUE_WEEK,\n" + - " 胎次 as FETUS_NUM,\n" + - " 窒息 as BABY_ASPHYXIAM,\n" + - " CONVERT(int,left(体重,len(体重)-1)) as BABY_WEIGHT,\n" + - " CONVERT(int,left(身长,len(身长)-2)) as BABY_HEIGHT,\n" + - " CONVERT(int,left(Apgar评分1,len(Apgar评分1)-1)) as BABY_APGAR_SCORE_ONE,\n" + - " CONVERT(int,left(Apgar评分5,len(Apgar评分5)-1)) as BABY_APGAR_SCORE_FIVE,\n" + - " CONVERT(int,left(Apgar评分10,len(Apgar评分10)-1)) as BABY_APGAR_SCORE_TEN,\n" + - " 妊娠结局 as BABY_PREGNANCY_OUT,\n" + - " 分娩方式 as TMCSIDE,\n" + - // " TMCTYPE as TMCTYPE,\n" + - " 产妇离开产室情况 as MATERNAL_INFO,\n" + - " 会阴切开术 as PERINEAL_CONDITION,\n" + - //" 失血量 as SH_LOSE_BLOOD,\n" + - " 失血量 as sxl,\n" + - // " TH_LOSE_BLOOD as TH_LOSE_BLOOD,\n" + - // " 接生者 as DELIVER_DOCTOR,\n" + - // " 产程第一期 as PROD_PROCESS_ONE,\n" + - " 产程第一期 as ccOne,\n" + + " substr(DUE_WEEK,0,2) as DUE_WEEK,\n" + + " substr(DUE_WEEK,4) as DUE_DAY, \n"+ + " FETUS_NUM as FETUS_NUM,\n" + + " to_number(BABY_WEIGHT) as BABY_WEIGHT,\n" + + " to_number(BABY_HEIGHT) as BABY_HEIGHT,\n" + + " to_number(BABY_APGAR_SCORE_ONE) as BABY_APGAR_SCORE_ONE,\n" + + " to_number(BABY_APGAR_SCORE_FIVE) as BABY_APGAR_SCORE_FIVE,\n" + + " to_number(BABY_APGAR_SCORE_TEN) as BABY_APGAR_SCORE_TEN,\n" + + " BABY_PREGNANCY_OUT as BABY_PREGNANCY_OUT,\n" + + " DELIVERY_MODE as DELIVERY_MODE,\n" + + " MATERNAL_INFO as MATERNAL_INFO,\n" + + " PERINEAL_CONDITION as PERINEAL_CONDITION,\n" + + //" DELIVER_DOCTOR as DELIVER_DOCTOR,\n" + + //" PROD_PROCESS_ONE as PROD_PROCESS_ONE,\n" + // " 第二期 as PROD_PROCESS_TWO,\n" + - " 第二期 as ccTwo,\n" + // " 第三期 as PROD_PROCESS_THREE,\n" + - " 第三期 as ccThree,\n" + //" 总计 as TOTAL_PROCESS,\n" + - " 总计 as total,\n" + - " CONVERT(int,胎盘数量) as PLACENTA_NUM,\n" + - //" DELIVER_HOSPITAL as DELIVER_HOSPITAL,\n" + - " 产妇居住地址 as ADDR,\n"+ - " 接生者 as DELIVER_DOCTOR"; + //" CONVERT(int,胎盘数量) as PLACENTA_NUM,\n" + + " DELIVER_HOSPITAL as DELIVER_HOSPITAL,\n" + + " ADDR as ADDR,\n"+ + " DELIVER_DOCTOR as DELIVER_DOCTOR"; - Connection conn = com.lyms.hospitalapi.zcfy.ConnTools.makeFmConnection(); + //Connection conn = com.lyms.hospitalapi.zcfy.ConnTools.makeFmConnection(); QueryRunner queryRunner = new QueryRunner(); SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { String sql ="select "+cloumns+" from zcfybjy.v_deliveryinfo where " + - " CREATED > to_date('"+start+"', 'yyyy-mm-dd hh24:mi:ss') and CREATED <= to_date('"+end+"', 'yyyy-mm-dd hh24:mi:ss')" ; + " CREATED > to_date('"+start+"', 'yyyy-mm-dd hh24:mi:ss') and CREATED <= to_date('"+end+"', 'yyyy-mm-dd hh24:mi:ss') " ; if (phone != null) { sql+=" and 手机号码 = '"+phone+"'"; } - List list = queryRunner.query(conn, sql, new BeanListHandler(Fm.class)); - ExceptionUtils.catchException("size====" + list.size()); + //List list = queryRunner.query(conn, sql, new BeanListHandler(Fm.class)); + //ExceptionUtils.catchException("size====" + list.size()); - /*List list=new ArrayList(); - list.add(fm1);*/ + List list=new ArrayList(); + list.add(fm1); if(CollectionUtils.isNotEmpty(list)){ for(Fm fm:list){ @@ -177,14 +194,14 @@ public class ZcfyFmService { int a = 0;//用来判断是否建了儿童档案,如果建了儿童档案就不保存分娩记录 int count = 0; List users = new ArrayList(); - String id = fm.getID();//获取所有的孕妇ID,方便孕妇产下双胞胎而用 + String idCard = fm.getIDCARD();//获取所有的孕妇身份证号,方便孕妇产下双胞胎而用 //用来查询这个孕妇分娩的最近日期的sql - String dateSql = "select max(CONVERT(char(19),CREATED,120)) as babyDate from xlhhis..v_fmjl where " + - " ID='"+id+"'" ; + String dateSql = "select max(to_char(created,'yyyy-mm-dd hh24:mi:ss')) as babyDate from zcfybjy.v_deliveryinfo where " + + " IDCARD ='"+idCard+"'" ; //获取到这个孕妇的最近的分娩日期 - List dateList = queryRunner.query(conn, dateSql, new BeanListHandler(Fm.class)); + /*List dateList = queryRunner.query(conn, dateSql, new BeanListHandler(Fm.class)); Calendar calendar = Calendar.getInstance(); calendar.setTime(fmt.parse(dateList.get(0).getBabyDate())); calendar.add(Calendar.DAY_OF_MONTH, -1); @@ -193,15 +210,15 @@ public class ZcfyFmService { String endDate = dateList.get(0).getBabyDate(); //查询这个孕妇最近日期所有分娩记录的sql - String allSql = "select "+cloumns+" from xlhhis..v_fmjl where " + - " CREATED > CONVERT(char(19),'"+startDate+"',120) and CREATED <= CONVERT(char(19),'"+endDate+"',120)" + - " and ID='"+id+"'" ; + String allSql = "select "+cloumns+" from zcfybjy.v_deliveryinfo where " + + " CREATED > to_date('"+startDate+"', 'yyyy-mm-dd hh24:mi:ss') and CREATED <= to_date('"+endDate+"', 'yyyy-mm-dd hh24:mi:ss')" + + " and IDCARD='"+idCard+"'" ; - //查出这个ID对应孕妇在这个时间段的分娩记录 - List allList = queryRunner.query(conn, allSql, new BeanListHandler(Fm.class)); + //查出这个IDCARD对应孕妇在这个时间段的分娩记录 + List allList = queryRunner.query(conn, allSql, new BeanListHandler(Fm.class));*/ - /*List allList = new ArrayList(); - allList.add(fm);*/ + List allList = new ArrayList(); + allList.add(fm); Date dueDate = null; List babies = new ArrayList<>(); @@ -218,7 +235,7 @@ public class ZcfyFmService { } //将中间字段的值整理赋值到正式字段中 - int sxl = allFm.getSxl().length(); + /*int sxl = allFm.getSxl().length(); allFm.setSH_LOSE_BLOOD(Integer.parseInt(allFm.getSxl().substring(0,sxl-2)));//失血量 String[] oneShi = allFm.getCcOne().split("时"); @@ -240,7 +257,7 @@ public class ZcfyFmService { int total = Integer.parseInt(totalShi[0])*60; String[] totalFen = totalShi[1].split("分"); allFm.setTOTAL_PROCESS(String.valueOf(total+Integer.parseInt(totalFen[0])));//总产程 - +*/ PatientsQuery query = new PatientsQuery(); query.setYn(YnEnums.YES.getId()); @@ -299,10 +316,13 @@ public class ZcfyFmService { map.put("three",map3); } - int hProcess = Integer.parseInt(allFm.getTOTAL_PROCESS())/60;//总产程小时数 - int mProcess = Integer.parseInt(allFm.getTOTAL_PROCESS())%60;//总产程分钟数 - totalMap.put("h",String.valueOf(hProcess)); - totalMap.put("m",String.valueOf(mProcess)); + if(allFm.getTOTAL_PROCESS()!=null){ + int hProcess = Integer.parseInt(allFm.getTOTAL_PROCESS())/60;//总产程小时数 + int mProcess = Integer.parseInt(allFm.getTOTAL_PROCESS())%60;//总产程分钟数 + totalMap.put("h",String.valueOf(hProcess)); + totalMap.put("m",String.valueOf(mProcess)); + } + deliverAddRequest.setProdprocess(map); deliverAddRequest.setTotalprocess(totalMap); @@ -421,7 +441,7 @@ public class ZcfyFmService { } }else{ a=1; - //乐陵服务器有分娩记录,但是在这边系统没有对应孕妇 取分娩信息建档儿童数据 + //诸城服务器有分娩记录,但是在这边系统没有对应孕妇 取分娩信息建档儿童数据 List names = buildBabyName(allList); Date dateTime = fmt.parse(allFm.getBABY_DELIVERY_TIME()); @@ -486,12 +506,12 @@ public class ZcfyFmService { } } } - DbUtils.closeQuietly(conn); + //DbUtils.closeQuietly(conn); } catch (Exception e) { ExceptionUtils.catchException(e, "sql执行异常"); e.printStackTrace(); } finally { - DbUtils.closeQuietly(conn); + //DbUtils.closeQuietly(conn); } } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java index ca39fa5..c0362ad 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java @@ -6,6 +6,7 @@ import com.lyms.hospitalapi.dzfy.DzfyHisService; import com.lyms.hospitalapi.llfy.LlfyFmService; import com.lyms.hospitalapi.qhdfy.QhdfyHisService; import com.lyms.hospitalapi.v1.HisService; +import com.lyms.hospitalapi.zcfy.ZcfyFmService; import com.lyms.platform.biz.service.PatientCheckTicketService; import com.lyms.platform.common.annotation.TokenRequired; import com.lyms.platform.common.base.BaseController; @@ -57,6 +58,9 @@ public class AntenatalExaminationController extends BaseController { private DzfyFmService dzfyFmService; @Autowired private LlfyFmService llfyFmService; + @Autowired + private ZcfyFmService zcfyFmService; + @Autowired private NczxyyLisService nczxyyLisService; @@ -101,7 +105,7 @@ public class AntenatalExaminationController extends BaseController { @RequestMapping(method = RequestMethod.GET, value = "/fm") @ResponseBody public String getFm(String start,String end,String syxh){ - llfyFmService.queryFmPatient(start,end,syxh); + zcfyFmService.queryFmPatient(start,end,syxh); return "1"; }