| | |
| | | import com.ltkj.web.controller.his.HisApiGetMethodService; |
| | | import com.ltkj.web.controller.his.HisApiMethod; |
| | | import com.ltkj.web.controller.his.HisApiMethodService; |
| | | import com.ltkj.web.wxUtils.HttpClientUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | |
| | | import com.ltkj.common.utils.poi.ExcelUtil; |
| | | import com.ltkj.common.core.page.TableDataInfo; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | |
| | | // @Log(title = "客户身份信息", businessType = BusinessType.EXPORT) |
| | | public AjaxResult getInfoByIdCard(@RequestParam @ApiParam(value = "客户身份证号") String cusIdcard) { |
| | | if (!"".equals(cusIdcard) && cusIdcard != null) { |
| | | |
| | | String sfjysfzh = sysConfigService.selectConfigByKey("sfjysfzh"); |
| | | // String sfjysjh = configService.selectConfigByKey("sfjysjh"); |
| | | |
| | | //判断身份证号格式是否正确 |
| | | // if(cusIdcard.length()==18){ |
| | | // if (! MatchUtils.isIdCard(cusIdcard)) { |
| | | // return AjaxResult.error("身份证号码错误"); |
| | | // } |
| | | // } |
| | | // if(cusIdcard.length()==9){ |
| | | // if (!MatchUtils.cardValidates(cusIdcard)) { |
| | | // return AjaxResult.error("身份证号码错误"); |
| | | // } |
| | | // } |
| | | Date dates = new Date(); |
| | | final String date = DateUtil.format(dates, "yyyy-MM-dd HH:mm:ss"); |
| | | if(sfjysfzh.equalsIgnoreCase("Y")){ |
| | | if(cusIdcard.length()==18){ |
| | | if (! MatchUtils.isIdCard(cusIdcard)) { |
| | | return AjaxResult.error("身份证号码错误"); |
| | | } |
| | | } |
| | | if(cusIdcard.length()==9){ |
| | | if (!MatchUtils.cardValidates(cusIdcard)) { |
| | | return AjaxResult.error("身份证号码错误"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | final String getInfoFromSqlData = sysConfigService.selectConfigByKey("getInfoFromSqlData"); |
| | | if ("Y".equals(getInfoFromSqlData)) { |
| | |
| | | LtkjTjPat tjPatByIdCard = testMapper.getTjPatByIdCard(cusIdcard); |
| | | if (null != tjPatByIdCard) { |
| | | String fcardNo = tjPatByIdCard.getFcardNo(); |
| | | if (null != fcardNo && !fcardNo.equals("")) { |
| | | if (null != fcardNo && !fcardNo.isEmpty()) { |
| | | fcardNo = fcardNo.trim(); |
| | | tjPatByIdCard.setFcardNo(fcardNo); |
| | | } else { |
| | |
| | | |
| | | String key = sysConfigService.selectConfigByKey("sfkqdyhis"); |
| | | |
| | | |
| | | //end====2023.12.12 |
| | | LambdaQueryWrapper<TjReservation> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjReservation::getIdCard, cusIdcard); |
| | | wq.eq(TjReservation::getIsExpire, 2); |
| | | TjReservation tjReservation = tjReservationService.getOne(wq); |
| | | if (tjReservation != null) { |
| | | // if (DateUtil.endOfDay(new Date()).before(tjReservation.getReservationTime())) { |
| | | // return AjaxResult.error("未到预约时间"); |
| | | // } |
| | | |
| | | if (null != tjReservation.getReservationTime() && DateUtil.endOfDay(DateUtil.offsetDay(tjReservation.getReservationTime(), |
| | | tjReservation.getYxts())).before(new Date())) { |
| | | tjReservation.setIsExpire(1); |
| | |
| | | qw.eq(TjCustomer::getCusIdcard, cusIdcard); |
| | | TjCustomer tjCustomer1 = tjCustomerService.getOne(qw); |
| | | if (tjCustomer1 != null) { |
| | | if (null != tjReservation.getCompanyId()) tjCustomer1.setDictCompId(Long.valueOf(tjReservation.getCompanyId())); |
| | | if (null != tjReservation.getCompany()) tjCustomer1.setCompName(tjReservation.getCompany()); |
| | | tjCustomerService.updateById(tjCustomer1); |
| | | tjCustomer1.setTjType(tjReservation.getTjType()); |
| | | tjCustomer1.setCusName(tjReservation.getName()); |
| | | tjCustomer1.setCusSex(Long.valueOf(tjReservation.getSex())); |
| | |
| | | tjCustomer1.setAgeUnit(tjReservation.getAgeUnit()); |
| | | tjCustomer1.setCareer(tjReservation.getCareer()); |
| | | tjCustomer1.setPym(PinyinUtil.getFirstLetter(tjReservation.getName(),"")); |
| | | /* if (null != key && key.equals("Y")) |
| | | { |
| | | AjaxResult result = controller.Outpincreateapply(tjCustomer1); |
| | | String result1 = getAjaxResult(result); |
| | | JSONObject object = getJSONObject(result1); |
| | | String code = object.getStr("ResultCode"); |
| | | if (code.equals("0")) { |
| | | JSONArray resultDatass = object.getJSONArray("ResultData"); |
| | | Map<String, Object> resultData = (Map<String, Object>) resultDatass.get(0); |
| | | if (null != resultData && resultData.size() > 0) { |
| | | String pationid = resultData.get("PationId").toString(); |
| | | if (null != pationid) { |
| | | // tjCustomer1.setPationId(pationid); |
| | | tjCustomerService.updateById(tjCustomer1); |
| | | //保存注册入参出参 |
| | | resultData.put("cardId",pationid); |
| | | JSONObject object4 = JSONUtil.parseObj(resultData); |
| | | LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpincreateapply"); |
| | | HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper); |
| | | hisApiGetMethodService.save(object4, "Outpincreateapply", hisApiConfig, JSONUtil.toJsonStr(BeanUtil.beanToMap(tjCustomer1))); |
| | | } |
| | | } |
| | | } |
| | | }else { |
| | | tjCustomerService.updateById(tjCustomer1); |
| | | }*/ |
| | | |
| | | tjCustomer1.setTeamNo(tjReservation.getTeamNo()); |
| | | tjCustomer1.setCompId(tjReservation.getCompanyId()); |
| | | tjCustomer1.setReservationId(tjReservation.getId()); |
| | | tjCustomer1.setDiscount(tjReservation.getDiscount()); |
| | | tjCustomer1.setGroupingId(tjReservation.getGroupingId()); |
| | | |
| | | if(null !=tjReservation.getCompanyId())tjCustomer1.setDictCompId(Long.valueOf(tjReservation.getCompanyId())); |
| | | if(null !=tjReservation.getCompany())tjCustomer1.setCompName(tjReservation.getCompany()); |
| | | |
| | | // tjCustomerService.updateById(tjCustomer1); |
| | | |
| | | return success(tjCustomer1); |
| | | }else { |
| | | TjCustomer tjCustomer = new TjCustomer(); |
| | |
| | | tjCustomer.setCusPassword(substring); |
| | | tjCustomer.setTjType(tjReservation.getTjType()); |
| | | tjCustomer.setPym(PinyinUtil.getFirstLetter(tjReservation.getName(),"")); |
| | | if(null !=tjReservation.getCompanyId())tjCustomer.setDictCompId(Long.valueOf(tjReservation.getCompanyId())); |
| | | if(null !=tjReservation.getCompany())tjCustomer.setCompName(tjReservation.getCompany()); |
| | | if (null != key && key.equals("Y")) |
| | | { |
| | | AjaxResult result = controller.Outpincreateapply(tjCustomer); |
| | |
| | | if (code.equals("0")) { |
| | | JSONArray resultDatass = object.getJSONArray("ResultData"); |
| | | Map<String, Object> resultData = (Map<String, Object>) resultDatass.get(0); |
| | | if (null != resultData && resultData.size() > 0) { |
| | | if (null != resultData && !resultData.isEmpty()) { |
| | | String pationid = resultData.get("PationId").toString(); |
| | | if (null != pationid) { |
| | | tjCustomer.setPationId(pationid); |
| | |
| | | if (null == tjCustomerServiceOne) { |
| | | return AjaxResult.error("该人员信息不存在请先进行登记!!!"); |
| | | } |
| | | if (null != key && key.equals("Y")) { |
| | | // if (null != key && key.equals("Y")) { |
| | | String cardId = tjCustomerServiceOne.getCardId(); |
| | | if (null != cardId && !cardId.equals("0")) { |
| | | int i = tjOrderService.selectTjOrderByCardId(cardId); |
| | |
| | | } |
| | | } |
| | | |
| | | // } |
| | | if(!tjCustomerServiceOne.getAge().equals(String.valueOf(DateUtil.ageOfNow(tjCustomerServiceOne.getCusBrithday())))){ |
| | | tjCustomerServiceOne.setAge(String.valueOf(DateUtil.ageOfNow(tjCustomerServiceOne.getCusBrithday()))); |
| | | tjCustomerService.updateById(tjCustomerServiceOne); |
| | | } |
| | | |
| | | return AjaxResult.success(tjCustomerServiceOne); |
| | | |
| | | } |
| | |
| | | if (null == tjCustomer.getCusIdcard() || null == tjCustomer.getCusPhone()) { |
| | | return AjaxResult.error("请输入身份证号或手机号"); |
| | | } |
| | | HisApiGetMethodService hisApiGetMethodService = new HisApiGetMethodService(); |
| | | |
| | | Date dates = new Date(); |
| | | final String date = DateUtil.format(dates, "yyyy-MM-dd HH:mm:ss"); |
| | |
| | | String cusIdcard = tjCustomer.getCusIdcard(); |
| | | |
| | | boolean b = true; |
| | | String sfjysfzh = sysConfigService.selectConfigByKey("sfjysfzh"); |
| | | String sfjysjh = sysConfigService.selectConfigByKey("sfjysjh"); |
| | | if (null != tjCustomer.getIdType()) { |
| | | if (tjCustomer.getIdType().equals("1")) { |
| | | b = MatchUtils.isIdCard(cusIdcard); |
| | | //判断身份证号格式是否正确 |
| | | if(sfjysfzh.equalsIgnoreCase("Y")){ |
| | | if(cusIdcard.length()==18){ |
| | | b = MatchUtils.isIdCard(cusIdcard); |
| | | } |
| | | } |
| | | } else { |
| | | if(cusIdcard.length()==9){ |
| | | b = MatchUtils.cardValidate(cusIdcard, tjCustomer.getIdType()); |
| | | } |
| | | |
| | | } |
| | | // else { |
| | | // b = MatchUtils.cardValidate(cusIdcard, tjCustomer.getIdType()); |
| | | // } |
| | | } else { |
| | | return AjaxResult.error("请选择证件类型"); |
| | | } |
| | | if (!b) return AjaxResult.error("证件号有误"); |
| | | |
| | | //判断身份证号格式是否正确 |
| | | if (!(MatchUtils.isMobileNO(tjCustomer.getCusPhone()))) |
| | | return AjaxResult.error("手机号错误"); |
| | | if(sfjysjh.equalsIgnoreCase("Y")){ |
| | | if (!(MatchUtils.isMobileNO(tjCustomer.getCusPhone()))) |
| | | return AjaxResult.error("手机号错误"); |
| | | } |
| | | |
| | | LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjCustomer::getCusIdcard, cusIdcard); |
| | |
| | | AjaxResult tjCustomer1 = suijieHisXinXi(tjCustomer, date); |
| | | if (tjCustomer1 != null) return tjCustomer1; |
| | | } else { |
| | | if (tjCustomerService.save(tjCustomer)) { |
| | | return AjaxResult.success(tjCustomer); |
| | | String s = sysConfigService.selectConfigByKey("is_request_common_his_api"); |
| | | if (null != s && s.equals("Y")){ |
| | | String apiUrl = sysConfigService.selectConfigByKey("common_api_url"); |
| | | String hospbm = sysConfigService.selectConfigByKey("common_api_service_hospbm"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("cardId",""); |
| | | map.put("cusName",tjCustomer.getCusName()); |
| | | map.put("cusSex",tjCustomer.getCusSex()); |
| | | map.put("cusIdCard",tjCustomer.getCusIdcard()); |
| | | map.put("compId",tjCustomer.getCompId()); |
| | | map.put("cusBrithday",tjCustomer.getCusBrithday() != null ? DateUtil.format(tjCustomer.getCusBrithday(), "yyyy-MM-dd") : ""); |
| | | map.put("cusAddr",tjCustomer.getCusAddr()); |
| | | map.put("cusPhone",tjCustomer.getCusPhone()); |
| | | map.put("compName",tjCustomer.getCompName()); |
| | | String post = HttpClientUtils.sendPost(apiUrl+"/api/his/"+hospbm+"/creat", map); |
| | | JSONObject jsonObject = JSONUtil.parseObj(post); |
| | | if (jsonObject.getStr("code").equals("200")){ |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | tjCustomer.setPationId(data.getStr("pationId")); |
| | | tjCustomer.setCardId(data.getStr("cardId")); |
| | | tjCustomer.setHisJzkh(data.getStr("cardId")); |
| | | if (tjCustomerService.save(tjCustomer)) { |
| | | return AjaxResult.success(tjCustomer); |
| | | } |
| | | }else return AjaxResult.error(); |
| | | }else { |
| | | if (tjCustomerService.save(tjCustomer)) { |
| | | return AjaxResult.success(tjCustomer); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.error(); |
| | |
| | | if (null == cusPhone) { |
| | | return AjaxResult.error("手机号不能为空"); |
| | | } |
| | | /*LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>(); |
| | | wq.eq(TjCustomer::getCusPhone, cusPhone); |
| | | TjCustomer customer = tjCustomerService.getOne(wq); |
| | | if (customer != null) { |
| | | return AjaxResult.error("该手机号已被使用!"); |
| | | }*/ |
| | | String sfjysfzh = sysConfigService.selectConfigByKey("sfjysfzh"); |
| | | String sfjysjh = sysConfigService.selectConfigByKey("sfjysjh"); |
| | | |
| | | //判断身份证号格式是否正确 |
| | | if(sfjysfzh.equalsIgnoreCase("Y")){ |
| | | if(tjCustomer.getCusIdcard().length()==18){ |
| | | if (!(MatchUtils.isIdCard(tjCustomer.getCusIdcard()))) |
| | | return AjaxResult.error("身份证号错误"); |
| | | } |
| | | |
| | | if(tjCustomer.getCusIdcard().length()==9){ |
| | | if (!MatchUtils.cardValidates(tjCustomer.getCusIdcard())) { |
| | | return AjaxResult.error("身份证号码错误"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //判断身份证号格式是否正确 |
| | | if(sfjysjh.equalsIgnoreCase("Y")){ |
| | | if (!(MatchUtils.isMobileNO(tjCustomer.getCusPhone()))) |
| | | return AjaxResult.error("手机号错误"); |
| | | } |
| | | |
| | | tjCustomer.setCusPhone(cusPhone); |
| | | tjCustomer.setPym(PinyinUtil.getFirstLetter(tjCustomer.getCusName(),"")); |
| | | if (tjCustomerService.updateById(tjCustomer)) { |