From 450d87f4a1f5e8c56a8d47d97e3d3a3714524dfc Mon Sep 17 00:00:00 2001 From: cfl Date: Thu, 2 Nov 2023 09:57:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B3=A8=E5=86=8C=E7=8E=AF=E4=BF=A1=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../talkonlineweb/controller/CommonController.java | 19 +++++++++++++++++++ .../talkonlineweb/controller/DoctorController.java | 13 +++---------- .../talkonlineweb/controller/PatientController.java | 4 ++++ .../com/lyms/talkonlineweb/domain/LymsMessage.java | 2 +- .../java/com/lyms/talkonlineweb/util/HXService.java | 6 ++++-- 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/CommonController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/CommonController.java index 6ca920b..0157daf 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/CommonController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/CommonController.java @@ -1,5 +1,6 @@ package com.lyms.talkonlineweb.controller; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.fasterxml.jackson.databind.ser.Serializers; @@ -13,8 +14,10 @@ import com.lyms.talkonlineweb.service.LymsChatgroupService; import com.lyms.talkonlineweb.service.LymsDoctorService; import com.lyms.talkonlineweb.service.LymsPatientService; import com.lyms.talkonlineweb.service.LymsTkrecordService; +import com.lyms.talkonlineweb.util.HXService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -33,6 +36,22 @@ public class CommonController { private LymsDoctorService lymsDoctorService; @Autowired private LymsPatientService lymsPatientService; + @Autowired + private HXService hxService; + + @GetMapping("getToken") + @TokenRequired + public BaseResponse token(){ + String token = hxService.getToken(); + return BaseResponse.ok().setObject(token); + } + + @PostMapping("addHxUser") + @TokenRequired + public BaseResponse addHxUser(String userName,String passwd){ + JSONObject json = hxService.addUser(userName,passwd,"nickName"); + return BaseResponse.ok().setObject(json); + } @GetMapping("endTalk") @TokenRequired diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java index abac6f5..6683f2a 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java @@ -239,16 +239,9 @@ public class DoctorController { map.put("doctor",doctor); map.put("token",jwt); map.put("hxuser",hxService.getHxuser()); -// if (StringUtil.isEmpty(doctor.getHxid())) { -// JSONObject json = hxService.addUser(doctor.getDlogin(), Constant.COMMON_PASSWD, doctor.getDname()); -// JSONArray rArr = json.getJSONArray("entities"); -// if (rArr.size() > 0) { -// LymsDoctor doctor2=new LymsDoctor(); -// doctor2.setDid(doctor.getDid()); -// doctor2.setHxid(rArr.getJSONObject(0).getString("uuid")); -// lymsDoctorService.updateById(doctor2); -// } -// } + if (StringUtil.isEmpty(doctor.getHxid())) { + lymsDoctorService.addDoctorHxId(doctor); + } baseResponse.setErrorcode(0); baseResponse.setObject(map); } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java index 463b6d3..20a51bb 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java @@ -441,6 +441,10 @@ public class PatientController { } + //登录时没有环信账号,增加环信账号 + if(StringUtil.isEmpty(patient2.getHxid())){ + lymsPatientService.addPatientHxId(patient2); + } patient.setPpasswd(null); map.put("patient", patient2); diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsMessage.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsMessage.java index 00815f0..e8019bd 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsMessage.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsMessage.java @@ -68,7 +68,7 @@ public class LymsMessage implements Serializable { /** * 1 有效 0 删除 */ - @TableField(value = "del_status") + @TableField(value = "yn") private int yn; @Override diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/HXService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/HXService.java index 99804ea..b41999d 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/HXService.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/HXService.java @@ -343,12 +343,14 @@ public class HXService { */ public JSONObject addChatGroups(String description,String owner,String[] members){ JSONObject rs=new JSONObject(); - Map param=new HashMap<>(); + HttpHeaders headers=new HttpHeaders(); + headers.add("Authorization","Bearer "+getToken()); + Map param=new HashMap<>(); for(int i = 0 ;i < members.length;i++){ members[i] = assembleHxLoginAccout(members[i]); } - headers.add("Authorization","Bearer "+getToken()); + List lParam=new ArrayList(); param.put("groupname", Arrays.toString(members)); param.put("desc",description); -- 1.8.3.1