zjh
2024-11-21 27e09a7b8549c5a84891c62b1625adbe81db04fc
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java
@@ -4,6 +4,7 @@
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.extra.pinyin.PinyinUtil;
import cn.hutool.json.JSONArray;
@@ -151,8 +152,8 @@
//                    return AjaxResult.error("身份证号码错误");
//                }
//            }
            Date dates = new Date();
            final String date = DateUtil.format(dates, "yyyy-MM-dd HH:mm:ss");
//            Date dates = new Date();
//            final String date = DateUtil.format(dates, "yyyy-MM-dd HH:mm:ss");
            final String getInfoFromSqlData = sysConfigService.selectConfigByKey("getInfoFromSqlData");
            if ("Y".equals(getInfoFromSqlData)) {
@@ -215,7 +216,8 @@
//                if (DateUtil.endOfDay(new Date()).before(tjReservation.getReservationTime())) {
//                    return AjaxResult.error("未到预约时间");
//                }
                if (null != tjReservation.getReservationTime() && DateUtil.endOfDay(tjReservation.getReservationTime()).before(new Date())) {
                if (null != tjReservation.getReservationTime() && DateUtil.endOfDay(DateUtil.offsetDay(tjReservation.getReservationTime(),
                        tjReservation.getYxts())).before(new Date())) {
                    tjReservation.setIsExpire(1);
                    tjReservationService.updateById(tjReservation);
                    return AjaxResult.error("对不起您的预约已超时请重新预约");
@@ -227,7 +229,7 @@
                    tjCustomer1.setTjType(tjReservation.getTjType());
                    tjCustomer1.setCusName(tjReservation.getName());
                    tjCustomer1.setCusSex(Long.valueOf(tjReservation.getSex()));
                    tjCustomer1.setCusBrithday(tjReservation.getBirthday());
                    tjCustomer1.setCusBrithday(DateUtil.parse(MatchUtils.getBirthDayByIdCard(tjReservation.getIdCard()), "yyyy-MM-dd"));
                    tjCustomer1.setCusPhone(tjReservation.getPhoe());
                    tjCustomer1.setCusEmail(tjReservation.getEmail());
                    tjCustomer1.setCusAddr(tjReservation.getAddress());
@@ -239,7 +241,33 @@
                    tjCustomer1.setAgeUnit(tjReservation.getAgeUnit());
                    tjCustomer1.setCareer(tjReservation.getCareer());
                    tjCustomer1.setPym(PinyinUtil.getFirstLetter(tjReservation.getName(),""));
                    tjCustomerService.updateById(tjCustomer1);
/*                    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());
@@ -251,7 +279,7 @@
                    tjCustomer.setCusIdcard(tjReservation.getIdCard());
                    tjCustomer.setCusName(tjReservation.getName());
                    tjCustomer.setCusSex(Long.valueOf(tjReservation.getSex()));
                    tjCustomer.setCusBrithday(tjReservation.getBirthday());
                    tjCustomer.setCusBrithday(DateUtil.parse(MatchUtils.getBirthDayByIdCard(tjReservation.getIdCard()), "yyyy-MM-dd"));
                    tjCustomer.setCusPhone(tjReservation.getPhoe());
                    tjCustomer.setCusEmail(tjReservation.getEmail());
                    tjCustomer.setCusAddr(tjReservation.getAddress());
@@ -263,7 +291,7 @@
                    tjCustomer.setAgeUnit(tjReservation.getAgeUnit());
                    tjCustomer.setCareer(tjReservation.getCareer());
                    tjCustomer.setDwPhone(tjReservation.getDwPhone());
                    tjCustomer.setCardId(tjReservation.getCardId());
//                    tjCustomer.setCardId(tjReservation.getCardId());
                    tjCustomer.setIndexCard(tjReservation.getIndexCard());
                    //截取密码自动生成set进去
                    String substring = cusIdcard.substring(cusIdcard.length() - 6);
@@ -271,7 +299,6 @@
                    tjCustomer.setCusPassword(substring);
                    tjCustomer.setTjType(tjReservation.getTjType());
                    tjCustomer.setPym(PinyinUtil.getFirstLetter(tjReservation.getName(),""));
                    tjCustomerService.save(tjCustomer);
                    if (null != key && key.equals("Y"))
                    {
                        AjaxResult result = controller.Outpincreateapply(tjCustomer);
@@ -285,7 +312,7 @@
                                String pationid = resultData.get("PationId").toString();
                                if (null != pationid) {
                                    tjCustomer.setPationId(pationid);
                                    tjCustomerService.updateById(tjCustomer);
                                    tjCustomerService.save(tjCustomer);
                                    //保存注册入参出参
                                    resultData.put("cardId",pationid);
                                    JSONObject object4 = JSONUtil.parseObj(resultData);
@@ -296,6 +323,8 @@
                                }
                            }
                        }
                    }else {
                        tjCustomerService.save(tjCustomer);
                    }
                    tjCustomer.setTeamNo(tjReservation.getTeamNo());
                    tjCustomer.setCompId(tjReservation.getCompanyId());
@@ -314,7 +343,7 @@
            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);
@@ -323,8 +352,11 @@
                    }
                }
//            }
            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);
        }
@@ -482,7 +514,7 @@
                String pationid = resultData.get("PationId").toString();
                if (null != pationid) {
                    tjCustomer.setPationId(pationid);
                    tjCustomerService.updateById(tjCustomer);
//                    tjCustomerService.updateById(tjCustomer);
                    //保存注册入参出参
                    resultData.put("cardId",pationid);
                    JSONObject object4 = JSONUtil.parseObj(resultData);
@@ -529,7 +561,6 @@
        if (tjCustomerService.updateById(tjCustomer)) {
            String config = sysConfigService.selectConfigByKey("sfkqdyhis");
            if (null != config && config.equals("Y")) {
                tjCustomer.setPationId(customer.getPationId());
                AjaxResult result = controller.Outpincreateapply(tjCustomer);
                String result1 = getAjaxResult(result);
                JSONObject object = getJSONObject(result1);