Commit 3b890dd0a886e5faa6c01eada40cdd0a15b1432d

Authored by jiangjiazhi
1 parent bde8493d9a

全部孕妇管理增加按照排序

Showing 5 changed files with 77 additions and 27 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ITempDao.java View file @ 3b890dd
... ... @@ -27,5 +27,7 @@
27 27 void updateFirst(TempModel temp, String id);
28 28  
29 29 int queryTempModelCount(MongoQuery query);
  30 +
  31 + TempModel findOneById(String id);
30 32 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/TempDaoImpl.java View file @ 3b890dd
... ... @@ -30,9 +30,6 @@
30 30 @Repository("tempDao")
31 31 public class TempDaoImpl extends BaseMongoDAOImpl<TempModel> implements ITempDao {
32 32  
33   - //日志调测器
34   - private static final Logger logger = LoggerFactory.getLogger(TempDaoImpl.class);
35   -
36 33 @Override
37 34 public TempModel addOneTemp(TempModel target) {
38 35 return save(target);
... ... @@ -51,6 +48,10 @@
51 48 @Override
52 49 public int queryTempModelCount(MongoQuery query) {
53 50 return (int) count(query.convertToMongoQuery());
  51 + }
  52 +
  53 + public TempModel findOneById(String id){
  54 + return findById(id);
54 55 }
55 56 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/TempService.java View file @ 3b890dd
... ... @@ -33,9 +33,6 @@
33 33 @Service
34 34 public class TempService {
35 35  
36   - //日志调测器
37   - private static final Logger logger = LoggerFactory.getLogger(TempService.class);
38   -
39 36 @Autowired
40 37 private ITempDao tempDao;
41 38  
... ... @@ -57,6 +54,10 @@
57 54 public void update(TempModel temp,String id){
58 55 temp.setModified(new Date());
59 56 tempDao.updateFirst(temp,id);
  57 + }
  58 +
  59 + public TempModel findOneById(String id){
  60 + return tempDao.findOneById(id);
60 61 }
61 62 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TempController.java View file @ 3b890dd
... ... @@ -11,6 +11,7 @@
11 11 import org.slf4j.LoggerFactory;
12 12 import org.springframework.beans.factory.annotation.Autowired;
13 13 import org.springframework.stereotype.Controller;
  14 +import org.springframework.web.bind.annotation.PathVariable;
14 15 import org.springframework.web.bind.annotation.RequestMapping;
15 16 import org.springframework.web.bind.annotation.RequestMethod;
16 17 import org.springframework.web.bind.annotation.ResponseBody;
... ... @@ -68,7 +69,21 @@
68 69 @ResponseBody
69 70 public BaseResponse findTempDataList(@Valid TempQueryRequest queryRequest,HttpServletRequest request){
70 71 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
71   - return tempFacade.findTempDataList(queryRequest,loginState.getId());
  72 + return tempFacade.findTempDataList(queryRequest, loginState.getId());
  73 + }
  74 +
  75 +
  76 + /**
  77 + * 查看报告
  78 + *
  79 + * @return
  80 + */
  81 + @TokenRequired
  82 + @RequestMapping(value = "/report/{id}",method = RequestMethod.GET)
  83 + @ResponseBody
  84 + public BaseResponse report(@PathVariable String id,HttpServletRequest request){
  85 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  86 + return tempFacade.reportList(loginState.getId(),id);
72 87 }
73 88 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TempFacade.java View file @ 3b890dd
... ... @@ -6,6 +6,7 @@
6 6 import com.lyms.platform.common.constants.ErrorCodeConstants;
7 7 import com.lyms.platform.common.enums.YnEnums;
8 8 import com.lyms.platform.common.result.BaseListResponse;
  9 +import com.lyms.platform.common.result.BaseObjectResponse;
9 10 import com.lyms.platform.common.result.BaseResponse;
10 11 import com.lyms.platform.common.utils.Assert;
11 12 import com.lyms.platform.common.utils.DateUtil;
12 13  
... ... @@ -55,10 +56,10 @@
55 56 @Autowired
56 57 private MongoUtil mongoUtil;
57 58  
58   - public BaseResponse addOrUpdateOneTemp(TempAddRequest addRequest,Integer userId) {
  59 + public BaseResponse addOrUpdateOneTemp(TempAddRequest addRequest, Integer userId) {
59 60 Assert.notNull(addRequest, "请求为空.");
60   - String hospital =autoMatchFacade.getHospitalId(userId);
61   - String parentId=mongoUtil.doHidePatient(addRequest.getParentId(), hospital);
  61 + String hospital = autoMatchFacade.getHospitalId(userId);
  62 + String parentId = mongoUtil.doHidePatient(addRequest.getParentId(), hospital);
62 63 addRequest.setParentId(parentId);
63 64 TempQuery tempQuery = new TempQuery();
64 65 tempQuery.setYn(YnEnums.YES.getId());
65 66  
66 67  
67 68  
68 69  
... ... @@ -69,28 +70,28 @@
69 70 tempQuery.setHospitalList(list);
70 71 TempModel tempModel = addRequest.convertToDataModel();
71 72  
72   - tempModel.setOperator(userId+"");
  73 + tempModel.setOperator(userId + "");
73 74 tempModel.sethId(hospital);
74 75  
75 76 List<TempModel> temp = tempService.queryTemp(tempQuery);
76 77 if (CollectionUtils.isNotEmpty(temp)) {
77   - LinkedHashMap<String,Double> data =temp.get(0).getTempList();
78   - if(null==data){
79   - data =new LinkedHashMap<String,Double>();
  78 + LinkedHashMap<String, Double> data = temp.get(0).getTempList();
  79 + if (null == data) {
  80 + data = new LinkedHashMap<String, Double>();
80 81 }
81   - data.put(DateUtil.getYyyyMmDd(new Date()),Double.valueOf(addRequest.getTemp()));
  82 + data.put(DateUtil.getYyyyMmDd(new Date()), Double.valueOf(addRequest.getTemp()));
82 83 temp.get(0).setTempList(data);
83 84 tempService.update(temp.get(0), temp.get(0).getId());
84 85 } else {
85   - LinkedHashMap<String,Double> data =new LinkedHashMap<>();
86   - data.put(DateUtil.getYyyyMmDd(new Date()),Double.valueOf(addRequest.getTemp()));
  86 + LinkedHashMap<String, Double> data = new LinkedHashMap<>();
  87 + data.put(DateUtil.getYyyyMmDd(new Date()), Double.valueOf(addRequest.getTemp()));
87 88 tempModel.setTempList(data);
88 89 tempService.addOneTemp(tempModel);
89 90 }
90 91 return new BaseResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS);
91 92 }
92 93  
93   - public BaseResponse findTempDataList(TempQueryRequest queryRequest,Integer userId) {
  94 + public BaseResponse findTempDataList(TempQueryRequest queryRequest, Integer userId) {
94 95  
95 96 String hospital = autoMatchFacade.getHospitalId(userId);
96 97 PatientsQuery patientsQuery = new PatientsQuery();
... ... @@ -116,9 +117,9 @@
116 117 if (CollectionUtils.isEmpty(patientses)) {
117 118 return new BaseListResponse().setData(new ArrayList()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
118 119 }
119   - List<String> pids= new ArrayList<>();
120   - for(Patients patients:patientses){
121   - if(StringUtils.isNotEmpty(patients.getPid())){
  120 + List<String> pids = new ArrayList<>();
  121 + for (Patients patients : patientses) {
  122 + if (StringUtils.isNotEmpty(patients.getPid())) {
122 123 pids.add(patients.getPid());
123 124 }
124 125 }
... ... @@ -135,12 +136,12 @@
135 136 tempQuery.setHospitalList(list);
136 137  
137 138 List<TempModel> temp = tempService.queryTemp(tempQuery);
138   - List dataList =new ArrayList();
139   - if(CollectionUtils.isNotEmpty(temp)){
140   - for(TempModel tmp:temp){
141   - if(StringUtils.isNotEmpty(tmp.getParentId())){
142   - Patients patients =patientsService.findOnePatientById(tmp.getParentId());
143   - if(patients != null) {
  139 + List dataList = new ArrayList();
  140 + if (CollectionUtils.isNotEmpty(temp)) {
  141 + for (TempModel tmp : temp) {
  142 + if (StringUtils.isNotEmpty(tmp.getParentId())) {
  143 + Patients patients = patientsService.findOnePatientById(tmp.getParentId());
  144 + if (patients != null) {
144 145 Map<String, Object> data = new LinkedHashMap<>();
145 146 data.put("id", tmp.getId());
146 147 data.put("username", patients.getUsername());
... ... @@ -156,6 +157,36 @@
156 157 }
157 158 }
158 159 return new BaseListResponse().setData(dataList).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  160 + }
  161 +
  162 +
  163 + /**
  164 + * 封装报告
  165 + *
  166 + * @param userId 用户id
  167 + * @param id 记录id
  168 + * @return
  169 + */
  170 + public BaseResponse reportList(Integer userId, String id) {
  171 + TempModel tem = tempService.findOneById(id);
  172 + Assert.notNull(tem, "查看的记录已被删除");
  173 + LinkedHashMap<String, Double> data = tem.getTempList();
  174 + if (null == data || data.isEmpty()) {
  175 + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  176 + }
  177 + /* Set<Map.Entry<String, Double>> set = data.entrySet();
  178 +
  179 + ArrayList<Map.Entry<String, Double>> da = new ArrayList<Map.Entry<String, Double>>(set);
  180 + Collections.reverse(da);*/
  181 + ;
  182 + List<String> time = new ArrayList<>();
  183 + List<String> temp=new ArrayList<>();
  184 + for (int i = 0; i < 7; i++) {
  185 + String t = DateUtil.getyyyy_MM_dd(DateUtil.addDay(new Date(), -i));
  186 + time.add(t);
  187 + temp.add(String.valueOf(data.get(t)));
  188 + }
  189 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
159 190 }
160 191 }