| | |
| | | import com.ltkj.system.service.ISysConfigService; |
| | | import com.ltkj.system.service.ISysDeptService; |
| | | import jdk.nashorn.internal.runtime.logging.Logger; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | * */ |
| | | |
| | | @Component |
| | | @Slf4j |
| | | public class HisApiMethod { |
| | | @Autowired |
| | | private HisApiMethodService controller; |
| | |
| | | |
| | | //对接his总接口 注册挂号接诊申请单操作 |
| | | @Logger |
| | | public AjaxResult HisApiMethods(TjCustomer customer, Long orderId) { |
| | | public AjaxResult HisApiMethods(TjCustomer customer,TjOrder tjOrder) { |
| | | String jzh=null; |
| | | try { |
| | | TjOrder tjOrder = orderService.getById(orderId); |
| | | // TjOrder tjOrder = orderService.getById(orderId); |
| | | Date dates = new Date(); |
| | | final String date = DateUtil.format(dates, "yyyy-MM-dd HH:mm:ss"); |
| | | OutpinregapplyDto outpinregapplyDto = new OutpinregapplyDto(); |
| | |
| | | hisApiGetMethodService.save(object4, "Outpinregapply", hisApiConfig, JSONUtil.toJsonStr(BeanUtil.beanToMap(outpinregapplyDto))); |
| | | |
| | | //门诊医生接诊 |
| | | controller.Outpinconapply(hisRegistrationId, date, "00029"); |
| | | AjaxResult result = controller.Outpinconapply(hisRegistrationId, date, "00029"); |
| | | String result3 = getAjaxResult(result); |
| | | JSONObject object2 = getJSONObject(result3); |
| | | String code2 = object2.getStr("ResultCode"); |
| | | if (!code2.equals("0")) { |
| | | return AjaxResult.error(object2.getStr("ResultContent")); |
| | | } |
| | | log.info("his接口-----医生接诊成功!"); |
| | | if(null != tjOrder.getTjCategory() && !tjOrder.getTjCategory().equals("13")){ |
| | | customer.setCardId(hisRegistrationId); |
| | | }else { |
| | |
| | | dto.setSfqj("0"); |
| | | dto.setJzqk(9); |
| | | controller.Outpinimpapply(dto); |
| | | return tijianshenqing(customer, date,tjOrder.getCardId()); |
| | | return AjaxResult.success(); |
| | | } |
| | | return AjaxResult.error(); |
| | | } catch (Exception e) { |
| | |
| | | |
| | | |
| | | //体检对his申请单调用方法 |
| | | private AjaxResult tijianshenqing(TjCustomer customer, String date,String cardId) { |
| | | public AjaxResult tijianshenqing(TjCustomer customer, String date,String cardId) { |
| | | |
| | | |
| | | List<TbTransition> detailList = tbTransitionService.getTbTransitionListByCusId(customer.getCusIdcard(),cardId); |
| | | |
| | | //检验申请 |
| | | OutpintestapplyDto dto = new OutpintestapplyDto(); |
| | | dto.setHisRegistrationId(cardId); |
| | |
| | | dto.setCzybm("00029"); |
| | | dto.setCzyksbm("0101"); |
| | | dto.setSfjz("0"); |
| | | List<TbTransition> detailList = tbTransitionService.getTbTransitionListByCusId(customer.getCusIdcard(),cardId); |
| | | |
| | | List<OutpintestapplyDetailsDto> detailsDtos = new ArrayList<>(); |
| | | List<OutpinmedicapplyDetilsDto> outpinmedicapplyDetilsDtos =new ArrayList<>(); |
| | | if (null != detailList && detailList.size() > 0) { |
| | |
| | | String mxfyxmbm = detail.getMxfyxmbm(); |
| | | tree.setHisXmdm(mxfyxmbm); |
| | | tree.setType("检验"); |
| | | // LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>(); |
| | | // wrapper.eq(TjProject::getHisXmbm, mxfyxmbm); |
| | | // List<TjProject> list = projectService.list(wrapper); |
| | | // String tj_price = ""; |
| | | // for (TjProject project : list) { |
| | | // tj_price += project.getProPrice() + "、"; |
| | | // } |
| | | // tree.setTjPrice(tj_price.substring(0, tj_price.length() - 1)); |
| | | // LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>(); |
| | | // wrapper.eq(TjProject::getHisXmbm, mxfyxmbm); |
| | | // wrapper.eq(TjProject::getSl,1); |
| | | // wrapper.groupBy(TjProject::getHisXmbm); |
| | | // TjProject project = projectService.getOne(wrapper); |
| | | // if(null !=project){ |
| | | // BigDecimal decimal = project.getProPrice().multiply(BigDecimal.valueOf(detail.getSl())); |
| | | // tree.setTjPrice(String.valueOf(decimal)); |
| | | // } |
| | | tree.setTjPrice(String.valueOf(detail.getProjg())); |
| | | LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>(); |
| | | if (detail.getSfzhfy().equals("1")) |
| | |
| | | outpinexamapplyDto.setCzybm("00029"); |
| | | outpinexamapplyDto.setCzyksbm("0101"); |
| | | outpinexamapplyDto.setSfjz("0"); |
| | | List<TbTransition> detailLists = tbTransitionService.getTbTransitionListByCusId(customer.getCusIdcard(),cardId); |
| | | // List<TbTransition> detailLists = tbTransitionService.getTbTransitionListByCusId(customer.getCusIdcard(),cardId); |
| | | List<OutpintestapplyDetailsDto> detailsDtoss = new ArrayList<>(); |
| | | if (null != detailLists && detailLists.size() > 0) { |
| | | if (null != detailList && detailList.size() > 0) { |
| | | LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>(); |
| | | wq.in(TjProject::getProId, detailLists.stream().map(TbTransition::getParentProId).collect(Collectors.toList())); |
| | | // wq.groupBy(TjProject::getHisXmbm); |
| | | // wq.in(TjProject::getDeptId, "247", "248", "249", "250", "251", "252", "271", "273", "274", "275", "298"); |
| | | wq.in(TjProject::getProId, detailList.stream().map(TbTransition::getParentProId).collect(Collectors.toList())); |
| | | wq.in(TjProject::getDeptId,deptService.getJcDeptIds()); |
| | | List<TjProject> projects = projectService.list(wq); |
| | | if (null != projects && projects.size() > 0) { |
| | |
| | | String mxfyxmbm = detail.getMxfyxmbm(); |
| | | tree.setHisXmdm(mxfyxmbm); |
| | | tree.setType("检查"); |
| | | // LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>(); |
| | | // wrapper.eq(TjProject::getHisXmbm, mxfyxmbm); |
| | | // List<TjProject> list = projectService.list(wrapper); |
| | | // String tj_price = ""; |
| | | // for (TjProject project : list) { |
| | | // tj_price += project.getProPrice() + "、"; |
| | | // } |
| | | // tree.setTjPrice(tj_price.substring(0, tj_price.length() - 1)); |
| | | // LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>(); |
| | | // wrapper.eq(TjProject::getHisXmbm, mxfyxmbm); |
| | | // wrapper.eq(TjProject::getSl,1); |
| | | // wrapper.groupBy(TjProject::getHisXmbm); |
| | | // TjProject project = projectService.getOne(wrapper); |
| | | // if(null !=project){ |
| | | // BigDecimal decimal = project.getProPrice().multiply(BigDecimal.valueOf(detail.getSl())); |
| | | // tree.setTjPrice(String.valueOf(decimal)); |
| | | // } |
| | | tree.setTjPrice(String.valueOf(detail.getProjg())); |
| | | LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>(); |
| | | if (detail.getSfzhfy().equals("1")) |
| | |
| | | tree.setCreateTime(DateUtil.date()); |
| | | ltkjJianchajianyanTreeService.save(tree); |
| | | } |
| | | // Map<String, Object> map = object5.getJSONObject("ResultData"); |
| | | // map.put("cardId", customer.getCardId()); |
| | | // JSONObject jsonObject = JSONUtil.parseObj(map); |
| | | // LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | // lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpinexamapply"); |
| | | // HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper); |
| | | // hisApiGetMethodService.save(jsonObject, "Outpinexamapply", hisApiConfig,JSONUtil.toJsonStr(BeanUtil.beanToMap(outpinexamapplyDto))); |
| | | |
| | | } |
| | | // else { |
| | | // return AjaxResult.error("检查申请失败!"); |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | dao.setCzybm("00029"); |
| | | dao.setCzyksbm("0101"); |
| | | dao.setSfjz("0"); |
| | | List<TbTransition> details = tbTransitionService.getTbTransitionListByCusId(customer.getCusIdcard(),cardId); |
| | | // List<TbTransition> details = tbTransitionService.getTbTransitionListByCusId(customer.getCusIdcard(),cardId); |
| | | List<OutpintestapplyDetailsDto> detailDtos = new ArrayList<>(); |
| | | if (null != details && details.size() > 0) { |
| | | if (null != detailList && detailList.size() > 0) { |
| | | LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>(); |
| | | wq.in(TjProject::getProId, details.stream().map(TbTransition::getParentProId).collect(Collectors.toList())); |
| | | // wq.groupBy(TjProject::getHisXmbm); |
| | | // wq.in(TjProject::getDeptId, "100", "240", "253", "254", "255", "257", "258", "259", "269", "270"); |
| | | wq.in(TjProject::getProId, detailList.stream().map(TbTransition::getParentProId).collect(Collectors.toList())); |
| | | wq.in(TjProject::getDeptId,deptService.getCzDeptIds()); |
| | | // wq.isNull(TjProject::getDeptId); |
| | | List<TjProject> projects = projectService.list(wq); |
| | | if (null != projects && projects.size() > 0) { |
| | | for (TjProject project : projects) { |
| | |
| | | String mxfyxmbm = detail.getMxfyxmbm(); |
| | | tree.setHisXmdm(mxfyxmbm); |
| | | tree.setType("处置"); |
| | | // LambdaQueryWrapper<TjProject> wrapper = new LambdaQueryWrapper<>(); |
| | | // wrapper.eq(TjProject::getHisXmbm, mxfyxmbm); |
| | | // wrapper.eq(TjProject::getSl,1); |
| | | // wrapper.groupBy(TjProject::getHisXmbm); |
| | | // TjProject project = projectService.getOne(wrapper); |
| | | // if(null !=project){ |
| | | // BigDecimal decimal = project.getProPrice().multiply(BigDecimal.valueOf(detail.getSl())); |
| | | // tree.setTjPrice(String.valueOf(decimal)); |
| | | // } |
| | | tree.setTjPrice(String.valueOf(detail.getProjg())); |
| | | LambdaQueryWrapper<LtkjJfzhglmxjfxmzd> wrapper1 = new LambdaQueryWrapper<>(); |
| | | if (detail.getSfzhfy().equals("1")) |
| | |
| | | tree.setCreateTime(DateUtil.date()); |
| | | ltkjJianchajianyanTreeService.save(tree); |
| | | } |
| | | // Map<String, Object> map = mzylyzsq3.getJSONObject("ResultData"); |
| | | // map.put("cardId", customer.getCardId()); |
| | | // JSONObject jsonObject = JSONUtil.parseObj(map); |
| | | // LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | // lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpintreatapply"); |
| | | // HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper); |
| | | // hisApiGetMethodService.save(jsonObject, "Outpintreatapply", hisApiConfig,JSONUtil.toJsonStr(BeanUtil.beanToMap(dao))); |
| | | } |
| | | // else { |
| | | // return AjaxResult.error("处置申请失败!"); |
| | | // } |
| | | } |
| | | |
| | | //药品申请 |
| | |
| | | String result1 = getAjaxResult(result); |
| | | JSONObject object = getJSONObject(result1); |
| | | String code = object.getStr("ResultCode"); |
| | | if(null !=code && code.equals("200")){ |
| | | JSONArray resultData = object.getJSONArray("ResultData"); |
| | | Map<String, Object> resultDatasss = (Map<String, Object>) resultData.get(0); |
| | | String cfh = resultDatasss.get("cfh").toString(); |
| | | |
| | | if(null !=code && code.equals("0")){ |
| | | JSONObject resultData = object.getJSONObject("ResultData"); |
| | | // Map<String, Object> resultDatasss = (Map<String, Object>) resultData.get(0); |
| | | String cfh = resultData.getStr("cfh"); |
| | | log.info("药品申请后的处方号是: "+cfh+" outpinmedicapplyDetilsDtos 里面的值为: "+outpinmedicapplyDetilsDtos.toString()); |
| | | for (OutpinmedicapplyDetilsDto detilsDto : outpinmedicapplyDetilsDtos) { |
| | | TjCf cf=new TjCf(); |
| | | cf.setCardId(cardId); |
| | |
| | | String result1 = getAjaxResult(result); |
| | | JSONObject object = getJSONObject(result1); |
| | | String code = object.getStr("ResultCode"); |
| | | if(null !=code && code.equals("200")){ |
| | | if(null !=code && code.equals("0")){ |
| | | cfService.delCfByCardId(cfh); |
| | | } |
| | | } |
| | |
| | | String result1 = getAjaxResult(result); |
| | | JSONObject object = getJSONObject(result1); |
| | | String code = object.getStr("ResultCode"); |
| | | if(null !=code && code.equals("200")){ |
| | | if(null !=code && code.equals("0")){ |
| | | cfService.delCfByCardId(cfh); |
| | | } |
| | | } |
| | |
| | | if (code.equals("0")) { |
| | | orderService.delHuoQuJcsqdh(jzh); |
| | | } |
| | | // else { |
| | | // return false; |
| | | // } |
| | | } |
| | | |
| | | } |
| | |
| | | if (code1.equals("0")) { |
| | | orderService.delHuoQuJysqdh(jzh); |
| | | } |
| | | // else { |
| | | // return false; |
| | | // } |
| | | } |
| | | } |
| | | |
| | |
| | | String result1 = getAjaxResult(result); |
| | | JSONObject object = getJSONObject(result1); |
| | | String code = object.getStr("ResultCode"); |
| | | if(null !=code && code.equals("200")){ |
| | | if(null !=code && code.equals("0")){ |
| | | cfService.delCfByCardId(cfh); |
| | | } |
| | | } |
| | |
| | | result2 = getAjaxResult(ajaxResult); |
| | | object1 = getJSONObject(result2); |
| | | code1 = object1.getStr("ResultCode"); |
| | | // if (!code1.equals("0")) { |
| | | // return false; |
| | | // } |
| | | return true; |
| | | } |
| | | |