Browse Source

Merge branch 'dev' of huangwenjie/wlyy2.0 into dev

huangwenjie 5 years ago
parent
commit
fc2a4d1019

+ 12 - 0
business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java

@ -132,6 +132,18 @@ public class WlyyBusinessService {
        }
        return false;
    }
    
    public String getPatientCodeByWlyyIdcard(String idcard) {
        BasePatientDO patientDO =  basePatientDao.findByIdcardAndDel(idcard,"1");
        if(patientDO == null){
            /**
             * todo 调用i健康接口获取居民信息
             */
        }else{
        
        }
        return patientDO.getId();
    }
//    public String getPatientInfo(String ){

+ 54 - 8
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -273,16 +273,17 @@ public class ImService {
	 * 查询全科医生与某个医生未结束的专家咨询
	 *
	 * @param patient 居民
	 * @param doctor  医生
	 * @param general_doctor  全科医生
	 * @return
	 */
	public String  getUnfinishedConsultByActualSender(String actualSender, String doctor) {
	public String  getUnfinishedConsultByActualSender(String patient, String general_doctor) {
		
		
		String totalSql = "SELECT a.consult as consultCode " +
				"FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
				"WHERE a.consult=b.consult " +
				"AND b.to_doctor='" +doctor+"' "+
				"AND b.actual_sender='" +actualSender+"' "+
				"AND a.patient= '" +patient+"' "+
				"AND a.actual_sender='" +general_doctor+"' "+
				"AND a.del='1' " +
				"AND a.type<> 12 " +
				"AND a.`status`=0";
@ -1742,7 +1743,7 @@ public class ImService {
	 * @param consult
	 * @return
	 */
	public JSONObject generalAddExpertConsult(String patient_code, String general_doctor, String special_doctor, String when, String symptoms, String images, ConsultTeamDo ct) throws Exception {
	public String generalAddExpertConsult(String patient_code, String general_doctor, String special_doctor, String when, String symptoms, String images, ConsultTeamDo ct) throws Exception {
		// 设置咨询类型:15
		ct.setType(15);
		// 设置发病时间
@ -1816,7 +1817,7 @@ public class ImService {
		String sessionId = "";
		messages = imUtil.getCreateTopicMessage(generalDoctor.getId(),generalDoctor.getName(), consult.getTitle(), content, consult.getImages(), special_doctor);
		//5、(im创建咨询) 续方咨询的sessionid为居民code+就诊code+12(图文,视频,图文+视频)
		sessionId = patient_code+"_"+general_doctor + "_" + special_doctor + "_" + ct.getType();
		sessionId = patient_code+"_"+general_doctor + "_" + ct.getType();
		obj = imUtil.createTopics(sessionId, consult.getId(), p.getName(), users, messages, imUtil.SESSION_TYPE_GENERAL_EXPERT);
		
		if (obj == null) {
@ -1829,7 +1830,7 @@ public class ImService {
		ct.setActualSender(generalDoctor.getId());//实际发起人-全科医生
		ct.setActualSenderName(generalDoctor.getName());//实际发起人-全科医生
		consultTeamDao.save(ct);
		consultDao.save(consult);
		consult = consultDao.save(consult);
		
		//设置咨询code
//			wlyyOutpatientDO.setConsult(consult.getCode());
@ -1860,7 +1861,7 @@ public class ImService {
		object.put("socket_sms_type",5);
		imUtil.sendMessage(special_doctor,general_doctor,"1",object.toString());
		
		return result;
		return consult.getId();
	}
	
	/**
@ -2034,4 +2035,49 @@ public class ImService {
		
		return count;
	}
	
	/**
	 * 根据消息ID请求转发的消息内容,组装并返回JSON
	 * 返回json
	 * @param sessionType
	 * @param content
	 * @return
	 */
	public JSONObject getMessageById(String sessionType, String content, String title) {
		JSONObject re = new com.alibaba.fastjson.JSONObject();
		re.put("title", title);
		content = "'" + content.replace(",", "','") + "'";
		String tableName = "";
		switch (sessionType) {
			case "1":
			case "8":
				tableName = "muc_messages";
				break;
			case "2":
				tableName = "p2p_messages";
				break;
			default:
				tableName = "group_messages";
				break;
		}
		
		String sql = "select id, session_id, sender_id, sender_name, content_type, content, timestamp from " + data_base_name + "." +
				tableName + " where id in(" + content + ") order by timestamp desc ";
		List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
		com.alibaba.fastjson.JSONArray ja = new com.alibaba.fastjson.JSONArray();
		for (int i = 0; i < list.size(); i++) {
			Map<String, Object> map = list.get(i);
			com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
			json.put("id", map.get("id"));
			json.put("session_id", map.get("session_id"));
			json.put("sender_id", map.get("sender_id"));
			json.put("sender_name", map.get("sender_name"));
			json.put("content_type", map.get("content_type"));
			json.put("content", map.get("content"));
			json.put("timestamp", map.get("timestamp"));
			ja.add(json);
		}
		re.put("list", ja);
		return re;
	}
}

+ 9 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -395,6 +395,15 @@ public class BaseHospitalRequestMapping {
        
        //(健康咨询)医生咨询记录查询
        public static final String expertConsultRecords ="/expertConsultRecords";
    
        //(健康咨询)根据i健康居民身份证号获取互联网医院居民CODE
        public static final String getPatientCodeByWlyyIdcard ="/getPatientCodeByWlyyIdcard";
    
        //(健康咨询)请求转发的消息内容
        public static final String getMessageForward ="/getMessageForward";
    
        //(健康咨询)转发消息
        public static final String postMessageForward ="/postMessageForward";
        
        //医生可接单列表(图文复诊、视频复诊、协同门诊)
        public static final String findWaitingRoomOutpatientByDoctor = "findWaitingRoomOutpatientByDoctor";

+ 47 - 3
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -17,6 +17,7 @@ import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wlyy.service.WlyyBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -54,6 +55,9 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	
	@Autowired
	private OutpatientDao outpatientDao;
	
	@Autowired
	private WlyyBusinessService wlyyBusinessService;
	
	
@ -178,7 +182,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		ConsultTeamDo consult = new ConsultTeamDo();
		consult.setType(15);//家医咨询求助互联网医院专科医生:全科医生-专科医生-咨询聊天
		
		JSONObject result = new JSONObject();
		String result = "";
		synchronized (patient_code.intern()){
			result = imService.generalAddExpertConsult(patient_code, general_doctor,special_doctor,when,symptoms,images,consult);
		}
@ -520,13 +524,13 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	                                          @ApiParam(name = "general_doctor", value = "全科医生")
	                                          @RequestParam(value = "general_doctor", required = true)String general_doctor,
	                                          @ApiParam(name = "special_doctor", value = "专科医生")
	                                          @RequestParam(value = "special_doctor", required = true)String special_doctor
	                                          @RequestParam(value = "special_doctor", required = false)String special_doctor
	                                          ) throws Exception {
		if(org.apache.axis.utils.StringUtils.isEmpty(patient_code)){
			patient_code= getUID();
		}
		
		String consultCode = imService.getUnfinishedConsultByActualSender(general_doctor, special_doctor);
		String consultCode = imService.getUnfinishedConsultByActualSender(patient_code,general_doctor);
		return success("请求成功",consultCode);
	}
	
@ -611,5 +615,45 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		return success(result);
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.getPatientCodeByWlyyIdcard)
	@ApiOperation(value = "(健康咨询)根据i健康居民身份证号获取互联网医院居民CODE", notes = "(健康咨询)根据i健康居民身份证号获取互联网医院居民CODE")
	public Envelop getPatientCodeByWlyyIdcard(@ApiParam(name = "idcard", value = "i健康居民身份证")
	                                         @RequestParam(value = "idcard", required = true)String idcard
	) throws Exception {
		return success("请求成功",wlyyBusinessService.getPatientCodeByWlyyIdcard(idcard));
	}
	
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.getMessageForward)
	@ApiOperation(value = "(健康咨询)请求转发的消息内容", notes = "(健康咨询)请求转发的消息内容")
	public Envelop getMessageForward(
	                              @ApiParam(name = "messageids", value = "消息ID,英文逗号连接", defaultValue = "")
	                                  @RequestParam(value = "messageids", required = true) String messageids,
	                              @ApiParam(name = "title", value = "会话标题", defaultValue = "")
	                                  @RequestParam(value = "title", required = true) String title,
	                              @ApiParam(name = "sessionType", value = "原会话的会话类型", defaultValue = "")
	                                  @RequestParam(value = "sessionType", required = true) String sessionType
	) throws Exception {
		return success("请求成功",imService.getMessageById(sessionType,messageids,title));
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.postMessageForward)
	@ApiOperation(value = "(健康咨询)转发消息", notes = "(健康咨询)转发消息")
	public Envelop messageForward(@ApiParam(name = "senderIdcard", value = "发送者身份证", defaultValue = "")
	                              @RequestParam(value = "senderIdcard", required = true) String senderIdcard,
	                              @ApiParam(name = "reciverIdcard", value = "发送者身份证", defaultValue = "")
	                              @RequestParam(value = "reciverIdcard", required = true) String reciverIdcard,
	                              @ApiParam(name = "messageids", value = "消息ID,英文逗号连接", defaultValue = "")
	                              @RequestParam(value = "messageids", required = true) String messageids,
	                              @ApiParam(name = "title", value = "会话标题", defaultValue = "")
	                              @RequestParam(value = "title", required = true) String title,
	                              @ApiParam(name = "sessionType", value = "原会话的会话类型", defaultValue = "")
	                              @RequestParam(value = "sessionType", required = true) String sessionType
	) throws Exception {
		/**
		 * todo 请求i健康接口发送转发的聊天消息
		 */
		return success("请求成功");
	}
	
}