Commit 64eeb1d1c12fc26f027543a162059674ed3db66c
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 9 changed files
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RiskReportFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/RiskPatientsResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/RiskReportResult.java
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
64eeb1d
| ... | ... | @@ -726,15 +726,8 @@ |
| 726 | 726 | if (buildTypeEq != null) { |
| 727 | 727 | condition = condition.and("buildType", buildTypeEq, MongoOper.IS); |
| 728 | 728 | } |
| 729 | - Criteria c1 = null; | |
| 730 | - if (lastCheckEmployeeId != null) { | |
| 731 | - condition = condition.and("lastCheckEmployeeId", lastCheckEmployeeId, MongoOper.IS); | |
| 732 | - } | |
| 733 | - else if(lastCheckEId){ | |
| 734 | - // condition = condition.and("lastCheckEmployeeId", "", MongoOper.NE); | |
| 735 | - // condition = condition.andCondition(MongoCondition.newInstance("lastCheckEmployeeId", null, MongoOper.NE)); | |
| 736 | - c1 = Criteria.where("lastCheckEmployeeId").ne("").ne(null); | |
| 737 | - } | |
| 729 | + | |
| 730 | + | |
| 738 | 731 | if (bookbuildingDoctor != null) { |
| 739 | 732 | condition = condition.and("bookbuildingDoctor", bookbuildingDoctor, MongoOper.IS); |
| 740 | 733 | } |
| 741 | 734 | |
| ... | ... | @@ -814,12 +807,23 @@ |
| 814 | 807 | if (null != pid) { |
| 815 | 808 | condition = condition.and("pid", pid, MongoOper.IS); |
| 816 | 809 | } |
| 810 | + Criteria c1 = null; | |
| 811 | + | |
| 817 | 812 | if (null != queryNo) { |
| 818 | 813 | MongoCondition c = MongoCondition.newInstance(); |
| 819 | 814 | MongoCondition con1 = MongoCondition.newInstance("phone", queryNo, MongoOper.IS); |
| 820 | 815 | MongoCondition con2 = MongoCondition.newInstance("username", queryNo, MongoOper.IS); |
| 821 | 816 | MongoCondition con3 = MongoCondition.newInstance("cardNo", queryNo, MongoOper.IS); |
| 822 | 817 | c1= c.orCondition(new MongoCondition[]{con1, con2, con3}).getCriteria(); |
| 818 | + } | |
| 819 | + | |
| 820 | + if (lastCheckEmployeeId != null) { | |
| 821 | + condition = condition.and("lastCheckEmployeeId", lastCheckEmployeeId, MongoOper.IS); | |
| 822 | + } | |
| 823 | + else if(lastCheckEId){ | |
| 824 | + condition = condition.and("lastCheckEmployeeId", "", MongoOper.NE); | |
| 825 | + MongoCondition c = MongoCondition.newInstance(); | |
| 826 | + c1= c.andCondition(MongoCondition.newInstance("lastCheckEmployeeId", null, MongoOper.NE)).getCriteria(); | |
| 823 | 827 | } |
| 824 | 828 | |
| 825 | 829 | if (fmDateStart != null && fmDateEnd != null) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java
View file @
64eeb1d
| ... | ... | @@ -26,7 +26,7 @@ |
| 26 | 26 | public class Test { |
| 27 | 27 | |
| 28 | 28 | public static void main(String[] args) { |
| 29 | -// PatientsQuery patientsQuery1 = new PatientsQuery(); | |
| 29 | + PatientsQuery patientsQuery1 = new PatientsQuery(); | |
| 30 | 30 | // patientsQuery1.setHospitalId("221"); |
| 31 | 31 | // patientsQuery1.setYn(YnEnums.YES.getId()); |
| 32 | 32 | // patientsQuery1.setType(1); |
| 33 | 33 | |
| 34 | 34 | |
| ... | ... | @@ -44,18 +44,30 @@ |
| 44 | 44 | // patientsQuery1.setBookbuildingDateEnd(DateUtil.parseYMD("2016-12-08")); |
| 45 | 45 | |
| 46 | 46 | |
| 47 | +// Date yuYueDate = DateUtil.addDay(new Date(), 2); | |
| 48 | +// if (yuYueDate != null) { | |
| 49 | +// //把时间格式化成 yyyy_MM_dd 的日期 | |
| 50 | +// yuYueDate = DateUtil.formatDate(yuYueDate); | |
| 51 | +// } | |
| 52 | +// AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 53 | +// antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 54 | +// antExChuQuery.setNextCheckTimeStart(yuYueDate); | |
| 55 | +// antExChuQuery.setNextCheckTimeEnd(yuYueDate); | |
| 56 | +// antExChuQuery.setHospitalId("242"); | |
| 57 | + | |
| 58 | + patientsQuery1.setLastCheckEId(true); | |
| 59 | + patientsQuery1.setHospitalId("242"); | |
| 60 | + patientsQuery1.setType(1); | |
| 61 | + | |
| 47 | 62 | Date yuYueDate = DateUtil.addDay(new Date(), 2); |
| 48 | 63 | if (yuYueDate != null) { |
| 49 | 64 | //把时间格式化成 yyyy_MM_dd 的日期 |
| 50 | 65 | yuYueDate = DateUtil.formatDate(yuYueDate); |
| 51 | 66 | } |
| 52 | - AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 53 | - antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 54 | - antExChuQuery.setNextCheckTimeStart(yuYueDate); | |
| 55 | - antExChuQuery.setNextCheckTimeEnd(yuYueDate); | |
| 56 | - antExChuQuery.setHospitalId("242"); | |
| 67 | + patientsQuery1.setDueDateStart(yuYueDate); | |
| 68 | + patientsQuery1.setDueDateEnd(yuYueDate); | |
| 57 | 69 | |
| 58 | - System.out.println(antExChuQuery.convertToQuery().convertToMongoQuery()); | |
| 70 | + System.out.println(patientsQuery1.convertToQuery().convertToMongoQuery()); | |
| 59 | 71 | |
| 60 | 72 | |
| 61 | 73 | /* |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java
View file @
64eeb1d
| ... | ... | @@ -93,7 +93,7 @@ |
| 93 | 93 | @TokenRequired |
| 94 | 94 | public BaseResponse queryAllPatPuerpera(@Valid RiskPatientsQueryRequest patientsQueryRequest,HttpServletRequest request) { |
| 95 | 95 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 96 | - return patientFacade.queryHighRisk(patientsQueryRequest, Boolean.TRUE, null, loginState.getId(), "true", Boolean.FALSE); | |
| 96 | + return patientFacade.queryHighRisk1(patientsQueryRequest, null, null, loginState.getId(), "true", Boolean.FALSE); | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java
View file @
64eeb1d
| ... | ... | @@ -28,10 +28,7 @@ |
| 28 | 28 | import org.springframework.beans.factory.annotation.Autowired; |
| 29 | 29 | import org.springframework.stereotype.Component; |
| 30 | 30 | |
| 31 | -import java.util.ArrayList; | |
| 32 | -import java.util.HashMap; | |
| 33 | -import java.util.List; | |
| 34 | -import java.util.Map; | |
| 31 | +import java.util.*; | |
| 35 | 32 | |
| 36 | 33 | /** |
| 37 | 34 | * 产检管理 |
| ... | ... | @@ -187,6 +184,7 @@ |
| 187 | 184 | } |
| 188 | 185 | data.add(cjStatisticsResult); |
| 189 | 186 | } |
| 187 | + Collections.sort(data,new CjStatisticsResult()); | |
| 190 | 188 | } |
| 191 | 189 | return baseListResponse.setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setPageInfo(patientsQuery1.getPageInfo()); |
| 192 | 190 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
64eeb1d
| ... | ... | @@ -421,6 +421,27 @@ |
| 421 | 421 | return new BaseListResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setPageInfo(patientsQuery.getPageInfo()); |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | + | |
| 425 | + public BaseResponse queryHighRisk1(RiskPatientsQueryRequest riskPatientsQueryRequest, Boolean isHighRisk, Integer type, Integer userId, String needPage, boolean isRegion) { | |
| 426 | + //组合请求 | |
| 427 | + PatientsQuery patientsQuery = complayRequest(riskPatientsQueryRequest, isHighRisk, type, userId, needPage, isRegion); | |
| 428 | + | |
| 429 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
| 430 | + //查询符合条件的孕妇 | |
| 431 | + StopWatch stopWatch = new StopWatch("queryPatient2 -" + hospital); | |
| 432 | + stopWatch.start(); | |
| 433 | + List<Patients> patientses = patientsService.queryPatient1(patientsQuery, "modified"); | |
| 434 | + stopWatch.stop(); | |
| 435 | + | |
| 436 | + logger.info(stopWatch.toString()); | |
| 437 | + List data = new ArrayList<>(); | |
| 438 | + if (CollectionUtils.isNotEmpty(patientses)) { | |
| 439 | + //如果是查高危孕妇 | |
| 440 | + data = convertToHighRisk(patientses, userId, hospital); | |
| 441 | + } | |
| 442 | + return new BaseListResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(data).setPageInfo(patientsQuery.getPageInfo()); | |
| 443 | + } | |
| 444 | + | |
| 424 | 445 | public BaseResponse findPatient(PatientQueryRequest patientQueryRequest, Integer userId) { |
| 425 | 446 | PatientsQuery patientsQuery = new PatientsQuery(); |
| 426 | 447 | patientsQuery.setPid(patientQueryRequest.getPid()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RiskReportFacade.java
View file @
64eeb1d
| ... | ... | @@ -10,10 +10,7 @@ |
| 10 | 10 | import com.lyms.platform.common.result.BaseListResponse; |
| 11 | 11 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 12 | 12 | import com.lyms.platform.common.result.BaseResponse; |
| 13 | -import com.lyms.platform.common.utils.DateUtil; | |
| 14 | -import com.lyms.platform.common.utils.JsonUtil; | |
| 15 | -import com.lyms.platform.common.utils.StringUtils; | |
| 16 | -import com.lyms.platform.common.utils.SystemConfig; | |
| 13 | +import com.lyms.platform.common.utils.*; | |
| 17 | 14 | import com.lyms.platform.operate.web.request.BabyCheckRequest; |
| 18 | 15 | import com.lyms.platform.operate.web.request.RiskPatientsQueryRequest; |
| 19 | 16 | import com.lyms.platform.operate.web.result.*; |
| ... | ... | @@ -101,7 +98,7 @@ |
| 101 | 98 | //总的孕妇条数 |
| 102 | 99 | int allPatientCount = patientsService.queryPatientCount(patientsQuery); |
| 103 | 100 | |
| 104 | - List results = new ArrayList<>(); | |
| 101 | + List<RiskReportResult> results = new ArrayList<>(); | |
| 105 | 102 | |
| 106 | 103 | BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); |
| 107 | 104 | basicConfigQuery.setYn(YnEnums.YES.getId()); |
| 108 | 105 | |
| ... | ... | @@ -115,12 +112,16 @@ |
| 115 | 112 | ExecutorService pool = Executors.newFixedThreadPool(riskLevelConfig.size()); |
| 116 | 113 | for(BasicConfig levelConfig : riskLevelConfig) |
| 117 | 114 | { |
| 118 | - Callable c = new HiskCountTask( basicConfigService, | |
| 115 | + if ("e637b361-99cf-41eb-84f2-f0dab596e928".equals(levelConfig.getId())) | |
| 116 | + { | |
| 117 | + continue; | |
| 118 | + } | |
| 119 | + Callable c = new HiskCountTask( basicConfigService, | |
| 119 | 120 | patientsService, levelConfig, |
| 120 | 121 | patientsQuery, |
| 121 | 122 | allPatientCount); |
| 122 | - Future f = pool.submit(c); | |
| 123 | - futures.add(f); | |
| 123 | + Future f = pool.submit(c); | |
| 124 | + futures.add(f); | |
| 124 | 125 | } |
| 125 | 126 | // 关闭线程池 |
| 126 | 127 | pool.shutdown(); |
| 127 | 128 | |
| ... | ... | @@ -131,14 +132,14 @@ |
| 131 | 132 | for (Future f : futures) |
| 132 | 133 | { |
| 133 | 134 | try { |
| 134 | - results.addAll((List) f.get()); | |
| 135 | - } catch (InterruptedException e) { | |
| 136 | - e.printStackTrace(); | |
| 137 | - } catch (ExecutionException e) { | |
| 138 | - e.printStackTrace(); | |
| 135 | + results.addAll((List<RiskReportResult>) f.get()); | |
| 136 | + } catch (Exception e) { | |
| 137 | + ExceptionUtils.catchException(e, "high risk count error."); | |
| 139 | 138 | } |
| 140 | 139 | } |
| 141 | 140 | } |
| 141 | + | |
| 142 | + Collections.sort(results,new RiskReportResult()); | |
| 142 | 143 | |
| 143 | 144 | return new BaseListResponse() |
| 144 | 145 | .setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS).setData(results); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CjStatisticsResult.java
View file @
64eeb1d
| 1 | 1 | package com.lyms.platform.operate.web.result; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.common.utils.StringUtils; | |
| 4 | + | |
| 5 | +import java.util.Comparator; | |
| 6 | + | |
| 3 | 7 | /** |
| 4 | 8 | * |
| 5 | 9 | * 产检统计 |
| 6 | 10 | * Created by Administrator on 2016/11/28 0028. |
| 7 | 11 | */ |
| 8 | -public class CjStatisticsResult { | |
| 12 | +public class CjStatisticsResult implements Comparator<CjStatisticsResult> { | |
| 9 | 13 | private String dId; |
| 10 | 14 | private String dName; |
| 11 | 15 | private String count; |
| ... | ... | @@ -37,5 +41,18 @@ |
| 37 | 41 | public void setCount(String count) { |
| 38 | 42 | this.count = count; |
| 39 | 43 | } |
| 44 | + | |
| 45 | + @Override | |
| 46 | + public int compare(CjStatisticsResult o1, CjStatisticsResult o2) { | |
| 47 | + if (o1 != null && o2 != null) | |
| 48 | + { | |
| 49 | + if (StringUtils.isNotEmpty(o2.getCount()) && StringUtils.isNotEmpty(o1.getCount())) | |
| 50 | + { | |
| 51 | + return Integer.parseInt(o2.getCount()) - Integer.parseInt(o1.getCount()); | |
| 52 | + } | |
| 53 | + } | |
| 54 | + return 0; | |
| 55 | + } | |
| 56 | + | |
| 40 | 57 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/RiskPatientsResult.java
View file @
64eeb1d
| ... | ... | @@ -69,6 +69,63 @@ |
| 69 | 69 | //服务状态 |
| 70 | 70 | private String serviceStatus; |
| 71 | 71 | |
| 72 | + //户籍地 | |
| 73 | + private String hjAddress; | |
| 74 | + | |
| 75 | + //居住地址 | |
| 76 | + private String jzAddress; | |
| 77 | + | |
| 78 | + //首次建档医院 | |
| 79 | + private String firstHospital; | |
| 80 | + | |
| 81 | + | |
| 82 | + //当前产检医院 | |
| 83 | + private String currentCheckHospital; | |
| 84 | + | |
| 85 | + public String getHjAddress() { | |
| 86 | + if(null==hjAddress){ | |
| 87 | + return SPIT; | |
| 88 | + } | |
| 89 | + return hjAddress; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public void setHjAddress(String hjAddress) { | |
| 93 | + this.hjAddress = hjAddress; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public String getJzAddress() { | |
| 97 | + if(null==jzAddress){ | |
| 98 | + return SPIT; | |
| 99 | + } | |
| 100 | + return jzAddress; | |
| 101 | + } | |
| 102 | + | |
| 103 | + public void setJzAddress(String jzAddress) { | |
| 104 | + this.jzAddress = jzAddress; | |
| 105 | + } | |
| 106 | + | |
| 107 | + public String getFirstHospital() { | |
| 108 | + if(null==firstHospital){ | |
| 109 | + return SPIT; | |
| 110 | + } | |
| 111 | + return firstHospital; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void setFirstHospital(String firstHospital) { | |
| 115 | + this.firstHospital = firstHospital; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public String getCurrentCheckHospital() { | |
| 119 | + if(null==currentCheckHospital){ | |
| 120 | + return SPIT; | |
| 121 | + } | |
| 122 | + return currentCheckHospital; | |
| 123 | + } | |
| 124 | + | |
| 125 | + public void setCurrentCheckHospital(String currentCheckHospital) { | |
| 126 | + this.currentCheckHospital = currentCheckHospital; | |
| 127 | + } | |
| 128 | + | |
| 72 | 129 | public String getServiceType() { |
| 73 | 130 | return serviceType; |
| 74 | 131 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/RiskReportResult.java
View file @
64eeb1d
| 1 | 1 | package com.lyms.platform.operate.web.result; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import com.lyms.platform.common.utils.StringUtils; | |
| 5 | + | |
| 6 | +import java.util.Comparator; | |
| 4 | 7 | import java.util.List; |
| 5 | 8 | |
| 6 | 9 | /** |
| 7 | 10 | * 高危报表结果 |
| 8 | 11 | * Created by lqy on 2016/11/28 |
| 9 | 12 | */ |
| 10 | -public class RiskReportResult { | |
| 13 | +public class RiskReportResult implements Comparator<RiskReportResult> { | |
| 11 | 14 | |
| 12 | 15 | //高危因素Id |
| 13 | 16 | private String highRiskId; |
| ... | ... | @@ -63,5 +66,19 @@ |
| 63 | 66 | public void setPercent(String percent) { |
| 64 | 67 | this.percent = percent; |
| 65 | 68 | } |
| 69 | + | |
| 70 | + @Override | |
| 71 | + public int compare(RiskReportResult o1, RiskReportResult o2) { | |
| 72 | + if (o1 != null && o2 != null) | |
| 73 | + { | |
| 74 | + if (StringUtils.isNotEmpty(o2.getRiskCount()) && StringUtils.isNotEmpty(o1.getRiskCount())) | |
| 75 | + { | |
| 76 | + return Integer.parseInt(o2.getRiskCount()) - Integer.parseInt(o1.getRiskCount()); | |
| 77 | + } | |
| 78 | + } | |
| 79 | + return 0; | |
| 80 | + } | |
| 81 | + | |
| 82 | + | |
| 66 | 83 | } |