Browse Source

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

liubing 3 years ago
parent
commit
43c72298e5

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java

@ -26,6 +26,7 @@ public class ConsultTeamDo extends UuidIdentityEntity {
	// 13、互联网医院专家咨询, 20紧急救助咨询, 21上门辅导咨询, 22安防警报咨询
	// 13、互联网医院专家咨询, 20紧急救助咨询, 21上门辅导咨询, 22安防警报咨询
	// 23 新生儿在线咨询
	// 23 新生儿在线咨询
	// 24 老人在线咨询
	// 24 老人在线咨询
	// 25
	private String patient;         // 提问者标识
	private String patient;         // 提问者标识
	private String name;            // 患者姓名
	private String name;            // 患者姓名
	private Integer sex;            // 患者性别
	private Integer sex;            // 患者性别

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java

@ -25,6 +25,7 @@ public class SystemMessageDO extends UuidIdentityEntity {
     * 家属紧急预警系统消息 50
     * 家属紧急预警系统消息 50
     * 新生儿在线咨询 850
     * 新生儿在线咨询 850
     * 老人在线咨询 851
     * 老人在线咨询 851
     * 老人健康咨询 852
     */
     */
    private String type;
    private String type;
    /**
    /**

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

@ -117,7 +117,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "sessionId",required = false) String sessionId,
            @RequestParam(value = "sessionId",required = false) String sessionId,
			@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老人在线咨询,25老人健康咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type){
			@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)){
@ -136,7 +136,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "doctor",required = false) String doctor,
			@RequestParam(value = "doctor",required = false) String doctor,
			@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老人在线咨询,25老人健康咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type){
			@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);
@ -160,7 +160,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "images",required = false) String images,
			@RequestParam(value = "images",required = false) String images,
			@ApiParam(name = "voice", value = "语音")
			@ApiParam(name = "voice", value = "语音")
			@RequestParam(value = "voice",required = false) String voice,
			@RequestParam(value = "voice",required = false) String voice,
			@ApiParam(name = "type", value = "咨询类型:23在线咨询,24老人在线咨询")
			@ApiParam(name = "type", value = "咨询类型:23在线咨询,24老人在线咨询,25老人健康咨询")
			@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){
			@RequestParam(value = "source",required = false) String source){
@ -173,7 +173,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			String agent = getAgentUID();
			String agent = getAgentUID();
			ConsultTeamDo consult = new ConsultTeamDo();
			ConsultTeamDo consult = new ConsultTeamDo();
			// 设置咨询类型:23 在线咨询 24老人在线咨询
			// 设置咨询类型:23 在线咨询 24老人在线咨询 25老人健康咨询
			consult.setType(type);
			consult.setType(type);
			// 设置主要症状
			// 设置主要症状
			consult.setSymptoms(symptoms);
			consult.setSymptoms(symptoms);
@ -189,10 +189,19 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				re = consultService.addTeamConsult(consult, patient,doctor,source,agent);
				re = consultService.addTeamConsult(consult, patient,doctor,source,agent);
				//发送系统消息
				//发送系统消息
				SystemMessageDO systemMessageDO = new SystemMessageDO();
				SystemMessageDO systemMessageDO = new SystemMessageDO();
				systemMessageDO.setTitle("新增在线咨询");
				systemMessageDO.setType("850");
				if (type==24){
					systemMessageDO.setType("851");
				switch (type){
					case 23:
						systemMessageDO.setTitle("新增在线咨询");
						systemMessageDO.setType("850");
						break;
					case 24:
						systemMessageDO.setTitle("新增在线咨询");
						systemMessageDO.setType("851");
						break;
					case 25:
						systemMessageDO.setTitle("新增健康咨询");
						systemMessageDO.setType("852");
						break;
				}
				}
				systemMessageDO.setReceiver(re.getString("doctor"));
				systemMessageDO.setReceiver(re.getString("doctor"));
				systemMessageDO.setReceiverName(re.getString("doctorName"));
				systemMessageDO.setReceiverName(re.getString("doctorName"));
@ -226,7 +235,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "patient",required = true) String patient,
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name = "orgCode", value = "机构code")
			@ApiParam(name = "orgCode", value = "机构code")
			@RequestParam(value = "orgCode",required = true) String orgCode,
			@RequestParam(value = "orgCode",required = true) String orgCode,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询 25老人健康咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type,
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type,
			@ApiParam(name = "page", value = "第几页")
			@ApiParam(name = "page", value = "第几页")
			@RequestParam(value = "page",required = false) int page,
			@RequestParam(value = "page",required = false) int page,
@ -251,7 +260,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "symptoms",required = false) String symptoms,
			@RequestParam(value = "symptoms",required = false) String symptoms,
			@ApiParam(name = "id", value = "咨询ID")
			@ApiParam(name = "id", value = "咨询ID")
			@RequestParam(value = "id",required = false) String id,
			@RequestParam(value = "id",required = false) String id,
			@ApiParam(name = "type", value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@ApiParam(name = "type", value = "咨询类型 23新生儿在线咨询 24老人在线咨询 25老人健康咨询")
			@RequestParam(value = "type",required = true) String type,
			@RequestParam(value = "type",required = true) String type,
			@ApiParam(name = "status", value = "咨询状态:0进行中,1已完成,-1患者取消,-2超时未响应自动关闭")
			@ApiParam(name = "status", value = "咨询状态:0进行中,1已完成,-1患者取消,-2超时未响应自动关闭")
			@RequestParam(value = "status",required = false) Integer status,
			@RequestParam(value = "status",required = false) Integer status,
@ -528,7 +537,6 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				object.put("relation_code",session_id);
				object.put("relation_code",session_id);
				imService.sendWaiSocketMessage(sender_id,doctorRoleDO.getDoctorCode(),object.toString(),"1");
				imService.sendWaiSocketMessage(sender_id,doctorRoleDO.getDoctorCode(),object.toString(),"1");
			}
			}
			return success(result);
			return success(result);
		} catch (Exception e) {
		} catch (Exception e) {
			return failedException2(e);
			return failedException2(e);

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

@ -76,6 +76,22 @@ public class SignEndpoint extends EnvelopRestEndpoint {
        }
        }
    }
    }
    @GetMapping(value = "findOrgWithoutSigned")
    @ApiOperation(value = "查找签约机构")
    public ListEnvelop findOrgWithoutSigned (
            @ApiParam(name = "patient", value = "患者code", required = true)
            @RequestParam(value = "patient",required = true) String patient,
            @ApiParam(name = "name", value = "机构名称", required = false)
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "type", value = "类型 3 养老 4 教育,1 医疗", required = false)
            @RequestParam(value = "type",required = false) String type) throws Exception {
        try{
            return ListEnvelop.getSuccess("查询成功",servicePackageService.findOrgWithoutSigned(patient,name,type));
        }catch (Exception e){
            return failedListEnvelopException2(e);
        }
    }
    @GetMapping(value = "findSignDoctor")
    @GetMapping(value = "findSignDoctor")
    @ApiOperation(value = "查找签约医生")
    @ApiOperation(value = "查找签约医生")
    public ListEnvelop findSignDoctor (
    public ListEnvelop findSignDoctor (

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

@ -517,6 +517,20 @@ public class ConsultService {
     */
     */
    public JSONObject addTeamConsult(ConsultTeamDo ct, String patient, String doctor, String source,String agent) throws Exception {
    public JSONObject addTeamConsult(ConsultTeamDo ct, String patient, String doctor, String source,String agent) throws Exception {
        JSONObject re = new JSONObject();
        JSONObject re = new JSONObject();
        String title = "";
        switch (ct.getType()){
            case 23:
                title="在线咨询";
                break;
            case 24:
                title="在线咨询";
                break;
            case 25:
                title="健康咨询";
                break;
            default:
                throw new RuntimeException("暂不支持发起此类型的咨询!");
        }
        boolean boo = StringUtils.isEmpty(getUnfinishedConsult(patient, doctor,ct.getType()));
        boolean boo = StringUtils.isEmpty(getUnfinishedConsult(patient, doctor,ct.getType()));
        logger.info("boo"+boo);
        logger.info("boo"+boo);
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("consultClose");
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("consultClose");
@ -528,7 +542,7 @@ public class ConsultService {
        }
        }
        if (!flag){
        if (!flag){
            if (!StringUtils.isEmpty(getUnfinishedConsult(patient, doctor,ct.getType()))) {
            if (!StringUtils.isEmpty(getUnfinishedConsult(patient, doctor,ct.getType()))) {
                throw new RuntimeException("居民还有未结束的在线咨询!");
                throw new RuntimeException("居民还有未结束的"+title+"!");
            }
            }
        }
        }
@ -557,7 +571,7 @@ public class ConsultService {
        // 医生未读数量为1
        // 医生未读数量为1
        ct.setDoctorRead(1);
        ct.setDoctorRead(1);
        // 添加咨询记录
        // 添加咨询记录
        ConsultDo consult = imService.addConsult(ct.getPatient(), "在线咨询", ct.getSymptoms(), ct.getImages(), ct.getType(),source);
        ConsultDo consult = imService.addConsult(ct.getPatient(), title, ct.getSymptoms(), ct.getImages(), ct.getType(),source);
//		// 设置关联指导
//		// 设置关联指导
//		consult.setGuidance(ct.getGuidance());
//		consult.setGuidance(ct.getGuidance());
        // 设置咨询标识
        // 设置咨询标识
@ -568,7 +582,7 @@ public class ConsultService {
        ct.setDoctorName(baseDoctorDO.getName());
        ct.setDoctorName(baseDoctorDO.getName());
        JSONObject jsonObject = new JSONObject();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("title", tempPatient.getName() + "申请在线咨询");
        jsonObject.put("title", tempPatient.getName() + "申请"+title);
        jsonObject.put("content",ct.getSymptoms());
        jsonObject.put("content",ct.getSymptoms());
        jsonObject.put("age", DateUtil.getAgeForIdcard(tempPatient.getIdcard()));
        jsonObject.put("age", DateUtil.getAgeForIdcard(tempPatient.getIdcard()));
        jsonObject.put("sex",tempPatient.getSex());
        jsonObject.put("sex",tempPatient.getSex());

+ 8 - 12
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java

@ -193,8 +193,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        if (doctorDO==null){
        if (doctorDO==null){
            return new ArrayList<>();
            return new ArrayList<>();
        }
        }
        //教师角色登录时为本机构科室列表,点击展开人员列表
        //助老员角色登录时为本机构科室列表,点击展开人员列表
        //医生通讯录只展示医生所在医院下所有科室列表 其他角色同理
        Integer doctorLevel = doctorDO.getLevel();
        Integer doctorLevel = doctorDO.getLevel();
        Integer doctorOrgType =0 ;
        Integer doctorOrgType =0 ;
        boolean isSearchDoctorOrgType=false;
        boolean isSearchDoctorOrgType=false;
@ -210,18 +209,13 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                isSearchDoctorOrgType=true;
                isSearchDoctorOrgType=true;
            }
            }
        }
        }
        if (1==doctorLevel) {//专科医生
            doctorOrgType=1;
            if ("1,2".equals(orgType)){
                isSearchDoctorOrgType=true;
            }
        }
        if (2==doctorLevel) {//社区医生
        if (1==doctorLevel) {//社区医生
            doctorOrgType=2;
            doctorOrgType=2;
            if ("1,2".equals(orgType)){
            if ("1,2".equals(orgType)){
                isSearchDoctorOrgType=true;
                isSearchDoctorOrgType=true;
            }
            }
        }
        }
        //医生机构
        //医生机构
        String sql ="select org.code from base_doctor_hospital dh inner join base_org org on dh.org_code = org.code " +
        String sql ="select org.code from base_doctor_hospital dh inner join base_org org on dh.org_code = org.code " +
                "and dh.doctor_code='"+doctorId+"' and org.type='"+doctorOrgType+"' ORDER BY dh.create_time desc limit 1";
                "and dh.doctor_code='"+doctorId+"' and org.type='"+doctorOrgType+"' ORDER BY dh.create_time desc limit 1";
@ -235,11 +229,13 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                sql += " and org.code = '"+doctorOrg.get(0)+"' ";
                sql += " and org.code = '"+doctorOrg.get(0)+"' ";
            }
            }
            sql += " GROUP BY org.`code` ";
            sql += " GROUP BY org.`code` ";
        }
        else if (orgType.equals("1,2")){//医疗机构
        } else if (orgType.equals("1,2")){//医疗机构
           sql+=" and org.type in(1,2) ";
           sql+=" and org.type in(1,2) ";
            if (isSearchDoctorOrgType&&doctorOrg.size()>0){
                sql += " and org.code = '"+doctorOrg.get(0)+"' ";
            }
        }
        }
        else {//养老
        else {//教师
            if (isSearchDoctorOrgType&&doctorOrg.size()>0){
            if (isSearchDoctorOrgType&&doctorOrg.size()>0){
                sql += " and org.code = '"+doctorOrg.get(0)+"' and org.type='"+orgType+"'  ";
                sql += " and org.code = '"+doctorOrg.get(0)+"' and org.type='"+orgType+"'  ";
            }else {
            }else {

+ 21 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java

@ -203,6 +203,27 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        return list;
        return list;
    }
    }
    public List<BaseOrgDO> findOrgWithoutSigned(String patient,String name,String type){
        String sql = " select DISTINCT o.* from base_org o where o.`code` not in ( " +
                "SELECT  DISTINCT i.org_code FROM  base_service_package_sign_record sr, " +
                " base_service_package_record r,  base_service_package i WHERE  sr.id = r.sign_id " +
                " and sr.status=1 and sr.patient = '"+patient+"' " +
                " AND r.service_package_id = i.id AND i.del = 1  AND sr.`status` = 1 " +
                ") ";
        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;
    }
    /**
    /**
     * 查找签约医生
     * 查找签约医生
     * @param patient
     * @param patient

+ 2 - 2
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/consult/FinishConsultJob.java

@ -59,7 +59,7 @@ public class FinishConsultJob implements Job {
            sql.append("SELECT s.id session_id, s.name session_name, s.create_date session_create_time, s.last_message_time, ")
            sql.append("SELECT s.id session_id, s.name session_name, s.create_date session_create_time, s.last_message_time, ")
            .append("t.id topic_id, t.name topic_name, t.create_time topic_create_time, t.start_message_id ")
            .append("t.id topic_id, t.name topic_name, t.create_time topic_create_time, t.start_message_id ")
            .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
            .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
            .append("WHERE s.id = t.session_id AND s.type in(23,24)  AND t.end_message_id IS NULL AND s.last_content_type in(1,2,3,4,15,16,17) and s.last_sender_id IN ( ")
            .append("WHERE s.id = t.session_id AND s.type in(23,24,25)  AND t.end_message_id IS NULL AND s.last_content_type in(1,2,3,4,15,16,17) and s.last_sender_id IN ( ")
            .append("SELECT id FROM ").append(imDb).append(".doctors d where d.id<>t.patient) ")
            .append("SELECT id FROM ").append(imDb).append(".doctors d where d.id<>t.patient) ")
            .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600 ")
            .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600 ")
            .append("ORDER BY t.create_time");
            .append("ORDER BY t.create_time");
@ -82,7 +82,7 @@ public class FinishConsultJob implements Job {
            sql = new StringBuffer();
            sql = new StringBuffer();
            sql.append("SELECT s.id session_id,t.id topic_id, t.name topic_name ")
            sql.append("SELECT s.id session_id,t.id topic_id, t.name topic_name ")
             .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
             .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
             .append("WHERE s.id = t.session_id AND s.type in (23,24) AND t.end_message_id IS NULL AND t.reply=1 AND s.last_content_type =14 ")
             .append("WHERE s.id = t.session_id AND s.type in (23,24,25) AND t.end_message_id IS NULL AND t.reply=1 AND s.last_content_type =14 ")
             .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600  ");
             .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600  ");
            StringBuffer sql2 = new StringBuffer();
            StringBuffer sql2 = new StringBuffer();