Commit 4a3a1125b5f66a9efda8b1d73f9d27228520adb7
1 parent
5aff5e8931
Exists in
master
and in
6 other branches
增加参数控制
Showing 2 changed files with 12 additions and 6 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TempController.java
View file @
4a3a112
... | ... | @@ -73,9 +73,9 @@ |
73 | 73 | @TokenRequired |
74 | 74 | @RequestMapping(value = "/add",method = RequestMethod.POST) |
75 | 75 | @ResponseBody |
76 | - public BaseResponse addOnceTemp(@Valid TempAddRequest tempRequest,HttpServletRequest request) { | |
76 | + public BaseResponse addOnceTemp(@Valid TempAddRequest tempRequest,boolean flag,HttpServletRequest request) { | |
77 | 77 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
78 | - return tempFacade.addOrUpdateOneTemp(tempRequest,loginState.getId()); | |
78 | + return tempFacade.addOrUpdateOneTemp(tempRequest,loginState.getId(),flag); | |
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/TempFacade.java
View file @
4a3a112
... | ... | @@ -65,7 +65,7 @@ |
65 | 65 | @Autowired |
66 | 66 | private MongoTemplate mongoTemplate; |
67 | 67 | |
68 | - public BaseResponse addOrUpdateOneTemp(TempAddRequest addRequest, Integer userId) { | |
68 | + public BaseResponse addOrUpdateOneTemp(TempAddRequest addRequest, Integer userId, boolean flag) { | |
69 | 69 | Assert.notNull(addRequest, "请求为空."); |
70 | 70 | String hospital = autoMatchFacade.getHospitalId(userId); |
71 | 71 | String parentId = mongoUtil.doHidePatient(addRequest.getParentId(), hospital); |
... | ... | @@ -74,7 +74,7 @@ |
74 | 74 | tempQuery.setYn(YnEnums.YES.getId()); |
75 | 75 | |
76 | 76 | Patients patients = patientsService.findOnePatientById(parentId); |
77 | - List<String> list1 =new ArrayList<String>(); | |
77 | + List<String> list1 = new ArrayList<String>(); | |
78 | 78 | list1.add(patients.getPid()); |
79 | 79 | tempQuery.setpIds(list1); |
80 | 80 | ArrayList list = new ArrayList(); |
... | ... | @@ -100,7 +100,13 @@ |
100 | 100 | data.put(DateUtil.getYyyyMmDd(new Date()), Double.valueOf(addRequest.getTemp())); |
101 | 101 | tempModel.setTempList(data); |
102 | 102 | tempModel.setNow(addRequest.getTemp()); |
103 | - tempService.addOneTemp(tempModel); | |
103 | + tempModel.setCreated(new Date()); | |
104 | + tempModel.setModified(new Date()); | |
105 | + if (flag) { | |
106 | + mongoTemplate.insert(tempModel); | |
107 | + } else { | |
108 | + tempService.addOneTemp(tempModel); | |
109 | + } | |
104 | 110 | } |
105 | 111 | return new BaseResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS); |
106 | 112 | } |
... | ... | @@ -215,7 +221,7 @@ |
215 | 221 | map.put("errorcode", ErrorCodeConstants.SUCCESS); |
216 | 222 | map.put("errormsg", "成功"); |
217 | 223 | if (CollectionUtils.isNotEmpty(tem)) { |
218 | - LinkedHashMap<String, Double> data1=new LinkedHashMap<>(); | |
224 | + LinkedHashMap<String, Double> data1 = new LinkedHashMap<>(); | |
219 | 225 | for (TempModel temp : tem) { |
220 | 226 | LinkedHashMap<String, Double> data = temp.getTempList(); |
221 | 227 | if (null == data || data.isEmpty()) { |