Commit 824d3fefb447adc8c249223c564f5fbd15ea23db

Authored by litao@lymsh.com
1 parent a3ae953e85

12333

Showing 3 changed files with 75 additions and 14 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TrackDownController.java View file @ 824d3fe
... ... @@ -7,10 +7,7 @@
7 7 import com.lyms.platform.pojo.TrackDown;
8 8 import org.springframework.beans.factory.annotation.Autowired;
9 9 import org.springframework.stereotype.Controller;
10   -import org.springframework.web.bind.annotation.PathVariable;
11   -import org.springframework.web.bind.annotation.RequestMapping;
12   -import org.springframework.web.bind.annotation.RequestMethod;
13   -import org.springframework.web.bind.annotation.ResponseBody;
  10 +import org.springframework.web.bind.annotation.*;
14 11  
15 12 import javax.servlet.http.HttpServletRequest;
16 13 import java.util.Date;
... ... @@ -28,7 +25,7 @@
28 25 @ResponseBody
29 26 @TokenRequired
30 27 @RequestMapping(value = "/all", method = RequestMethod.GET)
31   - public BaseResponse all(Date buildStart, Date buildEnd, Date checkStart, Date checkEnd, Date fmStart, Date fmEnd, String key, Integer page, Integer limit, HttpServletRequest request) {
  28 + public BaseResponse all(Date buildStart, Date buildEnd, Date checkStart, Date checkEnd, Date fmStart, Date fmEnd, String key, @RequestParam Integer page, @RequestParam Integer limit, HttpServletRequest request) {
32 29 return trackDownService.all(buildStart, buildEnd, checkStart, checkEnd, fmStart, fmEnd, key, page, limit, getUserId(request));
33 30 }
34 31  
... ... @@ -42,7 +39,7 @@
42 39 @ResponseBody
43 40 @TokenRequired
44 41 @RequestMapping(method = RequestMethod.GET)
45   - public BaseResponse list(String provinceId, String cityId, String areaId, String streetId, Integer trackType, Integer page, Integer limit, HttpServletRequest request) {
  42 + public BaseResponse list(String provinceId, String cityId, String areaId, String streetId, @RequestParam Integer trackType, @RequestParam Integer page, @RequestParam Integer limit, HttpServletRequest request) {
46 43 return trackDownService.list(provinceId, cityId, areaId, streetId, trackType, page, limit, getUserId(request));
47 44 }
48 45  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TrackDownServiceImpl.java View file @ 824d3fe
... ... @@ -3,6 +3,7 @@
3 3 import com.lyms.platform.biz.service.TrackDownService;
4 4 import com.lyms.platform.common.enums.FmTypeEnums;
5 5 import com.lyms.platform.common.enums.TrackDownDateEnums;
  6 +import com.lyms.platform.common.enums.TrackDownTransferEnums;
6 7 import com.lyms.platform.common.enums.YnEnums;
7 8 import com.lyms.platform.common.result.BaseResponse;
8 9 import com.lyms.platform.common.result.PageResult;
... ... @@ -11,7 +12,6 @@
11 12 import com.lyms.platform.common.utils.StringUtils;
12 13 import com.lyms.platform.operate.web.facade.AutoMatchFacade;
13 14 import com.lyms.platform.operate.web.service.ITrackDownService;
14   -import com.lyms.platform.operate.web.utils.CollectionUtils;
15 15 import com.lyms.platform.operate.web.utils.MongoUtil;
16 16 import com.lyms.platform.pojo.*;
17 17 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -88,7 +88,7 @@
88 88 temp.put("cqsc", mongoTemplate.count(Query.query(Criteria.where("parentId").is(patient.getId()).and("yn").is(1)), AntExChuModel.class) > 0L ? 1 : isExitTrackDown(patient.getId(), TrackDownDateEnums.D));
89 89  
90 90 // type=3 且(isAutoFm不为1,或者不存在)且dueStatus为0 没有: 有分娩住院追访并且流转至下一流程 勾勾 反之xx
91   - temp.put("fm", patient.getType() == 3 && (patient.getIsAutoFm() != 1 || patient.getIsAutoFm() == null) && patient.getDueStatus() == 0 ? 1 : isExitTrackDown(patient.getId(), TrackDownDateEnums.E)); // 分娩 1=勾勾 2=叉叉
  91 + temp.put("fm", patient.getType() != null && patient.getType() == 3 && (patient.getIsAutoFm() == null || patient.getIsAutoFm() != 1) && patient.getDueStatus() != null && patient.getDueStatus() == 0 ? 1 : isExitTrackDown(patient.getId(), TrackDownDateEnums.E)); // 分娩 1=勾勾 2=叉叉
92 92 temp.put("fmType", FmTypeEnums.getFmNameById(patient.getFmType()) == null ? "--" : FmTypeEnums.getFmNameById(patient.getFmType())); // 分娩方式
93 93  
94 94 // 产后复查 1=勾勾 2=叉叉 有产后复查记录>勾勾 没有: 有产后复查追访并且流转至下一流程 勾勾 反之xx
... ... @@ -106,6 +106,7 @@
106 106 }
107 107  
108 108 Integer archiveModelCount = 0;
  109 + List<Map<String, Object>> archiveModelList = new ArrayList<>();
109 110 for (ResidentsArchiveModel archiveModel : residentsArchiveModels) {
110 111 for (Map<String, Object> map : restList) {
111 112 if(StringUtils.isNotEmpty((String) map.get("cardNo")) && map.get("cardNo").toString().equals(archiveModel.getCertificateNum())) {
112 113  
... ... @@ -116,9 +117,9 @@
116 117 }
117 118 Map<String, Object> temp = new HashMap<>();
118 119 temp.put("id", archiveModel.getId());
119   - temp.put("cardNo", archiveModel.getCertificateNum());
  120 + temp.put("cardNo", StringUtils.encryCardNo(archiveModel.getCertificateNum()));
120 121 temp.put("username", archiveModel.getUsername());
121   - temp.put("phone", archiveModel.getPhone());
  122 + temp.put("phone", StringUtils.encryPhone(archiveModel.getPhone()));
122 123 temp.put("age", DateUtil.getAge(archiveModel.getBirthday()));
123 124 temp.put("resident", 1); // 妇女建档
124 125 temp.put("residentDate", DateUtil.getyyyy_MM_dd(archiveModel.getBuildDay())); // 妇女建档日期
125 126  
... ... @@ -133,9 +134,19 @@
133 134 temp.put("chfc", 3); // 产后复查 1=勾勾 2=叉叉
134 135 temp.put("chfcCount", 0); // 复查次数
135 136 archiveModelCount++;
136   - restList.add(temp);
  137 + archiveModelList.add(temp);
137 138 }
138   - return RespBuilder.buildSuccess("tabList", new PageResult(restList.size() + archiveModelCount, page, limit, CollectionUtils.getPageIds(restList, page, limit)));
  139 +
  140 + // 处理分页
  141 + if(restList.size() < limit) {
  142 + int count = limit - restList.size();
  143 + if(archiveModelList.size() <= count) {
  144 + restList.addAll(archiveModelList);
  145 + } else {
  146 + restList.addAll(archiveModelList.subList(0, count));
  147 + }
  148 + }
  149 + return RespBuilder.buildSuccess("tabList", new PageResult(restList.size() + archiveModelCount, page, limit, restList));
139 150 }
140 151  
141 152 private int isExitTrackDown(String parentId, TrackDownDateEnums trackDownDateEnums) {
... ... @@ -174,6 +185,8 @@
174 185  
175 186 @Override
176 187 public BaseResponse list(String provinceId, String cityId, String areaId, String streetId, Integer trackType, Integer page, Integer limit, Integer userId) {
  188 + PageResult pageResult = new PageResult();
  189 + List<Map<String, Object>> restList = new ArrayList<>();
177 190 Criteria criteria = new Criteria();
178 191 if(StringUtils.isNotEmpty(provinceId) || StringUtils.isNotEmpty(cityId) || StringUtils.isNotEmpty(areaId) || StringUtils.isNotEmpty(streetId) ) {
179 192 Criteria patientCriteria = new Criteria();
... ... @@ -191,7 +204,45 @@
191 204 }
192 205 List<Patients> patients = mongoTemplate.find(Query.query(patientCriteria.and("yn").is(1)), Patients.class);
193 206 }
194   - return null;
  207 +
  208 + if(trackType == TrackDownDateEnums.A.getId()) {
  209 + Criteria c = new Criteria();
  210 + if(StringUtils.isNotEmpty(provinceId)) {
  211 + c.and("provinceId").is(provinceId);
  212 + }
  213 + if(StringUtils.isNotEmpty(cityId)) {
  214 + c.and("cityId").is(cityId);
  215 + }
  216 + if(StringUtils.isNotEmpty(areaId)) {
  217 + c.and("areaId").is(areaId);
  218 + }
  219 + if(StringUtils.isNotEmpty(streetId)) {
  220 + c.and("streetId").is(streetId);
  221 + }
  222 + List<TrackDown> trackDowns = mongoTemplate.find(Query.query(Criteria.where("yn").is(1).and("trackDownTransfer").in(Arrays.asList(2, 3))
  223 + .and("trackDownDateType").is(TrackDownDateEnums.A.getId())), TrackDown.class);
  224 + List<String> residentIds = new ArrayList<>();
  225 + for (TrackDown trackDown : trackDowns) {
  226 + residentIds.add(trackDown.getId());
  227 + }
  228 + pageResult = findMongoPage(ResidentsArchiveModel.class, Query.query(c.and("id").nin(residentIds)), page, limit);
  229 + List<ResidentsArchiveModel> residentsArchiveModels = (List<ResidentsArchiveModel>) pageResult.getGrid();
  230 + for (ResidentsArchiveModel residentsArchiveModel : residentsArchiveModels) {
  231 + Map<String, Object> temp = new HashMap<>();
  232 + temp.put("id", residentsArchiveModel.getId());
  233 + temp.put("username", residentsArchiveModel.getUsername());
  234 + temp.put("cardNo", residentsArchiveModel.getCertificateNum());
  235 + temp.put("residenceAddress", mongoUtil.findAddressName(residentsArchiveModel.getProvinceId(), residentsArchiveModel.getCityId(), residentsArchiveModel.getAreaId(), residentsArchiveModel.getStreetId())); /** 居住地 */
  236 + temp.put("phone", StringUtils.encryPhone(residentsArchiveModel.getPhone()));
  237 + TrackDown trackDown = mongoTemplate.findOne(Query.query(Criteria.where("residentsArchiveId").is(residentsArchiveModel.getId()).and("yn").is(1)).with(new Sort(Sort.Direction.DESC, "created")), TrackDown.class);
  238 + temp.put("end", trackDown == null ? "--" : TrackDownTransferEnums.getName(trackDown.getTrackDownType()));
  239 + temp.put("trackDownTime", trackDown == null ? "--" : DateUtil.getyyyy_MM_dd(trackDown.getTrackDownDate()));
  240 + temp.put("yyTime", trackDown == null ? "--" : DateUtil.getyyyy_MM_dd(trackDown.getReservatDate()));
  241 + restList.add(temp);
  242 + }
  243 + }
  244 + pageResult.setGrid(restList);
  245 + return RespBuilder.buildSuccess(pageResult);
195 246 }
196 247  
197 248 @Override
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java View file @ 824d3fe
1 1 package com.lyms.platform.operate.web.utils;
2 2  
3   -import com.alibaba.fastjson.JSONArray;
4 3 import com.lyms.platform.biz.service.BabyBookbuildingService;
5 4 import com.lyms.platform.biz.service.PatientsService;
6 5 import com.lyms.platform.common.enums.RiskDefaultTypeEnum;
... ... @@ -330,6 +329,20 @@
330 329 }
331 330 return null;
332 331 }
  332 +
  333 + public String findAddressName(Object ... ids) {
  334 + StringBuilder sb = new StringBuilder();
  335 + if(ids != null && ids.length > 0) {
  336 + for (Object id : ids) {
  337 + String name = findName(id);
  338 + if(StringUtils.isNotEmpty(name)) {
  339 + sb.append(name);
  340 + }
  341 + }
  342 + }
  343 + return sb.toString();
  344 + }
  345 +
333 346  
334 347 public String findId(String name) {
335 348 if(StringUtils.isNotEmpty(name)) {