| | |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @GetMapping("/dataSynchronization") |
| | | @ApiOperation(value = "同步sql server数据到本地数据库数据接口") |
| | | @RepeatSubmit |
| | | @Transactional |
| | | public AjaxResult dataSynchronization(@RequestParam String tjNumber) { |
| | | //根据配置调取存储过程 将临时表数据存入预约表2023.12.12 |
| | | final String getInfoFromSqlData = configService.selectConfigByKey("getInfoFromSqlData"); |
| | |
| | | //开启和his对接 |
| | | if(null !=sfkqdyhis && sfkqdyhis.equals("Y")){ |
| | | |
| | | String baoGaoDan = ltkjHybgdService.getJianYanBaoGaoDan(order.getCardId()); |
| | | if(null !=baoGaoDan){ |
| | | Date dates = new Date(); |
| | | Map<String,Object> map=new HashMap<>(); |
| | | map.put("his_registration_id",order.getCardId()); |
| | | map.put("ksbm",""); |
| | | map.put("pationid",""); |
| | | map.put("ksrq",DateUtil.format(DateUtil.beginOfDay(dates), "yyyy-MM-dd HH:mm:ss")); |
| | | map.put("jsrq",DateUtil.format(DateUtil.endOfDay(dates), "yyyy-MM-dd HH:mm:ss")); |
| | | map.put("pagecount",10); |
| | | map.put("page",1); |
| | | AjaxResult result = controller.Getlabreportinfo(map); |
| | | String result1 = getAjaxResult(result); |
| | | JSONObject object = getJSONObject(result1); |
| | | String code = object.getStr("ResultCode"); |
| | | if(null ==code || !code.equals("0")){ |
| | | return AjaxResult.error("化验项目暂时无结果,请稍后同步!!!"); |
| | | } |
| | | JSONArray data = object.getJSONArray("ResultData"); |
| | | for (Object datum : data) { |
| | | JSONObject jsonObject = (JSONObject)datum; |
| | | LtkjHysqd jybgid = ltkjHysqdService.getLtkjHysqdByTjhAndTmh(order.getCardId(), jsonObject.getStr("JYBGID")); |
| | | if(null !=jybgid){ |
| | | continue; |
| | | List<String> baoGaoDans = ltkjHybgdService.getJianYanBaoGaoDan(order.getCardId()); |
| | | if(null !=baoGaoDans && baoGaoDans.size()>0){ |
| | | |
| | | // List<LtkjHysqd> one = testMapper.getHysqdByTmh(order.getCardId()); |
| | | // if (one != null && one.size() > 0) { |
| | | // for (LtkjHysqd ltkjHysqd : one) { |
| | | // ltkjHysqdService.deletedLtkjHysqdByTjhAndTmh(ltkjHysqd.getTjh(), ltkjHysqd.getTmh()); |
| | | // ltkjHybgdService.deletedLtkjHybgdByTjhAndTmh(ltkjHysqd.getTmh()); |
| | | // } |
| | | // } |
| | | // for (String baoGaoDan : baoGaoDans) { |
| | | // Date dates = new Date(); |
| | | Map<String,Object> map=new HashMap<>(); |
| | | map.put("his_registration_id",order.getCardId()); |
| | | map.put("ksbm",""); |
| | | map.put("pationid",""); |
| | | map.put("ksrq",DateUtil.format(DateUtil.beginOfDay(order.getCreateTime()), "yyyy-MM-dd HH:mm:ss")); |
| | | map.put("jsrq",DateUtil.format(DateUtil.endOfDay(order.getCreateTime()), "yyyy-MM-dd HH:mm:ss")); |
| | | map.put("pagecount",10); |
| | | map.put("page",1); |
| | | AjaxResult result = controller.Getlabreportinfo(map); |
| | | String result1 = getAjaxResult(result); |
| | | JSONObject object = getJSONObject(result1); |
| | | String code = object.getStr("ResultCode"); |
| | | if(null ==code || !code.equals("0")){ |
| | | return AjaxResult.error("化验项目暂时无结果,请稍后同步!!!"); |
| | | } |
| | | LtkjHysqd hysqd=new LtkjHysqd(); |
| | | hysqd.setTjh(order.getCardId()); |
| | | hysqd.setTmh(jsonObject.getStr("JYBGID")); |
| | | hysqd.setBbbh(jsonObject.getStr("BBDM")); |
| | | hysqd.setBbmc(jsonObject.getStr("BBMC")); |
| | | hysqd.setXmid(jsonObject.getStr("JYXMDM")); |
| | | hysqd.setXmmc(jsonObject.getStr("JYXMMC")); |
| | | hysqd.setSqsj(jsonObject.getStr("SQRQ")); |
| | | hysqd.setSqys(jsonObject.getStr("SQRBH")); |
| | | hysqd.setJgsj(jsonObject.getStr("JYBGRQ")); |
| | | hysqd.setSqrxm(jsonObject.getStr("SQRXM")); |
| | | hysqd.setSqdh(jsonObject.getStr("SQDBH")); |
| | | if (ltkjHysqdService.save(hysqd)) { |
| | | Map<String,Object> hashMap=new HashMap<>(); |
| | | hashMap.put("jybgid",hysqd.getTmh()); |
| | | AjaxResult bgdres = controller.Getlabdetailinfo(hashMap); |
| | | String result2 = getAjaxResult(bgdres); |
| | | JSONObject object1 = getJSONObject(result2); |
| | | String code1 = object1.getStr("ResultCode"); |
| | | if(null ==code1 || !code1.equals("0")){ |
| | | return AjaxResult.error("化验项目暂时无结果,请稍后同步!!!"); |
| | | JSONArray data = object.getJSONArray("ResultData"); |
| | | for (Object datum : data) { |
| | | JSONObject jsonObject = (JSONObject)datum; |
| | | LtkjHysqd jybgid = ltkjHysqdService.getLtkjHysqdByTjhAndTmh(order.getCardId(), jsonObject.getStr("JYBGID")); |
| | | if(null !=jybgid){ |
| | | ltkjHysqdService.deletedLtkjHysqdByTjhAndTmh(order.getCardId(),jsonObject.getStr("JYBGID")); |
| | | ltkjHybgdService.deletedLtkjHybgdByTjhAndTmh(jybgid.getTmh()); |
| | | } |
| | | JSONArray datas = object1.getJSONArray("ResultData"); |
| | | for (Object o : datas) { |
| | | JSONObject js = (JSONObject)o; |
| | | LtkjHysqd hysqd=new LtkjHysqd(); |
| | | hysqd.setTjh(order.getCardId()); |
| | | hysqd.setTmh(jsonObject.getStr("JYBGID")); |
| | | hysqd.setBbbh(jsonObject.getStr("BBDM")); |
| | | hysqd.setBbmc(jsonObject.getStr("BBMC")); |
| | | hysqd.setXmid(jsonObject.getStr("JYXMDM")); |
| | | hysqd.setXmmc(jsonObject.getStr("JYXMMC")); |
| | | hysqd.setSqsj(jsonObject.getStr("SQRQ")); |
| | | hysqd.setSqys(jsonObject.getStr("SQRBH")); |
| | | hysqd.setJgsj(jsonObject.getStr("JYBGRQ")); |
| | | hysqd.setSqrxm(jsonObject.getStr("SQRXM")); |
| | | hysqd.setSqdh(jsonObject.getStr("SQDBH")); |
| | | if (ltkjHysqdService.save(hysqd)) { |
| | | Map<String,Object> hashMap=new HashMap<>(); |
| | | hashMap.put("jybgid",hysqd.getTmh()); |
| | | AjaxResult bgdres = controller.Getlabdetailinfo(hashMap); |
| | | String result2 = getAjaxResult(bgdres); |
| | | JSONObject object1 = getJSONObject(result2); |
| | | String code1 = object1.getStr("ResultCode"); |
| | | if(null ==code1 || !code1.equals("0")){ |
| | | return AjaxResult.error("化验项目暂时无结果,请稍后同步!!!"); |
| | | } |
| | | JSONArray datas = object1.getJSONArray("ResultData"); |
| | | for (Object o : datas) { |
| | | JSONObject js = (JSONObject)o; |
| | | // ltkjHybgdService.deletedLtkjHybgdByTjhAndTmh(jsonObject.getStr("JYBGID")); |
| | | LtkjHybgd bgd=new LtkjHybgd(); |
| | | bgd.setTmh(hysqd.getTmh()); |
| | | bgd.setJcxmid(js.getStr("JCZBDM")); |
| | | bgd.setJcxm(js.getStr("JCZBMC")); |
| | | bgd.setTdh(js.getStr("")); |
| | | bgd.setJyjg(js.getStr("JCZBJG")); |
| | | bgd.setJgdw(js.getStr("JLDW")); |
| | | bgd.setFwzdz(js.getStr("")); |
| | | bgd.setFwzgz(js.getStr("")); |
| | | bgd.setFwz(js.getStr("CKZFW")); |
| | | bgd.setJysj(js.getStr("BGRQ")); |
| | | bgd.setJyys(js.getStr("JCRBH")); |
| | | bgd.setShsj(js.getStr("BGRQ")); |
| | | bgd.setShsj(js.getStr("BGRQ")); |
| | | bgd.setShys(js.getStr("SHRBH")); |
| | | bgd.setYcbz(js.getStr("YCTS")); |
| | | LtkjHybgd bgd=new LtkjHybgd(); |
| | | bgd.setTmh(hysqd.getTmh()); |
| | | bgd.setJcxmid(js.getStr("JCZBDM")); |
| | | bgd.setJcxm(js.getStr("JCZBMC")); |
| | | bgd.setTdh(js.getStr("")); |
| | | bgd.setJyjg(js.getStr("JCZBJG")); |
| | | bgd.setJgdw(js.getStr("JLDW")); |
| | | bgd.setFwzdz(js.getStr("")); |
| | | bgd.setFwzgz(js.getStr("")); |
| | | bgd.setFwz(js.getStr("CKZFW")); |
| | | bgd.setJysj(js.getStr("BGRQ")); |
| | | bgd.setJyys(js.getStr("JCRBH")); |
| | | bgd.setShsj(js.getStr("BGRQ")); |
| | | bgd.setShsj(js.getStr("BGRQ")); |
| | | bgd.setShys(js.getStr("SHRBH")); |
| | | bgd.setYcbz(js.getStr("YCTS")); |
| | | // bgd.setTpurl(js.getStr("")); |
| | | ltkjHybgdService.save(bgd); |
| | | ltkjHybgdService.save(bgd); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // } |
| | | //同步化验项目 |
| | | testMapper.updateDetailByCall(order.getCardId(), String.valueOf(order.getOrderId()), order.getTjNumber(), UserHoder.getLoginUser().getUserId()); |
| | | //同步检查项目 |
| | |
| | | if (null != customer) { |
| | | customer.setCusNumber(customer.getCusNumber() + 1); |
| | | if (customerService.updateById(customer)) { |
| | | LambdaQueryWrapper<TbTransition> wqq = new LambdaQueryWrapper<>(); |
| | | wqq.eq(TbTransition::getCusId, customer.getCusIdcard()); |
| | | wqq.eq(TbTransition::getCardId, customer.getCardId()); |
| | | transitionService.remove(wqq); |
| | | // LambdaQueryWrapper<TbTransition> wqq = new LambdaQueryWrapper<>(); |
| | | // wqq.eq(TbTransition::getCusId, customer.getCusIdcard()); |
| | | // wqq.eq(TbTransition::getCardId, customer.getCardId()); |
| | | // transitionService.remove(wqq); |
| | | asyncService.updateCheckType(tjNumber); |
| | | return AjaxResult.success("操作成功"); |
| | | } |
| | |
| | | if (null != tjOrderDetails && tjOrderDetails.size() > 0) { |
| | | for (TjOrderDetail tjOrderDetail : tjOrderDetails) { |
| | | if(remark.getProId().equals(tjOrderDetail.getProId())){ |
| | | String ckfw = tjOrderDetail.getStanId(); |
| | | if (StrUtil.isNotBlank(ckfw)) { |
| | | try { |
| | | Integer.parseInt(tjOrderDetail.getYcbz()); |
| | | String[] split = ckfw.split("-"); |
| | | BigDecimal min = new BigDecimal(split[0]); |
| | | BigDecimal max = new BigDecimal(split[1]); |
| | | String proResult = tjOrderDetail.getProResult(); |
| | | BigDecimal jyjgval = new BigDecimal(proResult); |
| | | if (jyjgval.compareTo(min) < 0) { |
| | | tjOrderDetail.setYcbz("↓"); |
| | | } else if (jyjgval.compareTo(max) > 0) { |
| | | tjOrderDetail.setYcbz("↑"); |
| | | }else { |
| | | tjOrderDetail.setYcbz(""); |
| | | } |
| | | } catch (NumberFormatException ignored) { } |
| | | } |
| | | if(null !=tjOrderDetail.getYcbz() && !tjOrderDetail.getYcbz().equals("")){ |
| | | tjOrderDetail.setProResult(tjOrderDetail.getProResult()+" ["+tjOrderDetail.getYcbz()+"]"); |
| | | } |