|
@ -1,35 +1,24 @@
|
|
|
package com.yihu.wlyy.web.doctor.patient;
|
|
|
|
|
|
import com.yihu.wlyy.aop.ObserverRequired;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroup;
|
|
|
import com.yihu.wlyy.entity.doctor.team.sign.DoctorPatientGroupInfo;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.entity.patient.SocialSecurityInfo;
|
|
|
import com.yihu.wlyy.logs.BusinessLogs;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.repository.patient.SocialSecurityInfoDao;
|
|
|
import com.yihu.wlyy.service.app.account.DoctorInfoService;
|
|
|
import com.yihu.wlyy.service.app.account.DoctorPatientGroupService;
|
|
|
import com.yihu.wlyy.service.app.account.PatientInfoService;
|
|
|
import com.yihu.wlyy.service.app.team.DrHealthTeamService;
|
|
|
import com.yihu.wlyy.service.common.account.PatientService;
|
|
|
import com.yihu.wlyy.util.CommonUtil;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.IdcardValidator;
|
|
|
import com.yihu.wlyy.util.MD5;
|
|
|
import com.yihu.wlyy.util.RSAUtils;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
@ -37,9 +26,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import java.net.URLDecoder;
|
|
|
import java.text.DateFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.UUID;
|
|
|
|
|
|
/**
|
|
|
* 医生端:患者分组管理
|
|
@ -179,7 +166,11 @@ public class PatientInfoController extends BaseController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/check_regist_info", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String checkRegistInfo(String name, String idcard, String ssc, String mobile) {
|
|
|
@ApiOperation("注册信息验证")
|
|
|
public String checkRegistInfo(@ApiParam(value = "居民姓名", name = "name") @RequestParam(required = true)String name,
|
|
|
@ApiParam(value = "居民身份证", name = "idcard") @RequestParam(required = true)String idcard,
|
|
|
@ApiParam(value = "居民社保卡", name = "ssc") @RequestParam(required = true)String ssc,
|
|
|
@ApiParam(value = "居民手机", name = "mobile") @RequestParam(required = true)String mobile) {
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(name)) {
|
|
|
return error(-1, "姓名不允许为空");
|
|
@ -264,4 +255,109 @@ public class PatientInfoController extends BaseController {
|
|
|
return error( -1, "建档失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 患者注册
|
|
|
*
|
|
|
* @param idcard 身份證號
|
|
|
* @param mobile 登录手机号
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "regist", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String regist(@ApiParam(value = "姓名", name = "name") @RequestParam(required = true) String name,
|
|
|
@ApiParam(value = "身份证", name = "idcard") @RequestParam(required = true)String idcard,
|
|
|
@ApiParam(value = "社保卡", name = "ssc") @RequestParam(required = true) String ssc,
|
|
|
@ApiParam(value = "手机", name = "mobile") @RequestParam(required = true) String mobile) {
|
|
|
try {
|
|
|
if (StringUtils.isEmpty(name)) {
|
|
|
return error(-1, "姓名不允许为空!");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(idcard)) {
|
|
|
return error(-1, "身份证号不允许为空!");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(ssc)) {
|
|
|
return error(-1, "社保卡号不允许为空!");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(mobile)) {
|
|
|
return error(-1, "手机号不允许为空!");
|
|
|
}
|
|
|
|
|
|
// 解密身份证号
|
|
|
rsaUtils.setBaseService(patientService);
|
|
|
idcard = rsaUtils.decryptString(idcard);
|
|
|
idcard = URLDecoder.decode(idcard, "UTF-8");
|
|
|
idcard = StringUtils.reverse(idcard);
|
|
|
// 校验身份证号
|
|
|
IdcardValidator validator = new IdcardValidator();
|
|
|
if (validator.isValidatedAllIdcard(idcard)) {
|
|
|
if (idcard.length() == 15) {
|
|
|
idcard = validator.convertIdcarBy15bit(idcard);
|
|
|
if (StringUtils.isEmpty(idcard)) {
|
|
|
return error(-1, "请输入正确的身份证号!");
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
return error(-1, "请输入正确的身份证号!");
|
|
|
}
|
|
|
|
|
|
SocialSecurityInfo socialSecurityInfo = socialSecurityInfoDao.findBySfzh18Max(idcard);
|
|
|
|
|
|
if (socialSecurityInfo != null) {
|
|
|
if (name.compareTo(socialSecurityInfo.getXming0() == null ? "" : socialSecurityInfo.getXming0()) != 0) {
|
|
|
return error(-1, "身份证号与姓名不一致<br/>请检查后重新输入");
|
|
|
}
|
|
|
if (ssc.compareTo(socialSecurityInfo.getCardno() == null ? "" : socialSecurityInfo.getCardno()) != 0) {
|
|
|
if (ssc.compareTo(socialSecurityInfo.getCard16() == null ? "" : socialSecurityInfo.getCard16()) != 0) {
|
|
|
return error(-1, "身份证号与医保卡号不一致,请检查后重新输入");
|
|
|
} else {
|
|
|
ssc = socialSecurityInfo.getCardno();//统一只存英文字母开头的医保卡
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
return error(-1, "对不起,暂不支持16年6月份之后办理的医保卡注册");
|
|
|
}
|
|
|
|
|
|
Patient patient = patientDao.findByIdcard(idcard);
|
|
|
|
|
|
if (patient == null) {
|
|
|
patient = new Patient();
|
|
|
} else {
|
|
|
if (!StringUtils.isEmpty(patient.getMobile())) {
|
|
|
return error(-2, "该身份证已被注册!");
|
|
|
}
|
|
|
}
|
|
|
patient.setName(name);
|
|
|
patient.setIdcard(idcard);
|
|
|
patient.setMobile(mobile);
|
|
|
//增加密码
|
|
|
String salt = UUID.randomUUID().toString().replace("-", "");
|
|
|
patient.setSalt(salt);
|
|
|
rsaUtils.setBaseService(patientService);
|
|
|
String password = mobile.substring(5,10);
|
|
|
password = rsaUtils.decryptString(password);
|
|
|
password = StringUtils.reverse(password);
|
|
|
patient.setPassword(MD5.GetMD5Code(password + salt));
|
|
|
patient.setSsc(ssc);
|
|
|
|
|
|
JSONObject json = patientService.register(idcard, ssc, name, mobile, MD5.GetMD5Code(password + salt)
|
|
|
,salt,salt,3);
|
|
|
if (json != null) {
|
|
|
try {
|
|
|
Patient p = patientDao.findByIdcard(idcard);
|
|
|
BusinessLogs.info(BusinessLogs.BusinessType.register, p.getCode(), p.getCode(), new JSONObject(p));
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
// 注册成功
|
|
|
return write(200, "注册成功!", "data", json);
|
|
|
} else {
|
|
|
// 注册失败
|
|
|
return error(-1, "注册失败!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "注册失败!");
|
|
|
}
|
|
|
}
|
|
|
}
|