Browse Source

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

# Conflicts:
#	common/common-entity/sql记录
yeshijie 3 years ago
parent
commit
3e3f36bd6d

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

@ -192,6 +192,25 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
		return success("操作成功", consult);
	}
	@GetMapping(value = "findConsultDoctor")
	@ApiOperation(value = "查找历史咨询过的教师")
	public Envelop findConsultDoctor(
			@ApiParam(name = "patient", value = "居民id")
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name = "orgCode", value = "机构code")
			@RequestParam(value = "orgCode",required = true) String orgCode,
			@ApiParam(name = "page", value = "第几页")
			@RequestParam(value = "page",required = false) int page,
			@ApiParam(name = "pagesize", value = "分页大小")
			@RequestParam(value = "pagesize",required = false) int pagesize)throws Exception{
		try {
			List<Map<String,Object>>  data = consultService.findConsultDoctor(orgCode, patient, page,pagesize);
			return success(data);
		}catch (Exception e){
			return failedException(e);
		}
	}
	@GetMapping(value = "records")
	@ApiOperation(value = "患者咨询记录查询")
	public Envelop records(

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

@ -91,7 +91,7 @@ public class ConsultService {
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list.size()>0){
            map = list.get(0);
            map.put("sessionId",String.valueOf(map.get("consult"))+"_"+patient+"_23");
            map.put("sessionId",patient+"_"+String.valueOf(map.get("doctor"))+"_23");
            BaseDoctorDO doctorDO = baseDoctorDao.findById(String.valueOf(map.get("doctor")));
            map.put("doctorName",doctorDO.getName());
        }
@ -214,7 +214,7 @@ public class ConsultService {
        List<Map<String,Object>> result = hibenateUtils.createSQLQuery(sql,page,pagesize);
        for (Map<String,Object> map:result){
            if(type.equals(ImUtil.SESSION_TYPE_ONLINE)){
                String sessionId = String.valueOf(map.get("id"))+"_"+patient+"_23";
                String sessionId = patient+"_"+String.valueOf(map.get("doctorCode"))+"_23";
                //新增未读消息数量
                Integer count = imUtil.UserSessionsUnreadMessageCount(sessionId,patient);
                map.put("sessionId",sessionId);
@ -327,6 +327,31 @@ public class ConsultService {
        return count;
    }
    /**
     * 查找历史咨询过的教师 去重
     * @param orgCode
     * @param patient
     * @return
     */
    public List<Map<String,Object>> findConsultDoctor(String orgCode,String patient,int page,int pagesize){
        String sql = "SELECT  DISTINCT " +
                " a.type AS type, " +
                " d.name AS doctorName, " +
                " d.photo AS doctorphoto, " +
                " d.id AS doctor, " +
                " d.job_title_name AS jobTitleName,  " +
                " h.dept_name AS deptName, " +
                " h.org_name AS orgName " +
                " FROM wlyy_consult a,wlyy_consult_team b, " +
                " base_doctor d,base_doctor_hospital h  " +
                " WHERE a.id=b.consult and d.id = h.doctor_code  " +
                " AND b.doctor=d.id  AND a.type = 23 and h.org_code = '"+orgCode+"' " +
                " and a.patient = '"+patient +"' "+
                " ORDER BY a.czrq desc";
        List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql,page,pagesize);
        return mapList;
    }
    /**
     * 查询医生所有的咨询记录
     * @param doctor 医生标识
@ -417,7 +442,7 @@ public class ConsultService {
            }
            if(type.equals(ImUtil.SESSION_TYPE_ONLINE)){
                String sessionId = String.valueOf(map.get("id"))+"_"+String.valueOf(map.get("patient"))+"_23";
                String sessionId = String.valueOf(map.get("patient"))+"_"+doctor+"_23";
                //新增未读消息数量
                Integer count = imUtil.UserSessionsUnreadMessageCount(sessionId,doctor);
                map.put("sessionId",sessionId);
@ -518,7 +543,7 @@ public class ConsultService {
        users.put(patient, 0);
        users.put(doctor, 0);
        String session_type = ImUtil.SESSION_TYPE_ONLINE;
        String sessionId = consult.getId() + "_" + patient + "_" + ct.getType();
        String sessionId = patient + "_" + doctor + "_" + ct.getType();
        JSONObject obj = imUtil.createTopics(sessionId, consult.getId(), tempPatient.getName(), users, messages, session_type);
        if (obj == null) {
            throw new RuntimeException("IM消息发送异常!");