From 3150078505c763e60869c3fb1a5f0f25c14c7885 Mon Sep 17 00:00:00 2001 From: wangbo <184677810@qq.com> Date: Thu, 13 Jun 2019 16:14:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=84=BF=E7=AB=A5=E5=87=BA=E9=99=A2=E8=AF=8A?= =?UTF-8?q?=E6=96=AD=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pojo/BabyDischargeDiagnosisModel.java | 71 +++++ .../lyms/hospitalapi/qhdfy/QhdfyHisService.java | 329 +++++++++++++-------- .../web/controller/BabyBuildController.java | 28 +- .../operate/web/facade/BabyBookbuildingFacade.java | 18 ++ 4 files changed, 319 insertions(+), 127 deletions(-) create mode 100644 platform-operate-api/src/main/java/com/lyms/hospitalapi/pojo/BabyDischargeDiagnosisModel.java diff --git a/platform-operate-api/src/main/java/com/lyms/hospitalapi/pojo/BabyDischargeDiagnosisModel.java b/platform-operate-api/src/main/java/com/lyms/hospitalapi/pojo/BabyDischargeDiagnosisModel.java new file mode 100644 index 0000000..d8cceb5a --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/hospitalapi/pojo/BabyDischargeDiagnosisModel.java @@ -0,0 +1,71 @@ +package com.lyms.hospitalapi.pojo; + +import java.util.Date; + +public class BabyDischargeDiagnosisModel { + //病历号=住院号 + private String blh; + + //出院日期 + private Date cyrq; + + //姓名 + private String hzxm; + + //性别 + private String sex; + + //出生日期 + private String birth; + + //出院诊断 + private String cyzdmc; + + public String getBlh() { + return blh; + } + + public void setBlh(String blh) { + this.blh = blh; + } + + public Date getCyrq() { + return cyrq; + } + + public void setCyrq(Date cyrq) { + this.cyrq = cyrq; + } + + public String getHzxm() { + return hzxm; + } + + public void setHzxm(String hzxm) { + this.hzxm = hzxm; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getBirth() { + return birth; + } + + public void setBirth(String birth) { + this.birth = birth; + } + + public String getCyzdmc() { + return cyzdmc; + } + + public void setCyzdmc(String cyzdmc) { + this.cyzdmc = cyzdmc; + } +} diff --git a/platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyHisService.java b/platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyHisService.java index 88b7788..769fe23 100644 --- a/platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyHisService.java +++ b/platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyHisService.java @@ -71,17 +71,16 @@ public class QhdfyHisService { public void syncLisReportTask(final String dateStr) { // DateTime dt = new DateTime(); // dt = dt.minusDays(1); - new Thread("syncLisReportTask"){ + new Thread("syncLisReportTask") { @Override - public void run() - { + public void run() { queryLisReport(DateUtil.parseYMD(dateStr)); } }.start(); } public List queryLisReport(Date startDate) { - System.out.print("begin queryLisReport"+ DateUtil.getyyyy_MM_dd_hms(new Date())); + System.out.print("begin queryLisReport" + DateUtil.getyyyy_MM_dd_hms(new Date())); Integer hospitalId = 216; List result = new ArrayList<>(); @@ -95,7 +94,7 @@ public class QhdfyHisService { referConfigQuery.setLimit(10000); List referValueList = referConfigService.queryRefer(referConfigQuery); Map referValueMap = new HashMap<>(); - for (ReferValue referValue:referValueList) { + for (ReferValue referValue : referValueList) { referValueMap.put(referValue.getCode(), referValue); } PatientsQuery patientsQuery = new PatientsQuery(); @@ -107,8 +106,8 @@ public class QhdfyHisService { patientsQuery.setBuildTypeList(buildType); - String startDateStr=DateUtil.getyyyy_MM_dd_hms(startDate); - String sql = "select top 100000 shenqinghao as hospitalId,bingrenid as patientFid,zhuyuanhao as patientHid,kahao as vcCardNo,phone,huanzhexingming as name,xingbie as sex,nianling as age,shenqingkeshidaima as deptCode,shenqingkeshimingcheng as deptName,shenqingyishengdaima as applyDoctorCode,shenqingyishengmingcheng as applyDoctorName,jianchayishengdaima as checkDoctorCode,jianchayishengxingming as checkDoctorName,baogaofabushijian as publishTime from valllist_ex_en where baogaofabushijian > CONVERT(DATETIME,'"+startDateStr+"', 20) and phone is not null and phone !='' " + + String startDateStr = DateUtil.getyyyy_MM_dd_hms(startDate); + String sql = "select top 100000 shenqinghao as hospitalId,bingrenid as patientFid,zhuyuanhao as patientHid,kahao as vcCardNo,phone,huanzhexingming as name,xingbie as sex,nianling as age,shenqingkeshidaima as deptCode,shenqingkeshimingcheng as deptName,shenqingyishengdaima as applyDoctorCode,shenqingyishengmingcheng as applyDoctorName,jianchayishengdaima as checkDoctorCode,jianchayishengxingming as checkDoctorName,baogaofabushijian as publishTime from valllist_ex_en where baogaofabushijian > CONVERT(DATETIME,'" + startDateStr + "', 20) and phone is not null and phone !='' " + " and shenqinghao is not null and shenqingkeshidaima in ('2320', '2321', '2322', '2323', '2324', '2325', '2326', '2327', '2328', '2329', '2310', '2540', '2541', '2544', '2555', '2558', '2559', '2560') order by shenqinghao desc"; String subSql = "select top 1000 sheqingdanhao as id,xiangmudaima as code,xiangmumingcheng as name,xiangmujieguo as result,zifujieguo as charResult,shuzijieguo as numberResult,gaodibiaozhi as flag,cankaozhi as ref,danwei as unit,jieguoleixing as result from valresult_ex_en where sheqingdanhao='"; List list = queryRunner.query(conn, sql, new BeanListHandler(LisReport.class)); @@ -116,28 +115,28 @@ public class QhdfyHisService { if (list.size() > 0) { - MongoCondition mongoCondition = MongoCondition.newInstance("hospitalId", ""+hospitalId, MongoOper.IS); + MongoCondition mongoCondition = MongoCondition.newInstance("hospitalId", "" + hospitalId, MongoOper.IS); List assayConfigList = assayConfigDao.query(mongoCondition.toMongoQuery()); - Map assayConfigMap = new HashMap<>(); - for (AssayConfig config:assayConfigList) { + Map assayConfigMap = new HashMap<>(); + for (AssayConfig config : assayConfigList) { assayConfigMap.put(config.getProjectCode(), config); } - for (LisReport report:list) { + for (LisReport report : list) { patientsQuery.setPhone(report.getPhone().trim()); int count = patientsService.queryPatientCount(patientsQuery); LisReportQuery lisReportQuery = new LisReportQuery(); lisReportQuery.setId(hospitalId + "_" + report.getHospitalId()); - lisReportQuery.setHospitalId(""+hospitalId); + lisReportQuery.setHospitalId("" + hospitalId); int reportCount = lisReportService.queryLisReportCount(lisReportQuery); if (count > 0 && reportCount == 0) { patientsQuery.setLimit(1); patientsQuery.setPage(0); patientsQuery.setNeed("y"); - patientsQuery.setHospitalId(hospitalId+""); + patientsQuery.setHospitalId(hospitalId + ""); List patientsList = patientsService.queryPatient(patientsQuery); Patients patients = patientsList.get(0); - if(null == patients.getLastMenses()){ + if (null == patients.getLastMenses()) { continue; } @@ -160,8 +159,8 @@ public class QhdfyHisService { crisisItem.setStatusName("待处理"); crisisItem.setSyncStatus(0); - List itemList = queryRunner.query(conn, subSql+report.getHospitalId()+"'", new BeanListHandler(LisReportItem.class)); - System.out.println("itemList ====> "+itemList.size() ); + List itemList = queryRunner.query(conn, subSql + report.getHospitalId() + "'", new BeanListHandler(LisReportItem.class)); + System.out.println("itemList ====> " + itemList.size()); if (itemList.size() > 0) { System.out.println("3====> " + reportCount); report.setId(hospitalId + "_" + report.getHospitalId()); @@ -170,7 +169,7 @@ public class QhdfyHisService { lisReportService.addLisReport(report); // crisis init - for (LisReportItem item:itemList) { + for (LisReportItem item : itemList) { boolean flag = false; ReferValue referValue = referValueMap.get(item.getCode().trim()); if (referValue != null) { @@ -212,10 +211,8 @@ public class QhdfyHisService { //当前孕妇关联的初诊复诊医生危急通知 Set sets = antenatalExaminationFacade.getCrisisUnionDoc(patients); - if (CollectionUtils.isNotEmpty(sets)) - { - for (String doctorId : sets) - { + if (CollectionUtils.isNotEmpty(sets)) { + for (String doctorId : sets) { LisCrisisNotify notify = new LisCrisisNotify(); notify.setHospitalId(patients.getHospitalId()); notify.setPatientId(patients.getId()); @@ -244,18 +241,18 @@ public class QhdfyHisService { return result; } } - System.out.print("end queryLisReport"+ DateUtil.getyyyy_MM_dd_hms(new Date())); + System.out.print("end queryLisReport" + DateUtil.getyyyy_MM_dd_hms(new Date())); return result; } private String buildRef(ReferValue referValue) { if (StringUtils.isNotBlank(referValue.getEmergencyMin()) && StringUtils.isNotBlank(referValue.getEmergencyMax())) { - return referValue.getEmergencyMin() +"~"+referValue.getEmergencyMax(); + return referValue.getEmergencyMin() + "~" + referValue.getEmergencyMax(); } else { if (StringUtils.isNotBlank(referValue.getEmergencyMin())) { - return ">"+referValue.getEmergencyMin(); + return ">" + referValue.getEmergencyMin(); } else if (StringUtils.isNotBlank(referValue.getEmergencyMax())) { - return "<"+referValue.getEmergencyMax(); + return "<" + referValue.getEmergencyMax(); } } return ""; @@ -270,7 +267,7 @@ public class QhdfyHisService { // 去重 List list = new ArrayList<>(); Date tempDate = null; - for (CheckResponse check:result) { + for (CheckResponse check : result) { if (check.getModified() != null && check.getModified().equals(tempDate)) { continue; } @@ -281,19 +278,19 @@ public class QhdfyHisService { // 排序 Collections.sort(list, new Comparator() { public int compare(Object a, Object b) { - if (((CheckResponse)a).getModified() == null) { + if (((CheckResponse) a).getModified() == null) { return 1; } - if (((CheckResponse)b).getModified() == null) { + if (((CheckResponse) b).getModified() == null) { return 1; } - if (((CheckResponse)a).getModified().before(((CheckResponse)a).getModified())) { + if (((CheckResponse) a).getModified().before(((CheckResponse) a).getModified())) { return -1; } return 1; } }); - for (CheckResponse check:list) { + for (CheckResponse check : list) { String ymd = DateUtil.getyyyy_MM_dd(check.getModified()); if (!keyList.contains(ymd)) { keyList.add(ymd); @@ -320,7 +317,7 @@ public class QhdfyHisService { } } List resultList = new ArrayList<>(); - for (String key:keyList) { + for (String key : keyList) { Map> dayMap = map.get(key); if (dayMap != null) { CheckResult checkResult = new CheckResult(); @@ -338,11 +335,12 @@ public class QhdfyHisService { /** * gxk 新建接口(与queryCheckList接口显示格式不同) * 根据日期或检查项目分类调用的方法 + * * @param cardNo * @param ftype(1,根据日期分类;2,根据检查项目分类) * @return */ - public List queryCheckListupdate(String cardNo,int ftype){ + public List queryCheckListupdate(String cardNo, int ftype) { /* CheckResponse check1=new CheckResponse(); check1.setHospitalName("秦皇岛妇幼保健"); @@ -426,10 +424,10 @@ public class QhdfyHisService { l.add(check10); l.add(check9);*/ - if(1==ftype){ + if (1 == ftype) { List result = new ArrayList<>(); - List CheckByDate=new ArrayList(); + List CheckByDate = new ArrayList(); //List CheckType=new ArrayList(); //result.addAll(l); result.addAll(queryLisCheckList(cardNo)); @@ -438,7 +436,7 @@ public class QhdfyHisService { // 去重 List list = new ArrayList<>(); Date tempDate = null; - for (CheckResponse check:result) { + for (CheckResponse check : result) { if (check.getModified() != null && check.getModified().equals(tempDate)) { continue; } @@ -448,20 +446,20 @@ public class QhdfyHisService { // 排序 Collections.sort(list, new Comparator() { public int compare(Object a, Object b) { - if (((CheckResponse)a).getModified() == null) { + if (((CheckResponse) a).getModified() == null) { return -1; } - if (((CheckResponse)b).getModified() == null) { + if (((CheckResponse) b).getModified() == null) { return -1; } - if (((CheckResponse)a).getModified().before(((CheckResponse)a).getModified())) { + if (((CheckResponse) a).getModified().before(((CheckResponse) a).getModified())) { return 1; } return -1; } }); - for (CheckResponse check:list) { + for (CheckResponse check : list) { String ymd = DateUtil.getyyyy_MM_dd(check.getModified()); if (!keyList.contains(ymd)) { keyList.add(ymd); @@ -469,28 +467,28 @@ public class QhdfyHisService { } - for(String time:keyList){ - List CheckType=new ArrayList(); - List result2=new ArrayList<>();//存放所有检验报告(type=1) - List result3=new ArrayList<>();//存放所有影像报告(type=2) - List result4=new ArrayList<>();//存放所有其他报告 - CheckType jianyan=new CheckType(); + for (String time : keyList) { + List CheckType = new ArrayList(); + List result2 = new ArrayList<>();//存放所有检验报告(type=1) + List result3 = new ArrayList<>();//存放所有影像报告(type=2) + List result4 = new ArrayList<>();//存放所有其他报告 + CheckType jianyan = new CheckType(); jianyan.setType("检验报告"); - CheckType yingxiang=new CheckType(); + CheckType yingxiang = new CheckType(); yingxiang.setType("影像报告"); - CheckType other=new CheckType(); + CheckType other = new CheckType(); other.setType("其它报告"); - for(CheckResponse chre:result){ - if(time.equals(DateUtil.getyyyy_MM_dd(chre.getModified()))){ - if(chre.getType() == 1){ + for (CheckResponse chre : result) { + if (time.equals(DateUtil.getyyyy_MM_dd(chre.getModified()))) { + if (chre.getType() == 1) { result2.add(chre); //jianyan.setTypeName(result2); //CheckType.add(jianyan); - }else if(chre.getType() == 2){ + } else if (chre.getType() == 2) { result3.add(chre); //yingxiang.setTypeName(result3); //CheckType.add(yingxiang); - }else{ + } else { result4.add(chre); //other.setTypeName(result4); //CheckType.add(other); @@ -509,7 +507,7 @@ public class QhdfyHisService { CheckType.add(other); - CheckByDate CheckByDate1=new CheckByDate(); + CheckByDate CheckByDate1 = new CheckByDate(); CheckByDate1.setTime(time); CheckByDate1.setTypes(CheckType); CheckByDate.add(CheckByDate1); @@ -517,87 +515,85 @@ public class QhdfyHisService { return CheckByDate; - }else{ + } else { List result = new ArrayList(); - List CheckByDate=new ArrayList(); + List CheckByDate = new ArrayList(); //List CheckType=new ArrayList(); //result.addAll(l); result.addAll(queryLisCheckList(cardNo)); //result.addAll(queryPacsCheckList(cardNo)); List keyList = new ArrayList<>(); - List listtype=new ArrayList<>(); + List listtype = new ArrayList<>(); List listt = new ArrayList<>(); // 去重 List list = new ArrayList<>(); - Integer num=0; - for(CheckResponse check:result){ - if(check.getType()!=null && check.getType()==num){ + Integer num = 0; + for (CheckResponse check : result) { + if (check.getType() != null && check.getType() == num) { continue; } list.add(check); - num=check.getType(); + num = check.getType(); } - String t=null; - for(CheckResponse check:result){ - if(check.getTitle()!=null && check.getTitle().equals(t)){ + String t = null; + for (CheckResponse check : result) { + if (check.getTitle() != null && check.getTitle().equals(t)) { continue; } listt.add(check); - t=check.getTitle(); + t = check.getTitle(); } // 排序 Collections.sort(list, new Comparator() { public int compare(Object a, Object b) { - if (((CheckResponse)a).getModified() == null) { + if (((CheckResponse) a).getModified() == null) { return -1; } - if (((CheckResponse)b).getModified() == null) { + if (((CheckResponse) b).getModified() == null) { return -1; } - if (((CheckResponse)a).getModified().before(((CheckResponse)a).getModified())) { + if (((CheckResponse) a).getModified().before(((CheckResponse) a).getModified())) { return 1; } return -1; } }); - for (CheckResponse check:list) { + for (CheckResponse check : list) { Integer ymd = check.getType(); if (!keyList.contains(ymd.toString())) { keyList.add(ymd.toString()); } } - for(CheckResponse check:listt){ - String ty=check.getTitle(); - if(!listtype.contains(ty)){ + for (CheckResponse check : listt) { + String ty = check.getTitle(); + if (!listtype.contains(ty)) { listtype.add(ty); } } + for (String type : keyList) { + List CheckType = new ArrayList(); - for(String type:keyList){ - - List CheckType=new ArrayList(); - - for(String typ:listtype){ - List result2=new ArrayList<>(); - CheckType CheckType1=new CheckType(); + for (String typ : listtype) { + List result2 = new ArrayList<>(); + CheckType CheckType1 = new CheckType(); //CheckType1.setType(typ); - for(CheckResponse chre:result){ - if(type.equals(chre.getType().toString()) && typ.equals(chre.getTitle())){ - chre.setTitle(DateUtil.getyyyy_MM_dd(chre.getModified())+" "+chre.getTitle()); + for (CheckResponse chre : result) { + if (type.equals(chre.getType().toString()) && typ.equals(chre.getTitle())) { + chre.setTitle(DateUtil.getyyyy_MM_dd(chre.getModified()) + " " + chre.getTitle()); result2.add(chre); //CheckType1.setTypeName(result2); //CheckType.add(CheckType1); } } - if(result2.size()>0){ + if (result2.size() > 0) { CheckType1.setType(typ); CheckType1.setTypeName(result2); CheckType.add(CheckType1); @@ -606,16 +602,16 @@ public class QhdfyHisService { } - CheckByDate CheckByDate1=new CheckByDate(); - if("1".equals(type)){ + CheckByDate CheckByDate1 = new CheckByDate(); + if ("1".equals(type)) { CheckByDate1.setTime("检验报告"); CheckByDate1.setTypes(CheckType); CheckByDate.add(CheckByDate1); - }else if("2".equals(type)){ + } else if ("2".equals(type)) { CheckByDate1.setTime("影像报告"); CheckByDate1.setTypes(CheckType); CheckByDate.add(CheckByDate1); - }else{ + } else { CheckByDate1.setTime("其它报告"); CheckByDate1.setTypes(CheckType); CheckByDate.add(CheckByDate1); @@ -623,41 +619,33 @@ public class QhdfyHisService { } - for(String typ:listtype){ + for (String typ : listtype) { } - - - return CheckByDate; } } - - - - - public static List queryLisCheckList(String cardNo) { List result = new ArrayList<>(); if (StringUtils.isNotBlank(cardNo)) { Connection conn = ConnTools.makeLisConnection(); QueryRunner queryRunner = new QueryRunner(true); try { - String sql = "select top 10000 baogaoleibiemingcheng as classifyName,huanzhexingming as name,shenqinghao as hospitalId,bingrenid as patientFid,zhuyuanhao as patientHid,kahao as vcCardNo,huanzhexingming as name,xingbie as sex,nianling as age,shenqingkeshidaima as deptCode,shenqingkeshimingcheng as deptName,shenqingyishengdaima as applyDoctorCode,shenqingyishengmingcheng as applyDoctorName,jianchayishengdaima as checkDoctorCode,jianchayishengxingming as checkDoctorName,baogaofabushijian as publishTime from valllist_ex_en where kahao ='"+cardNo+"' order by shenqinghao desc"; + String sql = "select top 10000 baogaoleibiemingcheng as classifyName,huanzhexingming as name,shenqinghao as hospitalId,bingrenid as patientFid,zhuyuanhao as patientHid,kahao as vcCardNo,huanzhexingming as name,xingbie as sex,nianling as age,shenqingkeshidaima as deptCode,shenqingkeshimingcheng as deptName,shenqingyishengdaima as applyDoctorCode,shenqingyishengmingcheng as applyDoctorName,jianchayishengdaima as checkDoctorCode,jianchayishengxingming as checkDoctorName,baogaofabushijian as publishTime from valllist_ex_en where kahao ='" + cardNo + "' order by shenqinghao desc"; String subSql = "select top 1000 sheqingdanhao as id,xiangmudaima as code,xiangmumingcheng as name,xiangmujieguo as result,zifujieguo as charResult,shuzijieguo as numberResult,gaodibiaozhi as flag,cankaozhi as ref,danwei as unit,jieguoleixing as result from valresult_ex_en where sheqingdanhao='"; List lisReportList = queryRunner.query(conn, sql, new BeanListHandler(LisReport.class)); List list = new ArrayList<>(); if (lisReportList.size() > 0) { - for (LisReport lisReport:lisReportList) { + for (LisReport lisReport : lisReportList) { // hospitalId为申请号 if (StringUtils.isNotBlank(lisReport.getHospitalId())) { - List lisReportItemList = queryRunner.query(conn, subSql+lisReport.getHospitalId()+"'", new BeanListHandler(LisReportItem.class)); + List lisReportItemList = queryRunner.query(conn, subSql + lisReport.getHospitalId() + "'", new BeanListHandler(LisReportItem.class)); if (lisReportItemList != null && lisReportItemList.size() > 0) { CheckResponse check = new CheckResponse(); check.setModified(lisReport.getPublishTime()); @@ -675,7 +663,7 @@ public class QhdfyHisService { check.setSex(lisReport.getSex()); List itemList = new ArrayList<>(); check.setItemList(itemList); - for (LisReportItem checkItem:lisReportItemList) { + for (LisReportItem checkItem : lisReportItemList) { CheckItemResponse item = new CheckItemResponse(); item.setName(checkItem.getName()); item.setCode(checkItem.getCode()); @@ -708,10 +696,10 @@ public class QhdfyHisService { return result; } - public List queryQhdCheckLisInfo(String vcCardNo,String phone,String titles,String checkTime) { + public List queryQhdCheckLisInfo(String vcCardNo, String phone, String titles, String checkTime) { System.out.println("checktime = " + checkTime); - String startDate = DateUtil.getyyyy_MM_dd(DateUtil.parseYMD(checkTime))+" 00:00:00"; - String endDate = DateUtil.getyyyy_MM_dd(DateUtil.addDay(DateUtil.parseYMD(checkTime),2))+" 00:00:00"; + String startDate = DateUtil.getyyyy_MM_dd(DateUtil.parseYMD(checkTime)) + " 00:00:00"; + String endDate = DateUtil.getyyyy_MM_dd(DateUtil.addDay(DateUtil.parseYMD(checkTime), 2)) + " 00:00:00"; List result = new ArrayList<>(); Connection conn = ConnTools.makeLisConnection(); @@ -736,10 +724,10 @@ public class QhdfyHisService { + " baogaofabushijian as modified, " + " baogaofabushijian as created, " + " phone as phone " - + " from valllist_ex_en where kahao = '"+vcCardNo+"' " - + " and baogaofabushijian >= CONVERT(DATETIME,'" + startDate +"', 120) " - + " and baogaofabushijian <= CONVERT(DATETIME,'" + endDate +"', 120) " - + " and baogaoleibiemingcheng in "+ titles + " order by baogaofabushijian desc "; + + " from valllist_ex_en where kahao = '" + vcCardNo + "' " + + " and baogaofabushijian >= CONVERT(DATETIME,'" + startDate + "', 120) " + + " and baogaofabushijian <= CONVERT(DATETIME,'" + endDate + "', 120) " + + " and baogaoleibiemingcheng in " + titles + " order by baogaofabushijian desc "; String subSql = " select " + " sheqingdanhao as lisId, " + " xiangmudaima as code, " @@ -760,7 +748,7 @@ public class QhdfyHisService { for (LisReportModel lisReport : lisReportList) { if (StringUtils.isNotBlank(lisReport.getLisId())) { List lisReportItemList = - queryRunner.query(conn, subSql+lisReport.getLisId()+"'", + queryRunner.query(conn, subSql + lisReport.getLisId() + "'", new BeanListHandler(LisReportItemModel.class)); if (CollectionUtils.isNotEmpty(lisReportItemList)) { System.out.println("items = " + lisReportItemList.size()); @@ -773,16 +761,15 @@ public class QhdfyHisService { } catch (SQLException e) { e.printStackTrace(); return result; - }finally { + } finally { DbUtils.closeQuietly(conn); } } return result; } - public List> getPatientInfoList(String cardNo){ - List> result = new ArrayList<>(); - + public List> getPatientInfoList(String cardNo) { + List> result = new ArrayList<>(); if (StringUtils.isNotBlank(cardNo)) { @@ -795,10 +782,10 @@ public class QhdfyHisService { System.out.println("times3 = " + (end - start)); try { - List list = queryRunner.query(conn, "select top 1 patid as P_ID,hzxm as P_NAME, sex as P_SEX, birth as BIRTH, sfzh as P_CARDNO, lxdh as P_MOBILEPHONE from SF_BRXXK where cardno= '"+cardNo+"'", new BeanListHandler(PregPatientinfo.class)); + List list = queryRunner.query(conn, "select top 1 patid as P_ID,hzxm as P_NAME, sex as P_SEX, birth as BIRTH, sfzh as P_CARDNO, lxdh as P_MOBILEPHONE from SF_BRXXK where cardno= '" + cardNo + "'", new BeanListHandler(PregPatientinfo.class)); if (list.size() > 0) { - for (PregPatientinfo info:list) { - Map map = new HashMap<>(); + for (PregPatientinfo info : list) { + Map map = new HashMap<>(); map.put("bhnum", info.getP_BHNUM()); if ("男".equals(info.getP_SEX())) { map.put("sex", "男"); @@ -818,7 +805,7 @@ public class QhdfyHisService { DbUtils.closeQuietly(conn); } catch (SQLException e) { DbUtils.closeQuietly(conn); - ExceptionUtils.catchException(e,"qhd his exception "); + ExceptionUtils.catchException(e, "qhd his exception "); e.printStackTrace(); } } @@ -838,9 +825,9 @@ public class QhdfyHisService { } } - public Map queryHisBabyDiagnosis(String blNo) { + public Map queryHisBabyDiagnosis(String blNo) { - Map map = new HashMap<>(); + Map map = new HashMap<>(); StringBuffer sb = new StringBuffer(); if (StringUtils.isNotBlank(blNo)) { Connection conn = com.lyms.hospitalapi.qhdfy.ConnTools.makeFmConnection(); @@ -848,22 +835,18 @@ public class QhdfyHisService { try { // List list = queryRunner.query(conn, "select cyzdmc as diagnosisItem from ZY_BRSYK where blh= '"+blNo+"'", new BeanListHandler(DiagnosisInfo.class)); - List list = queryRunner.query(conn, "select ZDMC as diagnosisItem from JHMK_BRZDQK where ZYHM = '"+blNo+"'", new BeanListHandler(DiagnosisInfo.class)); + List list = queryRunner.query(conn, "select ZDMC as diagnosisItem from JHMK_BRZDQK where ZYHM = '" + blNo + "'", new BeanListHandler(DiagnosisInfo.class)); if (CollectionUtils.isNotEmpty(list)) { // for (DiagnosisInfo info:list) { // map.put("diagnosisItem", info.getDiagnosisItem()); // break; // } - for (int i = 0 ; i < list.size() ; i++) - { - if (i < list.size() -1) - { + for (int i = 0; i < list.size(); i++) { + if (i < list.size() - 1) { sb.append(list.get(i).getDiagnosisItem()); sb.append(", "); - } - else - { + } else { sb.append(list.get(i).getDiagnosisItem()); } } @@ -877,4 +860,100 @@ public class QhdfyHisService { map.put("diagnosisItem", sb.toString()); return map; } + + public List> getBabyDiacrisis(String startDischargeDate, String endDischargeDate, + String startBirthDate, String endBirthDate, + String hospitalizationNo, String babyName, + Integer finalDiagnosis, Integer page, Integer limit) { + List> result = new ArrayList<>(); + String startDate = startDischargeDate + " 00:00:00"; + String endDate = endDischargeDate + " 00:00:00"; + int startPage = 1; + int endlimit = 10; + if (null != page && null != limit) { + if (page == 1) { + startPage = 1; + endlimit = limit; + } else { + startPage = (page - 1) * 10 + 1; + endlimit = startPage + limit - 1; + } + } + + long start = System.currentTimeMillis(); + + /* Connection conn = com.lyms.hospitalapi.qhdfy.ConnTools.makeHisConnection(); + QueryRunner queryRunner = new QueryRunner(); + */ + long end = System.currentTimeMillis(); + System.out.println("times3 = " + (end - start)); + //try { + String sql = ""; + String hospitalizationNoSql = ""; + String babyNameSql = ""; + String finalDiagnosisSql = ""; + String dischargeDateSql = ""; + String birthDateSql = ""; + if (StringUtils.isNotEmpty(hospitalizationNo) || StringUtils.isNotEmpty(startDischargeDate) || StringUtils.isNotEmpty(endDischargeDate) + || StringUtils.isNotEmpty(babyName) || null != finalDiagnosis || StringUtils.isNotEmpty(startBirthDate) || StringUtils.isNotEmpty(endBirthDate)) { + if (StringUtils.isNotEmpty(hospitalizationNo)) { + hospitalizationNoSql = " and blh= " + "'" + hospitalizationNo + "'"; + } + if (StringUtils.isNotEmpty(babyName)) { + babyNameSql = " and hzxm= " + "'" + babyName + "'"; + } + if (null != finalDiagnosis) { + finalDiagnosisSql = " and cyzddm like " + "'" + finalDiagnosis + "%" + "'"; + } + if (StringUtils.isNotEmpty(startBirthDate) && StringUtils.isNotEmpty(endBirthDate)) { + birthDateSql = " and birth >= CONVERT(varchar(100),'" + startBirthDate + "', 112) and birth <= CONVERT(varchar(100),'" + endBirthDate + "', 112)"; + } + if (StringUtils.isNotEmpty(startDischargeDate) && StringUtils.isNotEmpty(endDischargeDate)) { + dischargeDateSql = " and cyrq >= CONVERT(varchar(100),'" + startDate + "', 120) and cyrq <= CONVERT(varchar(100),'" + endDate + "', 120)"; + } + sql = hospitalizationNoSql + babyNameSql + finalDiagnosisSql + dischargeDateSql + birthDateSql; + } + System.out.println("select * from (select top 99999999 ROW_NUMBER() OVER(ORDER BY lrrq DESC ) " + + "AS ROWID,blh,cyrq,hzxm,sex,birth,cyzdmc from VW_LYMS_XSE_BRSYK where cyrq is not null " + sql + ") " + + "AS TEMP where ROWID BETWEEN " + startPage + " and " + endlimit + " order by ROWID Asc"); + + + Map map = new HashMap<>(); + map.put("dischargeDate", "20190524"); + map.put("babyName", "陈晨"); + map.put("sex", "女"); + map.put("birth", "20190404"); + map.put("monthAge", "2月2天"); + map.put("hospitalizationNo", "123456"); + map.put("dischargeDiagnosis", "新生儿肺炎"); + result.add(map); + + /*List list = queryRunner.query(conn, "select * from (select top 99999999 ROW_NUMBER() OVER(ORDER BY lrrq DESC ) " + + "AS ROWID,blh,cyrq,hzxm,sex,birth,cyzdmc from VW_LYMS_XSE_BRSYK where cyrq is not null " + sql + ") " + + "AS TEMP where ROWID BETWEEN " + startPage + " and " + endlimit + " order by ROWID Asc", new BeanListHandler(BabyDischargeDiagnosisModel.class)); + if (list.size() > 0) { + for (BabyDischargeDiagnosisModel info : list) { + Map map = new HashMap<>(); + map.put("dischargeDate", DateUtil.getyyyy_MM_dd(info.getCyrq())); + map.put("babyName", info.getHzxm()); + map.put("sex", info.getSex()); + map.put("birth", info.getBirth()); + map.put("monthAge", ""); + map.put("hospitalizationNo", info.getBlh()); + map.put("dischargeDiagnosis", info.getCyzdmc()); + result.add(map); + } + }*/ + long end1 = System.currentTimeMillis(); + System.out.println("times4 = " + (end1 - end)); + //DbUtils.closeQuietly(conn); + /*} catch (SQLException e) { + DbUtils.closeQuietly(conn); + ExceptionUtils.catchException(e, "qhd his exception "); + e.printStackTrace(); + + }*/ + return result; + } + } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBuildController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBuildController.java index 2e63c5a..b2f048b 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBuildController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBuildController.java @@ -2,6 +2,7 @@ package com.lyms.platform.operate.web.controller; import com.aspose.words.*; +import com.google.inject.spi.Toolable; import com.lyms.platform.common.annotation.TokenRequired; import com.lyms.platform.common.base.BaseController; import com.lyms.platform.common.base.LoginContext; @@ -100,19 +101,20 @@ public class BabyBuildController extends BaseController { @RequestMapping(value = "/queryBabyBuildById/{id}", method = RequestMethod.GET) @ResponseBody public BaseObjectResponse queryBabyBuildById(@PathVariable("id") String id) { - return babyBookbuildingFacade.queryBabyBuildById(id,true); + return babyBookbuildingFacade.queryBabyBuildById(id, true); } /** * 预建档查询 + * * @param id * @return */ @RequestMapping(value = "/queryBabyTempBuildById/{id}", method = RequestMethod.GET) @ResponseBody public BaseObjectResponse queryBabyTempBuildById(@PathVariable("id") String id) { - return babyBookbuildingFacade.queryBabyTempBuildById(id,false); + return babyBookbuildingFacade.queryBabyTempBuildById(id, false); } @@ -544,6 +546,28 @@ public class BabyBuildController extends BaseController { } /** + * 秦皇岛儿童出院诊断查询 + */ + + @ResponseBody + @RequestMapping(value = "/getBabyLeaveHospitalDiacrisis", method = RequestMethod.GET) + @TokenRequired + public BaseResponse getBabyLeaveHospitaiacrisis(HttpServletRequest request, HttpServletResponse response, + @RequestParam(value = "startDischargeDate", required = false) String startDischargeDate, + @RequestParam(value = "endDischargeDate", required = false) String endDischargeDate, + @RequestParam(value = "startBirthDate", required = false) String startBirthDate, + @RequestParam(value = "endBirthDate", required = false) String endBirthDate, + @RequestParam(value = "hospitalizationNo", required = false) String hospitalizationNo, + @RequestParam(value = "babyName", required = false) String babyName, + @RequestParam(value = "finalDiagnosis", required = false) Integer finalDiagnosis, + @RequestParam("page") Integer page, + @RequestParam("limit") Integer limit) { + + return babyBookbuildingFacade.getBabyDiacrisis(startDischargeDate, endDischargeDate, startBirthDate, endBirthDate, hospitalizationNo, babyName, finalDiagnosis, page, limit); + } + + + /** * 获取可以导出的医院列表 * * @param request diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java index a6952c7..de82d51 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java @@ -4030,4 +4030,22 @@ public class BabyBookbuildingFacade { public BaseObjectResponse queryBabyTempBuildById(String id, boolean isBuild) { return queryBabyBuildById(id, isBuild); } + + + public BaseListResponse getBabyDiacrisis(String startDischargeDate, String endDischargeDate, + String startBirthDate, String endBirthDate, + String hospitalizationNo, String babyName, + Integer finalDiagnosis, Integer page, Integer limit) { + + List list = qhdfyHisService.getBabyDiacrisis(startDischargeDate, endDischargeDate, startBirthDate, endBirthDate, hospitalizationNo, babyName, finalDiagnosis, page, limit); + BaseListResponse objectResponse = new BaseListResponse(); + //objectResponse.setPageInfo(); + objectResponse.setData(list); + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); + objectResponse.setErrormsg("成功"); + return objectResponse; + + } + + } \ No newline at end of file -- 1.8.3.1