Commit a60b98cc69bf784bb04be0bda4891f8c4856f4ae
1 parent
77a507cec2
Exists in
master
and in
6 other branches
体重管理
Showing 4 changed files with 148 additions and 2 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MeasureInfoController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MeasureInfoFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TempFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/NutritionInfoRequest.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MeasureInfoController.java
View file @
a60b98c
| ... | ... | @@ -6,9 +6,11 @@ |
| 6 | 6 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 7 | 7 | import com.lyms.platform.common.result.BaseResponse; |
| 8 | 8 | import com.lyms.platform.operate.web.facade.MeasureInfoFacade; |
| 9 | +import com.lyms.platform.operate.web.facade.TempFacade; | |
| 9 | 10 | import com.lyms.platform.operate.web.request.MeasureInfoRequest; |
| 10 | 11 | import com.lyms.platform.operate.web.request.NutritionInfoRequest; |
| 11 | 12 | import com.lyms.platform.operate.web.request.SmsTemplateRequest; |
| 13 | +import com.lyms.platform.operate.web.request.TempAddRequest; | |
| 12 | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | 15 | import org.springframework.stereotype.Controller; |
| 14 | 16 | import org.springframework.web.bind.annotation.*; |
| ... | ... | @@ -27,6 +29,10 @@ |
| 27 | 29 | |
| 28 | 30 | @Autowired |
| 29 | 31 | private MeasureInfoFacade measureInfoFacade; |
| 32 | + | |
| 33 | + @Autowired | |
| 34 | + private TempFacade tempFacade; | |
| 35 | + | |
| 30 | 36 | /** |
| 31 | 37 | * 血糖和脉搏 身高和体重的值列表 |
| 32 | 38 | * valueType 值类型: 1 体重和身高 2 血压和脉搏 3 体温 4血糖 |
| ... | ... | @@ -180,6 +186,45 @@ |
| 180 | 186 | { |
| 181 | 187 | return measureInfoFacade.addFaceInfo(nutritionInfoRequest); |
| 182 | 188 | } |
| 189 | + | |
| 190 | + | |
| 191 | + /** | |
| 192 | + * 添加体温 | |
| 193 | + * @param nutritionInfoRequest | |
| 194 | + * @param request | |
| 195 | + * @return | |
| 196 | + */ | |
| 197 | + @RequestMapping(method = RequestMethod.POST, value = "/addNutritionTemp") | |
| 198 | + @ResponseBody | |
| 199 | + public BaseResponse addNutritionTemp(@RequestBody NutritionInfoRequest nutritionInfoRequest, | |
| 200 | + HttpServletRequest request | |
| 201 | + ) | |
| 202 | + { | |
| 203 | + TempAddRequest addRequest = new TempAddRequest(); | |
| 204 | + addRequest.setParentId(nutritionInfoRequest.getPatientId()); | |
| 205 | + addRequest.setPid(nutritionInfoRequest.getPid()); | |
| 206 | + return tempFacade.addOrUpdateOneTemp(addRequest, nutritionInfoRequest.getHospitalId(), ""); | |
| 207 | + } | |
| 208 | + | |
| 209 | + | |
| 210 | + /** | |
| 211 | + * 添加血压 | |
| 212 | + * @param nutritionInfoRequest | |
| 213 | + * @param request | |
| 214 | + * @return | |
| 215 | + */ | |
| 216 | + @RequestMapping(method = RequestMethod.POST, value = "/addBloodPressure") | |
| 217 | + @ResponseBody | |
| 218 | + public BaseResponse addBloodPressure(@RequestBody NutritionInfoRequest nutritionInfoRequest, | |
| 219 | + HttpServletRequest request | |
| 220 | + ) | |
| 221 | + { | |
| 222 | + | |
| 223 | + return measureInfoFacade.addBloodPressure(nutritionInfoRequest); | |
| 224 | + } | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 183 | 228 | |
| 184 | 229 | |
| 185 | 230 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MeasureInfoFacade.java
View file @
a60b98c
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | import com.lyms.platform.operate.web.result.MeasureInfoResult; |
| 18 | 18 | import com.lyms.platform.operate.web.service.PatientWeightService; |
| 19 | 19 | import com.lyms.platform.operate.web.utils.CommonsHelper; |
| 20 | +import com.lyms.platform.operate.web.utils.MongoUtil; | |
| 20 | 21 | import com.lyms.platform.permission.dao.master.CouponMapper; |
| 21 | 22 | import com.lyms.platform.permission.model.Organization; |
| 22 | 23 | import com.lyms.platform.permission.service.MeasureDataInfoService; |
| ... | ... | @@ -31,6 +32,7 @@ |
| 31 | 32 | import org.apache.commons.dbutils.handlers.BeanListHandler; |
| 32 | 33 | import org.apache.commons.lang.StringUtils; |
| 33 | 34 | import org.springframework.beans.factory.annotation.Autowired; |
| 35 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
| 34 | 36 | import org.springframework.data.mongodb.core.query.Criteria; |
| 35 | 37 | import org.springframework.data.mongodb.core.query.Query; |
| 36 | 38 | import org.springframework.stereotype.Component; |
| 37 | 39 | |
| ... | ... | @@ -69,7 +71,17 @@ |
| 69 | 71 | @Autowired |
| 70 | 72 | private CouponMapper couponMapper; |
| 71 | 73 | |
| 74 | + | |
| 72 | 75 | @Autowired |
| 76 | + private BloodPressureService bloodPressureService; | |
| 77 | + | |
| 78 | + @Autowired | |
| 79 | + private MongoTemplate mongoTemplate; | |
| 80 | + | |
| 81 | + @Autowired | |
| 82 | + private MongoUtil mongoUtil; | |
| 83 | + | |
| 84 | + @Autowired | |
| 73 | 85 | private BasicConfigService basicConfigService; |
| 74 | 86 | |
| 75 | 87 | private static String[] blood_item = new String[]{"--","--","--","--","--","--","--","--","--"}; |
| ... | ... | @@ -743,7 +755,8 @@ |
| 743 | 755 | patInfo.put("bmi",bmi); |
| 744 | 756 | patInfo.put("currentWeight",currentWeight); |
| 745 | 757 | patInfo.put("patientId",pat.getId()); |
| 746 | - patInfo.put("lastWeight",pat.getId()); | |
| 758 | + patInfo.put("lastWeight",lastWeight); | |
| 759 | + patInfo.put("pid",pat.getPid()); | |
| 747 | 760 | |
| 748 | 761 | objectResponse.setData(patInfo); |
| 749 | 762 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
| ... | ... | @@ -857,6 +870,52 @@ |
| 857 | 870 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 858 | 871 | objectResponse.setErrormsg("成功"); |
| 859 | 872 | return objectResponse; |
| 873 | + } | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + public BaseResponse addBloodPressure(NutritionInfoRequest nutritionInfoRequest) { | |
| 878 | + | |
| 879 | + BloodPressure bloodPressure = new BloodPressure(); | |
| 880 | + bloodPressure.setParentId(nutritionInfoRequest.getPatientId()); | |
| 881 | + bloodPressure.setSsy(nutritionInfoRequest.getSsy()); | |
| 882 | + bloodPressure.setSzy(nutritionInfoRequest.getSzy()); | |
| 883 | + bloodPressure.setPulse(nutritionInfoRequest.getPulse()); | |
| 884 | + | |
| 885 | + String hospitalId = nutritionInfoRequest.getHospitalId(); | |
| 886 | + Map<String, Object> temp = new LinkedHashMap<>(); | |
| 887 | + bloodPressure.setModified(new Date()); | |
| 888 | + temp.put("szy", bloodPressure.getSzy()); | |
| 889 | + temp.put("ssy", bloodPressure.getSsy()); | |
| 890 | + temp.put("pulse", bloodPressure.getPulse()); | |
| 891 | + temp.put("timestamp", DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 892 | + temp.put("hospitalId", hospitalId); | |
| 893 | + Patients p = mongoTemplate.findById(bloodPressure.getParentId(), Patients.class); | |
| 894 | + BloodPressure bp = null; | |
| 895 | + if(p != null) { | |
| 896 | + bp = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(p.getPid())), BloodPressure.class); | |
| 897 | + } | |
| 898 | + if(bp == null) { | |
| 899 | + String parentId = mongoUtil.doHidePatient(bloodPressure.getParentId(), hospitalId); | |
| 900 | + bloodPressure.setPid(mongoUtil.getPid(parentId)); | |
| 901 | + bloodPressure.setParentId(parentId); | |
| 902 | + bloodPressure.setYn(YnEnums.YES.getId()); | |
| 903 | + bloodPressure.setCreated(new Date()); | |
| 904 | + bloodPressure.setHospitalId(hospitalId); | |
| 905 | + bloodPressure.setOperaterId(null); | |
| 906 | + Map<String, Map<String, Object>> infos = new LinkedHashMap<>(); | |
| 907 | + infos.put(DateUtil.getyyyy_MM_dd(new Date()), temp); | |
| 908 | + bloodPressure.setInfos(infos); | |
| 909 | + bloodPressureService.add(bloodPressure); | |
| 910 | + } else { | |
| 911 | + Map<String, Map<String, Object>> infos = bp.getInfos(); | |
| 912 | + infos.put(DateUtil.getyyyy_MM_dd(new Date()), temp); | |
| 913 | + bloodPressure.setInfos(infos); | |
| 914 | + bloodPressure.setId(bp.getId()); | |
| 915 | + bloodPressure.setPid(bp.getPid()); | |
| 916 | + bloodPressureService.update(bloodPressure); | |
| 917 | + } | |
| 918 | + return RespBuilder.buildSuccess(); | |
| 860 | 919 | } |
| 861 | 920 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TempFacade.java
View file @
a60b98c
| ... | ... | @@ -86,6 +86,10 @@ |
| 86 | 86 | public BaseResponse addOrUpdateOneTemp(TempAddRequest addRequest, Integer userId) { |
| 87 | 87 | Assert.notNull(addRequest, "请求为空."); |
| 88 | 88 | String hospital = autoMatchFacade.getHospitalId(userId); |
| 89 | + return addOrUpdateOneTemp( addRequest, hospital, String.valueOf(userId)); | |
| 90 | + } | |
| 91 | + | |
| 92 | + public BaseResponse addOrUpdateOneTemp(TempAddRequest addRequest, String hospital,String userId) { | |
| 89 | 93 | String parentId = mongoUtil.doHidePatient(addRequest.getParentId(), hospital); |
| 90 | 94 | addRequest.setParentId(parentId); |
| 91 | 95 | TempQuery tempQuery = new TempQuery(); |
| ... | ... | @@ -100,7 +104,7 @@ |
| 100 | 104 | tempQuery.setHospitalList(list); |
| 101 | 105 | TempModel tempModel = addRequest.convertToDataModel(); |
| 102 | 106 | |
| 103 | - tempModel.setOperator(userId + ""); | |
| 107 | + tempModel.setOperator(userId); | |
| 104 | 108 | tempModel.sethId(hospital); |
| 105 | 109 | |
| 106 | 110 | List<TempModel> temp = tempService.queryTemp(tempQuery); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/NutritionInfoRequest.java
View file @
a60b98c
| ... | ... | @@ -18,6 +18,44 @@ |
| 18 | 18 | |
| 19 | 19 | private String face; |
| 20 | 20 | |
| 21 | + private String pid; | |
| 22 | + | |
| 23 | + private String szy; | |
| 24 | + private String ssy; | |
| 25 | + private Integer pulse; | |
| 26 | + | |
| 27 | + public String getSzy() { | |
| 28 | + return szy; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public void setSzy(String szy) { | |
| 32 | + this.szy = szy; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public String getSsy() { | |
| 36 | + return ssy; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public void setSsy(String ssy) { | |
| 40 | + this.ssy = ssy; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public Integer getPulse() { | |
| 44 | + return pulse; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public void setPulse(Integer pulse) { | |
| 48 | + this.pulse = pulse; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public String getPid() { | |
| 52 | + return pid; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public void setPid(String pid) { | |
| 56 | + this.pid = pid; | |
| 57 | + } | |
| 58 | + | |
| 21 | 59 | public String getBeforeWeight() { |
| 22 | 60 | return beforeWeight; |
| 23 | 61 | } |