Commit a21885fadfa0fc53374e9d51c2452c31479af3d7
1 parent
7be9a8e06e
Exists in
master
and in
6 other branches
全部孕妇管理增加按照排序
Showing 3 changed files with 92 additions and 4 deletions
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java
View file @
a21885f
| ... | ... | @@ -96,6 +96,17 @@ |
| 96 | 96 | return iPatientDao.queryPatient(query.addOrder(Sort.Direction.DESC, field)); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | + public List<Patients> queryPatientBySort(PatientsQuery patientsQuery, String field,String sort) { | |
| 100 | + MongoQuery query = patientsQuery.convertToQuery(); | |
| 101 | + if (StringUtils.isNotEmpty(patientsQuery.getNeed())) { | |
| 102 | + patientsQuery.mysqlBuild(iPatientDao.queryPatientCount(query)); | |
| 103 | + query.start(patientsQuery.getOffset()).end(patientsQuery.getLimit()); | |
| 104 | + } | |
| 105 | + | |
| 106 | + return iPatientDao.queryPatient(query.addOrder(Sort.Direction.fromString(sort), field)); | |
| 107 | + } | |
| 108 | + | |
| 109 | + | |
| 99 | 110 | public int queryPatientCount(PatientsQuery patientsQuery) { |
| 100 | 111 | return iPatientDao.queryPatientCount(patientsQuery.convertToQuery()); |
| 101 | 112 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
a21885f
| ... | ... | @@ -582,20 +582,20 @@ |
| 582 | 582 | /** |
| 583 | 583 | * 查询高危孕妇 |
| 584 | 584 | * |
| 585 | - * @param riskPatientsQueryRequest | |
| 585 | + * @param patientQueryRequest | |
| 586 | 586 | * @param isHighRisk 控制是否是高危 |
| 587 | 587 | * @param type 控制类型 1孕妇 3产妇 |
| 588 | 588 | * @return |
| 589 | 589 | */ |
| 590 | - public BaseResponse queryHighRisk(RiskPatientsQueryRequest riskPatientsQueryRequest, Boolean isHighRisk, Integer type, Integer userId, String needPage, boolean isRegion) { | |
| 590 | + public BaseResponse queryHighRisk(RiskPatientsQueryRequest patientQueryRequest, Boolean isHighRisk, Integer type, Integer userId, String needPage, boolean isRegion) { | |
| 591 | 591 | //组合请求 |
| 592 | - PatientsQuery patientsQuery = complayRequest(riskPatientsQueryRequest, isHighRisk, type, userId, needPage, isRegion); | |
| 592 | + PatientsQuery patientsQuery = complayRequest(patientQueryRequest, isHighRisk, type, userId, needPage, isRegion); | |
| 593 | 593 | |
| 594 | 594 | String hospital = autoMatchFacade.getHospitalId(userId); |
| 595 | 595 | //查询符合条件的孕妇 |
| 596 | 596 | StopWatch stopWatch = new StopWatch("queryPatient1 -" + hospital); |
| 597 | 597 | stopWatch.start(); |
| 598 | - List<Patients> patientses = patientsService.queryPatient1(patientsQuery, "modified"); | |
| 598 | + List<Patients> patientses = patientsService.queryPatientBySort(patientsQuery,patientQueryRequest.getSort(),patientQueryRequest.getOrder()); | |
| 599 | 599 | stopWatch.stop(); |
| 600 | 600 | |
| 601 | 601 | logger.info(stopWatch.toString()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/RiskPatientsQueryRequest.java
View file @
a21885f
| ... | ... | @@ -147,6 +147,83 @@ |
| 147 | 147 | |
| 148 | 148 | private String notEnable; |
| 149 | 149 | |
| 150 | + | |
| 151 | + //排序的字段 | |
| 152 | + private String sort; | |
| 153 | + //排序的策略 升序/降序 | |
| 154 | + private String order; | |
| 155 | + | |
| 156 | + /** | |
| 157 | + * 排序策略枚举 | |
| 158 | + */ | |
| 159 | + private enum OrderEnum{ | |
| 160 | + DESC("1","DESC"),ASC("2","ASC"); | |
| 161 | + private OrderEnum(String id,String order){ | |
| 162 | + this.id | |
| 163 | + =id; | |
| 164 | + this.order=order; | |
| 165 | + } | |
| 166 | + private String id; | |
| 167 | + private String order; | |
| 168 | + | |
| 169 | + public static String valueOfOrder(String id){ | |
| 170 | + if(org.apache.commons.lang.StringUtils.isEmpty(id)){ | |
| 171 | + return DESC.order; | |
| 172 | + } | |
| 173 | + for(OrderEnum order:values()){ | |
| 174 | + if(order.id.equals(id)){ | |
| 175 | + return order.order; | |
| 176 | + } | |
| 177 | + } | |
| 178 | + return DESC.order; | |
| 179 | + } | |
| 180 | + } | |
| 181 | + | |
| 182 | + /** | |
| 183 | + * 排序字段枚举 | |
| 184 | + */ | |
| 185 | + private enum SortEnum{ | |
| 186 | + SORT_MODIFIED("1","modified"),//按更新时间排 | |
| 187 | + SORT_BUILD_DATE("2","bookbuildingDate"),//按建档时间排 | |
| 188 | + SORT_DUE_TIME("3","lastMenses"),//按孕产期排 | |
| 189 | + SORT_DUE_DETE("4","lastMenses");//按当前孕周排 | |
| 190 | + private SortEnum(String id,String sort){ | |
| 191 | + this.id=id | |
| 192 | + ; | |
| 193 | + this.sort=sort; | |
| 194 | + } | |
| 195 | + private String id; | |
| 196 | + private String sort; | |
| 197 | + | |
| 198 | + public static String valueOfOrder(String id){ | |
| 199 | + if(org.apache.commons.lang.StringUtils.isEmpty(id)){ | |
| 200 | + return SORT_MODIFIED.sort; | |
| 201 | + } | |
| 202 | + for(SortEnum order:values()){ | |
| 203 | + if(order.id.equals(id)){ | |
| 204 | + return order.sort; | |
| 205 | + } | |
| 206 | + } | |
| 207 | + return SORT_MODIFIED.sort; | |
| 208 | + } | |
| 209 | + } | |
| 210 | + | |
| 211 | + public String getSort() { | |
| 212 | + return SortEnum.valueOfOrder(sort); | |
| 213 | + } | |
| 214 | + | |
| 215 | + public void setSort(String sort) { | |
| 216 | + this.sort = sort; | |
| 217 | + } | |
| 218 | + | |
| 219 | + public String getOrder() { | |
| 220 | + return OrderEnum.valueOfOrder(order); | |
| 221 | + } | |
| 222 | + | |
| 223 | + public void setOrder(String order) { | |
| 224 | + this.order = order; | |
| 225 | + } | |
| 226 | + | |
| 150 | 227 | public String getDiseaseType() { |
| 151 | 228 | return diseaseType; |
| 152 | 229 | } |