Sfoglia il codice sorgente

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

8 anni fa
parent
commit
441b8773e3

+ 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);
            //得到团队的健康管理师
            member = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 3);
            if (member == null) {
                member = 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);
            //得到团队的健康管理师
            member = doctorTeamDoctor.findDoctorJiating2ByTeam(doctorTeam.getCode(), 3);
            if (member == null) {
                member = 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;

+ 93 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -976,7 +976,7 @@ public class FamilyContractService extends BaseService {
            SignFamily sssignFamily = signFamilyDao.findSSByIdcard(p.getIdcard());
            if (sssignFamily != null) {
                if(StringUtils.isNotEmpty(doctor)) {
                if (StringUtils.isNotEmpty(doctor)) {
                    if (!doctor.equals(sssignFamily.getDoctor())) {
                        result.put("status", -2);
                        result.put("msg", "居民已签约三师,故全科医生只可为" + sssignFamily.getDoctorName() + "医生,请重新选择全科医生");
@ -1793,7 +1793,99 @@ public class FamilyContractService extends BaseService {
    public List<SignFamily> findAllSignByPatient(String patient) {
        return signFamilyDao.findAllSignByPatient(patient);
    }
    public List<SignFamily> findNoHealthSignFamilyNum(String doctor) {
        return signFamilyDao.findNoHealthSignFamilyNum(doctor);
    }
    /**
     * 判断居民与医生是否存在签约关系
     *
     * @param patient
     * @param doctor
     * @return
     */
    public JSONObject isPatientAndDoctorExistSign(String patient, String doctor) {
        JSONObject result = new JSONObject();
        SignFamily familySign = signFamilyDao.findFamilySignByPatient(patient);
        SignFamily sanshiSign = signFamilyDao.findSanshiSignByPatient(patient);
        if (familySign != null) {
            if (doctor.equals(StringUtils.isEmpty(familySign.getDoctor()) ? "" : familySign.getDoctor()) ||
                    doctor.equals(StringUtils.isEmpty(familySign.getDoctorHealth()) ? "" : familySign.getDoctorHealth())) {
                if (familySign.getStatus() == 0) {
                    result.put("status", "0");
                    result.put("msg", "已申请家庭签约");
                } else {
                    result.put("status", "1");
                    result.put("msg", "已有家庭签约");
                }
                return result;
            }
        }
        if (sanshiSign != null) {
            if (doctor.equals(StringUtils.isEmpty(sanshiSign.getDoctor()) ? "" : sanshiSign.getDoctor()) ||
                    doctor.equals(StringUtils.isEmpty(sanshiSign.getDoctorHealth()) ? "" : sanshiSign.getDoctorHealth())) {
                result.put("status", "2");
                result.put("msg", "已有三师签约");
                return result;
            }
        }
        result.put("status", "-1");
        result.put("msg", "无签约关系");
        return result;
    }
    /**
     * 判断医生与居民是否可签约
     *
     * @param patient
     * @param doctor
     * @return
     */
    public JSONObject isPatientAndDoctorCanSign(String patient, String doctor) {
        JSONObject result = new JSONObject();
        Doctor doc = doctorDao.findByCode(doctor);
        SignFamily familySign = signFamilyDao.findFamilySignByPatient(patient);
        SignFamily sanshiSign = signFamilyDao.findSanshiSignByPatient(patient);
        if (familySign != null) {
            if (familySign.getStatus() == 0) {
                result.put("status", "0");
                result.put("msg", "已申请签约,不可签约");
            } else {
                result.put("status", "-1");
                result.put("msg", "因已签约家庭医生,不可签约");
            }
            return result;
        }
        if (sanshiSign != null) {
            if (doc.getLevel() == 2) {
                if (!doctor.equals(StringUtils.isEmpty(sanshiSign.getDoctor()) ? "" : sanshiSign.getDoctor())) {
                    result.put("status", "-2");
                    result.put("msg", "因签约对象不含签约三师中全科,不可签约");
                    return result;
                }
            } else {
                List<AdminTeam> teams = adminTeamService.findDoctorsTeams(doctor, sanshiSign.getDoctor());
                if (teams == null || teams.size() < 1) {
                    result.put("status", "-3");
                    result.put("msg", "因签约对象不与签约三师中全科在同一团队,不可签约");
                } else {
                    result.put("status", "1");
                    result.put("msg", "可签约");
                    result.put("team", teams);
                }
                return result;
            }
        }
        result.put("status", "1");
        result.put("msg", "可签约");
        return result;
    }
}

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

@ -713,6 +713,7 @@ public class TalkGroupService extends BaseService {
            Map<String, Object> map = jdbcTemplate.queryForMap(sqlP, new Object[]{im.get("")});
            if (map != null) {
                json.put("code", map.get("code"));
                json.put("name", map.get("name"));
                json.put("sex", map.get("sex"));
                json.put("idcard", map.get("idcard"));

+ 50 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -913,4 +913,54 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            return error(-1, "查询失败");
        }
    }
    /**
     * 查询居民是否与某个医生存在签约关系
     *
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/doctor_patient_sign_exist",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public String isPatientAndDoctorExistSign(@RequestParam(required = true) String doctor,
                                              @RequestParam(required = true) String patient){
        try{
            if(StringUtils.isEmpty(doctor)){
                return error(-1,"医生不能为空");
            }
            if(StringUtils.isEmpty(patient)){
                return error(-1,"居民不能为空");
            }
            JSONObject result = familyContractService.isPatientAndDoctorExistSign(patient,doctor);
            return write(200,"查询成功","data",result);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    /**
     * 查询居民与某个医生是否可签约
     *
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/doctor_patient_can_sign",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public String isPatientAndDoctorCanSign(@RequestParam(required = true) String doctor,
                                            @RequestParam(required = true) String patient){
        try{
            if(StringUtils.isEmpty(doctor)){
                return error(-1,"医生不能为空");
            }
            if(StringUtils.isEmpty(patient)){
                return error(-1,"居民不能为空");
            }
            JSONObject result = familyContractService.isPatientAndDoctorCanSign(patient,doctor);
            return write(200,"查询成功","data",result);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
}

+ 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.名医咨询

+ 41 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java

@ -577,4 +577,45 @@ public class FamilyContractController extends BaseController {
        }
    }
    /**
     * 查询居民是否与某个医生存在签约关系
     *
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/doctor_sign_exist",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public String isPatientAndDoctorExistSign(@RequestParam(required = true) String doctor){
        try{
            if(StringUtils.isEmpty(doctor)){
                return error(-1,"医生不能为空");
            }
            JSONObject result = familyContractService.isPatientAndDoctorExistSign(getUID(),doctor);
            return write(200,"查询成功","data",result);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    /**
     * 查询居民与某个医生是否可签约
     *
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/doctor_can_sign",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public String isPatientAndDoctorCanSign(@RequestParam(required = true) String doctor){
        try{
            if(StringUtils.isEmpty(doctor)){
                return error(-1,"医生不能为空");
            }
            JSONObject result = familyContractService.isPatientAndDoctorCanSign(getUID(),doctor);
            return write(200,"查询成功","data",result);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
}

+ 11 - 6
patient-co-wlyy/src/main/resources/weixin_menu.txt

@ -3,21 +3,26 @@
   {
	  "name":"家庭医生",
	  "sub_button":[
		 {
			   "type":"view",
			   "name":"签约管理",
			   "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fqygl%2fhtml%2fsigning-doctors.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		  {
			"type":"view",
			"name":"签约管理",
			"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fqygl%2fhtml%2fsigning-doctors.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		  },
		  {
			"type":"view",
			"name":"医生咨询",
			"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fyszx%2fhtml%2fdoctor-consultation.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		   },
		  },
		  {
			"type":"view",
			"name":"医生指导",
			"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fyszd%2fhtml%2fdoctor-guidance.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		   }
		  },
		  {
            "type":"view",
            "name":"健康文章",
            "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjkjy%2fhtml%2farticle_list.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
          }
	  ]
   },