|
@ -19,10 +19,7 @@ import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
import javax.annotation.PostConstruct;
|
|
import java.util.Date;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
@ -715,31 +712,47 @@ public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamily
|
|
}
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
public int addMemberByCaptcha(String patient, String member, String captcha, int relation) throws Exception {
|
|
|
|
|
|
|
|
if (patient.equals(member)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
public int addMemberByCaptcha(String patient, String idcard, String name, String mobile, Integer archiveType, String captcha, int relation) throws Exception {
|
|
|
|
|
|
BasePatientDO p = patientDao.findById(patient);
|
|
BasePatientDO p = patientDao.findById(patient);
|
|
BasePatientDO m = patientDao.findById(member);
|
|
|
|
if (p == null) {
|
|
if (p == null) {
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
// 添加的成员是否注册判断
|
|
|
|
if (m == null) {
|
|
|
|
return -2;
|
|
|
|
|
|
if(idcard.equals(p.getIdcard())){
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
// // 验证码验证
|
|
|
|
|
|
// // 验证码验证
|
|
// if (StringUtils.isNotEmpty(captcha)) {
|
|
// if (StringUtils.isNotEmpty(captcha)) {
|
|
// int checkStatus = smsService.check(m.getMobile(), 10, captcha);
|
|
|
|
|
|
// int checkStatus = smsService.check(mobile, 10, captcha);
|
|
// if (checkStatus == -2) {
|
|
// if (checkStatus == -2) {
|
|
// return -6; // 验证码过期
|
|
// return -6; // 验证码过期
|
|
// } else if (checkStatus == -1) {
|
|
// } else if (checkStatus == -1) {
|
|
// return -3; // 验证码错误
|
|
// return -3; // 验证码错误
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
BasePatientDO m = patientDao.findByIdcard(idcard);
|
|
|
|
String member = "";
|
|
|
|
// 添加的成员是否注册判断
|
|
|
|
if (m == null) {
|
|
|
|
//新增账户
|
|
|
|
m = new BasePatientDO();
|
|
|
|
String salt = UUID.randomUUID().toString().substring(0,5);
|
|
|
|
String pw = idcard.substring(idcard.length()-6,idcard.length());
|
|
|
|
m.setPassword(com.yihu.utils.security.MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
|
m.setSalt(salt);
|
|
|
|
m.setMobile(mobile);
|
|
|
|
m.setDel("1");
|
|
|
|
m.setEnabled(1);
|
|
|
|
m.setLocked(0);
|
|
|
|
m.setCreateTime(new Date());
|
|
|
|
m.setUpdateTime(new Date());
|
|
|
|
m.setName(name);
|
|
|
|
m.setIdcard(idcard);
|
|
|
|
m.setArchiveType(archiveType);
|
|
|
|
patientDao.save(m);
|
|
|
|
}
|
|
|
|
member = m.getId();
|
|
|
|
|
|
return addMemberFamily(p, m, patient, member, relation);
|
|
return addMemberFamily(p, m, patient, member, relation);
|
|
}
|
|
}
|