Commit cf743a197fc0146b4cec72ed80f6bc53c1ae3c64

Authored by changpengfei
1 parent f874f4a232
Exists in master

根据群组获取医生和患者信息

Showing 1 changed file with 35 additions and 0 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ChatGroupController.java View file @ cf743a1
... ... @@ -3,19 +3,26 @@
3 3 import com.alibaba.fastjson.JSONObject;
4 4 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 5 import com.lyms.talkonlineweb.domain.LymsChatgroup;
  6 +import com.lyms.talkonlineweb.domain.LymsDoctor;
6 7 import com.lyms.talkonlineweb.domain.LymsMessage;
  8 +import com.lyms.talkonlineweb.domain.PatientInfo;
7 9 import com.lyms.talkonlineweb.result.BaseResponse;
8 10 import com.lyms.talkonlineweb.service.LymsChatgroupService;
  11 +import com.lyms.talkonlineweb.service.LymsDoctorService;
9 12 import com.lyms.talkonlineweb.service.LymsMessageService;
  13 +import com.lyms.talkonlineweb.service.PatientInfoService;
10 14 import com.lyms.talkonlineweb.util.HXService;
11 15 import lombok.extern.log4j.Log4j2;
12 16 import org.springframework.beans.BeanUtils;
13 17 import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.web.bind.annotation.GetMapping;
14 19 import org.springframework.web.bind.annotation.PostMapping;
15 20 import org.springframework.web.bind.annotation.RequestMapping;
16 21 import org.springframework.web.bind.annotation.RestController;
17 22  
  23 +import java.util.HashMap;
18 24 import java.util.List;
  25 +import java.util.Map;
19 26  
20 27 @RestController
21 28 @RequestMapping("chat")
... ... @@ -28,6 +35,12 @@
28 35 private LymsMessageService lymsMessageService;
29 36  
30 37 @Autowired
  38 + private PatientInfoService patientInfoService;
  39 +
  40 + @Autowired
  41 + private LymsDoctorService lymsDoctorService;
  42 +
  43 + @Autowired
31 44 private HXService hxService;
32 45 /**
33 46 * 添加或删除聊天组
... ... @@ -67,6 +80,28 @@
67 80 BaseResponse baseResponse=new BaseResponse();
68 81 boolean f=lymsMessageService.saveOrUpdate(message);
69 82 baseResponse.setErrorcode(f==true?0:1);
  83 + return baseResponse;
  84 + }
  85 +
  86 + @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<>();
  91 +
  92 + chatgroup=lymsChatgroupService.getOne(Wrappers.query(chatgroup));
  93 + LymsDoctor doctor=new LymsDoctor();
  94 + doctor=lymsDoctorService.getOne(Wrappers.query(doctor).eq("dlogin",chatgroup.getTarget()));
  95 +
  96 + PatientInfo patientInfo=new PatientInfo();
  97 + patientInfo.setDid(doctor.getDpid());
  98 + patientInfo.setIdno(chatgroup.getFromp());
  99 + List<PatientInfo> pLst=patientInfoService.list(Wrappers.query(patientInfo));
  100 +
  101 + rs.put("doctor",doctor);
  102 + rs.put("patient",pLst);
  103 + baseResponse.setObject(rs);
  104 +
70 105 return baseResponse;
71 106 }
72 107 }