Commit 2063f9e1b635454e78983e4b344d99a3330d329b
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 9 changed files
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/Nczxyy/NczxyyLisService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PostReviewController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBaseService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IPostReviewService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BaseServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PostReviewServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
2063f9e
| ... | ... | @@ -970,9 +970,8 @@ |
| 970 | 970 | } |
| 971 | 971 | |
| 972 | 972 | public static void main(String[] arg) throws Exception { |
| 973 | - Date lastMensesMax = DateUtil.getNewDate(-42, "周", 0); | |
| 974 | 973 | |
| 975 | - System.out.println(getyyyy_MM_dd_hms(lastMensesMax)); | |
| 974 | + System.out.println(parseYMDHMS("2017-02-10")); | |
| 976 | 975 | // System.out.println(getMonth(start)); |
| 977 | 976 | // System.out.println(getMonth(end)); |
| 978 | 977 | } |
platform-operate-api/src/main/java/com/lyms/hospitalapi/Nczxyy/NczxyyLisService.java
View file @
2063f9e
| ... | ... | @@ -220,17 +220,6 @@ |
| 220 | 220 | |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - | |
| 224 | - | |
| 225 | - | |
| 226 | - | |
| 227 | - | |
| 228 | - | |
| 229 | - | |
| 230 | - | |
| 231 | - | |
| 232 | - | |
| 233 | - | |
| 234 | 223 | public static List<CheckResponse> queryLisCheckList(String cardNo){ |
| 235 | 224 | SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd "); |
| 236 | 225 | List<CheckResponse> result = new ArrayList<>(); |
| 237 | 226 | |
| 238 | 227 | |
| 239 | 228 | |
| ... | ... | @@ -248,50 +237,51 @@ |
| 248 | 237 | JSONObject json=new JSONObject(map1); |
| 249 | 238 | Nczxyy2 nczxyy2=null; |
| 250 | 239 | nczxyy2=(Nczxyy2)json.getObject("result", Nczxyy2.class); |
| 251 | - for(int i=0;i<nczxyy2.getList().size();i++){ | |
| 252 | - String DetailId=nczxyy2.getList().get(i).getId(); | |
| 253 | - String Str="{\"api_id\":\"800020\",\"active_key\":\"LYMS\",\"user_token\":\"LYMS\",\"operator_id\":\"YD_WX\",\"DetailId\":\""+DetailId+"\"}"; | |
| 254 | - map1.put("result1",HttpClientUtil.doPostHTTP(url, Str)); | |
| 255 | - JSONObject json1=new JSONObject(map1); | |
| 256 | - NczxyyXQ2 nczxyyxq2=null; | |
| 257 | - nczxyyxq2=(NczxyyXQ2)json1.getObject("result1", NczxyyXQ2.class); | |
| 258 | - if(nczxyyxq2!=null){ | |
| 259 | - try{ | |
| 260 | - CheckResponse CheckResponse=new CheckResponse(); | |
| 261 | - CheckResponse.setHospitalName("四川省南充市中心医院"); | |
| 262 | - CheckResponse.setName(nczxyyxq2.getData().get姓名()); | |
| 263 | - CheckResponse.setModified(formatter.parse(nczxyyxq2.getData().get报告时间())); | |
| 264 | - CheckResponse.setType(1); | |
| 265 | - CheckResponse.setDoctor(nczxyyxq2.getData().get申请医师()); | |
| 266 | - CheckResponse.setTitle(nczxyyxq2.getData().get申请项目()); | |
| 267 | - CheckResponse.setAge(nczxyyxq2.getData().get年龄()); | |
| 268 | - CheckResponse.setApplyDate(formatter.parse(nczxyyxq2.getData().get申请时间())); | |
| 269 | - CheckResponse.setApplyDateStr(nczxyyxq2.getData().get申请时间()); | |
| 270 | - CheckResponse.setCheckDept(nczxyyxq2.getData().get科室()); | |
| 271 | - CheckResponse.setSex(nczxyyxq2.getData().get性别()); | |
| 272 | - List<CheckItemResponse> itemlist=new ArrayList<CheckItemResponse>(); | |
| 273 | - CheckResponse.setItemList(itemlist); | |
| 274 | - for(int j=0;j<nczxyyxq2.getData().getLisPatResults().size();j++){ | |
| 275 | - CheckItemResponse item = new CheckItemResponse(); | |
| 276 | - item.setName(nczxyyxq2.getData().getLisPatResults().get(j).get名称()); | |
| 277 | - item.setCode(nczxyyxq2.getData().getLisPatResults().get(j).get项目号()); | |
| 278 | - item.setRefer(nczxyyxq2.getData().getLisPatResults().get(j).get临界值()); | |
| 279 | - item.setResult(nczxyyxq2.getData().getLisPatResults().get(j).get检验值()); | |
| 280 | - item.setUnit(nczxyyxq2.getData().getLisPatResults().get(j).get单位()); | |
| 281 | - item.setSpecial(nczxyyxq2.getData().getLisPatResults().get(j).get结论()); | |
| 282 | - itemlist.add(item); | |
| 240 | + if(nczxyy2.getList()!=null && !nczxyy2.getList().isEmpty()) { | |
| 241 | + for (int i = 0; i < nczxyy2.getList().size(); i++) { | |
| 242 | + String DetailId = nczxyy2.getList().get(i).getId(); | |
| 243 | + String Str = "{\"api_id\":\"800020\",\"active_key\":\"LYMS\",\"user_token\":\"LYMS\",\"operator_id\":\"YD_WX\",\"DetailId\":\"" + DetailId + "\"}"; | |
| 244 | + map1.put("result1", HttpClientUtil.doPostHTTP(url, Str)); | |
| 245 | + JSONObject json1 = new JSONObject(map1); | |
| 246 | + NczxyyXQ2 nczxyyxq2 = null; | |
| 247 | + nczxyyxq2 = (NczxyyXQ2) json1.getObject("result1", NczxyyXQ2.class); | |
| 248 | + if (nczxyyxq2 != null) { | |
| 249 | + try { | |
| 250 | + CheckResponse CheckResponse = new CheckResponse(); | |
| 251 | + CheckResponse.setHospitalName("四川省南充市中心医院"); | |
| 252 | + CheckResponse.setName(nczxyyxq2.getData().get姓名()); | |
| 253 | + CheckResponse.setModified(formatter.parse(nczxyyxq2.getData().get报告时间())); | |
| 254 | + CheckResponse.setType(1); | |
| 255 | + CheckResponse.setDoctor(nczxyyxq2.getData().get申请医师()); | |
| 256 | + CheckResponse.setTitle(nczxyyxq2.getData().get申请项目()); | |
| 257 | + CheckResponse.setAge(nczxyyxq2.getData().get年龄()); | |
| 258 | + CheckResponse.setApplyDate(formatter.parse(nczxyyxq2.getData().get申请时间())); | |
| 259 | + CheckResponse.setApplyDateStr(nczxyyxq2.getData().get申请时间()); | |
| 260 | + CheckResponse.setCheckDept(nczxyyxq2.getData().get科室()); | |
| 261 | + CheckResponse.setSex(nczxyyxq2.getData().get性别()); | |
| 262 | + List<CheckItemResponse> itemlist = new ArrayList<CheckItemResponse>(); | |
| 263 | + CheckResponse.setItemList(itemlist); | |
| 264 | + for (int j = 0; j < nczxyyxq2.getData().getLisPatResults().size(); j++) { | |
| 265 | + CheckItemResponse item = new CheckItemResponse(); | |
| 266 | + item.setName(nczxyyxq2.getData().getLisPatResults().get(j).get名称()); | |
| 267 | + item.setCode(nczxyyxq2.getData().getLisPatResults().get(j).get项目号()); | |
| 268 | + item.setRefer(nczxyyxq2.getData().getLisPatResults().get(j).get临界值()); | |
| 269 | + item.setResult(nczxyyxq2.getData().getLisPatResults().get(j).get检验值()); | |
| 270 | + item.setUnit(nczxyyxq2.getData().getLisPatResults().get(j).get单位()); | |
| 271 | + item.setSpecial(nczxyyxq2.getData().getLisPatResults().get(j).get结论()); | |
| 272 | + itemlist.add(item); | |
| 273 | + } | |
| 274 | + result.add(CheckResponse); | |
| 275 | + } catch (Exception e) { | |
| 276 | + e.printStackTrace(); | |
| 283 | 277 | } |
| 284 | - result.add(CheckResponse); | |
| 285 | - }catch (Exception e){ | |
| 286 | - e.printStackTrace(); | |
| 278 | + | |
| 287 | 279 | } |
| 288 | 280 | |
| 289 | 281 | } |
| 290 | - | |
| 291 | 282 | } |
| 292 | 283 | |
| 293 | 284 | return result; |
| 294 | 285 | } |
| 295 | - | |
| 296 | 286 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PostReviewController.java
View file @
2063f9e
| ... | ... | @@ -4,11 +4,13 @@ |
| 4 | 4 | import com.lyms.platform.common.base.BaseController; |
| 5 | 5 | import com.lyms.platform.common.base.LoginContext; |
| 6 | 6 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 7 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
| 7 | 8 | import com.lyms.platform.common.result.BaseResponse; |
| 8 | 9 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
| 9 | 10 | import com.lyms.platform.operate.web.facade.PostReviewFacade; |
| 10 | 11 | import com.lyms.platform.operate.web.request.PostReviewQueryRequest; |
| 11 | 12 | import com.lyms.platform.operate.web.request.PostReviewRequest; |
| 13 | +import com.lyms.platform.operate.web.service.IPostReviewService; | |
| 12 | 14 | import com.lyms.platform.permission.service.CouponService; |
| 13 | 15 | import org.apache.commons.lang.StringUtils; |
| 14 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -17,6 +19,7 @@ |
| 17 | 19 | |
| 18 | 20 | import javax.servlet.http.HttpServletRequest; |
| 19 | 21 | import javax.validation.Valid; |
| 22 | +import java.util.Date; | |
| 20 | 23 | |
| 21 | 24 | /** |
| 22 | 25 | * |
| ... | ... | @@ -36,6 +39,9 @@ |
| 36 | 39 | @Autowired |
| 37 | 40 | private AutoMatchFacade autoMatchFacade; |
| 38 | 41 | |
| 42 | + @Autowired | |
| 43 | + private IPostReviewService postReviewService; | |
| 44 | + | |
| 39 | 45 | @RequestMapping(method = RequestMethod.GET,value = "/cTime") |
| 40 | 46 | @ResponseBody |
| 41 | 47 | public long getCurrentTime(){ |
| ... | ... | @@ -107,6 +113,24 @@ |
| 107 | 113 | } |
| 108 | 114 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 109 | 115 | return postReviewFacade.updateOnePost(id,loginState.getId()); |
| 116 | + } | |
| 117 | + | |
| 118 | + /** | |
| 119 | + * 复查管理 | |
| 120 | + * @param startDate | |
| 121 | + * @param endDate | |
| 122 | + * @param doctorId | |
| 123 | + * @param key 姓名/联系方式/就诊卡 | |
| 124 | + * @param limit | |
| 125 | + * @param page | |
| 126 | + * @return | |
| 127 | + */ | |
| 128 | + @RequestMapping(method = RequestMethod.GET, value = "/postpartum/review") | |
| 129 | + @TokenRequired | |
| 130 | + @ResponseBody | |
| 131 | + public BaseObjectResponse postpartumReview(Date startDate, Date endDate, String doctorId, | |
| 132 | + String key, Integer page, Integer limit, HttpServletRequest request) { | |
| 133 | + return postReviewService.postpartumReview(getUserId(request), startDate, endDate, doctorId, key, page, limit); | |
| 110 | 134 | } |
| 111 | 135 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
2063f9e
| ... | ... | @@ -918,7 +918,7 @@ |
| 918 | 918 | mapData.put("data", results); |
| 919 | 919 | // 是否在本医院所在区域建档 |
| 920 | 920 | mapData.put("rBType", count > 0); |
| 921 | - mapData.put("pid",pid); | |
| 921 | + mapData.put("pid", pid); | |
| 922 | 922 | mapData.put("initBuildDate", DateUtil.getyyyy_MM_dd(new Date())); |
| 923 | 923 | list.add(mapData); |
| 924 | 924 | |
| ... | ... | @@ -1668,7 +1668,7 @@ |
| 1668 | 1668 | PatientsQuery patientsQuery = new PatientsQuery(); |
| 1669 | 1669 | patientsQuery.setId(parentId); |
| 1670 | 1670 | patientsQuery.setYn(YnEnums.YES.getId()); |
| 1671 | - patientsQuery.setHospitalId(autoMatchFacade.getHospitalId(userId)); | |
| 1671 | +// patientsQuery.setHospitalId(autoMatchFacade.getHospitalId(userId)); //bug 玉田中医院打印产检报告报服务器异常-见截图 | |
| 1672 | 1672 | PregnantInfoResult result = new PregnantInfoResult(); |
| 1673 | 1673 | SimplePregnantResult patientResult = new SimplePregnantResult(); |
| 1674 | 1674 | List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); |
| 1675 | 1675 | |
| ... | ... | @@ -1718,18 +1718,20 @@ |
| 1718 | 1718 | patientResult.setHusbandPhone(result.getHusbandPhone()); |
| 1719 | 1719 | } |
| 1720 | 1720 | // 增加初诊信息,桓台医院打印使用 |
| 1721 | - AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 1722 | - antExChuQuery.setParentId(patientResult.getId()); | |
| 1723 | - antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 1724 | - List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
| 1725 | - if (CollectionUtils.isNotEmpty(antExChuModels)) { | |
| 1726 | - AntExChuModel antExChuModel = antExChuModels.get(0); | |
| 1727 | - patientResult.setPregnancyTimes(antExChuModel.getPregnancyTimes()); | |
| 1728 | - patientResult.setProdTime(antExChuModel.getProdTime()); | |
| 1729 | - patientResult.setDelivery(antExChuModel.getDelivery()); | |
| 1730 | - patientResult.setPlanedProd(antExChuModel.getPlanedProd()); | |
| 1721 | + if (StringUtils.isNotEmpty(patientResult.getId())) | |
| 1722 | + { | |
| 1723 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 1724 | + antExChuQuery.setParentId(patientResult.getId()); | |
| 1725 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 1726 | + List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
| 1727 | + if (CollectionUtils.isNotEmpty(antExChuModels)) { | |
| 1728 | + AntExChuModel antExChuModel = antExChuModels.get(0); | |
| 1729 | + patientResult.setPregnancyTimes(antExChuModel.getPregnancyTimes()); | |
| 1730 | + patientResult.setProdTime(antExChuModel.getProdTime()); | |
| 1731 | + patientResult.setDelivery(antExChuModel.getDelivery()); | |
| 1732 | + patientResult.setPlanedProd(antExChuModel.getPlanedProd()); | |
| 1733 | + } | |
| 1731 | 1734 | } |
| 1732 | - | |
| 1733 | 1735 | BaseObjectResponse objectResponse = new BaseObjectResponse(); |
| 1734 | 1736 | objectResponse.setData(patientResult); |
| 1735 | 1737 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBaseService.java
View file @
2063f9e
| ... | ... | @@ -2,6 +2,8 @@ |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.common.result.PageResult; |
| 4 | 4 | |
| 5 | +import org.springframework.data.mongodb.core.query.Query; | |
| 6 | + | |
| 5 | 7 | import java.util.List; |
| 6 | 8 | |
| 7 | 9 | /** |
| ... | ... | @@ -18,6 +20,8 @@ |
| 18 | 20 | * @param params |
| 19 | 21 | * @return |
| 20 | 22 | */ |
| 21 | - public PageResult findPage(String sql, Integer currentPage, Integer pageSize, List<Object> params); | |
| 23 | + PageResult findPage(String sql, Integer currentPage, Integer pageSize, List<Object> params); | |
| 24 | + | |
| 25 | + <T> PageResult findMongoPage (Class<T> entity, Query query, Integer page, Integer limit); | |
| 22 | 26 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IPostReviewService.java
View file @
2063f9e
| 1 | +package com.lyms.platform.operate.web.service; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
| 4 | + | |
| 5 | +import java.util.Date; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Created by litao on 2017/7/3 0003 | |
| 9 | + */ | |
| 10 | +public interface IPostReviewService extends IBaseService { | |
| 11 | + BaseObjectResponse postpartumReview(Integer userId, Date startDate, Date endDate, String doctorId, String key, Integer page, Integer limit); | |
| 12 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BaseServiceImpl.java
View file @
2063f9e
| ... | ... | @@ -5,8 +5,9 @@ |
| 5 | 5 | import com.lyms.platform.operate.web.service.IBaseService; |
| 6 | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | 7 | import org.springframework.beans.factory.annotation.Qualifier; |
| 8 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
| 8 | 9 | import org.springframework.stereotype.Service; |
| 9 | - | |
| 10 | +import org.springframework.data.mongodb.core.query.Query; | |
| 10 | 11 | import java.util.List; |
| 11 | 12 | import java.util.Map; |
| 12 | 13 | |
| ... | ... | @@ -21,6 +22,9 @@ |
| 21 | 22 | @Qualifier("baseDaoImpl") |
| 22 | 23 | private IBaseDao baseDao; |
| 23 | 24 | |
| 25 | + @Autowired | |
| 26 | + private MongoTemplate mongoTemplate; | |
| 27 | + | |
| 24 | 28 | @Override |
| 25 | 29 | public PageResult findPage(String sql, Integer currentPage, Integer pageSize, List<Object> params) { |
| 26 | 30 | pageSize = pageSize == null ? 10 : pageSize; |
| ... | ... | @@ -29,6 +33,15 @@ |
| 29 | 33 | Integer count = baseDao.findCount(sql, params); |
| 30 | 34 | List<Map<String, Object>> rows = baseDao.findList(sql, currentPage, pageSize, params); |
| 31 | 35 | return new PageResult(count, currentPage, pageSize, rows); |
| 36 | + } | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public <T> PageResult findMongoPage(Class<T> entity, Query query, Integer page, Integer limit) { | |
| 40 | + Long count = mongoTemplate.count(query, entity); | |
| 41 | + query.skip((page - 1) * limit); | |
| 42 | + query.limit(limit); | |
| 43 | + List<T> rows = mongoTemplate.find(query, entity); | |
| 44 | + return new PageResult(count.intValue(), page, limit, rows); | |
| 32 | 45 | } |
| 33 | 46 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PostReviewServiceImpl.java
View file @
2063f9e
| 1 | +package com.lyms.platform.operate.web.service.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
| 4 | +import com.lyms.platform.common.result.PageResult; | |
| 5 | +import com.lyms.platform.common.result.RespBuilder; | |
| 6 | +import com.lyms.platform.common.utils.DateUtil; | |
| 7 | +import com.lyms.platform.common.utils.StringUtils; | |
| 8 | +import com.lyms.platform.operate.web.facade.AutoMatchFacade; | |
| 9 | +import com.lyms.platform.operate.web.service.IPostReviewService; | |
| 10 | +import com.lyms.platform.operate.web.utils.MongoUtil; | |
| 11 | +import com.lyms.platform.permission.dao.master.MasterUsersMapper; | |
| 12 | +import com.lyms.platform.permission.model.Users; | |
| 13 | +import com.lyms.platform.pojo.Patients; | |
| 14 | +import com.lyms.platform.pojo.PostReviewModel; | |
| 15 | +import org.apache.commons.collections.CollectionUtils; | |
| 16 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 17 | +import org.springframework.data.domain.Sort; | |
| 18 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
| 19 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 20 | +import org.springframework.data.mongodb.core.query.Query; | |
| 21 | +import org.springframework.stereotype.Service; | |
| 22 | + | |
| 23 | +import java.util.*; | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * Created by litao on 2017/7/3 0003 | |
| 27 | + */ | |
| 28 | +@Service | |
| 29 | +public class PostReviewServiceImpl extends BaseServiceImpl implements IPostReviewService { | |
| 30 | + | |
| 31 | + @Autowired | |
| 32 | + private MongoTemplate mongoTemplate; | |
| 33 | + | |
| 34 | + @Autowired | |
| 35 | + private AutoMatchFacade autoMatchFacade; | |
| 36 | + | |
| 37 | + @Autowired | |
| 38 | + private MasterUsersMapper usersMapper; | |
| 39 | + | |
| 40 | + @Autowired | |
| 41 | + private MongoUtil mongoUtil; | |
| 42 | + | |
| 43 | + @Override | |
| 44 | + public BaseObjectResponse postpartumReview(Integer userId, Date startDate, Date endDate, String doctorId, String key, Integer page, Integer limit) { | |
| 45 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 46 | + Query query = Query.query(Criteria.where("hospitalId").is(hospitalId).and("yn").is(1)); | |
| 47 | + if(startDate != null && endDate != null) { | |
| 48 | + query.addCriteria(Criteria.where("checkTime").gte(startDate).lt(DateUtil.addDay(endDate, 1))); | |
| 49 | + } | |
| 50 | + if(StringUtils.isNotEmpty(doctorId)) { | |
| 51 | + query.addCriteria(Criteria.where("prodDoctor").is(doctorId)); | |
| 52 | + } | |
| 53 | + | |
| 54 | + if(StringUtils.isNotEmpty(key)) { | |
| 55 | + Criteria criteria = new Criteria(); | |
| 56 | + criteria.orOperator(Criteria.where("username").is(key), Criteria.where("vcCardNo").is(key), Criteria.where("phone").is(key)); | |
| 57 | + List<Patients> patients = mongoUtil.findField(Patients.class, criteria, "id"); | |
| 58 | + if(CollectionUtils.isEmpty(patients)) { | |
| 59 | + return RespBuilder.buildSuccess(new PageResult(0, page, limit, null)); | |
| 60 | + } | |
| 61 | + List<String> ids = new ArrayList<>(); | |
| 62 | + for (Patients patient : patients) { | |
| 63 | + ids.add(patient.getId()); | |
| 64 | + } | |
| 65 | + query.addCriteria(Criteria.where("parentId").in(ids)); | |
| 66 | + } | |
| 67 | + | |
| 68 | + PageResult pageResult = findMongoPage(PostReviewModel.class, query, page, limit); | |
| 69 | + List<PostReviewModel> grid = (List<PostReviewModel>) pageResult.getGrid(); | |
| 70 | + | |
| 71 | + List<Map<String, Object>> rest = new ArrayList<>(); | |
| 72 | + for (PostReviewModel model : grid) { | |
| 73 | + Map<String, Object> tempMap = new HashMap<>(); | |
| 74 | + Patients p = mongoTemplate.findById(model.getParentId(), Patients.class); | |
| 75 | + tempMap.put("checkTime", model.getCheckTime()); /** 复查日期 */ | |
| 76 | + tempMap.put("hcertificateNum", p == null ? null : p.getHcertificateNum()); /** 证件号 */ | |
| 77 | + tempMap.put("username", p == null ? null : p.getUsername()); /** 姓名 */ | |
| 78 | + tempMap.put("age", p == null ? null : DateUtil.getAge(p.getBirth())); /** 年龄 */ | |
| 79 | + tempMap.put("day", p == null ? null : model.getDay()); /** 产后天数 */ | |
| 80 | + tempMap.put("reviewCount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(model.getParentId())), PostReviewModel.class)); /** 复查次数 */ | |
| 81 | + tempMap.put("reviewHospitalCount", mongoTemplate.count(Query.query(Criteria.where("parentId").is(model.getParentId()) | |
| 82 | + .and("hospitalId").is(model.getHospitalId())), PostReviewModel.class)); /** 本院复查次数 */ | |
| 83 | + String prodDoctor = model.getProdDoctor(); | |
| 84 | + if(StringUtils.isNotEmpty(prodDoctor)) { | |
| 85 | + Users users = usersMapper.getUsers(Integer.parseInt(prodDoctor)); | |
| 86 | + tempMap.put("doctorName", users == null ? null : users.getName()); /** 检查医生 */ | |
| 87 | + } else { | |
| 88 | + tempMap.put("doctorName", null); | |
| 89 | + } | |
| 90 | + tempMap.put("phone", p == null ? null : p.getPhone()); | |
| 91 | + rest.add(tempMap); | |
| 92 | + } | |
| 93 | + pageResult.setGrid(rest); | |
| 94 | + return RespBuilder.buildSuccess(pageResult); | |
| 95 | + } | |
| 96 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
View file @
2063f9e
| ... | ... | @@ -107,7 +107,7 @@ |
| 107 | 107 | boolean flag = true; |
| 108 | 108 | for (Map<String,Object> data : rest) { |
| 109 | 109 | if(areaId.equals(data.get("area_id"))) { /** 合并相同省市区月份数据 */ |
| 110 | - data.put(month, map.getValue()); | |
| 110 | + data.put(month, data.get(month) == null ? map.getValue() : (Integer) data.get(month) + map.getValue()); | |
| 111 | 111 | flag = false; |
| 112 | 112 | continue; |
| 113 | 113 | } |