Commit 59010b7a3627dd180e9c1a6bdec725a9ab3b8723
1 parent
3ab4c6e15d
Exists in
master
and in
6 other branches
产检节点统计
Showing 4 changed files with 112 additions and 79 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/SieveRecordService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/SieveRecordModel.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SieveRecordFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/SieveRecordService.java
View file @
59010b7
... | ... | @@ -28,7 +28,8 @@ |
28 | 28 | query.start(sieveRecordQuery.getOffset()).end(sieveRecordQuery.getLimit()); |
29 | 29 | } |
30 | 30 | |
31 | - return sieveRecordDao.query(query.addOrder(Sort.Direction.DESC, "created")); | |
31 | + query.addOrder(Sort.Direction.DESC, "time"); | |
32 | + return sieveRecordDao.query(query.addOrder(Sort.Direction.ASC, "created")); | |
32 | 33 | } |
33 | 34 | |
34 | 35 | public void save(SieveRecordModel model) { |
platform-dal/src/main/java/com/lyms/platform/pojo/SieveRecordModel.java
View file @
59010b7
... | ... | @@ -24,6 +24,17 @@ |
24 | 24 | // 0 未导出 1 已经导出 |
25 | 25 | private Integer status; |
26 | 26 | |
27 | + //保存时间的年月日 | |
28 | + private Date time; | |
29 | + | |
30 | + public Date getTime() { | |
31 | + return time; | |
32 | + } | |
33 | + | |
34 | + public void setTime(Date time) { | |
35 | + this.time = time; | |
36 | + } | |
37 | + | |
27 | 38 | public Integer getOperUserId() { |
28 | 39 | return operUserId; |
29 | 40 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
59010b7
... | ... | @@ -25,8 +25,10 @@ |
25 | 25 | import org.apache.commons.io.FileUtils; |
26 | 26 | import org.apache.commons.lang.StringUtils; |
27 | 27 | import org.springframework.beans.factory.annotation.Autowired; |
28 | +import org.springframework.beans.factory.annotation.Qualifier; | |
28 | 29 | import org.springframework.data.domain.Sort; |
29 | 30 | import org.springframework.data.mongodb.core.MongoTemplate; |
31 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
30 | 32 | import org.springframework.stereotype.Controller; |
31 | 33 | import org.springframework.web.bind.annotation.RequestMapping; |
32 | 34 | import org.springframework.web.bind.annotation.RequestMethod; |
... | ... | @@ -97,6 +99,13 @@ |
97 | 99 | @Autowired |
98 | 100 | private AntExRecordService recordService; |
99 | 101 | |
102 | + @Autowired | |
103 | + private PersonService personService; | |
104 | + | |
105 | + @Autowired | |
106 | + @Qualifier("commonThreadPool") | |
107 | + private ThreadPoolTaskExecutor commonThreadPool; | |
108 | + | |
100 | 109 | /** |
101 | 110 | * 获取科室 |
102 | 111 | */ |
103 | 112 | |
104 | 113 | |
105 | 114 | |
106 | 115 | |
107 | 116 | |
108 | 117 | |
109 | 118 | |
110 | 119 | |
111 | 120 | |
112 | 121 | |
113 | 122 | |
114 | 123 | |
115 | 124 | |
... | ... | @@ -357,99 +366,109 @@ |
357 | 366 | public String updateCheckRecord(@RequestParam(required = false) String hospitalId) |
358 | 367 | { |
359 | 368 | |
360 | - OrganizationQuery organizationQuery = new OrganizationQuery(); | |
361 | - organizationQuery.setYn(YnEnums.YES.getId()); | |
362 | - if (StringUtils.isNotEmpty(hospitalId)) | |
363 | - { | |
364 | - organizationQuery.setId(Integer.parseInt(hospitalId)); | |
365 | - } | |
366 | - List<Organization> organizationList = organizationService.queryOrganization(organizationQuery); | |
369 | + PersonModelQuery personModelQuery = new PersonModelQuery(); | |
370 | + personModelQuery.setYn(YnEnums.YES.getId()); | |
367 | 371 | |
368 | - PatientsQuery patientsQuery1 = new PatientsQuery(); | |
369 | - patientsQuery1.setYn(YnEnums.YES.getId()); | |
370 | - | |
371 | - if (CollectionUtils.isNotEmpty(organizationList)) | |
372 | + List<PersonModel> personModels = personService.queryPersons(personModelQuery); | |
373 | + if (CollectionUtils.isNotEmpty(personModels)) | |
372 | 374 | { |
373 | - for (Organization organization : organizationList) { | |
375 | + int batchSize = 200; | |
376 | + for(int i = 0,end = 0 ; i < personModels.size() ; i += batchSize) | |
377 | + { | |
378 | + end += batchSize; | |
379 | + end = end > personModels.size() ? personModels.size() : end; | |
380 | + final List<PersonModel> models = personModels.subList(i,batchSize); | |
374 | 381 | |
375 | - patientsQuery1.setHospitalId(organization.getId()+""); | |
376 | - List<Patients> pats = patientsService.queryPatient(patientsQuery1); | |
382 | + commonThreadPool.execute(new Runnable() { | |
383 | + @Override | |
384 | + public void run() { | |
385 | + for(PersonModel model : models) | |
386 | + { | |
387 | + PatientsQuery patientsQuery1 = new PatientsQuery(); | |
388 | + patientsQuery1.setYn(YnEnums.YES.getId()); | |
389 | + patientsQuery1.setPid(model.getId()); | |
390 | + List<Patients> pats = patientsService.queryPatient(patientsQuery1); | |
377 | 391 | |
378 | - int batchSize = 1000; | |
379 | - int end = 0; | |
380 | - for (int i = 0; i < pats.size(); i += batchSize) { | |
381 | - end = (end + batchSize); | |
382 | - if (end > pats.size()) { | |
383 | - end = pats.size(); | |
384 | - } | |
385 | - System.out.println("start:" + i + ",end:" + end); | |
386 | - final List<Patients> tempList = pats.subList(i, end); | |
392 | + int batchSize = 1000; | |
393 | + int end = 0; | |
394 | + for (int i = 0; i < pats.size(); i += batchSize) { | |
395 | + end = (end + batchSize); | |
396 | + if (end > pats.size()) { | |
397 | + end = pats.size(); | |
398 | + } | |
399 | + System.out.println("start:" + i + ",end:" + end); | |
400 | + final List<Patients> tempList = pats.subList(i, end); | |
387 | 401 | |
388 | - new Thread(new Runnable() { | |
389 | - @Override | |
390 | - public void run() { | |
391 | - if (CollectionUtils.isNotEmpty(tempList)) { | |
392 | - AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
393 | - for (Patients pat : tempList) { | |
394 | - antExRecordQuery.setParentId(pat.getId()); | |
395 | - if (StringUtils.isNotEmpty(pat.getId())) | |
396 | - { | |
397 | - | |
398 | - for (int i = 0 ; i < 5 ; i++) | |
399 | - { | |
400 | - if (i == 0) | |
401 | - { | |
402 | - antExRecordQuery.setcDueWeekStart(0); | |
403 | - antExRecordQuery.setcDueWeekEnd((12 + 1) * 7 - 1); | |
404 | - } | |
405 | - else if (i == 1) | |
406 | - { | |
407 | - antExRecordQuery.setcDueWeekStart(16*7); | |
408 | - antExRecordQuery.setcDueWeekEnd((20 + 1) * 7 - 1); | |
409 | - } | |
410 | - else if (i == 2) | |
411 | - { | |
412 | - antExRecordQuery.setcDueWeekStart(21*7); | |
413 | - antExRecordQuery.setcDueWeekEnd((24 + 1) * 7 - 1); | |
414 | - } | |
415 | - else if (i == 3) | |
416 | - { | |
417 | - antExRecordQuery.setcDueWeekStart(28*7); | |
418 | - antExRecordQuery.setcDueWeekEnd((36 + 1) * 7 - 1); | |
419 | - } | |
420 | - else if (i == 4) | |
421 | - { | |
422 | - antExRecordQuery.setcDueWeekStart(37*7); | |
423 | - antExRecordQuery.setcDueWeekEnd((40 + 1) * 7 - 1); | |
424 | - } | |
425 | - | |
426 | - List<AntExRecordModel> list = recordService.queryAntExRecords(antExRecordQuery); | |
427 | - if (CollectionUtils.isNotEmpty(list)) | |
428 | - { | |
429 | - for (int j = 0 ; j < list.size() ; j++) | |
402 | + commonThreadPool.execute(new Runnable() { | |
403 | + @Override | |
404 | + public void run() { | |
405 | + if (CollectionUtils.isNotEmpty(tempList)) { | |
406 | + AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
407 | + for (Patients pat : tempList) { | |
408 | + antExRecordQuery.setParentId(pat.getId()); | |
409 | + if (StringUtils.isNotEmpty(pat.getId())) | |
430 | 410 | { |
431 | - AntExRecordModel m = list.get(j); | |
432 | - if (j == (list.size() - 1)) | |
411 | + | |
412 | + for (int i = 0 ; i < 5 ; i++) | |
433 | 413 | { |
434 | - m.setIsFirst(1); | |
414 | + if (i == 0) | |
415 | + { | |
416 | + antExRecordQuery.setcDueWeekStart(0); | |
417 | + antExRecordQuery.setcDueWeekEnd((12 + 1) * 7 - 1); | |
418 | + } | |
419 | + else if (i == 1) | |
420 | + { | |
421 | + antExRecordQuery.setcDueWeekStart(16*7); | |
422 | + antExRecordQuery.setcDueWeekEnd((20 + 1) * 7 - 1); | |
423 | + } | |
424 | + else if (i == 2) | |
425 | + { | |
426 | + antExRecordQuery.setcDueWeekStart(21*7); | |
427 | + antExRecordQuery.setcDueWeekEnd((24 + 1) * 7 - 1); | |
428 | + } | |
429 | + else if (i == 3) | |
430 | + { | |
431 | + antExRecordQuery.setcDueWeekStart(28*7); | |
432 | + antExRecordQuery.setcDueWeekEnd((36 + 1) * 7 - 1); | |
433 | + } | |
434 | + else if (i == 4) | |
435 | + { | |
436 | + antExRecordQuery.setcDueWeekStart(37*7); | |
437 | + antExRecordQuery.setcDueWeekEnd((40 + 1) * 7 - 1); | |
438 | + } | |
439 | + | |
440 | + List<AntExRecordModel> list = recordService.queryAntExRecords(antExRecordQuery); | |
441 | + if (CollectionUtils.isNotEmpty(list)) | |
442 | + { | |
443 | + for (int j = 0 ; j < list.size() ; j++) | |
444 | + { | |
445 | + AntExRecordModel m = list.get(j); | |
446 | + if (j == (list.size() - 1)) | |
447 | + { | |
448 | + m.setIsFirst(1); | |
449 | + } | |
450 | + else | |
451 | + { | |
452 | + m.setIsFirst(2); | |
453 | + } | |
454 | + recordService.updateOne(m,m.getId()); | |
455 | + } | |
456 | + | |
457 | + } | |
435 | 458 | } |
436 | - else | |
437 | - { | |
438 | - m.setIsFirst(2); | |
439 | - } | |
440 | - recordService.updateOne(m,m.getId()); | |
441 | 459 | } |
442 | - | |
443 | 460 | } |
444 | 461 | } |
445 | 462 | } |
446 | - } | |
463 | + }); | |
447 | 464 | } |
465 | + | |
448 | 466 | } |
449 | - }).start(); | |
450 | - } | |
467 | + } | |
468 | + }); | |
451 | 469 | } |
452 | 470 | } |
471 | + | |
453 | 472 | return "updateCheckRecord finish"; |
454 | 473 | } |
455 | 474 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SieveRecordFacade.java
View file @
59010b7
... | ... | @@ -114,6 +114,8 @@ |
114 | 114 | private SieveRecordModel getPatientsData(YunBookbuildingAddRequest yunRequest) { |
115 | 115 | SieveRecordModel patient = new SieveRecordModel(); |
116 | 116 | |
117 | + patient.setTime(DateUtil.getYMDTime()); | |
118 | + | |
117 | 119 | patient.setPatientId(yunRequest.getPatientdId()); |
118 | 120 | |
119 | 121 | patient.setMensStartDay(yunRequest.getMensStartDay()); |