浏览代码

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangzhinan 3 年之前
父节点
当前提交
83b882e72a

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

@ -46,7 +46,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "consult", value = "咨询CODE")
            @ApiParam(name = "consult", value = "咨询CODE")
            @RequestParam(value = "consult",required = true) String consult,
            @RequestParam(value = "consult",required = true) String consult,
            @ApiParam(name = "doctorCode", value = "医生COEE")
            @ApiParam(name = "doctorCode", value = "医生COEE")
            @RequestParam(value = "doctorCode",required = true) String doctorCode) throws Exception {
            @RequestParam(value = "doctorCode",required = true) String doctorCode) {
        try {
        try {
            int resutl = consultService.finish(consult,doctorCode,2);
            int resutl = consultService.finish(consult,doctorCode,2);
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorCode);
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorCode);
@ -71,7 +71,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "consult", value = "咨询CODE")
            @ApiParam(name = "consult", value = "咨询CODE")
            @RequestParam(value = "consult",required = false) String consult,
            @RequestParam(value = "consult",required = false) String consult,
            @ApiParam(name = "patientCode", value = "居民COEE")
            @ApiParam(name = "patientCode", value = "居民COEE")
            @RequestParam(value = "patientCode",required = false) String patientCode)throws Exception {
            @RequestParam(value = "patientCode",required = false) String patientCode){
        try {
        try {
            return success("请求成功",imService.getConsultInfoAndPatientInfo(consult,patientCode));
            return success("请求成功",imService.getConsultInfoAndPatientInfo(consult,patientCode));
        }catch (Exception e){
        }catch (Exception e){
@ -102,7 +102,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "page",required = false) int page,
            @RequestParam(value = "page",required = false) int page,
            @ApiParam(name = "pagesize", value = "分页大小")
            @ApiParam(name = "pagesize", value = "分页大小")
            @RequestParam(value = "pagesize",required = false) int pagesize
            @RequestParam(value = "pagesize",required = false) int pagesize
    )throws Exception{
    ){
        try {
        try {
            List<Map<String,Object>>  data = consultService.findConsultRecordByDoctor(doctor, id,type,status, page,pagesize, symptoms,start_time,end_time,name);
            List<Map<String,Object>>  data = consultService.findConsultRecordByDoctor(doctor, id,type,status, page,pagesize, symptoms,start_time,end_time,name);

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

@ -117,7 +117,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "patient", value = "居民CODE")
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = true) String patient,
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type)throws Exception {
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type){
		try {
		try {
			if (StringUtils.isBlank(orgCode)&&StringUtils.isBlank(sessionId)){
			if (StringUtils.isBlank(orgCode)&&StringUtils.isBlank(sessionId)){
				return Envelop.getError("参数错误请求失败");
				return Envelop.getError("参数错误请求失败");
@ -136,7 +136,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "patient", value = "居民CODE")
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = true) String patient,
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type)throws Exception {
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type){
		try {
		try {
			String consultCode = consultService.getUnfinishedConsult(patient, doctor, type);
			String consultCode = consultService.getUnfinishedConsult(patient, doctor, type);
			return success("请求成功",consultCode);
			return success("请求成功",consultCode);
@ -161,55 +161,58 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "type", value = "咨询类型:23在线咨询,24老人在线咨询")
			@ApiParam(name = "type", value = "咨询类型:23在线咨询,24老人在线咨询")
			@RequestParam(value = "type",required = false) Integer type,
			@RequestParam(value = "type",required = false) Integer type,
			@ApiParam(name = "source", value = "咨询类型来源")
			@ApiParam(name = "source", value = "咨询类型来源")
			@RequestParam(value = "source",required = false) String source)throws Exception{
			@RequestParam(value = "source",required = false) String source){
		try{
			System.out.println("symptoms="+symptoms);
		System.out.println("symptoms="+symptoms);
		if (type == null) {
			type = 23;
		}
		ConsultTeamDo consult = new ConsultTeamDo();
		// 设置咨询类型:23 在线咨询 24老人在线咨询
		consult.setType(type);
		// 设置主要症状
		consult.setSymptoms(symptoms);
		// 设置咨询图片URL
		consult.setImages(images);
		// 设置咨询语音URL
		consult.setVoice(voice);
		consult.setDoctor(doctor);
		consult.setPatient(patient);
		// 保存到数据库
		synchronized (patient.intern()){//新增同步方法
			JSONObject re = null;
			re = consultService.addTeamConsult(consult, patient,doctor,source);
			//发送系统消息
			SystemMessageDO systemMessageDO = new SystemMessageDO();
			systemMessageDO.setTitle("新增在线咨询");
			systemMessageDO.setType("850");
			if (type==24){
				systemMessageDO.setType("851");
			if (type == null) {
				type = 23;
			}
			ConsultTeamDo consult = new ConsultTeamDo();
			// 设置咨询类型:23 在线咨询 24老人在线咨询
			consult.setType(type);
			// 设置主要症状
			consult.setSymptoms(symptoms);
			// 设置咨询图片URL
			consult.setImages(images);
			// 设置咨询语音URL
			consult.setVoice(voice);
			consult.setDoctor(doctor);
			consult.setPatient(patient);
			// 保存到数据库
			synchronized (patient.intern()){//新增同步方法
				JSONObject re = null;
				re = consultService.addTeamConsult(consult, patient,doctor,source);
				//发送系统消息
				SystemMessageDO systemMessageDO = new SystemMessageDO();
				systemMessageDO.setTitle("新增在线咨询");
				systemMessageDO.setType("850");
				if (type==24){
					systemMessageDO.setType("851");
				}
				systemMessageDO.setReceiver(re.getString("doctor"));
				systemMessageDO.setReceiverName(re.getString("doctorName"));
				systemMessageDO.setRelationCode(re.getString("sessiond_id"));
				systemMessageDO.setSender(re.getString("patient"));
				systemMessageDO.setSenderName(re.getString("patientName"));
				net.sf.json.JSONObject data = new net.sf.json.JSONObject();
				data.put("name",re.getString("patientName"));
				data.put("age", IdCardUtil.getAgeForIdcard(re.getString("patient_idcard")));
				data.put("gender",IdCardUtil.getSexForIdcard_new(re.getString("patient_idcard")));
				data.put("question",symptoms);
				data.put("type",1);
				systemMessageDO.setData(data.toString());
				consultService.saveMessage(systemMessageDO);
				serviceNewsService.addServiceNews(re.getString("patientName"),patient,"2",null);
			}
			}
			systemMessageDO.setReceiver(re.getString("doctor"));
			systemMessageDO.setReceiverName(re.getString("doctorName"));
			systemMessageDO.setRelationCode(re.getString("sessiond_id"));
			systemMessageDO.setSender(re.getString("patient"));
			systemMessageDO.setSenderName(re.getString("patientName"));
			net.sf.json.JSONObject data = new net.sf.json.JSONObject();
			data.put("name",re.getString("patientName"));
			data.put("age", IdCardUtil.getAgeForIdcard(re.getString("patient_idcard")));
			data.put("gender",IdCardUtil.getSexForIdcard_new(re.getString("patient_idcard")));
			data.put("question",symptoms);
			data.put("type",1);
			systemMessageDO.setData(data.toString());
			consultService.saveMessage(systemMessageDO);
			serviceNewsService.addServiceNews(re.getString("patientName"),patient,"2",null);
		}
		return success("操作成功", consult);
			return success("操作成功", consult);
		}catch(Exception e){
			return failedException(e);
		}
	}
	}
	@GetMapping(value = "findConsultDoctor")
	@GetMapping(value = "findConsultDoctor")
@ -224,7 +227,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "page", value = "第几页")
			@ApiParam(name = "page", value = "第几页")
			@RequestParam(value = "page",required = false) int page,
			@RequestParam(value = "page",required = false) int page,
			@ApiParam(name = "pagesize", value = "分页大小")
			@ApiParam(name = "pagesize", value = "分页大小")
			@RequestParam(value = "pagesize",required = false) int pagesize)throws Exception{
			@RequestParam(value = "pagesize",required = false) int pagesize){
		try {
		try {
			List<Map<String,Object>>  data = consultService.findConsultDoctor(orgCode, patient,type,page,pagesize);
			List<Map<String,Object>>  data = consultService.findConsultDoctor(orgCode, patient,type,page,pagesize);
			return success(data);
			return success(data);
@ -253,7 +256,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "pagesize", value = "分页大小")
			@ApiParam(name = "pagesize", value = "分页大小")
			@RequestParam(value = "pagesize",required = false) int pagesize,
			@RequestParam(value = "pagesize",required = false) int pagesize,
			@ApiParam(name = "doctorName", value = "医生名字")
			@ApiParam(name = "doctorName", value = "医生名字")
			@RequestParam(value = "doctorName",required = false) String doctorName)throws Exception{
			@RequestParam(value = "doctorName",required = false) String doctorName){
		try {
		try {
			List<Map<String,Object>>  data = consultService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,symptoms,status,doctorName);
			List<Map<String,Object>>  data = consultService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,symptoms,status,doctorName);
			Long total = consultService.countConsultRecordByPatient(patient, id,type,title,symptoms,doctorName,status);
			Long total = consultService.countConsultRecordByPatient(patient, id,type,title,symptoms,doctorName,status);
@ -273,25 +276,29 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "consult", value = "咨询CODE")
			@ApiParam(name = "consult", value = "咨询CODE")
			@RequestParam(value = "consult",required = false) String consult,
			@RequestParam(value = "consult",required = false) String consult,
			@ApiParam(name = "patientCode", value = "居民COEE")
			@ApiParam(name = "patientCode", value = "居民COEE")
			@RequestParam(value = "patientCode",required = false) String patientCode) throws Exception {
		int resutl = consultService.finish(consult,patientCode,1);
		BasePatientDO basePatientDO = basePatientService.findByIdAndDel(patientCode);
		JSONObject msgObj = new JSONObject();
		msgObj.put("msg",basePatientDO.getName()+"结束了咨询");
		msgObj.put("consultcode",consult);
		String jsonStr = "";
		if(1 == resutl){
			jsonStr = "{\"id\":\""+UUID.randomUUID().toString()+"\",\"sender_id\":\""+patientCode+"\",\"sender_name\":\"系统\",\"timestamp\":"+System.currentTimeMillis()+",\"content_type\":7,\"content\":"+msgObj.toString()+",\"business_type\":1}";
		}
			@RequestParam(value = "patientCode",required = false) String patientCode) {
		try {
			int resutl = consultService.finish(consult,patientCode,1);
			BasePatientDO basePatientDO = basePatientService.findByIdAndDel(patientCode);
			JSONObject msgObj = new JSONObject();
			msgObj.put("msg",basePatientDO.getName()+"结束了咨询");
			msgObj.put("consultcode",consult);
			String jsonStr = "";
			if(1 == resutl){
				jsonStr = "{\"id\":\""+UUID.randomUUID().toString()+"\",\"sender_id\":\""+patientCode+"\",\"sender_name\":\"系统\",\"timestamp\":"+System.currentTimeMillis()+",\"content_type\":7,\"content\":"+msgObj.toString()+",\"business_type\":1}";
			}
		return success(jsonStr);
			return success(jsonStr);
		}catch (Exception e){
			return failedException(e);
		}
	}
	}
	@GetMapping(value = "getTopic")
	@GetMapping(value = "getTopic")
	@ApiOperation(value = "根据咨询CODE获取session_id", notes = "根据咨询CODE获取session_id")
	@ApiOperation(value = "根据咨询CODE获取session_id", notes = "根据咨询CODE获取session_id")
	public Envelop getTopic(
	public Envelop getTopic(
			@ApiParam(name = "consult", value = "咨询CODE")
			@ApiParam(name = "consult", value = "咨询CODE")
			@RequestParam(value = "consult",required = false) String consult)throws Exception {
			@RequestParam(value = "consult",required = false) String consult) {
		try {
		try {
			return success("请求成功",imService.getTopic(consult));
			return success("请求成功",imService.getTopic(consult));
		}catch (Exception e){
		}catch (Exception e){
@ -311,8 +318,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "times", value = "")
			@ApiParam(name = "times", value = "")
			@RequestParam(value = "times",required = false) Integer times,
			@RequestParam(value = "times",required = false) Integer times,
			@ApiParam(name = "patientCode", value = "居民CODE")
			@ApiParam(name = "patientCode", value = "居民CODE")
			@RequestParam(value = "patientCode",required = false) String patientCode) throws Exception {
			@RequestParam(value = "patientCode",required = false) String patientCode){
		try {
		try {
			List<String> failed = new ArrayList<>();
			List<String> failed = new ArrayList<>();
			//处理语音文件
			//处理语音文件
@ -348,10 +354,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@ApiOperation(value = "获取会话成员")
	@ApiOperation(value = "获取会话成员")
	public ListEnvelop participants(
	public ListEnvelop participants(
			@ApiParam(name = "sessionId", value = "会话ID")
			@ApiParam(name = "sessionId", value = "会话ID")
			@RequestParam(value = "sessionId",required = true) String sessionId)throws Exception{
		
		JSONArray participants = imService.getSessions(sessionId);
		return success(participants);
			@RequestParam(value = "sessionId",required = true) String sessionId){
		try{
			JSONArray participants = imService.getSessions(sessionId);
			return success(participants);
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	}
	
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getSessionMessage)
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getSessionMessage)
@ -366,9 +375,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "page", value = "第几页")
			@ApiParam(name = "page", value = "第几页")
			@RequestParam(value = "page",required = true) int page,
			@RequestParam(value = "page",required = true) int page,
			@ApiParam(name = "pagesize", value = "分页数")
			@ApiParam(name = "pagesize", value = "分页数")
			@RequestParam(value = "pagesize",required = true) int pagesize)throws Exception{
		JSONArray messageArray = imService.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getUID());
		return success(messageArray);
			@RequestParam(value = "pagesize",required = true) int pagesize){
		try{
			JSONArray messageArray = imService.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getUID());
			return success(messageArray);
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	}
	
	
@ -377,28 +390,32 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	public Envelop getSign(@ApiParam(name = "pageUrl", value = "授权页面")
	public Envelop getSign(@ApiParam(name = "pageUrl", value = "授权页面")
	                       @RequestParam(value = "pageUrl", required = true)String pageUrl,
	                       @RequestParam(value = "pageUrl", required = true)String pageUrl,
	                       @ApiParam(name = "wxId", value = "微信id")
	                       @ApiParam(name = "wxId", value = "微信id")
	                       @RequestParam(value = "wxId", required = true)String wxId) throws Exception {
		logger.info("pageUrl="+pageUrl);
		logger.info("wxId="+wxId);
		String ticket = wechatInfoService.getJsapi_ticketByToken(wxId);
		WxWechatDO wxWechatDO = wechatDao.findById(wxId);
		Map<Object, Object> map = new HashMap<Object, Object>();
		if (ticket != null) {
			String noncestr = UUID.randomUUID().toString();
			long timestamp = System.currentTimeMillis() / 1000;
			String url = pageUrl;
			logger.info("getSign.url="+url);
			String str = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "&timestamp=" + timestamp + "&url=" + url;
			logger.info("getSign.str="+str);
			// sha1加密
			String signature = SHA1(str);
			map.put("noncestr", noncestr);
			map.put("timestamp", timestamp);
			map.put("signature", signature);
			map.put("appid", wxWechatDO.getAppId());
			return success(PatientRequestMapping.Wechat.api_success,map);
	                       @RequestParam(value = "wxId", required = true)String wxId){
		try{
			logger.info("pageUrl="+pageUrl);
			logger.info("wxId="+wxId);
			String ticket = wechatInfoService.getJsapi_ticketByToken(wxId);
			WxWechatDO wxWechatDO = wechatDao.findById(wxId);
			Map<Object, Object> map = new HashMap<Object, Object>();
			if (ticket != null) {
				String noncestr = UUID.randomUUID().toString();
				long timestamp = System.currentTimeMillis() / 1000;
				String url = pageUrl;
				logger.info("getSign.url="+url);
				String str = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "&timestamp=" + timestamp + "&url=" + url;
				logger.info("getSign.str="+str);
				// sha1加密
				String signature = SHA1(str);
				map.put("noncestr", noncestr);
				map.put("timestamp", timestamp);
				map.put("signature", signature);
				map.put("appid", wxWechatDO.getAppId());
				return success(PatientRequestMapping.Wechat.api_success,map);
			}
			return failed(PatientRequestMapping.Wechat.api_error);
		}catch (Exception e){
			return failedException(e);
		}
		}
		return failed(PatientRequestMapping.Wechat.api_error);
	}
	}
	
	
	/**
	/**
@ -434,9 +451,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	                                       @ApiParam(name = "userid", value = "新增成员ID,多个以英文逗号隔开", defaultValue = "1")
	                                       @ApiParam(name = "userid", value = "新增成员ID,多个以英文逗号隔开", defaultValue = "1")
	                                       @RequestParam(value = "userid", required = true) String userid,
	                                       @RequestParam(value = "userid", required = true) String userid,
	                                       @ApiParam(name = "olduserid", value = "删除的成员id")
	                                       @ApiParam(name = "olduserid", value = "删除的成员id")
	                                       @RequestParam(value = "olduserid", required = false) String olduserid)throws Exception{
		imService.updateParticipant(sessionid,userid,olduserid);
		return success("操作成功");
	                                       @RequestParam(value = "olduserid", required = false) String olduserid){
		try {
			imService.updateParticipant(sessionid,userid,olduserid);
			return success("操作成功");
		} catch (Exception e) {
			return failedException(e);
		}
	}
	}
	
	
	@PostMapping(value = "messageAppend")
	@PostMapping(value = "messageAppend")
@ -458,47 +479,51 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "type", required = false) String type,
			@RequestParam(value = "type", required = false) String type,
			@ApiParam(name = "times", value = "times", defaultValue = "")
			@ApiParam(name = "times", value = "times", defaultValue = "")
			@RequestParam(value = "times", required = false) Integer times
			@RequestParam(value = "times", required = false) Integer times
	)throws Exception{
		List<String> failed = new ArrayList<>();
		//处理语音文件
		if(!org.springframework.util.StringUtils.isEmpty(wechat_appid)){
			if("3".equalsIgnoreCase(content_type)){//语音文件
				String voicepath = imService.fetchWxVoices(wechat_appid);
				logger.info("voice_path:"+voicepath);
				JSONObject obj = new JSONObject();
				String voiceurl = "";
				// 将临时语音拷贝到正式存储路径下
				if (org.apache.commons.lang3.StringUtils.isNotEmpty(voicepath)) {
					voiceurl = fileUtil.copyTempVoice(voicepath,fastdfs_file_url);
					obj.put("path", voiceurl);
					obj.put("times", times);
					content = obj.toString();
				}
			}else if("2".equalsIgnoreCase(content_type)){//图片文件
				String imagepath = imService.fetchWxImages(wechat_appid);
				logger.info("image_path:"+imagepath);
				String imgeUrl = "";
				// 将临时语音拷贝到正式存储路径下
				if (org.apache.commons.lang3.StringUtils.isNotEmpty(imagepath)) {
					imgeUrl = fileUtil.copyTempVoice(imagepath,fastdfs_file_url);
					content = imgeUrl;
				}
			}else{
	){
		try {
			List<String> failed = new ArrayList<>();
			//处理语音文件
			if(!org.springframework.util.StringUtils.isEmpty(wechat_appid)){
				if("3".equalsIgnoreCase(content_type)){//语音文件
					String voicepath = imService.fetchWxVoices(wechat_appid);
					logger.info("voice_path:"+voicepath);
					JSONObject obj = new JSONObject();
					String voiceurl = "";
					// 将临时语音拷贝到正式存储路径下
					if (org.apache.commons.lang3.StringUtils.isNotEmpty(voicepath)) {
						voiceurl = fileUtil.copyTempVoice(voicepath,fastdfs_file_url);
						obj.put("path", voiceurl);
						obj.put("times", times);
						content = obj.toString();
					}
				}else if("2".equalsIgnoreCase(content_type)){//图片文件
					String imagepath = imService.fetchWxImages(wechat_appid);
					logger.info("image_path:"+imagepath);
					String imgeUrl = "";
					// 将临时语音拷贝到正式存储路径下
					if (org.apache.commons.lang3.StringUtils.isNotEmpty(imagepath)) {
						imgeUrl = fileUtil.copyTempVoice(imagepath,fastdfs_file_url);
						content = imgeUrl;
					}
				}else{
				}
			}
			session_id = imService.getPatientGuaidenceConsult(sender_id,session_id,type);
			String result = imService.patientGuaidenceAppend(sender_id,sender_name,session_id,content_type,content,"1",extend);
			List<BaseDoctorRoleDO> doctorRoleDOS = doctorRoleDao.findByRoleCode("guidance");
			for (BaseDoctorRoleDO doctorRoleDO:doctorRoleDOS){
				System.out.println("发送外层SOCKET消息:通知医生导诊");
				JSONObject object = new JSONObject();
				object.put("socket_sms_type",13);
				object.put("relation_code",session_id);
				imService.sendWaiSocketMessage(sender_id,doctorRoleDO.getDoctorCode(),object.toString(),"1");
			}
			}
		}
		session_id = imService.getPatientGuaidenceConsult(sender_id,session_id,type);
		String result = imService.patientGuaidenceAppend(sender_id,sender_name,session_id,content_type,content,"1",extend);
		List<BaseDoctorRoleDO> doctorRoleDOS = doctorRoleDao.findByRoleCode("guidance");
		for (BaseDoctorRoleDO doctorRoleDO:doctorRoleDOS){
			System.out.println("发送外层SOCKET消息:通知医生导诊");
			JSONObject object = new JSONObject();
			object.put("socket_sms_type",13);
			object.put("relation_code",session_id);
			imService.sendWaiSocketMessage(sender_id,doctorRoleDO.getDoctorCode(),object.toString(),"1");
		}
		return success(result);
			return success(result);
		} catch (Exception e) {
			return failedException(e);
		}
	}
	}
}
}

+ 7 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/WxPushEndpoint.java

@ -47,9 +47,13 @@ public class WxPushEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "sessionId", value = "会话id")
            @ApiParam(name = "sessionId", value = "会话id")
            @RequestParam(value = "sessionId", required = true) String sessionId,
            @RequestParam(value = "sessionId", required = true) String sessionId,
            @ApiParam(name = "contentString", value = "内容明细串")
            @ApiParam(name = "contentString", value = "内容明细串")
            @RequestParam(value = "contentString", required = false) String contentString) throws Exception {
        wxPushService.sendWXTemplate(userName, idCard, phone, title, url, content, topidId, sessionId, contentString);
        return success("success");
            @RequestParam(value = "contentString", required = false) String contentString) {
        try {
            wxPushService.sendWXTemplate(userName, idCard, phone, title, url, content, topidId, sessionId, contentString);
            return success("success");
        }catch (Exception e){
            return failedException(e);
        }
    }
    }
}
}

+ 9 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/course/DoctorCourseEndpoint.java

@ -112,10 +112,14 @@ public class DoctorCourseEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "getTXUploadSignature")
    @GetMapping(value = "getTXUploadSignature")
    @ApiOperation(value = "获取腾讯视频上传签名")
    @ApiOperation(value = "获取腾讯视频上传签名")
    public Envelop getTXUploadSignature() throws Exception {
        TencentVODUtil tencentVODUtil = new TencentVODUtil();
        tencentVODUtil.setSecretId(secretId);
        tencentVODUtil.setSecretKey(secretKey);
        return success(tencentVODUtil.getUploadSignature());
    public Envelop getTXUploadSignature() {
        try {
            TencentVODUtil tencentVODUtil = new TencentVODUtil();
            tencentVODUtil.setSecretId(secretId);
            tencentVODUtil.setSecretKey(secretKey);
            return success(tencentVODUtil.getUploadSignature());
        }catch (Exception e){
            return failedException(e);
        }
    }
    }
}
}

+ 3 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java

@ -261,6 +261,8 @@ public class SignEndpoint extends EnvelopRestEndpoint {
    public PageEnvelop<List<Map<String,Object>>> assessmentPage (
    public PageEnvelop<List<Map<String,Object>>> assessmentPage (
            @ApiParam(name = "doctorId", value = "医生id", required = false)
            @ApiParam(name = "doctorId", value = "医生id", required = false)
            @RequestParam(value = "doctorId",required = false)  String doctorId,
            @RequestParam(value = "doctorId",required = false)  String doctorId,
            @ApiParam(name = "patientId", value = "居民id", required = false)
            @RequestParam(value = "patientId",required = false)  String patientId,
            @ApiParam(name = "name", value = "居民姓名或身份证", required = false)
            @ApiParam(name = "name", value = "居民姓名或身份证", required = false)
            @RequestParam(value = "name",required = false) String name,
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "status", value = "认可结果(0未认可,1已认可,2不认可)", required = false)
            @ApiParam(name = "status", value = "认可结果(0未认可,1已认可,2不认可)", required = false)
@ -276,7 +278,7 @@ public class SignEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
            @RequestParam(value = "size") int size) throws Exception {
        try{
        try{
            return capacityAssessmentRecordService.assessmentPage(doctorId, name, type,page, size, status, levelConclusion, servicePackageStatus);
            return capacityAssessmentRecordService.assessmentPage(doctorId,patientId, name, type,page, size, status, levelConclusion, servicePackageStatus);
        }catch (Exception e){
        }catch (Exception e){
            return failedPageEnvelopException(e);
            return failedPageEnvelopException(e);
        }
        }

+ 7 - 4
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/patient/PatientNoLoginEndPoint.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.course.CourseService;
import com.yihu.jw.care.service.course.CourseService;
import com.yihu.jw.care.service.org.BaseOrgService;
import com.yihu.jw.care.service.org.BaseOrgService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.care.service.third.patient.PatientNoLoginService;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -47,6 +48,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private BaseOrgService orgService;
    private BaseOrgService orgService;
    @Autowired
    @Autowired
    private ServicePackageService servicePackageService;
    private ServicePackageService servicePackageService;
    @Autowired
    private PatientNoLoginService patientNoLoginService;
    /**
    /**
     * 获取微信openid
     * 获取微信openid
@ -111,7 +114,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "在线报名-获取机构详情")
    @ApiOperation(value = "在线报名-获取机构详情")
    public ObjEnvelop getOrgInfoById(
    public ObjEnvelop getOrgInfoById(
            @ApiParam(name = "id", value = "机构id", defaultValue = "808080eb7861c327017861d18d070011") @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "id", value = "机构id", defaultValue = "808080eb7861c327017861d18d070011") @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = true) String patient
            @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient",required = false) String patient
    ) {
    ) {
        try {
        try {
            JSONObject json = courseService.getOrgInfoById(id,patient);
            JSONObject json = courseService.getOrgInfoById(id,patient);
@ -155,14 +158,14 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = "findSignOrg")
    @GetMapping(value = "findSignOrg")
    @ApiOperation(value = "查找签约机构")
    @ApiOperation(value = "查找签约机构")
    public ListEnvelop findSignOrg (
    public ListEnvelop findSignOrg (
            @ApiParam(name = "patient", value = "医生code", required = true)
            @RequestParam(value = "patient",required = true) String patient,
            @ApiParam(name = "patient", value = "医生code", required = false)
            @RequestParam(value = "patient",required = false) String patient,
            @ApiParam(name = "name", value = "机构名称", required = false)
            @ApiParam(name = "name", value = "机构名称", required = false)
            @RequestParam(value = "name",required = false) String name,
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "type", value = "类型 3 养老 4 教育,1 医疗", required = false)
            @ApiParam(name = "type", value = "类型 3 养老 4 教育,1 医疗", required = false)
            @RequestParam(value = "type",required = false) String type) throws Exception {
            @RequestParam(value = "type",required = false) String type) throws Exception {
        try{
        try{
            return ListEnvelop.getSuccess("查询成功",servicePackageService.findSignOrg(patient,name,type));
            return ListEnvelop.getSuccess("查询成功",patientNoLoginService.findSignOrg(patient,name,type));
        }catch (Exception e){
        }catch (Exception e){
            return failedListEnvelopException(e);
            return failedListEnvelopException(e);
        }
        }

+ 17 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/YsDeviceService.java

@ -413,9 +413,22 @@ public class YsDeviceService {
                return result;
                return result;
            }
            }
            tmp.sort(Comparator.comparing(obj -> Long.parseLong(((LinkedHashMap) obj).get("startTime").toString())));
            tmp.sort(Comparator.comparing(obj -> Long.parseLong(((LinkedHashMap) obj).get("startTime").toString())));
            LinkedHashMap tmpFirst = tmp.getObject(0,LinkedHashMap.class);
            Long startTimeStr1 =  Long.parseLong(tmpFirst.get("startTime").toString()) ;
            long current = System.currentTimeMillis();
            long toDayZero = current/(1000*3600*24)*(1000*3600*24) - TimeZone.getDefault().getRawOffset();
            if (toDayZero-startTimeStr1>0){//去除开始时间不为当天是时间段
                tmp.remove(0);
            }
            if (null==tmp||0==tmp.size()){
                result.put(ResponseContant.resultFlag,ResponseContant.fail);
                result.put(ResponseContant.resultMsg,"未获取到当天录像信息");
                return result;
            }
            LinkedHashMap mergeTmp = null;
            LinkedHashMap mergeTmp = null;
            for (int i=0;i<tmp.size();i++){
                LinkedHashMap mapTmp = tmp.getObject(i,LinkedHashMap.class);
            Iterator<Object> arrIterator = tmp.iterator();
            while (arrIterator.hasNext()) {
                LinkedHashMap mapTmp = (LinkedHashMap) arrIterator.next();
                Long startTimeStr =  Long.parseLong(mapTmp.get("startTime").toString()) ;
                Long startTimeStr =  Long.parseLong(mapTmp.get("startTime").toString()) ;
                Long endTimeStr = Long.parseLong(mapTmp.get("endTime").toString()) ;
                Long endTimeStr = Long.parseLong(mapTmp.get("endTime").toString()) ;
                String startTimeDate = DateUtil.dateToStrLong(new Date(startTimeStr));
                String startTimeDate = DateUtil.dateToStrLong(new Date(startTimeStr));
@ -436,11 +449,10 @@ public class YsDeviceService {
                }
                }
                if (startTimeStr==Long.parseLong(mergeTmp.get("endTime").toString())){//时间区间相连
                if (startTimeStr==Long.parseLong(mergeTmp.get("endTime").toString())){//时间区间相连
                    startTimeStr =  Long.parseLong(mergeTmp.get("startTime").toString()) ;
                    startTimeStr =  Long.parseLong(mergeTmp.get("startTime").toString()) ;
                    Long videoLongTmp = Long.parseLong(mergeTmp.get("videoLong").toString());
                    videoLong = (endTimeStr-startTimeStr)/1000;
                    videoLong = (endTimeStr-startTimeStr)/1000;
                    mergeTmp.put("endTime",mapTmp.get("endTime"));
                    mergeTmp.put("endTime",mapTmp.get("endTime"));
                    mergeTmp.put("endTimeDate",endTimeDate);
                    mergeTmp.put("endTimeDate",endTimeDate);
                    mergeTmp.put("videoLong",videoLong+videoLongTmp);
                    mergeTmp.put("videoLong",videoLong);
                }else{
                }else{
                    timeTmp.add(mergeTmp);
                    timeTmp.add(mergeTmp);
                    mergeTmp = new LinkedHashMap();
                    mergeTmp = new LinkedHashMap();
@ -454,7 +466,7 @@ public class YsDeviceService {
                    mergeTmp.put("channelNo",mapTmp.get("channelNo"));
                    mergeTmp.put("channelNo",mapTmp.get("channelNo"));
                    mergeTmp.put("videoLong",videoLong);
                    mergeTmp.put("videoLong",videoLong);
                }
                }
                if (i==tmp.size()-1){
                if (!arrIterator.hasNext()){
                    timeTmp.add(mergeTmp);
                    timeTmp.add(mergeTmp);
                }
                }
            }
            }

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -314,7 +314,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            try {
            try {
                JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(orderDO.getPatient(),devicePatientDeviceDos.get(0).getDeviceSn(),1,null);
                JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(orderDO.getPatient(),devicePatientDeviceDos.get(0).getDeviceSn(),1,null);
                Map<String,Object> map = new HashMap<>();
                Map<String,Object> map = new HashMap<>();
                map.put("monitorInfoStatus",result.getIntValue(ResponseContant.resultFlag));
                map.put("monitorInfoStatus",monitorUrl.getIntValue(ResponseContant.resultFlag));
                if (monitorUrl.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                if (monitorUrl.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                    map.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
                    map.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
                }
                }
@ -1161,7 +1161,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        else{
        else{
            try {
            try {
                JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(patient,devicePatientDeviceDos.get(0).getDeviceSn(),1,null);
                JSONObject monitorUrl = ysDeviceServicel.getDeviceLiveAddress(patient,devicePatientDeviceDos.get(0).getDeviceSn(),1,null);
                result.put("monitorInfoStatus",result.getIntValue(ResponseContant.resultFlag));
                result.put("monitorInfoStatus",monitorUrl.getIntValue(ResponseContant.resultFlag));
                if (monitorUrl.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                if (monitorUrl.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail){
                    result.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
                    result.put("monitorInfo",monitorUrl.getString(ResponseContant.resultMsg));
                }
                }

+ 5 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java

@ -142,7 +142,7 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
        return res;
        return res;
    }
    }
    public PageEnvelop<List<Map<String,Object>>> assessmentPage(String doctorId,String name,int type, int page, int size,
    public PageEnvelop<List<Map<String,Object>>> assessmentPage(String doctorId,String patientId,String name,int type, int page, int size,
                    Integer status,Integer levelConclusion,Integer servicePackageStatus){
                    Integer status,Integer levelConclusion,Integer servicePackageStatus){
        String sql = "SELECT c.id,c.patient,c.assessment_time,c.service_package_status servicePackageStatus, " +
        String sql = "SELECT c.id,c.patient,c.assessment_time,c.service_package_status servicePackageStatus, " +
                "c.`status`,c.level_conclusion levelConclusion,c.org_code orgCode,c.org_name orgName,p.name,p.photo,p.mobile,p.sex,p.idcard  ";
                "c.`status`,c.level_conclusion levelConclusion,c.org_code orgCode,c.org_name orgName,p.name,p.photo,p.mobile,p.sex,p.idcard  ";
@ -154,6 +154,10 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
            filters += " and c.assessment_time>='" + DateUtil.getNowYear() + "-01-01' ";
            filters += " and c.assessment_time>='" + DateUtil.getNowYear() + "-01-01' ";
        }
        }
        if(StringUtils.isNoneBlank(patientId)){
            filters += " and c.patient = '"+patientId+"' ";
        }
        if(StringUtils.isNoneBlank(doctorId)){
        if(StringUtils.isNoneBlank(doctorId)){
            filters += " and (c.doctor = '"+doctorId+"' or d.doctor_id = '"+doctorId+"')";
            filters += " and (c.doctor = '"+doctorId+"' or d.doctor_id = '"+doctorId+"')";
        }
        }

+ 51 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/third/patient/PatientNoLoginService.java

@ -0,0 +1,51 @@
package com.yihu.jw.care.service.third.patient;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * Created by Bing on 2021/6/22.
 */
@Service
public class PatientNoLoginService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 查找签约机构
     * @param patient
     *  type 3 养老 4 教育,1 医疗
     * @return
     */
    public List<BaseOrgDO> findSignOrg(String patient, String name, String type){
        String sql = "SELECT " +
                " DISTINCT o.* " +
                "FROM " +
                " base_service_package_record r, " +
                " base_service_package_item i, " +
                " base_org o " +
                "WHERE " +
                " r.service_package_id = i.service_package_id " +
                "AND i.del = 1 " +
                "and i.org_code = o.code " ;
        if("1".equals(type)){
            sql += " and (o.type =1 or o.type = 2) ";
        }else if("3".equals(type)){
            sql += " and o.type =3 ";
        }
        if (StringUtils.isNotBlank(name)){
            sql += " and o.name like '%"+name+"%' ";
        }
        //type =4 新生儿
        List<BaseOrgDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(BaseOrgDO.class));
        return list;
    }
}

+ 6 - 0
svr/svr-cloud-device/pom.xml

@ -145,6 +145,12 @@
            <artifactId>bcprov-ext-jdk16</artifactId>
            <artifactId>bcprov-ext-jdk16</artifactId>
            <version>1.46</version>
            <version>1.46</version>
        </dependency>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-yarn-api</artifactId>
            <version>2.7.3</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    </dependencies>

文件差异内容过多而无法显示
+ 148 - 6
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/YsDeviceService.java