Forráskód Böngészése

Merge branch 'dev' of lyr/patient-co-management into dev

lyr 8 éve
szülő
commit
049accb321

+ 4 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/ConsultTeamDao.java

@ -29,8 +29,8 @@ public interface ConsultTeamDao extends PagingAndSortingRepository<ConsultTeam,
	List<ConsultTeam> findUnfinishedConsultType(String patient,String doctor);
	// 统计未完成的数量
	@Query("select count(1) from ConsultTeam a where a.patient = ?1 and a.status = 0 and a.del = '1'and a.type=?2")
	int countByPatient(String patient,Integer signType);
	@Query("select count(1) from ConsultTeam a where a.patient = ?1 and a.status = 0 and a.del = '1'and a.doctor=?2")
	int countByPatient(String patient,String doctor);
	// 被指定且未结束列表
	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and b.to = ?1 and a.del = '1' and b.del = '1' and a.type<3")
@ -168,8 +168,8 @@ public interface ConsultTeamDao extends PagingAndSortingRepository<ConsultTeam,
	@Query("SELECT a FROM ConsultTeam a WHERE a.type=2 and unix_timestamp(a.czrq)>=unix_timestamp(?1) and unix_timestamp(a.czrq)<unix_timestamp(?2) ")
	List<ConsultTeam> findByCzrqyYesterday(String yesterday,String now);
	//查找
	@Query("SELECT a FROM ConsultTeam a WHERE a.patient=?1 and a.status=0 and a.del=1 and a.type=6")
	ConsultTeam findFamousConsultByPatient(String uid);
	@Query("SELECT a FROM ConsultTeam a WHERE a.patient=?1 and a.doctor = ?2 and a.status=0 and a.del=1 and a.type=6")
	ConsultTeam findFamousConsultByPatient(String uid,String doctor);
	//名医咨询 -全部
	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and (a.type=6 or a.type=7 ) and b.to = ?1 and a.id < ?2 and a.del = '1' and b.del = '1'")
	Page<ConsultTeam> findFamousDoctorAllList(String uid, long id, Pageable pageRequest);

+ 42 - 6
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -83,8 +83,44 @@ public class ConsultTeamService extends ConsultService {
     * @param patient
     * @return
     */
    public boolean exist(String patient, Integer type) {
        int count = consultTeamDao.countByPatient(patient, type);
    public boolean exist(String patient, Integer type) throws Exception {
        DoctorTeamMember member = null;
        // 咨询三师
        if (type == 1) {
            // 查询三师签约信息
            SignFamily sc = signFamilyDao.findBySanshiPatientYes(patient);
            if(sc == null){
                throw new Exception("不存在三师签约");
            }
            // 设置健康管理师,三师咨询默认给健康管理师处理
            //查找病人所在的团队
            DoctorTeam doctorTeam = doctorTeamDao.findBySanshiParientCode(patient);
            //得到团队的健康管理师
            DoctorTeamMember doctorTeamMember = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 3);
            if (doctorTeamMember == null) {
                doctorTeamMember = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 2);
            }
        } else if (type == 2) {
            // 咨询家庭医生
            SignFamily sf = signFamilyDao.findByjiatingPatient(patient);
            if(sf == null){
                throw new Exception("不存在家庭签约");
            }
            // 设置健康管理师,家庭医生咨询默认给健康管理师处理
            //查找病人所在的团队
            DoctorTeam doctorTeam = doctorTeamDao.findByParientCode(patient);
            //得到团队的健康管理师
            DoctorTeamMember doctorTeamMember = doctorTeamDoctor.findDoctorJiating2ByTeam(doctorTeam.getCode(), 3);
            if (doctorTeamMember == null) {
                doctorTeamMember = doctorTeamDoctor.findDoctorJiating2ByTeam(doctorTeam.getCode(), 2);
            }
        }
        if(member == null){
            throw new Exception("找不到签约服务团队医生");
        }
        int count = consultTeamDao.countByPatient(patient, member.getMemberCode());
        return count > 0;
    }
@ -913,7 +949,7 @@ public class ConsultTeamService extends ConsultService {
     * 查询居民与某个医生未结束的咨询
     *
     * @param patient 居民
     * @param doctor 医生
     * @param doctor  医生
     * @return
     */
    public List<ConsultTeam> getUnfinishedConsult(String patient, String doctor) {
@ -954,9 +990,9 @@ public class ConsultTeamService extends ConsultService {
        return consultTeamLogDao.findOne(logId);
    }
    public boolean isExistFamousConsult(String uid) {
        ConsultTeam consultTeam = consultTeamDao.findFamousConsultByPatient(uid);
        if (consultTeam != null) {
    public boolean isExistConsult(String uid, String doctor) {
        int consultTeam = consultTeamDao.countByPatient(uid, doctor);
        if (consultTeam > 0) {
            return true;
        } else {
            return false;

+ 9 - 5
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -263,8 +263,12 @@ public class ConsultController extends WeixinBaseController {
            if (type != 1 && type != 2) {
                return error(-1, "无效请求!");
            }
            if (consultTeamService.exist(getUID(), type)) {
                return error(-1, "还有咨询未结束,不允许再次提交咨询!");
            try {
                if (consultTeamService.exist(getUID(), type)) {
                    return error(-1, "还有咨询未结束,不允许再次提交咨询!");
                }
            } catch (Exception e) {
                return error(-1, e.getMessage());
            }
            if (StringUtils.isEmpty(images)) {
                images = fetchWxImages();
@ -363,9 +367,9 @@ public class ConsultController extends WeixinBaseController {
            if (StringUtils.isNotEmpty(voice)) {
                voice = CommonUtil.copyTempVoice(voice);
            }
            //判断是否已经存在还没有关闭的名医咨询
            if (consultTeamService.isExistFamousConsult(getUID())) {
                return error(-1, "已经存在名医咨询!");
            //判断是否已经存在还没有关闭的咨询
            if (consultTeamService.isExistConsult(getUID(), doctorCode)) {
                return error(-1, "还有咨询未结束,不允许再次提交咨询!");
            }
            ConsultTeam consult = new ConsultTeam();
            // 设置咨询类型:1三师咨询,2家庭医生咨询 6.名医咨询