Commit 9ff8e4eaff4fed1a0f82a88c34c1425e6fdaf347
1 parent
3598907a5f
Exists in
master
科室值班医生/护士 ,回访功能
Showing 10 changed files with 156 additions and 34 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/LymsChatgroup.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctor.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsMessage.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsChatgroupMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsMessageMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsMessageService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsMessageServiceImpl.java
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ChatGroupController.java
View file @
9ff8e4e
... | ... | @@ -62,6 +62,10 @@ |
62 | 62 | |
63 | 63 | @Autowired |
64 | 64 | private AppgetdoctorlistInfoService appgetdoctorlistInfoService; |
65 | + @Autowired | |
66 | + private LymsChatInfoService lymsChatInfoService; | |
67 | + @Autowired | |
68 | + private LymsReturnVisitRecordService lymsReturnVisitRecordService; | |
65 | 69 | |
66 | 70 | /** |
67 | 71 | * 添加或删除聊天组 |
... | ... | @@ -80,6 +84,24 @@ |
80 | 84 | if (gLst.size() > 0) { |
81 | 85 | LymsChatgroup group2 = gLst.get(0); |
82 | 86 | group = group2; |
87 | + //回访的状态才去执行 | |
88 | + if (1==group2.getType()) { | |
89 | + group2.setStat(0); | |
90 | + //修改群组状态 | |
91 | + lymsChatgroupService.updateById(group2); | |
92 | + //添加回访记录 | |
93 | + LymsPatient patient= lymsPatientService.getOne(new QueryWrapper<LymsPatient>() | |
94 | + .lambda().eq(LymsPatient::getIdno, group.getFromp())); | |
95 | + LymsDoctor doctor= lymsDoctorService.getOne(new QueryWrapper<LymsDoctor>() | |
96 | + .lambda().eq(LymsDoctor::getDlogin, group.getTarget())); | |
97 | + LymsReturnVisitRecord returnVisitRecord=new LymsReturnVisitRecord(); | |
98 | + returnVisitRecord.setDlogins(doctor.getDlogin()); | |
99 | + returnVisitRecord.setDpid(doctor.getDpid()); | |
100 | + returnVisitRecord.setIdno(patient.getIdno()); | |
101 | + returnVisitRecord.setType(1); | |
102 | + returnVisitRecord.setHxgroupid(group2.getHxgroupid()); | |
103 | + lymsReturnVisitRecordService.save(returnVisitRecord); | |
104 | + } | |
83 | 105 | } else { |
84 | 106 | LymsPatient patient= lymsPatientService.getOne(new QueryWrapper<LymsPatient>() |
85 | 107 | .lambda().eq(LymsPatient::getIdno, group.getFromp())); |
86 | 108 | |
87 | 109 | |
... | ... | @@ -123,14 +145,14 @@ |
123 | 145 | if (rArr.size() > 0) { |
124 | 146 | doctor.setHxid(rArr.getJSONObject(0).getString("uuid")); |
125 | 147 | lymsDoctorService.updateById(doctor); |
126 | - adminDlogins.add(doctor.getDlogin()); | |
127 | - groupnames.add(doctor.getDname()); | |
128 | 148 | } |
149 | + adminDlogins.add(doctor.getDlogin()); | |
150 | + groupnames.add(doctor.getDname()); | |
129 | 151 | } |
130 | 152 | } |
131 | 153 | |
132 | 154 | log.info("创建环信组:{} description:{}", group.getOwnerk(), StringUtils.join(adminDlogins.toArray(), ",")); |
133 | - JSONObject rJson = hxService.addChatGroups(StringUtils.join(adminDlogins.toArray(), ","), group.getOwnerk(), (String[]) adminDlogins.toArray()); | |
155 | + JSONObject rJson = hxService.addChatGroups(StringUtils.join(adminDlogins.toArray(), ","), group.getOwnerk(), adminDlogins.toArray(new String[adminDlogins.size()])); | |
134 | 156 | log.info("rJson:" + rJson); |
135 | 157 | group.setHxgroupid(rJson.getJSONObject("data").getString("groupid")); |
136 | 158 | group.setDescription(StringUtils.join(adminDlogins.toArray(), ",")); |
137 | 159 | |
... | ... | @@ -355,11 +377,11 @@ |
355 | 377 | } |
356 | 378 | /** |
357 | 379 | * 医生端获取自己的患者列表 |
358 | - * @param doctorId | |
380 | + * @param doctorId 医生id | |
359 | 381 | * @param current 页数 |
360 | 382 | * @param size 条数 |
361 | 383 | * @param synthesisQuery 综合筛选条件 |
362 | - * @param adminType 0:普通医生 1:科室管理员(用于问诊聊天) | |
384 | + * @param did 科室id 值班医生/值班护士 时需要传。doctorId 就不能传 | |
363 | 385 | * @return |
364 | 386 | */ |
365 | 387 | @GetMapping("getDoctorPatient") |
366 | 388 | |
367 | 389 | |
... | ... | @@ -376,13 +398,13 @@ |
376 | 398 | QueryWrapper queryWrapper=new QueryWrapper<>(); |
377 | 399 | if(null!=did){ |
378 | 400 | //科室下的患者 |
379 | - queryWrapper.eq("did", did); | |
401 | + queryWrapper.eq("pc.did", did); | |
380 | 402 | }else { |
381 | 403 | //医生下的患者 |
382 | - queryWrapper.eq("dtid", doctorId); | |
404 | + queryWrapper.eq("pc.dtid", doctorId); | |
383 | 405 | } |
384 | 406 | if (StringUtil.isNotEmpty(synthesisQuery)){ |
385 | - queryWrapper.like("pname", synthesisQuery); | |
407 | + queryWrapper.like("p.pname", synthesisQuery); | |
386 | 408 | } |
387 | 409 | List<Map<String,Object>> list=lymsChatgroupService.getDoctorPatient(page,queryWrapper); |
388 | 410 | for (Map<String, Object> map : list) { |
... | ... | @@ -405,7 +427,7 @@ |
405 | 427 | */ |
406 | 428 | @GetMapping("getChatStat") |
407 | 429 | @TokenRequired |
408 | - public BaseResponse getChatStat(Integer groupId){ | |
430 | + public BaseResponse getChatStat(String groupId){ | |
409 | 431 | BaseResponse baseResponse =new BaseResponse(); |
410 | 432 | try { |
411 | 433 | final LymsChatgroup chatgroup = lymsChatgroupService.getOne(new QueryWrapper<LymsChatgroup>() |
... | ... | @@ -421,6 +443,62 @@ |
421 | 443 | } |
422 | 444 | return baseResponse; |
423 | 445 | } |
424 | - | |
446 | + /** | |
447 | + * 添加/修改 回访聊天信息自动回复话术 | |
448 | + * @param request | |
449 | + * @return | |
450 | + */ | |
451 | + @PostMapping("addOrUpdateLymsChatInfo") | |
452 | + @TokenRequired | |
453 | + public BaseResponse addOrUpdateLymsChatInfo(@RequestBody LymsChatInfo chatInfo){ | |
454 | + BaseResponse baseResponse =new BaseResponse(); | |
455 | + try { | |
456 | + final boolean b = lymsChatInfoService.saveOrUpdate(chatInfo); | |
457 | + baseResponse.setErrorcode(b?0:1); | |
458 | + baseResponse.setErrormsg(b?"成功":"失败"); | |
459 | + } catch (Exception e) { | |
460 | + e.printStackTrace(); | |
461 | + } | |
462 | + return baseResponse; | |
463 | + } | |
464 | + /** | |
465 | + * 删除 回访聊天信息自动回复话术 | |
466 | + * @param request | |
467 | + * @return | |
468 | + */ | |
469 | + @DeleteMapping("delLymsChatInfo") | |
470 | + @TokenRequired | |
471 | + public BaseResponse delLymsChatInfo(Integer id){ | |
472 | + BaseResponse baseResponse =new BaseResponse(); | |
473 | + try { | |
474 | + final boolean b = lymsChatInfoService.removeById(id); | |
475 | + baseResponse.setErrorcode(b?0:1); | |
476 | + baseResponse.setErrormsg(b?"成功":"失败"); | |
477 | + } catch (Exception e) { | |
478 | + e.printStackTrace(); | |
479 | + } | |
480 | + return baseResponse; | |
481 | + } | |
482 | + /** | |
483 | + * 查询列表 回访聊天信息自动回复话术 | |
484 | + * @param request | |
485 | + * @return | |
486 | + */ | |
487 | + @GetMapping("getLymsChatInfo") | |
488 | + @TokenRequired | |
489 | + public BaseResponse getLymsChatInfo(LymsChatInfo chatInfo, int current, int size){ | |
490 | + BaseResponse baseResponse =new BaseResponse(); | |
491 | + try { | |
492 | + QueryWrapper<LymsChatInfo> queryWrapper = Wrappers.query(chatInfo); | |
493 | + Page<LymsChatInfo> page = new Page<>(current, size); | |
494 | + Page<LymsChatInfo> patientPagePage = lymsChatInfoService.page(page,queryWrapper); | |
495 | + baseResponse.setObject(patientPagePage); | |
496 | + baseResponse.setErrorcode(0); | |
497 | + baseResponse.setErrormsg("成功"); | |
498 | + } catch (Exception e) { | |
499 | + e.printStackTrace(); | |
500 | + } | |
501 | + return baseResponse; | |
502 | + } | |
425 | 503 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java
View file @
9ff8e4e
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | import com.alibaba.fastjson.JSONObject; |
5 | 5 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
6 | 6 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
7 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
7 | 8 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
8 | 9 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
9 | 10 | import com.lyms.talkonlineweb.annotation.TokenRequired; |
10 | 11 | |
11 | 12 | |
... | ... | @@ -328,21 +329,26 @@ |
328 | 329 | */ |
329 | 330 | @GetMapping("getAdminDoctor") |
330 | 331 | @TokenRequired |
331 | - public BaseResponse getAdminDoctor(Integer groupId){ | |
332 | + public BaseResponse getAdminDoctor(String groupId){ | |
332 | 333 | BaseResponse baseResponse=new BaseResponse(); |
333 | 334 | List<LymsDoctor> doctorAminList= new ArrayList<>(); |
334 | 335 | try { |
335 | 336 | final LymsChatgroup chatgroup = lymsChatgroupService.getOne(new QueryWrapper<LymsChatgroup>() |
336 | 337 | .lambda().eq(LymsChatgroup::getHxgroupid, groupId)); |
337 | 338 | if(null!=chatgroup) { |
338 | - final LymsDoctor lymsDoctor = lymsDoctorService.getOne(new QueryWrapper<LymsDoctor>() | |
339 | - .lambda().eq(LymsDoctor::getDlogin, chatgroup.getTarget())); | |
340 | - if (null!=lymsDoctor) { | |
341 | - doctorAminList = lymsDoctorService.list(new QueryWrapper<LymsDoctor>() | |
342 | - .lambda().eq(LymsDoctor::getDpid, lymsDoctor.getDpid()) | |
343 | - .eq(LymsDoctor::getAdminType, 1)); | |
344 | - } | |
339 | + if (StringUtil.isNotEmpty(chatgroup.getDescription())) { | |
340 | + List<String> list = Arrays.asList(chatgroup.getDescription().split(",")); | |
341 | + if(CollectionUtils.isNotEmpty(list)){ | |
342 | + for (int i=1;i<list.size();i++) { | |
343 | + final LymsDoctor lymsDoctor = lymsDoctorService.getOne(new QueryWrapper<LymsDoctor>() | |
344 | + .lambda().eq(LymsDoctor::getDlogin, list.get(i))); | |
345 | + if(null!=lymsDoctor){ | |
346 | + doctorAminList.add(lymsDoctor); | |
347 | + } | |
348 | + } | |
349 | + } | |
345 | 350 | |
351 | + } | |
346 | 352 | } |
347 | 353 | } catch (Exception e) { |
348 | 354 | e.printStackTrace(); |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/TkRecordController.java
View file @
9ff8e4e
... | ... | @@ -18,6 +18,7 @@ |
18 | 18 | import org.springframework.web.bind.annotation.*; |
19 | 19 | |
20 | 20 | import java.util.ArrayList; |
21 | +import java.util.Arrays; | |
21 | 22 | import java.util.List; |
22 | 23 | |
23 | 24 | @RestController |
... | ... | @@ -41,6 +42,8 @@ |
41 | 42 | private LymsDoctorService lymsDoctorService; |
42 | 43 | @Autowired |
43 | 44 | private LymsPatientService lymsPatientService; |
45 | + @Autowired | |
46 | + private LymsReturnVisitRecordService lymsReturnVisitRecordService; | |
44 | 47 | |
45 | 48 | /** |
46 | 49 | * 保存问诊记录 |
... | ... | @@ -85,7 +88,7 @@ |
85 | 88 | LymsPatient patient=lymsPatientService.getById(tkrecord.getPid()); |
86 | 89 | group.setOwnerk("test"); |
87 | 90 | List<String> adminDlogins=new ArrayList<>(); |
88 | - adminDlogins.add(group.getFromp()); | |
91 | + adminDlogins.add(patient.getIdno()); | |
89 | 92 | List<String> groupnames=new ArrayList<>(); |
90 | 93 | groupnames.add(patient.getPname()); |
91 | 94 | //患者注册环信 |
... | ... | @@ -100,7 +103,7 @@ |
100 | 103 | //查询值班医生/值班护士 |
101 | 104 | List<LymsDoctor> doctorAminList= lymsDoctorService.list(new QueryWrapper<LymsDoctor>() |
102 | 105 | .lambda().eq(LymsDoctor::getDpid, doctor.getDpid()) |
103 | - .in(LymsDoctor::getAdminType, new int[]{1,2})); | |
106 | + .in(LymsDoctor::getAdminType, Arrays.asList(1,2))); | |
104 | 107 | //科室值班医生注册环信 |
105 | 108 | for (LymsDoctor lymsDoctor : doctorAminList) { |
106 | 109 | if(StringUtil.isEmpty(lymsDoctor.getHxid())) { |
107 | 110 | |
108 | 111 | |
109 | 112 | |
110 | 113 | |
... | ... | @@ -122,26 +125,35 @@ |
122 | 125 | if (rArr.size() > 0) { |
123 | 126 | doctor.setHxid(rArr.getJSONObject(0).getString("uuid")); |
124 | 127 | lymsDoctorService.updateById(doctor); |
125 | - adminDlogins.add(doctor.getDlogin()); | |
126 | - groupnames.add(doctor.getDname()); | |
127 | 128 | } |
128 | 129 | } |
130 | + adminDlogins.add(doctor.getDlogin()); | |
131 | + groupnames.add(doctor.getDname()); | |
129 | 132 | } |
130 | 133 | |
131 | 134 | |
132 | 135 | log.info("创建环信组:{} description:{}", group.getOwnerk(), StringUtils.join(adminDlogins.toArray(), ",")); |
133 | - JSONObject rJson = hxService.addChatGroups(StringUtils.join(adminDlogins.toArray(), ","), group.getOwnerk(), (String[]) adminDlogins.toArray()); | |
136 | + JSONObject rJson = hxService.addChatGroups(StringUtils.join(adminDlogins.toArray(), ","), group.getOwnerk(), adminDlogins.toArray(new String[adminDlogins.size()])); | |
134 | 137 | log.info("rJson:" + rJson); |
135 | 138 | group.setHxgroupid(rJson.getJSONObject("data").getString("groupid")); |
136 | 139 | group.setDescription(StringUtils.join(adminDlogins.toArray(), ",")); |
137 | 140 | //环信群组名称更改为姓名串-用于PC端问诊展示 |
138 | 141 | group.setGroupname(StringUtils.join(groupnames.toArray(), ",")); |
142 | + group.setFromp(patient.getIdno()); | |
143 | + group.setTarget(doctor.getDlogin()); | |
139 | 144 | if(null==tkrecord.getType()) { |
140 | 145 | lymsChatgroupService.saveOrUpdate(group); |
141 | 146 | lymsTkrecordService.save(tkrecord); |
142 | 147 | }else { |
143 | 148 | group.setType(1); |
144 | 149 | lymsChatgroupService.saveOrUpdate(group); |
150 | + LymsReturnVisitRecord returnVisitRecord=new LymsReturnVisitRecord(); | |
151 | + returnVisitRecord.setDlogins(doctor.getDlogin()); | |
152 | + returnVisitRecord.setDpid(doctor.getDpid()); | |
153 | + returnVisitRecord.setIdno(patient.getIdno()); | |
154 | + returnVisitRecord.setType(1); | |
155 | + returnVisitRecord.setHxgroupid(rJson.getJSONObject("data").getString("groupid")); | |
156 | + lymsReturnVisitRecordService.save(returnVisitRecord); | |
145 | 157 | } |
146 | 158 | baseResponse.setObject(group); |
147 | 159 |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsChatgroup.java
View file @
9ff8e4e
... | ... | @@ -40,7 +40,7 @@ |
40 | 40 | private String ownerk; |
41 | 41 | |
42 | 42 | /** |
43 | - * 患者ID | |
43 | + * 患者身份证 | |
44 | 44 | */ |
45 | 45 | @TableField(value = "fromp") |
46 | 46 | private String fromp; |
... | ... | @@ -52,7 +52,7 @@ |
52 | 52 | private String hxgroupid; |
53 | 53 | |
54 | 54 | /** |
55 | - * 医生ID | |
55 | + * 医生登录账号 | |
56 | 56 | */ |
57 | 57 | @TableField(value = "target") |
58 | 58 | private String target; |
59 | 59 | |
... | ... | @@ -63,16 +63,14 @@ |
63 | 63 | @TableField(value = "ctime") |
64 | 64 | private Date ctime; |
65 | 65 | /** |
66 | - * 发起聊天医生回访状态 | |
67 | - * 0:未回访 | |
68 | - * 1:已回访 | |
66 | + * 组类型- | |
67 | + * 0:问诊 1:回访 | |
69 | 68 | */ |
70 | 69 | @TableField(value = "type") |
71 | 70 | private Integer type; |
72 | 71 | /** |
73 | - * 发回访状态 | |
74 | - * 0:未结束 | |
75 | - * 1:已结束 | |
72 | + * 回访状态- | |
73 | + * 0:未结束 1:已结束(type是1的时候才有用) | |
76 | 74 | */ |
77 | 75 | @TableField(value = "stat") |
78 | 76 | private Integer stat; |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctor.java
View file @
9ff8e4e
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsMessage.java
View file @
9ff8e4e
... | ... | @@ -28,7 +28,7 @@ |
28 | 28 | private String fromid; |
29 | 29 | |
30 | 30 | /** |
31 | - * 接受人员 | |
31 | + * 环信组id | |
32 | 32 | */ |
33 | 33 | @TableField(value = "targetid") |
34 | 34 | private String targetid; |
... | ... | @@ -50,6 +50,14 @@ |
50 | 50 | */ |
51 | 51 | @TableField(value = "sendtime") |
52 | 52 | private Date sendtime; |
53 | + | |
54 | + /** | |
55 | + * 发送角色 | |
56 | + * 0: 患者 1:医生 2:客服 | |
57 | + */ | |
58 | + @TableField(value = "type") | |
59 | + private Integer type; | |
60 | + | |
53 | 61 | |
54 | 62 | @TableField(exist = false) |
55 | 63 | private static final long serialVersionUID = 1L; |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsChatgroupMapper.java
View file @
9ff8e4e
... | ... | @@ -37,12 +37,15 @@ |
37 | 37 | "pc.did," , |
38 | 38 | "pc.dtid," , |
39 | 39 | "pc.dtname," , |
40 | + "d.dlogin," , | |
40 | 41 | "i.iname, " , |
42 | + "i.iid, " , | |
41 | 43 | "i.createdtime " , |
42 | 44 | "FROM " , |
43 | 45 | "(`lyms_illness` i " , |
44 | 46 | "left join `lyms_pcase` pc ON (pc.pcid = i.pcid) " , |
45 | - "left join `lyms_patient` p ON (p.id = pc.pid)) " , | |
47 | + "left join `lyms_patient` p ON (p.id = pc.pid) " , | |
48 | + "left join `lyms_doctor` d ON (d.did = pc.dtid)) " , | |
46 | 49 | "${ew.customSqlSegment}", |
47 | 50 | "</script>"}) |
48 | 51 | // "WHERE " + |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsMessageMapper.java
View file @
9ff8e4e
1 | 1 | package com.lyms.talkonlineweb.mapper; |
2 | 2 | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.toolkit.Constants; | |
3 | 5 | import com.lyms.talkonlineweb.domain.LymsMessage; |
4 | 6 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
7 | +import org.apache.ibatis.annotations.Mapper; | |
8 | +import org.apache.ibatis.annotations.Param; | |
9 | +import org.apache.ibatis.annotations.Select; | |
5 | 10 | |
11 | +import java.util.List; | |
12 | + | |
6 | 13 | /** |
7 | 14 | * @Entity com.lyms.talkonlineweb.domain.LymsMessage |
8 | 15 | */ |
16 | +@Mapper | |
9 | 17 | public interface LymsMessageMapper extends BaseMapper<LymsMessage> { |
10 | 18 | |
11 | 19 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsMessageService.java
View file @
9ff8e4e
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsMessageServiceImpl.java
View file @
9ff8e4e
1 | 1 | package com.lyms.talkonlineweb.service.impl; |
2 | 2 | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
3 | 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
4 | 5 | import com.lyms.talkonlineweb.domain.LymsMessage; |
5 | 6 | import com.lyms.talkonlineweb.service.LymsMessageService; |
6 | 7 | import com.lyms.talkonlineweb.mapper.LymsMessageMapper; |
8 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | 9 | import org.springframework.stereotype.Service; |
8 | 10 | |
11 | +import java.util.List; | |
12 | + | |
9 | 13 | /** |
10 | 14 | * |
11 | 15 | */ |
12 | 16 | @Service |
13 | 17 | public class LymsMessageServiceImpl extends ServiceImpl<LymsMessageMapper, LymsMessage> |
14 | 18 | implements LymsMessageService{ |
19 | + @Autowired | |
20 | + LymsMessageMapper lymsMessageMapper; | |
15 | 21 | |
16 | 22 | } |