Commit 125faa0b02097038639b259ad83772aac401554f
1 parent
69d91d1e46
Exists in
master
PC-医生管理,编辑医生时,状态从值班状态改为就诊医生时逻辑操作
Showing 1 changed file with 41 additions and 15 deletions
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java
View file @
125faa0
| ... | ... | @@ -123,28 +123,54 @@ |
| 123 | 123 | LymsDoctor depart2=new LymsDoctor(); |
| 124 | 124 | depart2.setDlogin(doctor.getDlogin()); |
| 125 | 125 | List<LymsDoctor> dLst=lymsDoctorService.list(Wrappers.query(depart2)); |
| 126 | - if (dLst.size()>0) { | |
| 127 | - baseResponse.setErrormsg("不能创建重复账号"); | |
| 128 | - baseResponse.setErrorcode(1); | |
| 129 | - return baseResponse; | |
| 130 | - } | |
| 131 | 126 | //操作记录标识 |
| 132 | 127 | Integer did=0; |
| 133 | 128 | if(doctor.getDid()==null){ |
| 129 | + if (dLst.size()>0) { | |
| 130 | + baseResponse.setErrormsg("不能创建重复账号"); | |
| 131 | + baseResponse.setErrorcode(1); | |
| 132 | + return baseResponse; | |
| 133 | + } | |
| 134 | 134 | doctor.setCreatedtime(new Date()); |
| 135 | 135 | }else{ |
| 136 | 136 | did=1; |
| 137 | 137 | doctor.setUpdatedTime(new Date()); |
| 138 | - //修改医生状态时。变为就诊医生状态 | |
| 139 | -// if (dLst.size()>0 && null!=doctor.getAdminType() && doctor.getAdminType()==0) { | |
| 140 | -// depart2=dLst.get(0); | |
| 141 | -// //变更前是值班医生/值班护士时,变更环信群组及删除环信群组用户(值班医生/值班护士) | |
| 142 | -// if(depart2.getAdminType()==1 || depart2.getAdminType()==2){ | |
| 143 | -// | |
| 144 | -// } | |
| 145 | -// } | |
| 146 | - | |
| 147 | - | |
| 138 | + //修改医生状态时。变为就诊医生状态(需要移除聊天群组,因为已经不是值班角色) | |
| 139 | + if (dLst.size()>0 && null!=doctor.getAdminType() && doctor.getAdminType()==0) { | |
| 140 | + depart2=dLst.get(0); | |
| 141 | + //变更前是值班医生/值班护士时,变更环信群组及删除环信群组用户(值班医生/值班护士) | |
| 142 | + if(depart2.getAdminType()==1 || depart2.getAdminType()==2){ | |
| 143 | + final List<LymsChatgroup> chatgroupList = lymsChatgroupService.list(new QueryWrapper<LymsChatgroup>().lambda() | |
| 144 | + .ne(LymsChatgroup::getTarget, depart2.getDlogin()) | |
| 145 | + .eq(LymsChatgroup::getHdepartId, depart2.getDpid())); | |
| 146 | + for (LymsChatgroup lymsChatgroup : chatgroupList) { | |
| 147 | + JSONObject json = hxService.delUserHxGroup(lymsChatgroup.getHxgroupid(),depart2.getDlogin()); | |
| 148 | + JSONObject jsonObject = json.getJSONObject("data"); | |
| 149 | + if (jsonObject.size() > 0 && (boolean) jsonObject.get("result")) { | |
| 150 | + //更新到数据库群组中 | |
| 151 | + //群组中的账号 | |
| 152 | + List<String> description = new ArrayList<>(Arrays.asList(lymsChatgroup.getDescription().split(","))); | |
| 153 | + //群组中的医生姓名 | |
| 154 | + List<String> groupname = new ArrayList<>(Arrays.asList(lymsChatgroup.getGroupname().split(","))); | |
| 155 | + for (String s : description) { | |
| 156 | + if(s.equals(depart2.getDlogin())){ | |
| 157 | + description.remove(s); | |
| 158 | + break; | |
| 159 | + } | |
| 160 | + } | |
| 161 | + for (String s : groupname) { | |
| 162 | + if(s.equals(depart2.getDname())){ | |
| 163 | + groupname.remove(s); | |
| 164 | + break; | |
| 165 | + } | |
| 166 | + } | |
| 167 | + lymsChatgroup.setDescription(StringUtils.join(description.toArray(),",")); | |
| 168 | + lymsChatgroup.setGroupname(StringUtils.join(groupname.toArray(),",")); | |
| 169 | + lymsChatgroupService.updateById(lymsChatgroup); | |
| 170 | + } | |
| 171 | + } | |
| 172 | + } | |
| 173 | + } | |
| 148 | 174 | } |
| 149 | 175 | if(result.hasErrors()){ |
| 150 | 176 | baseResponse.setErrorcode(1); |