Commit ffc3789d1fe1b18ae4d7a40d17b1b0d5d8ddf2e1
1 parent
43a507441a
Exists in
dev
解决医生工作时间设置bug
Showing 1 changed file with 27 additions and 13 deletions
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorWorktimeController.java
View file @
ffc3789
| ... | ... | @@ -49,11 +49,20 @@ |
| 49 | 49 | if(StringUtil.isEmpty(doctorWorkTime.getStartTime()) || StringUtil.isEmpty(doctorWorkTime.getEndTime())){ |
| 50 | 50 | return BaseResponse.error("开始时间和结束时间必须填写"); |
| 51 | 51 | } |
| 52 | + if(doctorWorkTime.getDid() == null){ | |
| 53 | + LymsDoctor doctor = lymsDoctorService.getDoctorByToken(authorization); | |
| 54 | + doctorWorkTime.setDid(doctor.getDid()); | |
| 55 | + } | |
| 56 | + | |
| 52 | 57 | if(doctorWorkTime.getId() == null){ |
| 53 | - if(doctorWorkTime.getDid() == null){ | |
| 54 | - LymsDoctor doctor = lymsDoctorService.getDoctorByToken(authorization); | |
| 55 | - doctorWorkTime.setDid(doctor.getDid()); | |
| 58 | + QueryWrapper<LymsDoctorWorkTime> queryWrapper = new QueryWrapper(); | |
| 59 | + queryWrapper.eq("did",doctorWorkTime.getDid()); | |
| 60 | + queryWrapper.eq("status",1); | |
| 61 | + List<LymsDoctorWorkTime> doctorWorkTimes = lymsDoctorWorktimeService.list(queryWrapper); | |
| 62 | + if(CollectionUtils.isNotEmpty(doctorWorkTimes)){ | |
| 63 | + return BaseResponse.error("该医生已经维护过"); | |
| 56 | 64 | } |
| 65 | + | |
| 57 | 66 | doctorWorkTime.setStatus(1); |
| 58 | 67 | doctorWorkTime.setCreatedtime(new Date()); |
| 59 | 68 | } |
| 60 | 69 | |
| ... | ... | @@ -71,10 +80,14 @@ |
| 71 | 80 | @TokenRequired |
| 72 | 81 | public BaseResponse queryDoctorWorktime(@RequestHeader String authorization){ |
| 73 | 82 | LymsDoctor doctor = lymsDoctorService.getDoctorByToken(authorization); |
| 74 | - QueryWrapper queryWrapper = new QueryWrapper(); | |
| 83 | + QueryWrapper<LymsDoctorWorkTime> queryWrapper = new QueryWrapper(); | |
| 75 | 84 | queryWrapper.eq("did",doctor.getDid()); |
| 76 | - LymsDoctorWorkTime doctorWorkTime = lymsDoctorWorktimeService.getOne(queryWrapper); | |
| 77 | - return BaseResponse.ok().setObject(doctorWorkTime); | |
| 85 | + queryWrapper.eq("status",1); | |
| 86 | + List<LymsDoctorWorkTime> doctorWorkTimes = lymsDoctorWorktimeService.list(queryWrapper); | |
| 87 | + if(CollectionUtils.isEmpty(doctorWorkTimes)){ | |
| 88 | + return BaseResponse.error("医生未维护过工作时间"); | |
| 89 | + } | |
| 90 | + return BaseResponse.ok().setObject(doctorWorkTimes.get(0)); | |
| 78 | 91 | } |
| 79 | 92 | |
| 80 | 93 | /** |
| ... | ... | @@ -87,13 +100,13 @@ |
| 87 | 100 | public BaseResponse queryByDoctorId(Integer did){ |
| 88 | 101 | QueryWrapper<LymsDoctorWorkTime> queryWrapper = new QueryWrapper(); |
| 89 | 102 | queryWrapper.eq("did",did); |
| 90 | - LymsDoctorWorkTime doctorWorkTime = lymsDoctorWorktimeService.getOne(queryWrapper); | |
| 91 | - /*if(doctorWorkTime != null){ | |
| 92 | - doctorWorkTime.setId(null); | |
| 93 | - doctorWorkTime.setCreatedtime(null); | |
| 94 | - doctorWorkTime.setUpdatedtime(null); | |
| 95 | - }*/ | |
| 96 | - return BaseResponse.ok().setObject(doctorWorkTime); | |
| 103 | + queryWrapper.eq("status",1); | |
| 104 | + List<LymsDoctorWorkTime> doctorWorkTimes = lymsDoctorWorktimeService.list(queryWrapper); | |
| 105 | + if(CollectionUtils.isEmpty(doctorWorkTimes)){ | |
| 106 | + return BaseResponse.error("医生未维护过工作时间"); | |
| 107 | + } | |
| 108 | + | |
| 109 | + return BaseResponse.ok().setObject(doctorWorkTimes.get(0)); | |
| 97 | 110 | } |
| 98 | 111 | |
| 99 | 112 | /** |
| ... | ... | @@ -110,6 +123,7 @@ |
| 110 | 123 | if(doctor != null){ |
| 111 | 124 | QueryWrapper<LymsDoctorWorkTime> queryWrapper = new QueryWrapper(); |
| 112 | 125 | queryWrapper.eq("did",doctor.getDid()); |
| 126 | + queryWrapper.eq("status",1); | |
| 113 | 127 | LymsDoctorWorkTime doctorWorkTime = lymsDoctorWorktimeService.getOne(queryWrapper); |
| 114 | 128 | /*if(doctorWorkTime != null){ |
| 115 | 129 | doctorWorkTime.setId(null); |