LAPTOP-KB9HII50\70708 преди 3 години
родител
ревизия
e85c90e793

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/DoctorConsultEndpoint.java

@ -163,7 +163,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
            if(permissionService.noPermission(1,param)){
                return Envelop.getError("该操作没有权限");
            }
            consultService.sendWeTempMesMiniProgram(sender_id,reciver_id,session_id,token,channelName);
            consultService.sendWeTempMesMiniProgram(sender_id,reciver_id,"2",session_id,token,channelName);
            return success("操作成功");
        }catch (Exception e){
            return failedException2(e);

+ 25 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/PatientConsultEndpoint.java

@ -115,6 +115,31 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@Autowired
	private MessageUtil messageUtil;
	@PostMapping(value = "videoInviteMiniProgram")
	@ApiOperation(value = "医生端:发起/断开 会话小程序视频邀请", notes = "医生端:发起/断开 会话小程序视频邀请")
	public Envelop videoInviteMiniProgram(@ApiParam(name = "sender_id", value = "发起人")
										  @RequestParam(value = "sender_id",required = true) String sender_id,
										  @ApiParam(name = "reciver_id", value = "接收人")
										  @RequestParam(value = "reciver_id",required = true) String reciver_id,
										  @ApiParam(name = "reciver_type", value = "接收人类型1居民 2医生")
										  @RequestParam(value = "reciver_type",required = false) String reciver_type,
										  @ApiParam(name = "token", value = "token")
										  @RequestParam(value = "token",required = false) String token,
										  @ApiParam(name = "channelName", value = "房间号")
										  @RequestParam(value = "channelName",required = false) String channelName,
										  @ApiParam(name = "session_id", value = "会话ID",required = false)
										  @RequestParam(value = "session_id",required = false) String session_id
	){
		try{
			consultService.sendWeTempMesMiniProgram(sender_id,reciver_id,"1",session_id,token,channelName);
			return success("操作成功");
		}catch (Exception e){
			return failedException2(e);
		}
	}
	@PostMapping(value = "sendGetuiMessage")
	@ApiOperation(value = "im推送个推消息")
	public Envelop sendGetuiMessage(String sessionId,String type,String contentType,String senderName,String senderId,String targetId){

+ 11 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultService.java

@ -98,10 +98,18 @@ public class ConsultService {
     * @param reciver_id 接收者ID
     * @param session_id 会话ID
     */
    public String sendWeTempMesMiniProgram(String sender_id, String reciver_id, String session_id,String token,String channelName)throws Exception {
    public String sendWeTempMesMiniProgram(String sender_id, String reciver_id,String sender_type, String session_id,String token,String channelName)throws Exception {
        BasePatientDO patient = basePatientDao.findById(reciver_id);
        if(patient!=null){
            BaseDoctorDO doctorDO = baseDoctorDao.findById(sender_id);
            String key2 = "";
            if("1".equals(sender_type)){
                BasePatientDO tmp = basePatientDao.findById(reciver_id);
                key2 = tmp.getName();
            }else{
                BaseDoctorDO doctorDO = baseDoctorDao.findById(sender_id);
                key2 = doctorDO.getName();
            }
            JSONObject json = new JSONObject();
            json.put("nickName", patient.getName());
            json.put("token", token);
@ -111,7 +119,7 @@ public class ConsultService {
            json.put("sessionId", session_id);
            String first = "【key1】您好!【key2】向您发起了视频请求";
            first = first.replace("key1",patient.getName());
            first = first.replace("key2", doctorDO.getName());
            first = first.replace("key2", key2);
            List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wechatId,patient.getId());
            if (basePatientWechatDos.size()>0){
                String openId = basePatientWechatDos.get(0).getOpenid();

+ 1 - 55
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/role/RoleService.java

@ -92,64 +92,10 @@ public class RoleService extends BaseJpaService<DoctorRole, DoctorRoleDao> {
        if (roleList != null && roleList.size() > 0) {
            //遍历角色
            for (DoctorRole role : roleList) {
                if(role.getCode().length()!=6&&role.getCode().length()!=10){
                    continue;
                }
                Map<String, String> map = new HashMap<>();
                map.put("code", role.getCode());
                map.put("name", role.getName());
                //获取区域权限
                String areaString = "";
                List<DoctorRoleRealm> areaList = doctorRoleRealmDao.findByRoleCode(role.getCode());
                if (areaList != null && areaList.size() > 0) {
                    //获取最大权限区域
                    List<String> areas = new ArrayList<>();
                    List<String> orgs = new ArrayList<>();
                    for (DoctorRoleRealm areaItem : areaList) {
                        String currentArea = areaItem.getAreaCode();
                        int currentLength = currentArea.length();
                        if (currentLength == 6) //区域
                        {
                            areas.add(currentArea);
                        } else {               //机构
                            orgs.add(currentArea);
                        }
                    }
                    //区域权限重复校验
                    for (int i = areas.size() - 1; i >= 0; i--) {
                        String currentArea = areas.get(i);
                        for (int j = 0; j < areas.size() - i - 1; j++) {
                            String shortArea = getShortArea(areas.get(j));
                            if (currentArea.startsWith(shortArea))   //包含则移除
                            {
                                areas.remove(i);
                            }
                        }
                    }
                    //机构权限重复校验
                    for (int m = orgs.size() - 1; m >= 0; m--) {
                        String currentOrg = orgs.get(m);
                        for (int n = 0; n < areas.size() - m - 1; n++) {
                            String shortArea = getShortArea(areas.get(n));
                            if (currentOrg.startsWith(shortArea))   //包含则移除
                            {
                                orgs.remove(m);
                            }
                        }
                    }
                    for (String item : areas) {
                        areaString += item + ",";
                    }
                    for (String item : orgs) {
                        areaString += item + ",";
                    }
                    areaString = areaString.substring(0, areaString.length() - 1);
                }
                map.put("areas", areaString);
                map.put("areas", "");
                map.put("level",roleConverse(role.getCode())+"");
                map.put("isManage", "1");
                if(resultLevel==roleConverse(role.getCode())){