|
@ -6,13 +6,19 @@ 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.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.RSAUtils;
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@ -30,6 +36,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
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.*;
|
|
@ -46,6 +53,14 @@ public class PatientInfoController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private PatientInfoService patientInfoService;
|
|
|
@Autowired
|
|
|
private RSAUtils rsaUtils;
|
|
|
@Autowired
|
|
|
private PatientService patientService;
|
|
|
@Autowired
|
|
|
private SocialSecurityInfoDao socialSecurityInfoDao;
|
|
|
@Autowired
|
|
|
private PatientDao patientDao;
|
|
|
/**
|
|
|
* 获取患者基本信息
|
|
|
*
|
|
@ -139,4 +154,114 @@ public class PatientInfoController extends BaseController {
|
|
|
return invalidUserException(e, -1, "获取字典信息失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "checkPatientArchives",method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
@ApiOperation("判断居民建档状态和签约状态")
|
|
|
public String checkPatientArchives(@ApiParam(value = "居民身份证", name = "icCard") @RequestParam(required = true)String icCard){
|
|
|
try {
|
|
|
// 获取医生下的患者
|
|
|
return write(200, "获取成功!", "data",patientInfoService.checkPatientArchives(icCard));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "获取字典信息失败!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 注册信息验证
|
|
|
*
|
|
|
* @param name 姓名
|
|
|
* @param idcard 身份证号
|
|
|
* @param ssc 社保卡号
|
|
|
* @param mobile 手机号
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/check_regist_info", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public String checkRegistInfo(String name, String idcard, String ssc, 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, "手机号不允许为空");
|
|
|
}
|
|
|
//if (patientService.findByMobile(mobile) != null) {
|
|
|
// return error(-1, "该手机号已被注册");
|
|
|
//}
|
|
|
// 解密身份证号
|
|
|
//idcard = RSAUtils.getInstance(patientService).decryptString(idcard);
|
|
|
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, "身份证号与姓名不一致,请检查后重新输入");
|
|
|
}
|
|
|
if (ssc.compareTo(socialSecurityInfo.getCardno() == null ? "" : socialSecurityInfo.getCardno()) != 0 && ssc.compareTo(socialSecurityInfo.getCard16() == null ? "" : socialSecurityInfo.getCard16()) != 0) {
|
|
|
return error(-1, "身份证号与医保卡号不一致,请检查后重新输入");
|
|
|
}
|
|
|
} else {
|
|
|
return error(-1, "对不起,暂不支持16年6月份之后办理的医保卡注册");
|
|
|
}
|
|
|
|
|
|
Patient patient = patientDao.findByIdcard(idcard);
|
|
|
|
|
|
if (patient != null) {
|
|
|
if (!StringUtils.isEmpty(patient.getMobile())) {
|
|
|
return error(-2, "该身份证已被注册");
|
|
|
}
|
|
|
}
|
|
|
return write(200, "验证成功");
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "验证失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "createProfileAndSign",method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
@ApiOperation("居民注册与建档")
|
|
|
public String createProfileAndSign(@ApiParam(value = "身份证", name = "idcard") @RequestParam(required = true)String idcard,
|
|
|
@ApiParam(value = "医保卡号", name = "ssc") @RequestParam(required = true)String ssc,
|
|
|
@ApiParam(value = "姓名", name = "name") @RequestParam(required = true)String name,
|
|
|
@ApiParam(value = "手机号", name = "mobile") @RequestParam(required = true)String mobile,
|
|
|
@ApiParam(value = "生日", name = "brithday") @RequestParam(required = true)String brithday,
|
|
|
@ApiParam(value = "基卫居委会", name = "jwCountryCode") @RequestParam(required = true)String jwCountryCode,
|
|
|
@ApiParam(value = "民族", name = "nation") @RequestParam(required = true)String nation,
|
|
|
@ApiParam(value = "血型", name = "blood") @RequestParam(required = true)String blood,
|
|
|
@ApiParam(value = "婚姻状况", name = "marry") @RequestParam(required = true)String marry,
|
|
|
@ApiParam(value = "详细地址", name = "adress") @RequestParam(required = true)String adress){
|
|
|
try {
|
|
|
// 获取医生下的患者
|
|
|
return write(200, "建档成功!", "data",patientInfoService.createProfileAndSign(getUID(),idcard,ssc,name,mobile,brithday,jwCountryCode,nation,blood,marry,adress));
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error( -1, "建档失败!");
|
|
|
}
|
|
|
}
|
|
|
}
|