|
@ -21,6 +21,8 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@ -54,27 +56,27 @@ public class RegisterService {
|
|
|
@Autowired
|
|
|
private YkyyService ykyyService;
|
|
|
|
|
|
public Map<String,Object> registerPatient(String name, String mobile, String idcard, String ssc, String pw,String openid,String wxId,String captcha)throws Exception{
|
|
|
public Map<String, Object> registerPatient(String name, String mobile, String idcard, String ssc, String pw, String openid, String wxId, String captcha) throws Exception {
|
|
|
|
|
|
Map<String,Object> rs = new HashedMap();
|
|
|
try{
|
|
|
BasePatientDO p1 = basePatientDao.findByIdcardAndDel(idcard,"1");
|
|
|
if(p1!=null){
|
|
|
rs.put("code","-1");
|
|
|
rs.put("mes","身份证已经存在");
|
|
|
Map<String, Object> rs = new HashedMap();
|
|
|
try {
|
|
|
BasePatientDO p1 = basePatientDao.findByIdcardAndDel(idcard, "1");
|
|
|
if (p1 != null) {
|
|
|
rs.put("code", "-1");
|
|
|
rs.put("mes", "身份证已经存在");
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
List<BasePatientDO> p2 = basePatientDao.findByMobileAndDel(mobile,"1");
|
|
|
if(p2!=null&&p2.size()>0){
|
|
|
rs.put("code","-2");
|
|
|
rs.put("mes","手机号已经存在");
|
|
|
List<BasePatientDO> p2 = basePatientDao.findByMobileAndDel(mobile, "1");
|
|
|
if (p2 != null && p2.size() > 0) {
|
|
|
rs.put("code", "-2");
|
|
|
rs.put("mes", "手机号已经存在");
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
BasePatientDO patient = new BasePatientDO();
|
|
|
|
|
|
String salt = UUID.randomUUID().toString().substring(0,5);
|
|
|
String salt = UUID.randomUUID().toString().substring(0, 5);
|
|
|
|
|
|
patient.setIdcard(idcard);
|
|
|
patient.setName(name);
|
|
@ -101,7 +103,7 @@ public class RegisterService {
|
|
|
basePatientMedicareCardDao.save(medicareCardDO);
|
|
|
|
|
|
//保存微信信息
|
|
|
if(StringUtils.isNotBlank(openid)&&StringUtils.isNotBlank(wxId)){
|
|
|
if (StringUtils.isNotBlank(openid) && StringUtils.isNotBlank(wxId)) {
|
|
|
BasePatientWechatDo wechatDo = new BasePatientWechatDo();
|
|
|
wechatDo.setWechatId(wxId);
|
|
|
wechatDo.setOpenid(openid);
|
|
@ -112,25 +114,26 @@ public class RegisterService {
|
|
|
ykyyService.registerYkt(temp.getId(),pw,captcha);
|
|
|
}*/
|
|
|
|
|
|
rs.put("code","1");
|
|
|
rs.put("mes","ok");
|
|
|
rs.put("patient",temp);
|
|
|
rs.put("code", "1");
|
|
|
rs.put("mes", "ok");
|
|
|
rs.put("patient", temp);
|
|
|
return rs;
|
|
|
}catch (Exception e){
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
rs.put("code","-3");
|
|
|
rs.put("mes","保存用户信息失败");
|
|
|
rs.put("code", "-3");
|
|
|
rs.put("mes", "保存用户信息失败");
|
|
|
return rs;
|
|
|
}
|
|
|
public Map<String,Object> registerPatient(String mobile,String pw,String name,String idcard, String cardType,String ssc,String openid)throws Exception{
|
|
|
|
|
|
Map<String,Object> rs = new HashedMap();
|
|
|
try{
|
|
|
List<BasePatientDO> p2 = basePatientDao.findByMobileAndDel(mobile,"1");
|
|
|
if(p2!=null&&p2.size()>0){
|
|
|
rs.put("code","-2");
|
|
|
rs.put("mes","手机号已经存在");
|
|
|
|
|
|
public Map<String, Object> registerPatient(String mobile, String pw, String name, String idcard, String cardType, String ssc, String openid) throws Exception {
|
|
|
|
|
|
Map<String, Object> rs = new HashedMap();
|
|
|
try {
|
|
|
List<BasePatientDO> p2 = basePatientDao.findByMobileAndDel(mobile, "1");
|
|
|
if (p2 != null && p2.size() > 0) {
|
|
|
rs.put("code", "-2");
|
|
|
rs.put("mes", "手机号已经存在");
|
|
|
return rs;
|
|
|
}
|
|
|
List<BasePatientDO> p3 = basePatientDao.findListByIdcardAndDel(idcard, "1");
|
|
@ -145,10 +148,24 @@ public class RegisterService {
|
|
|
idcard = idcard.toUpperCase();
|
|
|
}
|
|
|
BasePatientDO patient = new BasePatientDO();
|
|
|
String salt = UUID.randomUUID().toString().substring(0,5);
|
|
|
String salt = UUID.randomUUID().toString().substring(0, 5);
|
|
|
patient.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
patient.setSalt(salt);
|
|
|
patient.setCardType(cardType);
|
|
|
try {
|
|
|
System.out.println("cardType==>" + cardType);
|
|
|
if ("身份证".equals(cardType)) {
|
|
|
String year = idcard.substring(6, 10);
|
|
|
String month = idcard.substring(10, 12);
|
|
|
String day = idcard.substring(12, 14);
|
|
|
String birthday = year + "-" + month + "-" + day;
|
|
|
System.out.println("birthday===>" + birthday);
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
patient.setBirthday(dateFormat.parse(birthday));
|
|
|
}
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
patient.setMobile(mobile);
|
|
|
patient.setDel("1");
|
|
|
patient.setEnabled(1);
|
|
@ -156,13 +173,13 @@ public class RegisterService {
|
|
|
patient.setSsc(ssc);
|
|
|
patient.setCreateTime(new Date());
|
|
|
patient.setUpdateTime(new Date());
|
|
|
if(StringUtils.isNoneBlank(name)){
|
|
|
if (StringUtils.isNoneBlank(name)) {
|
|
|
patient.setName(name);
|
|
|
}
|
|
|
if (StringUtils.isNoneBlank(idcard)){
|
|
|
if (StringUtils.isNoneBlank(idcard)) {
|
|
|
patient.setIdcard(idcard);
|
|
|
}
|
|
|
if(StringUtils.isNoneBlank(openid)){
|
|
|
if (StringUtils.isNoneBlank(openid)) {
|
|
|
patient.setOpenid(openid);
|
|
|
}
|
|
|
|
|
@ -181,7 +198,7 @@ public class RegisterService {
|
|
|
wlyyPatientFamilyMemberDO.setFamilyMember(patient.getId());
|
|
|
wlyyPatientFamilyMemberDO.setFamilyRelation("7");
|
|
|
wlyyPatientFamilyMemberDO.setFamilyRelationName("本人");
|
|
|
if (StringUtils.isNoneBlank(idcard)){
|
|
|
if (StringUtils.isNoneBlank(idcard)) {
|
|
|
wlyyPatientFamilyMemberDO.setCardNo(idcard);
|
|
|
}
|
|
|
familyMemberDao.save(wlyyPatientFamilyMemberDO);
|
|
@ -189,58 +206,58 @@ public class RegisterService {
|
|
|
ykyyService.registerYkt(temp.getId(),pw,captcha);
|
|
|
}*/
|
|
|
|
|
|
rs.put("code","1");
|
|
|
rs.put("mes","ok");
|
|
|
rs.put("patient",temp);
|
|
|
rs.put("code", "1");
|
|
|
rs.put("mes", "ok");
|
|
|
rs.put("patient", temp);
|
|
|
return rs;
|
|
|
}catch (Exception e){
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
rs.put("code","-3");
|
|
|
rs.put("mes","保存用户信息失败");
|
|
|
rs.put("code", "-3");
|
|
|
rs.put("mes", "保存用户信息失败");
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public Integer checkeMobileAndIdcard(String mobile,String idcard){
|
|
|
BasePatientDO patientDO = basePatientDao.findByIdcardAndDel(idcard, "1");
|
|
|
if(patientDO==null){
|
|
|
public Integer checkeMobileAndIdcard(String mobile, String idcard) {
|
|
|
BasePatientDO patientDO = basePatientDao.findByIdcardAndDel(idcard, "1");
|
|
|
if (patientDO == null) {
|
|
|
return -1;
|
|
|
}
|
|
|
if(!mobile.equals(patientDO.getMobile())){
|
|
|
if (!mobile.equals(patientDO.getMobile())) {
|
|
|
return -2;
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
public String updatePatientPw(String pw,String mobile){
|
|
|
public String updatePatientPw(String pw, String mobile) {
|
|
|
|
|
|
List<BasePatientDO> list = basePatientDao.findByMobileAndDel(mobile,"1");
|
|
|
if(list!=null&&list.size()>0){
|
|
|
for(BasePatientDO patient:list){
|
|
|
String salt = UUID.randomUUID().toString().substring(0,5);
|
|
|
List<BasePatientDO> list = basePatientDao.findByMobileAndDel(mobile, "1");
|
|
|
if (list != null && list.size() > 0) {
|
|
|
for (BasePatientDO patient : list) {
|
|
|
String salt = UUID.randomUUID().toString().substring(0, 5);
|
|
|
patient.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
patient.setSalt(salt);
|
|
|
}
|
|
|
basePatientDao.saveAll(list);
|
|
|
}else{
|
|
|
} else {
|
|
|
return "-1";
|
|
|
}
|
|
|
return "ok";
|
|
|
}
|
|
|
|
|
|
public boolean saveDoctorPwlimitDate(String doctor){
|
|
|
public boolean saveDoctorPwlimitDate(String doctor) {
|
|
|
String key = "hlwyy:authPw:doctor:" + doctor;
|
|
|
com.alibaba.fastjson.JSONObject valueJson = new com.alibaba.fastjson.JSONObject();
|
|
|
valueJson.put("updateTime",new Date().getTime());
|
|
|
valueJson.put("isChanged",true);
|
|
|
redisTemplate.opsForValue().set(key,valueJson.toJSONString());
|
|
|
valueJson.put("updateTime", new Date().getTime());
|
|
|
valueJson.put("isChanged", true);
|
|
|
redisTemplate.opsForValue().set(key, valueJson.toJSONString());
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
public String updateDoctorPw(String mobile,String pw,String wxId){
|
|
|
public String updateDoctorPw(String mobile, String pw, String wxId) {
|
|
|
List<BaseDoctorDO> list = baseDoctorDao.findByMobile(mobile);
|
|
|
if(list!=null&&list.size()>0){
|
|
|
for(BaseDoctorDO doctorDO:list){
|
|
|
if (list != null && list.size() > 0) {
|
|
|
for (BaseDoctorDO doctorDO : list) {
|
|
|
//认证信息设置
|
|
|
String salt = randomString(5);
|
|
|
doctorDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
@ -248,14 +265,14 @@ public class RegisterService {
|
|
|
baseDoctorDao.save(doctorDO);
|
|
|
saveDoctorPwlimitDate(doctorDO.getId());
|
|
|
}
|
|
|
}else{
|
|
|
} else {
|
|
|
return "-1";
|
|
|
}
|
|
|
return "ok";
|
|
|
}
|
|
|
|
|
|
|
|
|
public String updateDoctorMoble(String id,String mobile){
|
|
|
public String updateDoctorMoble(String id, String mobile) {
|
|
|
BaseDoctorDO doctorDO = baseDoctorDao.getOne(id);
|
|
|
//认证信息设置
|
|
|
doctorDO.setMobile(mobile);
|
|
@ -268,7 +285,7 @@ public class RegisterService {
|
|
|
StringBuffer buffer = new StringBuffer();
|
|
|
Random random = new Random();
|
|
|
|
|
|
for(int i = 0; i < length; ++i) {
|
|
|
for (int i = 0; i < length; ++i) {
|
|
|
int pos = random.nextInt(str.length());
|
|
|
buffer.append(str.charAt(pos));
|
|
|
}
|