Commit 70edb9a65ce9d76c01d4ed3f5537d18661fa68dd
1 parent
d8e403a8b1
Exists in
master
科室值班大夫回复/回访功能
Showing 6 changed files with 182 additions and 52 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ChatGroupController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/TkRecordController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctor.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsChatgroupMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/DateUtil.java
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ChatGroupController.java
View file @
70edb9a
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | import com.lyms.talkonlineweb.util.StringUtil; |
20 | 20 | import lombok.extern.log4j.Log4j2; |
21 | 21 | import org.apache.commons.io.IOUtils; |
22 | +import org.apache.commons.lang3.StringUtils; | |
22 | 23 | import org.springframework.beans.BeanUtils; |
23 | 24 | import org.springframework.beans.factory.annotation.Autowired; |
24 | 25 | import org.springframework.web.bind.annotation.*; |
... | ... | @@ -80,8 +81,14 @@ |
80 | 81 | LymsChatgroup group2 = gLst.get(0); |
81 | 82 | group = group2; |
82 | 83 | } else { |
83 | - LymsPatient patient= lymsPatientService.getOne(new QueryWrapper<LymsPatient>().lambda().eq(LymsPatient::getIdno, group.getFromp())); | |
84 | - LymsDoctor doctor= lymsDoctorService.getOne(new QueryWrapper<LymsDoctor>().lambda().eq(LymsDoctor::getDlogin, group.getTarget())); | |
84 | + LymsPatient patient= lymsPatientService.getOne(new QueryWrapper<LymsPatient>() | |
85 | + .lambda().eq(LymsPatient::getIdno, group.getFromp())); | |
86 | + LymsDoctor doctor= lymsDoctorService.getOne(new QueryWrapper<LymsDoctor>() | |
87 | + .lambda().eq(LymsDoctor::getDlogin, group.getTarget())); | |
88 | + List<String> adminDlogins=new ArrayList<>(); | |
89 | + adminDlogins.add(group.getFromp()); | |
90 | + List<String> groupnames=new ArrayList<>(); | |
91 | + groupnames.add(patient.getPname()); | |
85 | 92 | //患者注册环信 |
86 | 93 | if (StringUtil.isEmpty(patient.getHxid())) { |
87 | 94 | JSONObject json = hxService.addUser(patient.getIdno(), Constant.COMMON_PASSWD, patient.getPname()); |
88 | 95 | |
89 | 96 | |
90 | 97 | |
91 | 98 | |
... | ... | @@ -91,23 +98,44 @@ |
91 | 98 | lymsPatientService.updateById(patient); |
92 | 99 | } |
93 | 100 | } |
94 | - //医生注册环信 | |
95 | - if (StringUtil.isEmpty(doctor.getHxid())) { | |
96 | - JSONObject json = hxService.addUser(doctor.getDlogin(), Constant.COMMON_PASSWD, doctor.getDname()); | |
97 | - JSONArray rArr = json.getJSONArray("entities"); | |
98 | - if (rArr.size() > 0) { | |
99 | - doctor.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
100 | - lymsDoctorService.updateById(doctor); | |
101 | + //查询值班医生 | |
102 | + List<LymsDoctor> doctorAminList= lymsDoctorService.list(new QueryWrapper<LymsDoctor>() | |
103 | + .lambda().eq(LymsDoctor::getDpid, doctor.getDpid()) | |
104 | + .eq(LymsDoctor::getAdminType, 1)); | |
105 | + //科室值班医生注册环信 | |
106 | + for (LymsDoctor lymsDoctor : doctorAminList) { | |
107 | + if(StringUtil.isEmpty(lymsDoctor.getHxid())) { | |
108 | + JSONObject json = hxService.addUser(lymsDoctor.getDlogin(), Constant.COMMON_PASSWD, lymsDoctor.getDname()); | |
109 | + JSONArray rArr = json.getJSONArray("entities"); | |
110 | + if (rArr.size() > 0) { | |
111 | + lymsDoctor.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
112 | + lymsDoctorService.updateById(lymsDoctor); | |
113 | + } | |
101 | 114 | } |
115 | + adminDlogins.add(lymsDoctor.getDlogin()); | |
116 | + groupnames.add(lymsDoctor.getDname()); | |
102 | 117 | } |
103 | - log.info("创建环信组:{} from:{} target:{}", group.getOwnerk(), group.getFromp(), group.getTarget()); | |
104 | - JSONObject rJson = hxService.addChatGroups(group.getFromp() + "," + group.getTarget(), group.getOwnerk(), new String[]{group.getFromp(), group.getTarget()}); | |
118 | + if ( ! adminDlogins.contains(doctor.getDlogin())) { | |
119 | + //医生注册环信 | |
120 | + if (StringUtil.isEmpty(doctor.getHxid())) { | |
121 | + JSONObject json = hxService.addUser(doctor.getDlogin(), Constant.COMMON_PASSWD, doctor.getDname()); | |
122 | + JSONArray rArr = json.getJSONArray("entities"); | |
123 | + if (rArr.size() > 0) { | |
124 | + doctor.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
125 | + lymsDoctorService.updateById(doctor); | |
126 | + adminDlogins.add(doctor.getDlogin()); | |
127 | + groupnames.add(doctor.getDname()); | |
128 | + } | |
129 | + } | |
130 | + } | |
131 | + | |
132 | + log.info("创建环信组:{} description:{}", group.getOwnerk(), StringUtils.join(adminDlogins.toArray(), ",")); | |
133 | + JSONObject rJson = hxService.addChatGroups(StringUtils.join(adminDlogins.toArray(), ","), group.getOwnerk(), (String[]) adminDlogins.toArray()); | |
105 | 134 | log.info("rJson:" + rJson); |
106 | 135 | group.setHxgroupid(rJson.getJSONObject("data").getString("groupid")); |
107 | - group.setDescription(group.getFromp() + "," + group.getTarget()); | |
108 | -// group.setGroupname(group.getFromp() + "," + group.getTarget()); | |
136 | + group.setDescription(StringUtils.join(adminDlogins.toArray(), ",")); | |
109 | 137 | //环信群组名称更改为姓名串-用于PC端问诊展示 |
110 | - group.setGroupname(patient.getPname() + "," + doctor.getDdname()); | |
138 | + group.setGroupname(StringUtils.join(groupnames.toArray(), ",")); | |
111 | 139 | |
112 | 140 | group.setCtime(new Date()); |
113 | 141 | lymsChatgroupService.saveOrUpdate(group); |
114 | 142 | |
115 | 143 | |
116 | 144 | |
... | ... | @@ -331,20 +359,28 @@ |
331 | 359 | * @param current 页数 |
332 | 360 | * @param size 条数 |
333 | 361 | * @param synthesisQuery 综合筛选条件 |
362 | + * @param adminType 0:普通医生 1:科室管理员(用于问诊聊天) | |
334 | 363 | * @return |
335 | 364 | */ |
336 | 365 | @GetMapping("getDoctorPatient") |
337 | 366 | @TokenRequired |
338 | - public BaseResponse getDoctorPatient(Integer doctorId,Integer current, Integer size,String synthesisQuery){ | |
367 | + public BaseResponse getDoctorPatient(Integer doctorId,Integer current, Integer size,String synthesisQuery, | |
368 | + Integer did){ | |
339 | 369 | BaseResponse baseResponse =new BaseResponse(); |
340 | - if(null==doctorId){ | |
370 | + if((null==doctorId && null==did)||(null!=doctorId && null!=did)){ | |
341 | 371 | baseResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); |
342 | 372 | baseResponse.setErrormsg("参数错误"); |
343 | 373 | return baseResponse; |
344 | 374 | } |
345 | 375 | Page<Map<String,Object>> page=new Page<>(current,size); |
346 | 376 | QueryWrapper queryWrapper=new QueryWrapper<>(); |
347 | - queryWrapper.eq("dtid", doctorId); | |
377 | + if(null!=did){ | |
378 | + //科室下的患者 | |
379 | + queryWrapper.eq("did", did); | |
380 | + }else { | |
381 | + //医生下的患者 | |
382 | + queryWrapper.eq("dtid", doctorId); | |
383 | + } | |
348 | 384 | if (StringUtil.isNotEmpty(synthesisQuery)){ |
349 | 385 | queryWrapper.like("pname", synthesisQuery); |
350 | 386 | } |
... | ... | @@ -359,24 +395,6 @@ |
359 | 395 | } |
360 | 396 | page.setRecords(list); |
361 | 397 | baseResponse.setObject(page); |
362 | - return baseResponse; | |
363 | - } | |
364 | - | |
365 | - /** | |
366 | - * 进入医生回访聊天 | |
367 | - * @param request | |
368 | - * @return | |
369 | - */ | |
370 | - @GetMapping("getDoctorCallback") | |
371 | - @TokenRequired | |
372 | - public BaseResponse getDoctorCallback(HttpServletRequest request){ | |
373 | - BaseResponse baseResponse =new BaseResponse(); | |
374 | - Map<String,Object> param=new HashMap<>(); | |
375 | - param.put("vtype",998); | |
376 | - List<LymsDict> dLst=lymsDictService.listByMap(param); | |
377 | - if(dLst.size()>0){ | |
378 | - baseResponse.setObject(dLst.get(0)); | |
379 | - } | |
380 | 398 | return baseResponse; |
381 | 399 | } |
382 | 400 |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java
View file @
70edb9a
... | ... | @@ -50,6 +50,8 @@ |
50 | 50 | |
51 | 51 | @Autowired |
52 | 52 | private AppgetdoctorlistInfoService appgetdoctorlistInfoService; |
53 | + @Autowired | |
54 | + private LymsChatgroupService lymsChatgroupService; | |
53 | 55 | |
54 | 56 | /** |
55 | 57 | * 获取医生列表 |
... | ... | @@ -313,6 +315,36 @@ |
313 | 315 | boolean f=lymsDoctorService.updateById(doctor); |
314 | 316 | baseResponse.setErrorcode(f==true?0:1); |
315 | 317 | baseResponse.setErrormsg(f==true?"成功":"失败"); |
318 | + return baseResponse; | |
319 | + } | |
320 | + /** | |
321 | + * 查询科室值班医生 | |
322 | + * @param groupId 群组ID | |
323 | + * @return | |
324 | + */ | |
325 | + @GetMapping("getAdminDoctor") | |
326 | + @TokenRequired | |
327 | + public BaseResponse getAdminDoctor(Integer groupId){ | |
328 | + BaseResponse baseResponse=new BaseResponse(); | |
329 | + List<LymsDoctor> doctorAminList= new ArrayList<>(); | |
330 | + try { | |
331 | + final LymsChatgroup chatgroup = lymsChatgroupService.getOne(new QueryWrapper<LymsChatgroup>() | |
332 | + .lambda().eq(LymsChatgroup::getHxgroupid, groupId)); | |
333 | + if(null!=chatgroup) { | |
334 | + final LymsDoctor lymsDoctor = lymsDoctorService.getOne(new QueryWrapper<LymsDoctor>() | |
335 | + .lambda().eq(LymsDoctor::getDlogin, chatgroup.getTarget())); | |
336 | + if (null!=lymsDoctor) { | |
337 | + doctorAminList = lymsDoctorService.list(new QueryWrapper<LymsDoctor>() | |
338 | + .lambda().eq(LymsDoctor::getDpid, lymsDoctor.getDpid()) | |
339 | + .eq(LymsDoctor::getAdminType, 1)); | |
340 | + } | |
341 | + | |
342 | + } | |
343 | + } catch (Exception e) { | |
344 | + e.printStackTrace(); | |
345 | + } | |
346 | + baseResponse.setObject(doctorAminList); | |
347 | + baseResponse.setErrormsg("成功"); | |
316 | 348 | return baseResponse; |
317 | 349 | } |
318 | 350 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/TkRecordController.java
View file @
70edb9a
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | |
3 | 3 | import com.alibaba.fastjson.JSONArray; |
4 | 4 | import com.alibaba.fastjson.JSONObject; |
5 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
5 | 6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
6 | 7 | import com.lyms.talkonlineweb.annotation.TokenRequired; |
7 | 8 | import com.lyms.talkonlineweb.domain.*; |
8 | 9 | |
... | ... | @@ -11,10 +12,12 @@ |
11 | 12 | import com.lyms.talkonlineweb.util.HXService; |
12 | 13 | import com.lyms.talkonlineweb.util.StringUtil; |
13 | 14 | import lombok.extern.log4j.Log4j2; |
15 | +import org.apache.commons.lang3.StringUtils; | |
14 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
15 | 17 | import org.springframework.validation.annotation.Validated; |
16 | 18 | import org.springframework.web.bind.annotation.*; |
17 | 19 | |
20 | +import java.util.ArrayList; | |
18 | 21 | import java.util.List; |
19 | 22 | |
20 | 23 | @RestController |
... | ... | @@ -80,6 +83,11 @@ |
80 | 83 | LymsChatgroup group =new LymsChatgroup(); |
81 | 84 | LymsDoctor doctor=lymsDoctorService.getById(tkrecord.getDid()); |
82 | 85 | LymsPatient patient=lymsPatientService.getById(tkrecord.getPid()); |
86 | + group.setOwnerk("test"); | |
87 | + List<String> adminDlogins=new ArrayList<>(); | |
88 | + adminDlogins.add(group.getFromp()); | |
89 | + List<String> groupnames=new ArrayList<>(); | |
90 | + groupnames.add(patient.getPname()); | |
83 | 91 | //患者注册环信 |
84 | 92 | if (StringUtil.isEmpty(patient.getHxid())) { |
85 | 93 | JSONObject json = hxService.addUser(patient.getIdno(), Constant.COMMON_PASSWD, patient.getPname()); |
86 | 94 | |
87 | 95 | |
88 | 96 | |
89 | 97 | |
90 | 98 | |
... | ... | @@ -89,28 +97,45 @@ |
89 | 97 | lymsPatientService.updateById(patient); |
90 | 98 | } |
91 | 99 | } |
92 | - //医生注册环信 | |
93 | - if (StringUtil.isEmpty(doctor.getHxid())) { | |
94 | - JSONObject json = hxService.addUser(doctor.getDlogin(), Constant.COMMON_PASSWD, doctor.getDname()); | |
95 | - JSONArray rArr = json.getJSONArray("entities"); | |
96 | - if (rArr.size() > 0) { | |
97 | - doctor.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
98 | - lymsDoctorService.updateById(doctor); | |
100 | + //查询值班医生 | |
101 | + List<LymsDoctor> doctorAminList= lymsDoctorService.list(new QueryWrapper<LymsDoctor>() | |
102 | + .lambda().eq(LymsDoctor::getDpid, doctor.getDpid()) | |
103 | + .eq(LymsDoctor::getAdminType, 1)); | |
104 | + //科室值班医生注册环信 | |
105 | + for (LymsDoctor lymsDoctor : doctorAminList) { | |
106 | + if(StringUtil.isEmpty(lymsDoctor.getHxid())) { | |
107 | + JSONObject json = hxService.addUser(lymsDoctor.getDlogin(), Constant.COMMON_PASSWD, lymsDoctor.getDname()); | |
108 | + JSONArray rArr = json.getJSONArray("entities"); | |
109 | + if (rArr.size() > 0) { | |
110 | + lymsDoctor.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
111 | + lymsDoctorService.updateById(lymsDoctor); | |
112 | + } | |
99 | 113 | } |
114 | + adminDlogins.add(lymsDoctor.getDlogin()); | |
115 | + groupnames.add(lymsDoctor.getDname()); | |
100 | 116 | } |
101 | - group.setFromp(patient.getIdno()); | |
102 | - group.setTarget(doctor.getDlogin()); | |
103 | - group.setOwnerk("test"); | |
117 | + if ( ! adminDlogins.contains(doctor.getDlogin())) { | |
118 | + //医生注册环信 | |
119 | + if (StringUtil.isEmpty(doctor.getHxid())) { | |
120 | + JSONObject json = hxService.addUser(doctor.getDlogin(), Constant.COMMON_PASSWD, doctor.getDname()); | |
121 | + JSONArray rArr = json.getJSONArray("entities"); | |
122 | + if (rArr.size() > 0) { | |
123 | + doctor.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
124 | + lymsDoctorService.updateById(doctor); | |
125 | + adminDlogins.add(doctor.getDlogin()); | |
126 | + groupnames.add(doctor.getDname()); | |
127 | + } | |
128 | + } | |
129 | + } | |
104 | 130 | |
105 | - log.info("创建环信组:{} from:{} target:{}", group.getOwnerk(), group.getFromp(), group.getTarget()); | |
106 | - JSONObject rJson = hxService.addChatGroups(group.getFromp() + "," + group.getTarget(), group.getOwnerk(), new String[]{group.getFromp(), group.getTarget()}); | |
131 | + | |
132 | + log.info("创建环信组:{} description:{}", group.getOwnerk(), StringUtils.join(adminDlogins.toArray(), ",")); | |
133 | + JSONObject rJson = hxService.addChatGroups(StringUtils.join(adminDlogins.toArray(), ","), group.getOwnerk(), (String[]) adminDlogins.toArray()); | |
107 | 134 | log.info("rJson:" + rJson); |
108 | 135 | group.setHxgroupid(rJson.getJSONObject("data").getString("groupid")); |
109 | - group.setDescription(group.getFromp() + "," + group.getTarget()); | |
110 | -// group.setGroupname(group.getFromp() + "," + group.getTarget()); | |
111 | - | |
136 | + group.setDescription(StringUtils.join(adminDlogins.toArray(), ",")); | |
112 | 137 | //环信群组名称更改为姓名串-用于PC端问诊展示 |
113 | - group.setGroupname(patient.getPname() + "," + doctor.getDname()); | |
138 | + group.setGroupname(StringUtils.join(groupnames.toArray(), ",")); | |
114 | 139 | if(null==tkrecord.getType()) { |
115 | 140 | lymsChatgroupService.saveOrUpdate(group); |
116 | 141 | lymsTkrecordService.save(tkrecord); |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctor.java
View file @
70edb9a
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsChatgroupMapper.java
View file @
70edb9a
talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/DateUtil.java
View file @
70edb9a
... | ... | @@ -37,6 +37,7 @@ |
37 | 37 | public static SimpleDateFormat y_m = new SimpleDateFormat("yyyy年MM月"); |
38 | 38 | |
39 | 39 | public static SimpleDateFormat y_m_d1 = new SimpleDateFormat("yyyy年MM月dd日"); |
40 | + public static SimpleDateFormat y_m_d2 = new SimpleDateFormat("yyyy年MM月dd日 HH点mm分ss秒"); | |
40 | 41 | public static SimpleDateFormat md = new SimpleDateFormat("MM-dd"); |
41 | 42 | public static SimpleDateFormat m_d = new SimpleDateFormat("MM/dd"); |
42 | 43 | public static SimpleDateFormat y_m_d_h_m_s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
... | ... | @@ -64,7 +65,26 @@ |
64 | 65 | public static String getYyyyMmDdHhMmSs(Date datetime) { |
65 | 66 | return getDateTime(datetime, YYYY_MM_DD_HH_MM_SS); |
66 | 67 | } |
67 | - | |
68 | + public static String getyyyy_MM_dd1(Date d) { | |
69 | + if (d == null) { | |
70 | + return null; | |
71 | + } | |
72 | + try { | |
73 | + return y_m_d1.format(d); | |
74 | + } catch (Exception e) { | |
75 | + return null; | |
76 | + } | |
77 | + } | |
78 | + public static String getyyyy_MM_dd_HH_mm_ss(Date d) { | |
79 | + if (d == null) { | |
80 | + return null; | |
81 | + } | |
82 | + try { | |
83 | + return y_m_d2.format(d); | |
84 | + } catch (Exception e) { | |
85 | + return null; | |
86 | + } | |
87 | + } | |
68 | 88 | public static Date parseYMD(String s) { |
69 | 89 | if (s == null) { |
70 | 90 | return null; |
... | ... | @@ -73,6 +93,34 @@ |
73 | 93 | try { |
74 | 94 | |
75 | 95 | return y_m_d.parse(s); |
96 | + } catch (Exception e) { | |
97 | + return null; | |
98 | + } finally { | |
99 | + lock.unlock(); | |
100 | + } | |
101 | + } | |
102 | + public static Date parseYMDHMS(String s) { | |
103 | + if (s == null) { | |
104 | + return null; | |
105 | + } | |
106 | + lock.lock(); | |
107 | + try { | |
108 | + | |
109 | + return y_m_d_h_m_s.parse(s); | |
110 | + } catch (Exception e) { | |
111 | + return null; | |
112 | + } finally { | |
113 | + lock.unlock(); | |
114 | + } | |
115 | + } | |
116 | + public static Date parseYMDHM(String s) { | |
117 | + if (s == null) { | |
118 | + return null; | |
119 | + } | |
120 | + lock.lock(); | |
121 | + try { | |
122 | + | |
123 | + return y_m_d_h_m1.parse(s); | |
76 | 124 | } catch (Exception e) { |
77 | 125 | return null; |
78 | 126 | } finally { |