Commit 27fe28ed3bca7f04cf1b4ea65a9366761b73f069

Authored by jiangjiazhi
1 parent 8559461730

增加soureceid

Showing 1 changed file with 24 additions and 5 deletions

platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdfyHisService.java View file @ 27fe28e
... ... @@ -59,13 +59,20 @@
59 59 queryLisReport(new Date(date.getTime()-1000*60*60));
60 60 }
61 61  
62   - public void syncLisReportTask(String dateStr) {
  62 + public void syncLisReportTask(final String dateStr) {
63 63 // DateTime dt = new DateTime();
64 64 // dt = dt.minusDays(1);
65   - queryLisReport(DateUtil.parseYMD(dateStr));
  65 + new Thread("syncLisReportTask"){
  66 + @Override
  67 + public void run()
  68 + {
  69 + queryLisReport(DateUtil.parseYMD(dateStr));
  70 + }
  71 + }.start();
66 72 }
67 73  
68 74 public List<QhdfyLisReport> queryLisReport(Date startDate) {
  75 + System.out.print("begin queryLisReport"+ DateUtil.getyyyy_MM_dd_hms(new Date()));
69 76 //TODO
70 77 Integer hospitalId = 216;
71 78 List<QhdfyLisReport> result = new ArrayList<>();
72 79  
... ... @@ -83,10 +90,15 @@
83 90 referValueMap.put(referValue.getCode(), referValue);
84 91 }
85 92 PatientsQuery patientsQuery = new PatientsQuery();
86   - 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";
  93 + List buildType = new ArrayList();
  94 + buildType.add(0);
  95 + buildType.add(2);
  96 + buildType.add(3);
  97 + patientsQuery.setBuildTypeList(buildType);
  98 + String startDateStr=DateUtil.getyyyy_MM_dd_hms(startDate);
  99 + 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";
87 100 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='";
88   - Object[] params = {startDate};
89   - List<LisReport> list = queryRunner.query(conn, sql, new BeanListHandler<LisReport>(LisReport.class),startDate);
  101 + List<LisReport> list = queryRunner.query(conn, sql, new BeanListHandler<LisReport>(LisReport.class));
90 102 System.out.println("危急值====> " + list.size());
91 103 if (list.size() > 0) {
92 104 MongoCondition mongoCondition = MongoCondition.newInstance("hospitalId", ""+hospitalId, MongoOper.IS);
93 105  
... ... @@ -102,12 +114,16 @@
102 114 lisReportQuery.setId(hospitalId + "_" + report.getHospitalId());
103 115 lisReportQuery.setHospitalId(""+hospitalId);
104 116 int reportCount = lisReportService.queryLisReportCount(lisReportQuery);
  117 +
105 118 if (count > 0 && reportCount == 0) {
106 119 patientsQuery.setLimit(1);
107 120 patientsQuery.setPage(0);
108 121 patientsQuery.setNeed("y");
109 122 List<Patients> patientsList = patientsService.queryPatient(patientsQuery);
110 123 Patients patients = patientsList.get(0);
  124 + if(null==patients.getLastMenses()){
  125 + continue;
  126 + }
111 127 LisCrisisItem crisisItem = new LisCrisisItem();
112 128 crisisItem.setPid(patients.getPid());
113 129 crisisItem.setPatientId(patients.getId());
114 130  
... ... @@ -127,7 +143,9 @@
127 143 crisisItem.setStatusName("待处理");
128 144  
129 145 List<LisReportItem> itemList = queryRunner.query(conn, subSql+report.getHospitalId()+"'", new BeanListHandler<LisReportItem>(LisReportItem.class));
  146 + System.out.println("itemList ====> "+itemList.size() );
130 147 if (itemList.size() > 0) {
  148 + System.out.println("3====> " + reportCount);
131 149 report.setId(hospitalId + "_" + report.getHospitalId());
132 150 report.setItemList(itemList);
133 151 report.setHospitalId(hospitalId + "");
... ... @@ -186,6 +204,7 @@
186 204 return result;
187 205 }
188 206 }
  207 + System.out.print("end queryLisReport"+ DateUtil.getyyyy_MM_dd_hms(new Date()));
189 208 return result;
190 209 }
191 210