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);