فهرست منبع

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

trick9191 7 سال پیش
والد
کامیت
2e2aad3b58

+ 55 - 6
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/sign/SignFamilyService.java

@ -277,7 +277,7 @@ public class SignFamilyService extends BaseJpaService<SignFamily,Long> {
            if(!StringUtils.isEmpty(doctor)){
                //1.4.2更新重点关注列表,取消关注
                updateTrackPatient(signFamily.getPatient(),signFamily.getDoctor());
                updateTrackPatient(signFamily.getPatient(),signFamily.getDoctor(),signFamily.getDoctorHealth(),doctor,doctorHealth);
                signFamily.setDoctor(doctor);
                signFamily.setDoctorName(doctorName);
@ -285,7 +285,7 @@ public class SignFamilyService extends BaseJpaService<SignFamily,Long> {
            if(!StringUtils.isEmpty(doctorHealth)){
                //1.4.2更新重点关注列表,取消关注
                updateTrackPatient(signFamily.getPatient(),signFamily.getDoctorHealth());
                updateTrackPatient(signFamily.getPatient(),signFamily.getDoctorHealth(),signFamily.getDoctor(),doctor,doctorHealth);
                signFamily.setDoctorHealth(doctorHealth);
                signFamily.setDoctorHealthName(doctorHealthName);
@ -447,9 +447,58 @@ public class SignFamilyService extends BaseJpaService<SignFamily,Long> {
        return list ;
    }
    public void updateTrackPatient(String patient,String oldDoctor){
        TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(oldDoctor,patient);
        trackPatient.setDel("0");
        trackPatientDao.save(trackPatient);
    /**
     * 设置取消关注
     * @param patient
     * @param oldDoctor 患者签约旧的要取消关注的医生
     * @param oldDoctor2 患者旧的签约的另一个医生
     * @param newDoctor 患者新签约的全科医生
     * @param newHDoctor 患者新签约的健康管理师
     */
    public void updateTrackPatient(String patient,String oldDoctor,String oldDoctor2,String newDoctor,String newHDoctor){
        //是否需要修改
        boolean flag = false;
        if(StringUtils.isBlank(oldDoctor)){
            return ;
        }
        //1.两个都修改
        if(StringUtils.isNotBlank(newDoctor)&&StringUtils.isNotBlank(newHDoctor)){
            if((!oldDoctor.equals(newDoctor))&&(!oldDoctor.equals(newHDoctor))){
                flag = true;
            }
            //只改全科
        }else if(StringUtils.isNotBlank(newDoctor)&&StringUtils.isBlank(newHDoctor)){
            if(!oldDoctor.equals(newDoctor)){
                if(StringUtils.isBlank(oldDoctor2)){
                    flag = true;
                }else{
                    if(!oldDoctor.equals(oldDoctor2)){
                        flag = true;
                    }
                }
            }
            //只改健管
        }else if(StringUtils.isBlank(newDoctor)&&StringUtils.isNotBlank(newHDoctor)){
            if(!oldDoctor.equals(newHDoctor)){
                if(StringUtils.isBlank(oldDoctor2)){
                    flag = true;
                }else{
                    if(!oldDoctor.equals(oldDoctor2)){
                        flag = true;
                    }
                }
            }
        }else{
            return ;
        }
        if(flag){
            TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(oldDoctor,patient);
            if(trackPatient!=null){
                trackPatient.setDel("0");
                trackPatientDao.save(trackPatient);
            }
        }
    }
}

+ 41 - 43
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -42,6 +42,8 @@ import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
@ -71,6 +73,7 @@ import java.util.*;
@Component
public class DoctorInfoService extends BaseService {
    private static Logger logger = LoggerFactory.getLogger(DoctorInfoService.class);
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
@ -856,7 +859,7 @@ public class DoctorInfoService extends BaseService {
        String oldDoctorHealthName = signFamily.getDoctorHealthName();
        //1.4.2更新重点关注列表,取消关注
        familyContractService.updateTrackPatient(patient,signFamily.getDoctorHealth());
        familyContractService.updateTrackPatient(patient,signFamily.getDoctorHealth(),signFamily.getDoctor(),null,newDoctorCode);
        //修改签约中的健康管理师
        signFamily.setDoctorHealth(newD.getCode());
@ -1013,7 +1016,7 @@ public class DoctorInfoService extends BaseService {
        Doctor newD = doctorDao.findByCode(newDoctorCode);
        //1.4.2更新重点关注列表,取消关注
        familyContractService.updateTrackPatient(patient,signFamily.getDoctorHealth());
        familyContractService.updateTrackPatient(patient,signFamily.getDoctorHealth(),signFamily.getDoctor(),null,newDoctorCode);
        //修改签约中的健康管理师
        signFamily.setDoctorHealth(newD.getCode());
@ -1239,7 +1242,7 @@ public class DoctorInfoService extends BaseService {
        String oldDoctorName = signFamily.getDoctorName();
        //1.4.2更新重点关注列表,取消关注
        familyContractService.updateTrackPatient(patient,signFamily.getDoctor());
        familyContractService.updateTrackPatient(patient,signFamily.getDoctor(),signFamily.getDoctorHealth(),newDoctorCode,null);
        //修改签约中的全科医生
        signFamily.setDoctor(newD.getCode());
@ -1257,50 +1260,45 @@ public class DoctorInfoService extends BaseService {
        newDoctorTeamMember.setCode(UUID.randomUUID().toString().replace("-", ""));
        doctorTeamDoctor.save(newDoctorTeamMember);
        Patient p = patientDao.findByCode(patient);
        JSONObject data = new JSONObject();
        data.put("toUser", patient);
        data.put("represented",patient);//被代理人
        data.put("doctor", newD.getCode());
        data.put("doctorName", newD.getName());
        data.put("keyword3", "家庭医生-全科医生");
        data.put("keyword2", DateUtil.dateToStrNoSecond(new Date()));
        data.put("keyword1", newD.getName());
        if (StringUtils.isEmpty(signFamily.getDoctorHealth()) || signFamily.getDoctor().equals(signFamily.getDoctorHealth())) {
            data.put("remark", newD.getName() + "医生将继续为您提供优质健康服务");
        } else {
            data.put("remark", newD.getName() + "医生将继续为您提供优质健康服务");
        }
        try{
            Patient p = patientDao.findByCode(patient);
            JSONObject data = new JSONObject();
            data.put("toUser", patient);
            data.put("represented",patient);//被代理人
            data.put("doctor", newD.getCode());
            data.put("doctorName", newD.getName());
            data.put("keyword3", "家庭医生-全科医生");
            data.put("keyword2", DateUtil.dateToStrNoSecond(new Date()));
            data.put("keyword1", newD.getName());
            if (StringUtils.isEmpty(signFamily.getDoctorHealth()) || signFamily.getDoctor().equals(signFamily.getDoctorHealth())) {
                data.put("remark", newD.getName() + "医生将继续为您提供优质健康服务");
            } else {
                data.put("remark", newD.getName() + "医生将继续为您提供优质健康服务");
            }
        if (StringUtils.isNotBlank(p.getOpenid())) {
            data.put("first", p.getName() + ",您签约团队的全科医生已变更,您的新全科医生信息如下:");
            pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 10, p.getOpenid(), p.getName(), data);
        }
//        else {
//            //如果自己没有绑定,则发给家人
//            JSONObject json = weiXinOpenIdUtils.getFamilyOpenId(p.getCode());
//            Patient member = (Patient) json.get("member");
//            if (StringUtils.isNotBlank(member.getOpenid())) {
//                data.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) json.get("relation"), member.getName()) + p.getName() + ",您好!因签约团队内分工调整,您的责任医生有变动," + oldDoctorName +
//                        "医生无法继续为您服务,具体变动如下:");
//                pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), member.getName(), data);
//            }
//        }
            if (StringUtils.isNotBlank(p.getOpenid())) {
                data.put("first", p.getName() + ",您签约团队的全科医生已变更,您的新全科医生信息如下:");
                pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 10, p.getOpenid(), p.getName(), data);
            }
        //发送代理人
        JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(),p.getOpenid());
        if(jsonArray!=null&&jsonArray.length()>0){
            for (int i = 0;i<jsonArray.length();i++){
                JSONObject j  = jsonArray.getJSONObject(i);
                Patient member = (Patient) j.get("member");
                JSONObject json = data;
                json.remove("toUser");
                json.put("toUser",member.getCode());
                json.remove("first");
                json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) json.get("relation"), p.getName()) + p.getName() + ",您好!您签约团队的全科医生已变更,您的新全科医生信息如下:");
                pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), p.getName(), json);
            //发送代理人
            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(),p.getOpenid());
            if(jsonArray!=null&&jsonArray.length()>0){
                for (int i = 0;i<jsonArray.length();i++){
                    JSONObject j  = jsonArray.getJSONObject(i);
                    Patient member = (Patient) j.get("member");
                    JSONObject json = data;
                    json.remove("toUser");
                    json.put("toUser",member.getCode());
                    json.remove("first");
                    json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) json.get("relation"), p.getName()) + p.getName() + ",您好!您签约团队的全科医生已变更,您的新全科医生信息如下:");
                    pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), p.getName(), json);
                }
            }
        }catch (Exception e){
            logger.info(e.getMessage());
        }
    }
