Commit 4f159d442118692617b97c52f12144515af2a124
1 parent
a6872e9fd3
Exists in
master
and in
1 other branch
医生信息BUG
Showing 1 changed file with 59 additions and 38 deletions
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ChatGroupController.java
View file @
4f159d4
| ... | ... | @@ -2,15 +2,10 @@ |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 5 | -import com.lyms.talkonlineweb.domain.LymsChatgroup; | |
| 6 | -import com.lyms.talkonlineweb.domain.LymsDoctor; | |
| 7 | -import com.lyms.talkonlineweb.domain.LymsMessage; | |
| 8 | -import com.lyms.talkonlineweb.domain.PatientInfo; | |
| 5 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
| 6 | +import com.lyms.talkonlineweb.domain.*; | |
| 9 | 7 | import com.lyms.talkonlineweb.result.BaseResponse; |
| 10 | -import com.lyms.talkonlineweb.service.LymsChatgroupService; | |
| 11 | -import com.lyms.talkonlineweb.service.LymsDoctorService; | |
| 12 | -import com.lyms.talkonlineweb.service.LymsMessageService; | |
| 13 | -import com.lyms.talkonlineweb.service.PatientInfoService; | |
| 8 | +import com.lyms.talkonlineweb.service.*; | |
| 14 | 9 | import com.lyms.talkonlineweb.util.HXService; |
| 15 | 10 | import lombok.extern.log4j.Log4j2; |
| 16 | 11 | import org.springframework.beans.BeanUtils; |
| 17 | 12 | |
| 18 | 13 | |
| 19 | 14 | |
| 20 | 15 | |
| 21 | 16 | |
| 22 | 17 | |
| ... | ... | @@ -39,31 +34,36 @@ |
| 39 | 34 | |
| 40 | 35 | @Autowired |
| 41 | 36 | private LymsDoctorService lymsDoctorService; |
| 42 | - | |
| 43 | 37 | @Autowired |
| 38 | + private LymsHdepartService lymsHdepartService; | |
| 39 | + @Autowired | |
| 40 | + private LymsDictService lymsDictService; | |
| 41 | + @Autowired | |
| 44 | 42 | private HXService hxService; |
| 43 | + | |
| 45 | 44 | /** |
| 46 | 45 | * 添加或删除聊天组 |
| 46 | + * | |
| 47 | 47 | * @param group |
| 48 | 48 | * @return |
| 49 | 49 | */ |
| 50 | 50 | @PostMapping("saveChatGroup") |
| 51 | - public BaseResponse saveChatGroup(LymsChatgroup group){ | |
| 52 | - BaseResponse baseResponse=new BaseResponse(); | |
| 53 | - List<LymsChatgroup> gLst=lymsChatgroupService.list(Wrappers.query(group)); | |
| 54 | - if(group.getOwnerk()==null){ | |
| 51 | + public BaseResponse saveChatGroup(LymsChatgroup group) { | |
| 52 | + BaseResponse baseResponse = new BaseResponse(); | |
| 53 | + List<LymsChatgroup> gLst = lymsChatgroupService.list(Wrappers.query(group)); | |
| 54 | + if (group.getOwnerk() == null) { | |
| 55 | 55 | group.setOwnerk("test"); |
| 56 | 56 | } |
| 57 | - if(gLst.size()>0){ | |
| 58 | - LymsChatgroup group2=gLst.get(0); | |
| 59 | - group=group2; | |
| 60 | - }else{ | |
| 61 | - log.info("创建环信组:{} from:{} target:{}",group.getOwnerk(),group.getFromp(),group.getTarget()); | |
| 62 | - JSONObject rJson=hxService.addChatGroups(group.getFromp()+","+group.getTarget(),group.getOwnerk(), new String[]{group.getFromp(), group.getTarget()}); | |
| 63 | - log.info("rJson:"+rJson); | |
| 57 | + if (gLst.size() > 0) { | |
| 58 | + LymsChatgroup group2 = gLst.get(0); | |
| 59 | + group = group2; | |
| 60 | + } else { | |
| 61 | + log.info("创建环信组:{} from:{} target:{}", group.getOwnerk(), group.getFromp(), group.getTarget()); | |
| 62 | + JSONObject rJson = hxService.addChatGroups(group.getFromp() + "," + group.getTarget(), group.getOwnerk(), new String[]{group.getFromp(), group.getTarget()}); | |
| 63 | + log.info("rJson:" + rJson); | |
| 64 | 64 | group.setHxgroupid(rJson.getJSONObject("data").getString("groupid")); |
| 65 | - group.setDescription(group.getFromp()+","+group.getTarget()); | |
| 66 | - group.setGroupname(group.getFromp()+","+group.getTarget()); | |
| 65 | + group.setDescription(group.getFromp() + "," + group.getTarget()); | |
| 66 | + group.setGroupname(group.getFromp() + "," + group.getTarget()); | |
| 67 | 67 | lymsChatgroupService.saveOrUpdate(group); |
| 68 | 68 | } |
| 69 | 69 | baseResponse.setObject(group); |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | |
| 75 | 75 | |
| ... | ... | @@ -72,37 +72,58 @@ |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * 保存消息记录 |
| 75 | + * | |
| 75 | 76 | * @param message |
| 76 | 77 | * @return |
| 77 | 78 | */ |
| 78 | 79 | @PostMapping("saveMsg") |
| 79 | - public BaseResponse saveMsg(LymsMessage message){ | |
| 80 | - BaseResponse baseResponse=new BaseResponse(); | |
| 81 | - boolean f=lymsMessageService.saveOrUpdate(message); | |
| 82 | - baseResponse.setErrorcode(f==true?0:1); | |
| 80 | + public BaseResponse saveMsg(LymsMessage message) { | |
| 81 | + BaseResponse baseResponse = new BaseResponse(); | |
| 82 | + boolean f = lymsMessageService.saveOrUpdate(message); | |
| 83 | + baseResponse.setErrorcode(f == true ? 0 : 1); | |
| 83 | 84 | return baseResponse; |
| 84 | 85 | } |
| 85 | 86 | |
| 86 | 87 | @GetMapping("getPatDoc") |
| 87 | - public BaseResponse getPatDoc(LymsChatgroup chatgroup){ | |
| 88 | - log.info(">>>>>>>>>>chatgroup:"+chatgroup); | |
| 89 | - BaseResponse baseResponse=new BaseResponse(); | |
| 90 | - Map<String,Object> rs=new HashMap<>(); | |
| 88 | + public BaseResponse getPatDoc(LymsChatgroup chatgroup) { | |
| 89 | + log.info(">>>>>>>>>>chatgroup:" + chatgroup); | |
| 90 | + BaseResponse baseResponse = new BaseResponse(); | |
| 91 | + Map<String, Object> rs = new HashMap<>(); | |
| 91 | 92 | |
| 92 | - chatgroup=lymsChatgroupService.getOne(Wrappers.query(chatgroup)); | |
| 93 | - LymsDoctor doctor=new LymsDoctor(); | |
| 94 | - doctor=lymsDoctorService.getOne(Wrappers.query(doctor).eq("dlogin",chatgroup.getTarget())); | |
| 93 | + chatgroup = lymsChatgroupService.getOne(Wrappers.query(chatgroup)); | |
| 94 | + LymsDoctor doctor = new LymsDoctor(); | |
| 95 | + doctor = lymsDoctorService.getOne(Wrappers.query(doctor).eq("dlogin", chatgroup.getTarget())); | |
| 95 | 96 | |
| 96 | - PatientInfo patientInfo=new PatientInfo(); | |
| 97 | + PatientInfo patientInfo = new PatientInfo(); | |
| 97 | 98 | patientInfo.setDid(doctor.getDpid()); |
| 98 | 99 | patientInfo.setIdno(chatgroup.getFromp()); |
| 99 | - List<PatientInfo> pLst=patientInfoService.list(Wrappers.query(patientInfo)); | |
| 100 | - | |
| 101 | - rs.put("doctor",doctor); | |
| 102 | - rs.put("patient",pLst); | |
| 100 | + List<PatientInfo> pLst = patientInfoService.list(Wrappers.query(patientInfo)); | |
| 101 | + conDocCode(doctor); | |
| 102 | + rs.put("doctor", doctor); | |
| 103 | + rs.put("patient", pLst); | |
| 103 | 104 | baseResponse.setObject(rs); |
| 104 | 105 | |
| 105 | 106 | return baseResponse; |
| 107 | + } | |
| 108 | + | |
| 109 | + public void conDocCode(LymsDoctor d) { | |
| 110 | + Map param = new HashMap(); | |
| 111 | + param.put("vtype", 4); | |
| 112 | + List<LymsDict> dLst = lymsDictService.listByMap(param); | |
| 113 | + param.clear(); | |
| 114 | + param.put("did", d.getDpid()); | |
| 115 | + List<LymsHdepart> departLst = lymsHdepartService.listByMap(param); | |
| 116 | + if (departLst.size() > 0) { | |
| 117 | + LymsHdepart depart = departLst.get(0); | |
| 118 | + d.setHname(depart.getHname()); | |
| 119 | + d.setDdname(depart.getDname()); | |
| 120 | + dLst.forEach(dd -> { | |
| 121 | + if (dd.getCode() == d.getLvl()) { | |
| 122 | + d.setLname(dd.getValue()); | |
| 123 | + } | |
| 124 | + }); | |
| 125 | + } | |
| 126 | + | |
| 106 | 127 | } |
| 107 | 128 | } |