|  | @ -190,12 +190,11 @@ public class WechatController extends WeixinBaseController {
 | 
												
													
														
															|  |     @ResponseBody
 |  |     @ResponseBody
 | 
												
													
														
															|  |     public String regist(@RequestParam(value = "name", required = true) String name,
 |  |     public String regist(@RequestParam(value = "name", required = true) String name,
 | 
												
													
														
															|  |                          @RequestParam(value = "idcard", required = true) String idcard,
 |  |                          @RequestParam(value = "idcard", required = true) String idcard,
 | 
												
													
														
															|  |                          @RequestParam(value = "ssc", required = false) String ssc,
 |  | 
 | 
												
													
														
															|  | 
 |  |                          @RequestParam(value = "ssc", required = true) String ssc,
 | 
												
													
														
															|  |                          @RequestParam(value = "mobile", required = true) String mobile,
 |  |                          @RequestParam(value = "mobile", required = true) String mobile,
 | 
												
													
														
															|  |                          @RequestParam(value = "captcha", required = true) String captcha,
 |  |                          @RequestParam(value = "captcha", required = true) String captcha,
 | 
												
													
														
															|  |                          @RequestParam(value = "openid", required = true) String openid,
 |  |                          @RequestParam(value = "openid", required = true) String openid,
 | 
												
													
														
															|  |                          @RequestParam(value = "password", required = true) String password,
 |  | 
 | 
												
													
														
															|  |                          @RequestParam(value = "token", required = false) String token) {
 |  | 
 | 
												
													
														
															|  | 
 |  |                          @RequestParam(value = "password", required = true) String password) {
 | 
												
													
														
															|  |         try {
 |  |         try {
 | 
												
													
														
															|  |             if (StringUtils.isEmpty(name)) {
 |  |             if (StringUtils.isEmpty(name)) {
 | 
												
													
														
															|  |                 return error(-1, "姓名不允许为空!");
 |  |                 return error(-1, "姓名不允许为空!");
 | 
												
											
												
													
														
															|  | @ -203,9 +202,9 @@ public class WechatController extends WeixinBaseController {
 | 
												
													
														
															|  |             if (StringUtils.isEmpty(idcard)) {
 |  |             if (StringUtils.isEmpty(idcard)) {
 | 
												
													
														
															|  |                 return error(-1, "身份证号不允许为空!");
 |  |                 return error(-1, "身份证号不允许为空!");
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | //            if (StringUtils.isEmpty(ssc)) {
 |  | 
 | 
												
													
														
															|  | //                return error(-1, "社保卡号不允许为空!");
 |  | 
 | 
												
													
														
															|  | //            }
 |  | 
 | 
												
													
														
															|  | 
 |  |             if (StringUtils.isEmpty(ssc)) {
 | 
												
													
														
															|  | 
 |  |                 return error(-1, "社保卡号不允许为空!");
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  |             if (StringUtils.isEmpty(mobile)) {
 |  |             if (StringUtils.isEmpty(mobile)) {
 | 
												
													
														
															|  |                 return error(-1, "手机号不允许为空!");
 |  |                 return error(-1, "手机号不允许为空!");
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
											
												
													
														
															|  | @ -248,74 +247,74 @@ public class WechatController extends WeixinBaseController {
 | 
												
													
														
															|  |             //判断身份证号与姓名是否一致
 |  |             //判断身份证号与姓名是否一致
 | 
												
													
														
															|  |             //判断身份证和社保卡是否一致  统一只存英文字母开头的医保卡
 |  |             //判断身份证和社保卡是否一致  统一只存英文字母开头的医保卡
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             if (!org.springframework.util.StringUtils.isEmpty(token)) {
 |  | 
 | 
												
													
														
															|  |                 UserInfoResponse userInfoResponse = ylzUserService.getUserByToken(token);
 |  | 
 | 
												
													
														
															|  |                 if (userInfoResponse.getCardInfo() != null && userInfoResponse.getCardInfo().size() > 0) {
 |  | 
 | 
												
													
														
															|  |                     List<UserInfoResponse.CardInfo> cards = userInfoResponse.getCardInfo();
 |  | 
 | 
												
													
														
															|  |                     Boolean hasCard = false;
 |  | 
 | 
												
													
														
															|  |                     UserInfoResponse.CardInfo cardInfo = null;
 |  | 
 | 
												
													
														
															|  |                     for (UserInfoResponse.CardInfo card : cards) {
 |  | 
 | 
												
													
														
															|  |                         //如果患者有正常状态的社保卡
 |  | 
 | 
												
													
														
															|  |                         if ("01".equals(card.getCardType()) && "normal".equals("state")) {
 |  | 
 | 
												
													
														
															|  |                             hasCard = true;
 |  | 
 | 
												
													
														
															|  |                             cardInfo = card;
 |  | 
 | 
												
													
														
															|  |                             break;
 |  | 
 | 
												
													
														
															|  |                         }
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                     if (!hasCard) {
 |  | 
 | 
												
													
														
															|  |                         return error(-1, "医保卡不存在,必须使用正常状态的厦门医保卡");
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  |                     if (name.compareTo(userInfoResponse.getName() == null ? "" : userInfoResponse.getName()) != 0) {
 |  | 
 | 
												
													
														
															|  |                         return error(-1, "身份证号与姓名不一致<br/>请检查后重新输入");
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  |                     if (ssc.compareTo(cardInfo.getCardNo() == null ? "" : cardInfo.getCardNo()) != 0) {
 |  | 
 | 
												
													
														
															|  |                         return error(-1, "身份证号与医保卡号不一致,请检查后重新输入");
 |  | 
 | 
												
													
														
															|  |                     } else {
 |  | 
 | 
												
													
														
															|  |                         ssc = cardInfo.getCardNo();//统一只存英文字母开头的医保卡
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  |                     SocialSecurityInfo socialSecurityInfo = socialSecurityInfoDao.findBySfzh18Max(idcard);
 |  | 
 | 
												
													
														
															|  |                     //如果我们表没有记录那就新增一条记录
 |  | 
 | 
												
													
														
															|  |                     if(socialSecurityInfo==null){
 |  | 
 | 
												
													
														
															|  |                         socialSecurityInfo=new SocialSecurityInfo();
 |  | 
 | 
												
													
														
															|  |                         socialSecurityInfo.setXming0(name);
 |  | 
 | 
												
													
														
															|  |                         socialSecurityInfo.setXbie00(IdCardUtil.getSexForIdcard(idcard));
 |  | 
 | 
												
													
														
															|  |                         socialSecurityInfo.setCsrqi0(IdCardUtil.getBirthdayForIdcardStr(idcard));
 |  | 
 | 
												
													
														
															|  |                         socialSecurityInfo.setSfzh18(idcard);
 |  | 
 | 
												
													
														
															|  |                         socialSecurityInfo.setGrsfen("8");
 |  | 
 | 
												
													
														
															|  |                         socialSecurityInfo.setId0000(idcard);
 |  | 
 | 
												
													
														
															|  |                         socialSecurityInfo.setGzztai("01");
 |  | 
 | 
												
													
														
															|  |                         socialSecurityInfo.setCardno(ssc);
 |  | 
 | 
												
													
														
															|  |                         socialSecurityInfoDao.save(socialSecurityInfo);
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  |                     //如果医保卡不一致更新{
 |  | 
 | 
												
													
														
															|  |                     if(!socialSecurityInfo.getCardno().equals(ssc)){
 |  | 
 | 
												
													
														
															|  |                         socialSecurityInfo.setCardno(ssc);
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             //==============================旧版验证=========================
 |  | 
 | 
												
													
														
															|  | //            SocialSecurityInfo socialSecurityInfo = socialSecurityInfoDao.findBySfzh18Max(idcard);
 |  | 
 | 
												
													
														
															|  | 
 |  | //            if (!org.springframework.util.StringUtils.isEmpty(token)) {
 | 
												
													
														
															|  | 
 |  | //                UserInfoResponse userInfoResponse = ylzUserService.getUserByToken(token);
 | 
												
													
														
															|  | 
 |  | //                if (userInfoResponse.getCardInfo() != null && userInfoResponse.getCardInfo().size() > 0) {
 | 
												
													
														
															|  | 
 |  | //                    List<UserInfoResponse.CardInfo> cards = userInfoResponse.getCardInfo();
 | 
												
													
														
															|  | 
 |  | //                    Boolean hasCard = false;
 | 
												
													
														
															|  | 
 |  | //                    UserInfoResponse.CardInfo cardInfo = null;
 | 
												
													
														
															|  | 
 |  | //                    for (UserInfoResponse.CardInfo card : cards) {
 | 
												
													
														
															|  | 
 |  | //                        //如果患者有正常状态的社保卡
 | 
												
													
														
															|  | 
 |  | //                        if ("01".equals(card.getCardType()) && "normal".equals("state")) {
 | 
												
													
														
															|  | 
 |  | //                            hasCard = true;
 | 
												
													
														
															|  | 
 |  | //                            cardInfo = card;
 | 
												
													
														
															|  | 
 |  | //                            break;
 | 
												
													
														
															|  | 
 |  | //                        }
 | 
												
													
														
															|  | 
 |  | //                    }
 | 
												
													
														
															|  | //
 |  | //
 | 
												
													
														
															|  | //            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) {
 |  | 
 | 
												
													
														
															|  | 
 |  | //                    if (!hasCard) {
 | 
												
													
														
															|  | 
 |  | //                        return error(-1, "医保卡不存在,必须使用正常状态的厦门医保卡");
 | 
												
													
														
															|  | 
 |  | //                    }
 | 
												
													
														
															|  | 
 |  | //                    if (name.compareTo(userInfoResponse.getName() == null ? "" : userInfoResponse.getName()) != 0) {
 | 
												
													
														
															|  | 
 |  | //                        return error(-1, "身份证号与姓名不一致<br/>请检查后重新输入");
 | 
												
													
														
															|  | 
 |  | //                    }
 | 
												
													
														
															|  | 
 |  | //                    if (ssc.compareTo(cardInfo.getCardNo() == null ? "" : cardInfo.getCardNo()) != 0) {
 | 
												
													
														
															|  | //                        return error(-1, "身份证号与医保卡号不一致,请检查后重新输入");
 |  | //                        return error(-1, "身份证号与医保卡号不一致,请检查后重新输入");
 | 
												
													
														
															|  | //                    } else {
 |  | //                    } else {
 | 
												
													
														
															|  | //                        ssc = socialSecurityInfo.getCardno();//统一只存英文字母开头的医保卡
 |  | 
 | 
												
													
														
															|  | 
 |  | //                        ssc = cardInfo.getCardNo();//统一只存英文字母开头的医保卡
 | 
												
													
														
															|  | 
 |  | //                    }
 | 
												
													
														
															|  | 
 |  | //                    SocialSecurityInfo socialSecurityInfo = socialSecurityInfoDao.findBySfzh18Max(idcard);
 | 
												
													
														
															|  | 
 |  | //                    //如果我们表没有记录那就新增一条记录
 | 
												
													
														
															|  | 
 |  | //                    if(socialSecurityInfo==null){
 | 
												
													
														
															|  | 
 |  | //                        socialSecurityInfo=new SocialSecurityInfo();
 | 
												
													
														
															|  | 
 |  | //                        socialSecurityInfo.setXming0(name);
 | 
												
													
														
															|  | 
 |  | //                        socialSecurityInfo.setXbie00(IdCardUtil.getSexForIdcard(idcard));
 | 
												
													
														
															|  | 
 |  | //                        socialSecurityInfo.setCsrqi0(IdCardUtil.getBirthdayForIdcardStr(idcard));
 | 
												
													
														
															|  | 
 |  | //                        socialSecurityInfo.setSfzh18(idcard);
 | 
												
													
														
															|  | 
 |  | //                        socialSecurityInfo.setGrsfen("8");
 | 
												
													
														
															|  | 
 |  | //                        socialSecurityInfo.setId0000(idcard);
 | 
												
													
														
															|  | 
 |  | //                        socialSecurityInfo.setGzztai("01");
 | 
												
													
														
															|  | 
 |  | //                        socialSecurityInfo.setCardno(ssc);
 | 
												
													
														
															|  | 
 |  | //                        socialSecurityInfoDao.save(socialSecurityInfo);
 | 
												
													
														
															|  | //                    }
 |  | //                    }
 | 
												
													
														
															|  | 
 |  | //                    //如果医保卡不一致更新{
 | 
												
													
														
															|  | 
 |  | //                    if(!socialSecurityInfo.getCardno().equals(ssc)){
 | 
												
													
														
															|  | 
 |  | //                        socialSecurityInfo.setCardno(ssc);
 | 
												
													
														
															|  | 
 |  | //                    }
 | 
												
													
														
															|  | 
 |  | //
 | 
												
													
														
															|  | 
 |  | //
 | 
												
													
														
															|  | //                }
 |  | //                }
 | 
												
													
														
															|  | //            } else {
 |  | 
 | 
												
													
														
															|  | //                return error(-1, "对不起,暂不支持16年6月份之后办理的医保卡注册");
 |  | 
 | 
												
													
														
															|  | 
 |  | //
 | 
												
													
														
															|  | //            }
 |  | //            }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             //==============================旧版验证=========================
 | 
												
													
														
															|  | 
 |  |             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);
 |  |             Patient patient = patientDao.findByIdcard(idcard);
 | 
												
													
														
															|  | 
 |  | 
 |