Commit 903d09138cbabc7067eb6335d849aa42a7e42958
1 parent
585f643477
Exists in
master
and in
1 other branch
防止同一天平台重复添加患者病例
Showing 1 changed file with 15 additions and 0 deletions
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java
View file @
903d091
... | ... | @@ -135,6 +135,21 @@ |
135 | 135 | patient.setCreatedtime(new Date()); |
136 | 136 | patient.setPpasswd(Constant.COMMON_PASSWD); |
137 | 137 | } else { |
138 | + QueryWrapper<LymsPcase> queryWrapper = new QueryWrapper<>(); | |
139 | + queryWrapper.eq("pid", patient.getId()); | |
140 | + Calendar calendar = Calendar.getInstance(); | |
141 | + calendar.setTime(new Date()); | |
142 | + calendar.set(Calendar.HOUR_OF_DAY, 00);//时 | |
143 | + calendar.set(Calendar.MINUTE, 00);//分 | |
144 | + calendar.set(Calendar.SECOND, 00);//秒 | |
145 | + queryWrapper.ge("createdtime", calendar.getTime()); | |
146 | + int count = lymsPcaseService.count(queryWrapper); | |
147 | + //如果今天有这个患者病例不用添加(这里防止同一天平台重复添加) | |
148 | + if (count != 0) { | |
149 | + baseResponse.setErrorcode(1); | |
150 | + baseResponse.setErrormsg("今天已经添加过该患者病例。不要重复添加!"); | |
151 | + return baseResponse; | |
152 | + } | |
138 | 153 | patient.setId(patient2.getId()); |
139 | 154 | patient.setUpdatedtime(new Date()); |
140 | 155 | patient.setCcnt(patient2.getCcnt()+ (null== patient.getCcnt()?0:patient.getCcnt())); |