Commit e856f77284f7ec31614e8a0743fbd48c1fd9bc11
1 parent
aa575b9762
Exists in
master
update
Showing 1 changed file with 16 additions and 1 deletions
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java
View file @
e856f77
| ... | ... | @@ -1227,12 +1227,27 @@ |
| 1227 | 1227 | public BaseResponse bookbuildingPatient(@RequestBody LymsPatient patient) { |
| 1228 | 1228 | BaseResponse baseResponse = new BaseResponse(); |
| 1229 | 1229 | try { |
| 1230 | + QueryWrapper<LymsPatient> queryWrapper=new QueryWrapper<>(); | |
| 1231 | + queryWrapper.lambda().eq(LymsPatient::getIdno, patient.getIdno()); | |
| 1232 | + List<LymsPatient> patientList = lymsPatientService.list(queryWrapper); | |
| 1230 | 1233 | if(null==patient.getId()) { |
| 1234 | + if (0<patientList.size()) { | |
| 1235 | + baseResponse.setErrorcode(1); | |
| 1236 | + baseResponse.setErrormsg("身份证已注册,请查询档案信息。"); | |
| 1237 | + return baseResponse; | |
| 1238 | + } | |
| 1231 | 1239 | patient.setPpasswd(DigestUtils.md5DigestAsHex("123456".getBytes())); |
| 1240 | + }else { | |
| 1241 | + LymsPatient lymsPatient = lymsPatientService.getById(patient.getId()); | |
| 1242 | + if(0<patientList.size() && ! patientList.get(0).getIdno().equals(lymsPatient.getIdno())){ | |
| 1243 | + baseResponse.setErrorcode(1); | |
| 1244 | + baseResponse.setErrormsg("身份证已注册,请查询档案信息。"); | |
| 1245 | + return baseResponse; | |
| 1246 | + } | |
| 1232 | 1247 | } |
| 1233 | 1248 | boolean f = lymsPatientService.saveOrUpdate(patient); |
| 1234 | 1249 | baseResponse.setErrorcode(f?0:1); |
| 1235 | - baseResponse.setErrormsg(f?"注册成功!":"注册失败!"); | |
| 1250 | + baseResponse.setErrormsg(f?(null==patient.getId()?"注册成功!":"修改成功"):(null==patient.getId()?"注册成功!":"修改成功")); | |
| 1236 | 1251 | } catch (Exception e) { |
| 1237 | 1252 | e.printStackTrace(); |
| 1238 | 1253 | } |