浏览代码

统计代码提交

chenweida 8 年之前
父节点
当前提交
a8361a3525

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/discussion/WlyyTalkGroup.java

@ -15,7 +15,7 @@ public class WlyyTalkGroup  extends IdEntity {
	private String code;
	private String code;
	// 讨论组名称
	// 讨论组名称
	private String name;
	private String name;
	// 讨论组类别 1:咨询 2:讨论 3:干预
	// 讨论组类别 1:咨询 2:求助 3:干预
	private Integer type;
	private Integer type;
	// 讨论组针对病人
	// 讨论组针对病人
	private String patient;
	private String patient;

+ 4 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/discussion/DiscussionGroupDao.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.repository.discussion;
import java.util.List;
import java.util.List;
import com.yihu.wlyy.entity.discussion.WlyyTalkGroupMember;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -46,4 +47,7 @@ public interface DiscussionGroupDao extends PagingAndSortingRepository<WlyyTalkG
	@Query("from WlyyTalkGroup tg where tg.consultCode=?1 and tg.type=?2 ")
	@Query("from WlyyTalkGroup tg where tg.consultCode=?1 and tg.type=?2 ")
	WlyyTalkGroup findByConsultAndType(String consult, int type);
	WlyyTalkGroup findByConsultAndType(String consult, int type);
	@Query("select tgm from WlyyTalkGroup tg,WlyyTalkGroupMember tgm where tg.code = tgm.groupCode and tg.creator=?1 and tg.type=2 and tgm.memberCode = ?2")
	WlyyTalkGroupMember findCreateAndDoctor(String create, String doctorCode);
}
}

+ 21 - 14
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/talk/TalkGroupService.java

