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 a1406d6..7c0f90c 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 @@ -59,13 +59,20 @@ public class QhdfyHisService { queryLisReport(new Date(date.getTime()-1000*60*60)); } - public void syncLisReportTask(String dateStr) { + public void syncLisReportTask(final String dateStr) { // DateTime dt = new DateTime(); // dt = dt.minusDays(1); - queryLisReport(DateUtil.parseYMD(dateStr)); + new Thread("syncLisReportTask"){ + @Override + 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())); //TODO Integer hospitalId = 216; List result = new ArrayList<>(); @@ -83,10 +90,15 @@ public class QhdfyHisService { referValueMap.put(referValue.getCode(), referValue); } PatientsQuery patientsQuery = new PatientsQuery(); - 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,'"+startDate+"', 20) and phone is not null and phone !='' and shenqinghao is not null order by shenqinghao desc"; + List buildType = new ArrayList(); + buildType.add(0); + buildType.add(2); + buildType.add(3); + 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 !='' and shenqinghao is not null 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='"; - Object[] params = {startDate}; - List list = queryRunner.query(conn, sql, new BeanListHandler(LisReport.class),startDate); + List list = queryRunner.query(conn, sql, new BeanListHandler(LisReport.class)); System.out.println("危急值====> " + list.size()); if (list.size() > 0) { MongoCondition mongoCondition = MongoCondition.newInstance("hospitalId", ""+hospitalId, MongoOper.IS); @@ -102,12 +114,16 @@ public class QhdfyHisService { lisReportQuery.setId(hospitalId + "_" + report.getHospitalId()); lisReportQuery.setHospitalId(""+hospitalId); int reportCount = lisReportService.queryLisReportCount(lisReportQuery); + if (count > 0 && reportCount == 0) { patientsQuery.setLimit(1); patientsQuery.setPage(0); patientsQuery.setNeed("y"); List patientsList = patientsService.queryPatient(patientsQuery); Patients patients = patientsList.get(0); + if(null==patients.getLastMenses()){ + continue; + } LisCrisisItem crisisItem = new LisCrisisItem(); crisisItem.setPid(patients.getPid()); crisisItem.setPatientId(patients.getId()); @@ -127,7 +143,9 @@ public class QhdfyHisService { crisisItem.setStatusName("待处理"); 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()); report.setItemList(itemList); report.setHospitalId(hospitalId + ""); @@ -186,6 +204,7 @@ public class QhdfyHisService { return result; } } + System.out.print("end queryLisReport"+ DateUtil.getyyyy_MM_dd_hms(new Date())); return result; }