Przeglądaj źródła

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

linzhuo 8 lat temu
rodzic
commit
d60af6daa3

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

@ -91,10 +91,9 @@ 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,int relation) throws Exception {
    public int changeMobile(String patient, String mobile, String captcha, int type) throws Exception {
        Patient p = patientDao.findByCode(patient);
        if (p == null) {

+ 17 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java

@ -219,5 +219,22 @@ public class ImUtill {
        }
    }
    /**
     * 获取会话成员
     * @param sessionId
     * @return
     * @throws Exception
     */
    public static JSONArray getParticipants(String sessionId){
        String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
                + "api/v2/sessions/"+sessionId+"/participants?session_id="+sessionId;
        try{
            String ret = HttpClientUtil.get(url,"utf-8");
            return new JSONArray(ret);
        }catch (Exception e){
            throw new RuntimeException("获取议题失败!");
        }
    }
}

+ 12 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SendPatientUtil.java

@ -4,6 +4,7 @@ package com.yihu.wlyy.util;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
@ -30,8 +31,18 @@ public class SendPatientUtil extends  Thread {
	public String sendToPatient(String from,String fromName,String to,String contentType,String content,String title,String type){
		JSONArray jsonArray = ImUtill.getParticipants(to+"_consult_"+type);
		JSONObject participants = new JSONObject();
		participants.put(from,2);
		for(Object object:jsonArray){
			JSONObject jsonObject = (JSONObject)object;
			participants.put(jsonObject.getString("id"),jsonObject.get("role"));
		}
		if(participants.isNull(from)){
			participants.put(from,0);
		}
		if(participants.isNull(to)){
			participants.put(from,0);
		}
		participants.put(to,0);
		if(!"4".equals(contentType)){
			contentType = "0";

+ 9 - 21
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java

@ -282,7 +282,7 @@ public class LoginController extends BaseController {
    @ResponseBody
    public String forgetpwd(int type,
                            @RequestParam(required = false) String idcard,
                            String mobile,
                            @RequestParam(required = false) String mobile,
                            @RequestParam(required = false) String captchaToken,
                            @RequestParam(required = false)String captcha,
                            @RequestParam(required = false)String patient,
@ -302,40 +302,28 @@ public class LoginController extends BaseController {
//            newpwd = URLDecoder.decode(newpwd, "UTF-8");
//            newpwd = StringUtils.reverse(newpwd);
            // 对验证码进行校验
//            int res = smsService.check(mobile, type, captcha);
//            switch (res) {
//                case -2:
//                    return error(-1, "验证码已过期!");
//                case -1:
//                    return error(-1, "验证码错误!");
//                case 0:
//                    return error(-1, "验证码无效!");
//            }
            if (type == 2) {
                // 医生端
                Doctor doctor = doctorService.findDoctorByMobile(mobile);
                if (doctor == null) {
                    return error(-1, "操作失败:此用户未注册");
                } else {
                    Doctor doctor = doctorService.findDoctorByMobile(mobile);
                    String password = RSAUtils.getInstance(doctorService).decryptString(newpwd);
                    password=StringUtils.reverse(password);
                    password=MD5.GetMD5Code(password+doctor.getSalt());
                    doctor.setPassword(password);
                    doctorService.updateDoctorPwd(doctor);
                    return success("操作成功!");
                }
            } else {
                // 患者端
                List<Patient> patients = patientService.findByMobile(mobile);
                if (patients == null||patients.size()==0||StringUtils.isBlank(patient)) {
                Patient patientTemp = patientService.findByIdcard(idcard);
                if (patientTemp == null) {
                    return error(-1, "操作失败:此用户未注册");
                } else {
                    Patient p  = patientService.findByCode(patient);
                    String password = RSAUtils.getInstance(doctorService).decryptString(newpwd);
                    password=StringUtils.reverse(password);
                    password=MD5.GetMD5Code(password+p.getSalt());
                    p.setPassword(password);
                    patientService.updatePatientPwd(p);
                    password=MD5.GetMD5Code(password+patientTemp.getSalt());
                    patientTemp.setPassword(password);
                    patientService.updatePatientPwd(patientTemp);
                    return success("操作成功!");
                }
            }

+ 2 - 5
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

@ -718,14 +718,11 @@ 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,int relation) {
    public String changePatientMobile(String mobile, String captcha, int type) {
        try {
            if (StringUtils.isEmpty(mobile)) {
                return error(-1, "请填写新手机号码");
@ -740,7 +737,7 @@ public class PatientController extends WeixinBaseController {
            if (smsCheck != 1) {
                return error(-1, "验证码错误");
            }
            int result = patientInfoService.changeMobile(getUID(), mobile, captcha, type,relation);
            int result = patientInfoService.changeMobile(getUID(), mobile, captcha, type);
            if (result == -1) {
                return error(-1, "居民信息查找失败");
            } else if (result == 1) {