//    /**

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

@ -2279,6 +2279,9 @@ public class FamilyContractService extends BaseService {
        SignFamily signFamily = signFamilyDao.findByjiatingPatientYes(patient);
        String oldDoctor = signFamily.getDoctor();
        String oldHdoctor = signFamily.getDoctorHealth();
        if (signFamily == null) {
            result.put("status", -1);
            result.put("msg", "居民不存在家庭签约");
@ -2377,7 +2380,7 @@ public class FamilyContractService extends BaseService {
            }
            //1.4.2更新重点关注列表,取消关注
            updateTrackPatient(patient,signFamily.getDoctorHealth());
            updateTrackPatient(patient,oldHdoctor,oldDoctor,doctor,healthDoctor);
            signFamily.setDoctorHealth(docHealth.getCode());
            signFamily.setDoctorHealthName(docHealth.getName());
@ -2431,7 +2434,7 @@ public class FamilyContractService extends BaseService {
            }
            //1.4.2更新重点关注列表,取消关注
            updateTrackPatient(patient,signFamily.getDoctor());
            updateTrackPatient(patient,oldDoctor,oldHdoctor,doctor,healthDoctor);
            signFamily.setDoctor(docQk.getCode());
            signFamily.setDoctorName(docQk.getName());
@ -4325,9 +4328,58 @@ public class FamilyContractService extends BaseService {
        return rs;
    }
    public void updateTrackPatient(String patient,String oldDoctor){
        TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(oldDoctor,patient);
        trackPatient.setDel("0");
        trackPatientDao.save(trackPatient);
    /**
     * 设置取消关注
     * @param patient
     * @param oldDoctor 患者签约旧的要取消关注的医生
     * @param oldDoctor2 患者旧的签约的另一个医生
     * @param newDoctor 患者新签约的全科医生
     * @param newHDoctor 患者新签约的健康管理师
     */
    public void updateTrackPatient(String patient,String oldDoctor,String oldDoctor2,String newDoctor,String newHDoctor){
        //是否需要修改
        boolean flag = false;
        if(StringUtils.isBlank(oldDoctor)){
            return ;
        }
        //1.两个都修改
        if(StringUtils.isNotBlank(newDoctor)&&StringUtils.isNotBlank(newHDoctor)){
            if((!oldDoctor.equals(newDoctor))&&(!oldDoctor.equals(newHDoctor))){
                flag = true;
            }
        //只改全科
        }else if(StringUtils.isNotBlank(newDoctor)&&StringUtils.isBlank(newHDoctor)){
            if(!oldDoctor.equals(newDoctor)){
                if(StringUtils.isBlank(oldDoctor2)){
                    flag = true;
                }else{
                    if(!oldDoctor.equals(oldDoctor2)){
                        flag = true;
                    }
                }
            }
        //只改健管
        }else if(StringUtils.isBlank(newDoctor)&&StringUtils.isNotBlank(newHDoctor)){
            if(!oldDoctor.equals(newHDoctor)){
                if(StringUtils.isBlank(oldDoctor2)){
                    flag = true;
                }else{
                    if(!oldDoctor.equals(oldDoctor2)){
                        flag = true;
                    }
                }
            }
        }else{
            return ;
        }
       if(flag){
            TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(oldDoctor,patient);
            if(trackPatient!=null){
                trackPatient.setDel("0");
                trackPatientDao.save(trackPatient);
            }
        }
    }
}

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

@ -1163,6 +1163,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            }
            return write(200, "更新成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "更新失败");
        }
    }