@ -127,12 +127,12 @@ public class TalkGroupService extends BaseService {
     * @param patientName
     * @param patientName
     */
     */
    public JSONObject createConsultTalkGroup(String doctor, String doctorName, String hospitalCode, String hospitalName,
    public JSONObject createConsultTalkGroup(String doctor, String doctorName, String hospitalCode, String hospitalName,
                                       String patient, String patientName, String consult) {
                                             String patient, String patientName, String consult) {
        //讨论组建立
        //讨论组建立
        WlyyTalkGroup talkGroup = new WlyyTalkGroup();
        WlyyTalkGroup talkGroup = new WlyyTalkGroup();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyy-MM-dd");
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyy-MM-dd");
        String name = patientName + "—咨询(" + dateFormat.format(new Date()) + ")";
        String name = patientName + "—咨询(" + dateFormat.format(new Date()) + ")";
        String groupCode=getCode();
        String groupCode = getCode();
        talkGroup.setCode(groupCode);
        talkGroup.setCode(groupCode);
        talkGroup.setName(name);
        talkGroup.setName(name);
        talkGroup.setType(1);
        talkGroup.setType(1);
@ -173,8 +173,8 @@ public class TalkGroupService extends BaseService {
        saveTalkGroup(talkGroup, members);
        saveTalkGroup(talkGroup, members);
        JSONObject result = new JSONObject(talkGroup);
        JSONObject result = new JSONObject(talkGroup);
        result.put("members",result);
        result.put("groupCode",groupCode);
        result.put("members", result);
        result.put("groupCode", groupCode);
        return result;
        return result;
    }
    }
@ -188,17 +188,17 @@ public class TalkGroupService extends BaseService {
        JSONObject json = new JSONObject();
        JSONObject json = new JSONObject();
        List<WlyyTalkGroup> groups = discussionGroupDao.findByCodeAndType(consult, 2);
        List<WlyyTalkGroup> groups = discussionGroupDao.findByCodeAndType(consult, 2);
        if(groups != null && groups.size() > 0){
        if (groups != null && groups.size() > 0) {
            json = new JSONObject(groups.get(0));
            json = new JSONObject(groups.get(0));
            List<WlyyTalkGroupMember> members = discussionGroupMemberDao.findByGroupCode(groups.get(0).getCode());
            List<WlyyTalkGroupMember> members = discussionGroupMemberDao.findByGroupCode(groups.get(0).getCode());
            if(members != null){
            if (members != null) {
                JSONArray mArray = new JSONArray();
                JSONArray mArray = new JSONArray();
                for(WlyyTalkGroupMember member : members){
                for (WlyyTalkGroupMember member : members) {
                    mArray.put(new JSONObject(member));
                    mArray.put(new JSONObject(member));
                }
                }
                json.put("members",mArray);
                json.put("members", mArray);
            } else {
            } else {
                json.put("members",new JSONArray());
                json.put("members", new JSONArray());
            }
            }
            return json;
            return json;
@ -229,7 +229,7 @@ public class TalkGroupService extends BaseService {
        List<Doctor> doctors = jdbcTemplate.query(sql, new Object[]{doctor, doctor},
        List<Doctor> doctors = jdbcTemplate.query(sql, new Object[]{doctor, doctor},
                new BeanPropertyRowMapper(Doctor.class));
                new BeanPropertyRowMapper(Doctor.class));
        for(Doctor doc : doctors){
        for (Doctor doc : doctors) {
            JSONObject json = new JSONObject(doc);
            JSONObject json = new JSONObject(doc);
            if (json.has("password")) {
            if (json.has("password")) {
@ -369,6 +369,7 @@ public class TalkGroupService extends BaseService {
            return null;
            return null;
        }
        }
    }
    }
    /**
    /**
     * 查询咨询对应讨论组
     * 查询咨询对应讨论组
     *
     *
@ -379,13 +380,15 @@ public class TalkGroupService extends BaseService {
    public List<WlyyTalkGroup> findAllConsultTalkGroup(String consult) throws Exception {
    public List<WlyyTalkGroup> findAllConsultTalkGroup(String consult) throws Exception {
        List<WlyyTalkGroup> talkGroup = discussionGroupDao.findByConsult(consult);
        List<WlyyTalkGroup> talkGroup = discussionGroupDao.findByConsult(consult);
       return talkGroup;
        return talkGroup;
    }
    }
    public WlyyTalkGroup findConsultTalkGroupByType(String consult,int type) throws Exception {
        WlyyTalkGroup talkGroup = discussionGroupDao.findByConsultAndType(consult,type);
    public WlyyTalkGroup findConsultTalkGroupByType(String consult, int type) throws Exception {
        WlyyTalkGroup talkGroup = discussionGroupDao.findByConsultAndType(consult, type);
        return talkGroup;
        return talkGroup;
    }
    }
    /**
    /**
     * 获取医生对应病人的讨论组纪录
     * 获取医生对应病人的讨论组纪录
     *
     *
@ -1116,8 +1119,12 @@ public class TalkGroupService extends BaseService {
    }
    }
    public ConsultTeam findConsultByGroup(String groupCode) {
    public ConsultTeam findConsultByGroup(String groupCode) {
        WlyyTalkGroup w=discussionGroupDao.findByCode(groupCode);
        WlyyTalkGroup w = discussionGroupDao.findByCode(groupCode);
        return consultTeamDao.findByConsult(w.getConsultCode());
        return consultTeamDao.findByConsult(w.getConsultCode());
    }
    }
    public WlyyTalkGroupMember findCreateAndDoctor(String create, String doctorCode) {
        return discussionGroupDao.findCreateAndDoctor(create, doctorCode);
    }
}
}

+ 29 - 14
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/team/DrHealthTeamService.java

@ -1,16 +1,18 @@
/*******************************************************************************
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
 *******************************************************************************/
package com.yihu.wlyy.service.app.team;
package com.yihu.wlyy.service.app.team;
import com.yihu.wlyy.entity.discussion.WlyyTalkGroupMember;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatient;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatient;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.repository.doctor.*;
import com.yihu.wlyy.repository.doctor.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.talk.TalkGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component;
@ -41,6 +43,9 @@ public class DrHealthTeamService extends BaseService {
    private DoctorDao doctorDao;
    private DoctorDao doctorDao;
    @Autowired
    @Autowired
    DoctorAdminTeamMemberDao memberDao;
    DoctorAdminTeamMemberDao memberDao;
    @Autowired
    private TalkGroupService talkGroupService;
    /**
    /**
     * 查询签约团队的其他医生
     * 查询签约团队的其他医生
     *
     *
@ -245,7 +250,7 @@ public class DrHealthTeamService extends BaseService {
    }
    }
    public List<Doctor> findJiatingTeamDoctors(String parientCode) {
    public List<Doctor> findJiatingTeamDoctors(String parientCode) {
		System.out.println("DrHealthTeamService findJiatingTeamDoctors"+parientCode);
        System.out.println("DrHealthTeamService findJiatingTeamDoctors" + parientCode);
        //查看当前的患者所在的家庭团队
        //查看当前的患者所在的家庭团队
        DoctorTeam doctorTeam = doctorTeamDao.findByParientCode(parientCode);
        DoctorTeam doctorTeam = doctorTeamDao.findByParientCode(parientCode);
        //查看家庭团队里面的医生
        //查看家庭团队里面的医生
@ -257,22 +262,32 @@ public class DrHealthTeamService extends BaseService {
        }
        }
    }
    }
    public Map<String,List<Doctor>> getTeamDoctorsAndAdminTeamDoctors(String doctorCode,Long teamId) {
        Map<String,List<Doctor>> returnMap=new HashMap<>();
    public Map<String, List<Doctor>> getTeamDoctorsAndAdminTeamDoctors(String doctorCode, Long teamId) {
        Map<String, List<Doctor>> returnMap = new HashMap<>();
        //得到责任医生
        //得到责任医生
        List<Doctor> zrDoctors=  doctorTeamMemberDao.getTeamZKByQK(doctorCode);
        for(Doctor doctor:zrDoctors){
            //判断是否求助
            doctor.setIsHelp("0");
        List<Doctor> zrDoctors = doctorTeamMemberDao.getTeamZKByQK(doctorCode);
        for (Doctor doctor : zrDoctors) {
            WlyyTalkGroupMember wlyyTalkGroupMember = talkGroupService.findCreateAndDoctor(doctorCode, doctor.getCode());
            if (wlyyTalkGroupMember != null) {
                //判断是否求助
                doctor.setIsHelp("0");
            } else {
                doctor.setIsHelp("1");
            }
        }
        }
        //得到医生所在的团队的除了自己的所有人
        //得到医生所在的团队的除了自己的所有人
        List<Doctor> teamDoctors= memberDao.findAllHeathExcludeThis(teamId, doctorCode);
        for(Doctor doctor:teamDoctors){
            //判断是否求助
            doctor.setIsHelp("0");
        List<Doctor> teamDoctors = memberDao.findAllHeathExcludeThis(teamId, doctorCode);
        for (Doctor doctor : teamDoctors) {
            WlyyTalkGroupMember wlyyTalkGroupMember = talkGroupService.findCreateAndDoctor(doctorCode, doctor.getCode());
            if (wlyyTalkGroupMember != null) {
                //判断是否求助
                doctor.setIsHelp("0");
            } else {
                doctor.setIsHelp("1");
            }
        }
        }
        returnMap.put("zr",zrDoctors);
        returnMap.put("team",teamDoctors);
        returnMap.put("zr", zrDoctors);
        returnMap.put("team", teamDoctors);
        return returnMap;
        return returnMap;
    }
    }
}
}