浏览代码

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

linzhuo 8 年之前
父节点
当前提交
e77209168d

+ 10 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/education/FoodComp.java

@ -32,6 +32,16 @@ public class FoodComp extends IdEntity {
	//重量
	private int weight;
	private String photo;
	public String getPhoto() {
		return photo;
	}
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	public Long getPid() {
		return pid;
	}

+ 10 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java

@ -91,26 +91,29 @@ public class PatientInfoService extends BaseService {
     * @param patient 患者code
     * @param mobile  新手机号
     * @param captcha 验证码
     * @param  relation 是否成为家庭关系
     * @return
     */
    public int changeMobile(String patient, String mobile, String captcha, int type) {
    public int changeMobile(String patient, String mobile, String captcha, int type,int relation) throws Exception {
        Patient p = patientDao.findByCode(patient);
        if (p == null) {
            return -1;
        }
        List<Patient> pMobile = patientDao.findByMobile(mobile);
        //List<Patient> patients = patientDao.findByMobile(mobile);
        //更新的时候不校验手机是否存在
        //if (pMobile != null && !pMobile.getCode().equals(patient)) {
        //    return -2;
        //}
        // 验证码验证
        int smsCheck = smsService.check(mobile, type == 1 ? 8 : 9, captcha);
        // 验证失败,不允许变更
        if (smsCheck != 1) {
            return -3;
        //需要添加成员关系
        if(relation==2){
            List<Patient> patients = patientDao.findByMobile(mobile);
            for(Patient pTemp :patients){
                familyMemberService.addMember(p,pTemp.getCode(),7);
            }
        }
        p.setMobile(mobile);
        signFamilyDao.updatePatientMobile(p.getCode(), mobile);

+ 3 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java

@ -139,7 +139,7 @@ public class FamilyMemberService extends BaseService {
        return 1;
    }
    public int addMember(Patient p, String member) throws Exception{
    public int addMember(Patient p, String member,int type) throws Exception{
        if (p.getCode().equals(member)) {
            return 0;
        }
@ -153,7 +153,7 @@ public class FamilyMemberService extends BaseService {
            fm.setPatient(p.getCode());
            fm.setFamilyMember(member);
        }
        fm.setFamilyRelation(6);
        fm.setFamilyRelation(type);
        fm.setCzrq(new Date());
        // 添加对方与自己的关系
@ -166,7 +166,7 @@ public class FamilyMemberService extends BaseService {
        }
        // 对方与自己的关系转换
        int relationTrans = familyRelationTrans(p, 6);
        int relationTrans = familyRelationTrans(p, type);
        fmt.setFamilyRelation(relationTrans);
        fmt.setCzrq(new Date());
        memberDao.save(fm);

+ 0 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -193,7 +193,6 @@ public class PushMsgTask {
                logger.error("send wechat message failed:openid is empty");
                return false;
            }
            if (access_token != null) {
                String token_url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token;
                String params = typeMsg(type, openid, name, json);

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java

@ -315,7 +315,7 @@ public class WechatController extends WeixinBaseController {
                    if("1".equals(home)){
                        List<Patient> patients = patientService.findByMobile(mobile);
                        for(Patient patient1 :patients){
                            familyMemberService.addMember(p,patient1.getCode());
                            familyMemberService.addMember(p,patient1.getCode(),7);
                        }
                    }
                } catch (Exception e) {

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

@ -12,6 +12,7 @@ import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.family.FamilyMemberService;
import com.yihu.wlyy.service.app.message.MessageService;
import com.yihu.wlyy.service.app.sign.PatientRemindService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
@ -66,6 +67,8 @@ public class DoctorFamilyContractController extends WeixinBaseController {
    PatientRemindService patientRemindService;
    @Autowired
    AdminTeamService teamService;
    @Autowired
    FamilyMemberService familyMemberService;
    /**
@ -90,6 +93,21 @@ public class DoctorFamilyContractController extends WeixinBaseController {
        }
    }
    /**
     * 查看当前医生签约的居民
     */
    @RequestMapping(value = "getMobilePatient")
    @ResponseBody
    public String getMobilePatient(String mobile) {
        try {
            List<Patient> patients = patientService.findByMobile(mobile);
            return write(200, "获取数据成功!", "data", patients);
        }catch (Exception e) {
                error(e);
                return error(-1, "获取数据失败!");
            }
    }
    private void addList(JSONObject returnJO, List<Patient> pts, JSONArray array, String key) {
        if (pts != null && pts.size() > 0) {
            for (Patient sf : pts) {
@ -254,7 +272,8 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            String signDoctorCode,//簽約人code
            String signDoctorName,//簽約人銘
            String signDoctorLevel,//簽約人等级
            long adminTeamCode //行政团队
            long adminTeamCode, //行政团队
            int relation//存在多个用户的时候是否成为家庭成员
    ) {
        try {
            if (StringUtils.isEmpty(idcard)) {
@ -321,6 +340,12 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                try {
                    Patient p = patientService.findByIdcard(idcard);
                    BusinessLogs.info(BusinessLogs.BusinessType.register, getUID(), p.getCode(), new JSONObject(p));
                    if(relation==1){
                        List<Patient> patients = patientService.findByMobile(mobile);
                        for(Patient patient1 :patients){
                            familyMemberService.addMember(p,patient1.getCode(),7);
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }

+ 21 - 8
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

@ -13,7 +13,9 @@ import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.app.team.DrHealthTeamService;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.web.WeixinBaseController;
@ -61,6 +63,10 @@ public class PatientController extends WeixinBaseController {
    AdminTeamService teamService;
    @Autowired
    TokenDao tokenDao;
    @Autowired
    PatientService patientService;
    @Autowired
    private SMSService smsService;
    /**
     * 患者基本信息查询接口
@ -712,11 +718,14 @@ public class PatientController extends WeixinBaseController {
     * @param mobile  新手机号
     * @param captcha 验证码
     * @param type    1:变更手机号  2:绑定手机号
     * @param  relation 0:第一次请求(如果新号码成员有多个会返回集合从新请求为是否绑定成为家人)
     *                  1、第二次请求不成为家人,
     *                  2.第二次请求传入成为家人
     * @return
     */
    @RequestMapping(value = "/mobile_update", method = RequestMethod.POST)
    @ResponseBody
    public String changePatientMobile(String mobile, String captcha, int type) {
    public String changePatientMobile(String mobile, String captcha, int type,int relation) {
        try {
            if (StringUtils.isEmpty(mobile)) {
                return error(-1, "请填写新手机号码");
@ -727,15 +736,19 @@ public class PatientController extends WeixinBaseController {
            if (type != 1 && type != 2) {
                return error(-1, "操作类型参数错误");
            }
            int result = patientInfoService.changeMobile(getUID(), mobile, captcha, type);
            if(relation==0){
                int smsCheck = smsService.check(mobile, type == 1 ? 8 : 9, captcha);
                if (smsCheck != 1) {
                    return error(-1, "验证码错误");
                }
                List<Patient> patients = patientService.findByMobile(mobile);
                if(patients!=null&&patients.size()>0){
                    return write(1, "新手机存在多个用户","data",patients);
                }
            }
            int result = patientInfoService.changeMobile(getUID(), mobile, captcha, type,relation);
            if (result == -1) {
                return error(-1, "居民信息查找失败");
            } else if (result == -2) {
                return error(-1, "手机号已注册");
            } else if (result == -3) {
                return error(-1, "验证码错误");
            } else if (result == 1) {
                return write(200, "手机号更新成功");
            } else {