Commit 37bccd75d03dfe21cc6ecfa9197821d22f053678
1 parent
1b6c0f3043
Exists in
master
and in
6 other branches
测量
Showing 2 changed files with 47 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MeasureInfoController.java
View file @
37bccd7
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | import com.lyms.platform.operate.web.request.NutritionInfoRequest; |
| 12 | 12 | import com.lyms.platform.operate.web.request.SmsTemplateRequest; |
| 13 | 13 | import com.lyms.platform.operate.web.request.TempAddRequest; |
| 14 | +import com.lyms.platform.pojo.BloodSugar; | |
| 14 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | 16 | import org.springframework.stereotype.Controller; |
| 16 | 17 | import org.springframework.web.bind.annotation.*; |
| ... | ... | @@ -240,6 +241,22 @@ |
| 240 | 241 | return measureInfoFacade.addBloodPressure(nutritionInfoRequest); |
| 241 | 242 | } |
| 242 | 243 | |
| 244 | + | |
| 245 | + /** | |
| 246 | + * 添加血糖 | |
| 247 | + * @param bloodSugar | |
| 248 | + * @param request | |
| 249 | + * @return | |
| 250 | + */ | |
| 251 | + @RequestMapping(method = RequestMethod.POST, value = "/addBloodSugar") | |
| 252 | + @ResponseBody | |
| 253 | + public BaseResponse addBloodSugar(@RequestBody BloodSugar bloodSugar, | |
| 254 | + HttpServletRequest request | |
| 255 | + ) | |
| 256 | + { | |
| 257 | + | |
| 258 | + return measureInfoFacade.addBloodSugar(bloodSugar); | |
| 259 | + } | |
| 243 | 260 | |
| 244 | 261 | |
| 245 | 262 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MeasureInfoFacade.java
View file @
37bccd7
| ... | ... | @@ -86,6 +86,9 @@ |
| 86 | 86 | private MongoUtil mongoUtil; |
| 87 | 87 | |
| 88 | 88 | @Autowired |
| 89 | + private BloodSugarService bloodSugarService; | |
| 90 | + | |
| 91 | + @Autowired | |
| 89 | 92 | private BasicConfigService basicConfigService; |
| 90 | 93 | |
| 91 | 94 | private static String[] blood_item = new String[]{"--","--","--","--","--","--","--","--","--"}; |
| ... | ... | @@ -1039,6 +1042,33 @@ |
| 1039 | 1042 | public BaseResponse addToDataInfo(MeasureInfoRequest measureInfoRequest) { |
| 1040 | 1043 | MAX_TODAY_COUNT = 100; |
| 1041 | 1044 | return addMeasureDataInfo(measureInfoRequest); |
| 1045 | + } | |
| 1046 | + | |
| 1047 | + public BaseResponse addBloodSugar(BloodSugar bloodSugar) { | |
| 1048 | + | |
| 1049 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
| 1050 | + BloodSugar one = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(mongoUtil.getPid(bloodSugar.getParentId())).and("created").gt(DateUtil.getYMDTime()).and("bloodSugarType").is(bloodSugar.getBloodSugarType())), BloodSugar.class); | |
| 1051 | + if(one != null) { | |
| 1052 | + one.setModified(new Date()); | |
| 1053 | + one.setBloodSugar(bloodSugar.getBloodSugar()); | |
| 1054 | + bloodSugarService.update(one); | |
| 1055 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 1056 | + objectResponse.setErrormsg("成功"); | |
| 1057 | + return objectResponse; | |
| 1058 | + } | |
| 1059 | + bloodSugar.setParentId(mongoUtil.doHidePatient(bloodSugar.getParentId(), bloodSugar.getHospitalId())); | |
| 1060 | + bloodSugar.setHospitalId(bloodSugar.getHospitalId()); | |
| 1061 | + bloodSugar.setCreated(new Date()); | |
| 1062 | + bloodSugar.setCreateUser(null); | |
| 1063 | + bloodSugar.setYn(YnEnums.YES.getId()); | |
| 1064 | + bloodSugar.setModified(new Date()); | |
| 1065 | + bloodSugar.setCreatYmdDate(DateUtil.getyyyy_MM_dd(new Date())); | |
| 1066 | + bloodSugar.setPid(mongoUtil.getPid(bloodSugar.getParentId())); | |
| 1067 | + bloodSugarService.add(bloodSugar); | |
| 1068 | + | |
| 1069 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 1070 | + objectResponse.setErrormsg("成功"); | |
| 1071 | + return objectResponse; | |
| 1042 | 1072 | } |
| 1043 | 1073 | } |