| | |
| | | private ITjFlowingWaterService tjFlowingWaterService; |
| | | @Autowired |
| | | private HisApiGetMethodService hisApiGetMethodService; |
| | | @Autowired |
| | | private LtkjJianchajianyanTreeService ltkjJianchajianyanTreeService; |
| | | |
| | | /** |
| | | * 该体检科室下客户列表显示接口 |
| | |
| | | tjCustomerLambdaQueryWrapper.eq(TjCustomer::getCusId,tjOrder.getUserId()); |
| | | TjCustomer tjCustomer = tjCustomerService.getOne(tjCustomerLambdaQueryWrapper); |
| | | HashMap<String, Object> hisRequestParams = new HashMap<>(); |
| | | hisRequestParams.put("card_no",tjCustomer.getCusIdcard()); |
| | | hisRequestParams.put("patientId",tjCustomer.getPationId()); |
| | | // 不在需要身份证号 |
| | | // hisRequestParams.put("card_no",tjCustomer.getCusIdcard()); |
| | | hisRequestParams.put("patientId",tjCustomer.getCardId()); |
| | | AjaxResult queryPay = hisApiGetMethodService.getHISDataNew("QueryPay", hisRequestParams); |
| | | if (Integer.parseInt(queryPay.get("code").toString()) == 200) { |
| | | List<Map<String, String>> data = (List<Map<String, String>>) queryPay.get("data"); |
| | | Date date = new Date(); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | List<Map<String, String>> list = data.stream().filter(item -> String.valueOf(item.get("PayDate")).equals(dateFormat.format(date))).collect(Collectors.toList()); |
| | | JSONArray jsonArray = JSONUtil.parseArray(list); |
| | | BigDecimal decimal = new BigDecimal("0"); |
| | | for (Object o : jsonArray) { |
| | | JSONObject object = (JSONObject) o; |
| | | JSONArray items = object.getJSONArray("Items"); |
| | | for (Object item : items) { |
| | | JSONObject jsonObject = (JSONObject) item; |
| | | BigDecimal fee = jsonObject.getBigDecimal("Fee"); |
| | | decimal.add(fee); |
| | | } |
| | | ArrayList<String> sqdhs = new ArrayList<>(); |
| | | ArrayList<String> xmfls = new ArrayList<>(); |
| | | BigDecimal cateFeeAll = BigDecimal.ZERO; |
| | | for (Map<String, String> datum : data) { |
| | | String advId = datum.get("Adv_Id").split("_")[1]; |
| | | BigDecimal cateFee = new BigDecimal(datum.get("CateFee")); |
| | | String cateCode = datum.get("CateCode"); |
| | | cateFeeAll = cateFeeAll.add(cateFee); |
| | | sqdhs.add(advId); |
| | | xmfls.add(cateCode); |
| | | } |
| | | if (decimal.compareTo(new BigDecimal("0")) != 0){ |
| | | LambdaQueryWrapper<LtkjJianchajianyanTree> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(LtkjJianchajianyanTree::getSqdh, sqdhs) |
| | | .in(LtkjJianchajianyanTree::getXmfl, xmfls) |
| | | .groupBy(LtkjJianchajianyanTree::getType) |
| | | .select(LtkjJianchajianyanTree::getFyhj); |
| | | List<LtkjJianchajianyanTree> results = ltkjJianchajianyanTreeService.list(queryWrapper); |
| | | BigDecimal total = results.stream() |
| | | .map(item -> new BigDecimal(item.getFyhj())) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | if (cateFeeAll.compareTo(total) != 0){ |
| | | return AjaxResult.error("存在未缴费项目"); |
| | | } |
| | | |
| | | tjFlowingWater.setPayStasus(1L); |
| | | tjFlowingWater.setPayType(0L); |
| | | tjFlowingWater.setTollCollectorId("148"); |