| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /* @Authot:zjh |
| | |
| | | //对接his总接口 注册挂号接诊申请单操作 |
| | | @Logger |
| | | public AjaxResult HisApiMethods(TjCustomer customer, Long orderId) { |
| | | String jzh=null; |
| | | try { |
| | | 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(); |
| | | outpinregapplyDto.setPationid(customer.getPationId()); |
| | | outpinregapplyDto.setSqysbm("00029"); |
| | | outpinregapplyDto.setMzksbm("0101"); |
| | | outpinregapplyDto.setCzybm("00029"); |
| | | outpinregapplyDto.setSfjz("0"); |
| | | outpinregapplyDto.setGhzlbm("01"); |
| | | outpinregapplyDto.setYwckbm("0001"); |
| | | outpinregapplyDto.setSflstd("0"); |
| | | outpinregapplyDto.setGhrq(date); |
| | | //门诊挂号 |
| | | AjaxResult ajaxResult = controller.Outpinregapply(outpinregapplyDto); |
| | | String result2 = getAjaxResult(ajaxResult); |
| | | JSONObject object1 = getJSONObject(result2); |
| | | String code1 = object1.getStr("ResultCode"); |
| | | if (code1.equals("0")) { |
| | | JSONArray resultDatas = object1.getJSONArray("ResultData"); |
| | | if (null != resultDatas && resultDatas.size() > 0) { |
| | | Map<String, Object> resultDatasss = (Map<String, Object>) resultDatas.get(0); |
| | | String hisRegistrationId = resultDatasss.get("his_registration_id").toString(); |
| | | jzh=hisRegistrationId; |
| | | //保存挂号入参出参 |
| | | resultDatasss.put("cardId",hisRegistrationId); |
| | | JSONObject object4 = JSONUtil.parseObj(resultDatasss); |
| | | LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpinregapply"); |
| | | HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper); |
| | | hisApiGetMethodService.save(object4, "Outpinregapply", hisApiConfig, JSONUtil.toJsonStr(BeanUtil.beanToMap(outpinregapplyDto))); |
| | | |
| | | TjOrder tjOrder = orderService.getById(orderId); |
| | | Date dates = new Date(); |
| | | final String date = DateUtil.format(dates, "yyyy-MM-dd HH:mm:ss"); |
| | | // AjaxResult result = controller.Outpincreateapply(customer); |
| | | // 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) { |
| | | // customer.setPationId(pationid); |
| | | // customerService.updateById(customer); |
| | | OutpinregapplyDto outpinregapplyDto = new OutpinregapplyDto(); |
| | | outpinregapplyDto.setPationid(customer.getPationId()); |
| | | outpinregapplyDto.setSqysbm("00029"); |
| | | outpinregapplyDto.setMzksbm("0101"); |
| | | outpinregapplyDto.setCzybm("00029"); |
| | | outpinregapplyDto.setSfjz("0"); |
| | | outpinregapplyDto.setGhzlbm("01"); |
| | | outpinregapplyDto.setYwckbm("0001"); |
| | | outpinregapplyDto.setSflstd("0"); |
| | | outpinregapplyDto.setGhrq(date); |
| | | //门诊挂号 |
| | | AjaxResult ajaxResult = controller.Outpinregapply(outpinregapplyDto); |
| | | String result2 = getAjaxResult(ajaxResult); |
| | | JSONObject object1 = getJSONObject(result2); |
| | | String code1 = object1.getStr("ResultCode"); |
| | | if (code1.equals("0")) { |
| | | JSONArray resultDatas = object1.getJSONArray("ResultData"); |
| | | if (null != resultDatas && resultDatas.size() > 0) { |
| | | Map<String, Object> resultDatasss = (Map<String, Object>) resultDatas.get(0); |
| | | String hisRegistrationId = resultDatasss.get("his_registration_id").toString(); |
| | | //保存挂号入参出参 |
| | | resultDatasss.put("cardId",hisRegistrationId); |
| | | JSONObject object4 = JSONUtil.parseObj(resultDatasss); |
| | | LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpinregapply"); |
| | | HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper); |
| | | hisApiGetMethodService.save(object4, "Outpinregapply", hisApiConfig, JSONUtil.toJsonStr(BeanUtil.beanToMap(outpinregapplyDto))); |
| | | |
| | | //门诊医生接诊 |
| | | controller.Outpinconapply(hisRegistrationId, date, "00029"); |
| | | if(null != tjOrder.getTjCategory() && !tjOrder.getTjCategory().equals("13")){ |
| | | customer.setCardId(hisRegistrationId); |
| | | }else { |
| | | customer.setCardId("0"); |
| | | //门诊医生接诊 |
| | | controller.Outpinconapply(hisRegistrationId, date, "00029"); |
| | | if(null != tjOrder.getTjCategory() && !tjOrder.getTjCategory().equals("13")){ |
| | | customer.setCardId(hisRegistrationId); |
| | | }else { |
| | | customer.setCardId("0"); |
| | | } |
| | | customerService.updateById(customer); |
| | | transitionService.updateCardIdByTjNumAndIdCard(customer.getCusIdcard(), hisRegistrationId, tjOrder.getTjNumber()); |
| | | tjOrder.setCardId(hisRegistrationId); |
| | | orderService.updateById(tjOrder); |
| | | } |
| | | customerService.updateById(customer); |
| | | transitionService.updateCardIdByTjNumAndIdCard(customer.getCusIdcard(), hisRegistrationId, tjOrder.getTjNumber()); |
| | | tjOrder.setCardId(hisRegistrationId); |
| | | orderService.updateById(tjOrder); |
| | | |
| | | //添加体检诊断 |
| | | OutpinimpapplyDto dto=new OutpinimpapplyDto(); |
| | | dto.setHisRegistrationId(tjOrder.getCardId()); |
| | | dto.setMzzdid(1); |
| | | dto.setSqysbm("00029"); |
| | | dto.setMzksbm("0101"); |
| | | dto.setFbrq(date); |
| | | dto.setZdrq(date); |
| | | dto.setCzybm("00029"); |
| | | dto.setCzyksbm("0101"); |
| | | dto.setZs("健康查体"); |
| | | dto.setBs("不详"); |
| | | dto.setClyz(""); |
| | | dto.setJws(""); |
| | | dto.setTgjc(""); |
| | | dto.setGms(""); |
| | | dto.setJbbm("Z00.001"); |
| | | dto.setJbbm1(""); |
| | | dto.setJbbm2(""); |
| | | dto.setFzbz("1"); |
| | | dto.setHzqx("6"); |
| | | dto.setSfqc("0"); |
| | | dto.setQchs(""); |
| | | dto.setSfqj("0"); |
| | | dto.setJzqk(9); |
| | | controller.Outpinimpapply(dto); |
| | | return tijianshenqing(customer, date,tjOrder.getCardId()); |
| | | } |
| | | |
| | | //添加体检诊断 |
| | | OutpinimpapplyDto dto=new OutpinimpapplyDto(); |
| | | dto.setHisRegistrationId(tjOrder.getCardId()); |
| | | dto.setMzzdid(1); |
| | | dto.setSqysbm("00029"); |
| | | dto.setMzksbm("0101"); |
| | | dto.setFbrq(date); |
| | | dto.setZdrq(date); |
| | | dto.setCzybm("00029"); |
| | | dto.setCzyksbm("0101"); |
| | | dto.setZs("健康查体"); |
| | | dto.setBs("不详"); |
| | | dto.setClyz(""); |
| | | dto.setJws(""); |
| | | dto.setTgjc(""); |
| | | dto.setGms(""); |
| | | dto.setJbbm("Z00.001"); |
| | | dto.setJbbm1(""); |
| | | dto.setJbbm2(""); |
| | | dto.setFzbz("1"); |
| | | dto.setHzqx("6"); |
| | | dto.setSfqc("0"); |
| | | dto.setQchs(""); |
| | | dto.setSfqj("0"); |
| | | dto.setJzqk(9); |
| | | controller.Outpinimpapply(dto); |
| | | |
| | | return tijianshenqing(customer, date,tjOrder.getCardId()); |
| | | return AjaxResult.error(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return AjaxResult.error().put("jzh",jzh); |
| | | } |
| | | |
| | | // } |
| | | // } |
| | | // } |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | |
| | |
| | | LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper3); |
| | | tree.setXmfl(ejjfxmzd.getYjkmdm()); |
| | | } |
| | | tree.setCreateTime(DateUtil.date()); |
| | | ltkjJianchajianyanTreeService.save(tree); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //门诊检查申请 |
| | | OutpinexamapplyDto outpinexamapplyDto = new OutpinexamapplyDto(); |
| | |
| | | LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper3); |
| | | tree.setXmfl(ejjfxmzd.getYjkmdm()); |
| | | } |
| | | tree.setCreateTime(DateUtil.date()); |
| | | ltkjJianchajianyanTreeService.save(tree); |
| | | } |
| | | // Map<String, Object> map = object5.getJSONObject("ResultData"); |
| | |
| | | LtkjEjjfxmzd ejjfxmzd = ltkjEjjfxmzdService.getOne(wrapper3); |
| | | tree.setXmfl(ejjfxmzd.getYjkmdm()); |
| | | } |
| | | tree.setCreateTime(DateUtil.date()); |
| | | ltkjJianchajianyanTreeService.save(tree); |
| | | } |
| | | // Map<String, Object> map = mzylyzsq3.getJSONObject("ResultData"); |
| | |
| | | result2 = getAjaxResult(ajaxResult); |
| | | object1 = getJSONObject(result2); |
| | | code1 = object1.getStr("ResultCode"); |
| | | // if (!code1.equals("0")) { |
| | | // return false; |
| | | // } |
| | | if (code1.equals("0")) { |
| | | orderService.delHuoQuZlsqdh(order.getCardId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | //作废补录项目 |
| | | public boolean ZfBlXm(List<String> bldhs, TjOrder order) { |
| | | |
| | | if(null !=bldhs && bldhs.size()>0){ |
| | | try { |
| | | for (String bldh : bldhs) { |
| | | List<String> jcsqdh = orderService.getHuoQuBlJcsqdh(order.getCardId(),bldh); |
| | | |
| | | List<String> jysqdh = orderService.getHuoQuBlJysqdh(order.getCardId(),bldh); |
| | | |
| | | |
| | | List<String> zlsqdh = orderService.getHuoQuBlZlsqdh(order.getCardId(),bldh); |
| | | |
| | | |
| | | List<String> cfhs = cfService.getCfBlhs(order.getCardId(),bldh); |
| | | |
| | | //2.1.6.5 作废门诊检查申请 |
| | | if (null != jcsqdh && jcsqdh.size()>0) { |
| | | for (String s : jcsqdh) { |
| | | AjaxResult result = controller.Outpindelexamapply(order.getCardId(), "00029", s); |
| | | String result1 = getAjaxResult(result); |
| | | JSONObject object = getJSONObject(result1); |
| | | String code = object.getStr("ResultCode"); |
| | | if (code.equals("0")) { |
| | | orderService.delHuoQuBlJcsqdh(order.getCardId(),bldh); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | //2.1.6.3 作废门诊检验申请 |
| | | |
| | | AjaxResult ajaxResult = null; |
| | | String result2 = null; |
| | | JSONObject object1 = null; |
| | | String code1 = null; |
| | | |
| | | if (null != jysqdh && jysqdh.size()>0) { |
| | | for (String s : jysqdh) { |
| | | ajaxResult = controller.Outpindeltestapply(order.getCardId(), "00029", s); |
| | | result2 = getAjaxResult(ajaxResult); |
| | | object1 = getJSONObject(result2); |
| | | code1 = object1.getStr("ResultCode"); |
| | | if (code1.equals("0")) { |
| | | orderService.delHuoQuBlJysqdh(order.getCardId(),bldh); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //2.1.6.9 作废门诊治疗处置申请 |
| | | if (null != zlsqdh && zlsqdh.size()>0) { |
| | | for (String s : zlsqdh) { |
| | | ajaxResult = controller.Outpintdelreatapply(order.getCardId(), "00029", s); |
| | | result2 = getAjaxResult(ajaxResult); |
| | | object1 = getJSONObject(result2); |
| | | code1 = object1.getStr("ResultCode"); |
| | | if (code1.equals("0")) { |
| | | orderService.delHuoQuZlsqdh(order.getCardId(),bldh); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //作废药品申请 |
| | | if(null !=cfhs && cfhs.size()>0){ |
| | | for (String cfh : cfhs) { |
| | | AjaxResult result = controller.Outpindelmedicapply(order.getCardId(), "00029", cfh); |
| | | String result1 = getAjaxResult(result); |
| | | JSONObject object = getJSONObject(result1); |
| | | String code = object.getStr("ResultCode"); |
| | | if(null !=code && code.equals("200")){ |
| | | cfService.delCfByCardId(cfh); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | //退费后取消接诊作废申请单等操作 |
| | | public boolean ZfHisApiMethod(String jzh) { |
| | | Date dates = new Date(); |
| | | final String date = DateUtil.format(dates, "yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | List<String> jcsqdh = orderService.getHuoQuJcsqdh(jzh); |
| | | |
| | | List<String> jysqdh = orderService.getHuoQuJysqdh(jzh); |
| | | |
| | | |
| | | List<String> zlsqdh = orderService.getHuoQuZlsqdh(jzh); |
| | | |
| | | |
| | | List<String> cfhs = cfService.getCfhs(jzh); |
| | | |
| | | //2.1.6.5 作废门诊检查申请 |
| | | if (null != jcsqdh && jcsqdh.size()>0) { |
| | | for (String s : jcsqdh) { |
| | | AjaxResult result = controller.Outpindelexamapply(jzh, "00029", s); |
| | | String result1 = getAjaxResult(result); |
| | | JSONObject object = getJSONObject(result1); |
| | | String code = object.getStr("ResultCode"); |
| | | if (code.equals("0")) { |
| | | orderService.delHuoQuJcsqdh(jzh); |
| | | } |
| | | // else { |
| | | // return false; |
| | | // } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | //2.1.6.3 作废门诊检验申请 |
| | | |
| | | AjaxResult ajaxResult = null; |
| | | String result2 = null; |
| | | JSONObject object1 = null; |
| | | String code1 = null; |
| | | |
| | | if (null != jysqdh && jysqdh.size()>0) { |
| | | for (String s : jysqdh) { |
| | | ajaxResult = controller.Outpindeltestapply(jzh, "00029", s); |
| | | result2 = getAjaxResult(ajaxResult); |
| | | object1 = getJSONObject(result2); |
| | | code1 = object1.getStr("ResultCode"); |
| | | if (code1.equals("0")) { |
| | | orderService.delHuoQuJysqdh(jzh); |
| | | } |
| | | // else { |
| | | // return false; |
| | | // } |
| | | } |
| | | } |
| | | |
| | | //2.1.6.9 作废门诊治疗处置申请 |
| | | if (null != zlsqdh && zlsqdh.size()>0) { |
| | | for (String s : zlsqdh) { |
| | | ajaxResult = controller.Outpintdelreatapply(jzh, "00029", s); |
| | | result2 = getAjaxResult(ajaxResult); |
| | | object1 = getJSONObject(result2); |
| | | code1 = object1.getStr("ResultCode"); |
| | | if (code1.equals("0")) { |
| | | orderService.delHuoQuZlsqdh(jzh); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //作废药品申请 |
| | | if(null !=cfhs && cfhs.size()>0){ |
| | | for (String cfh : cfhs) { |
| | | AjaxResult result = controller.Outpindelmedicapply(jzh, "00029", cfh); |
| | | String result1 = getAjaxResult(result); |
| | | JSONObject object = getJSONObject(result1); |
| | | String code = object.getStr("ResultCode"); |
| | | if(null !=code && code.equals("200")){ |
| | | cfService.delCfByCardId(cfh); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //2.1.3 门诊医生取消接诊 |
| | | ajaxResult = controller.Outpinunconapply(jzh, date, "00029"); |
| | | result2 = getAjaxResult(ajaxResult); |
| | | object1 = getJSONObject(result2); |
| | | code1 = object1.getStr("ResultCode"); |
| | | // if (!code1.equals("0")) { |
| | | // return false; |
| | | // } |
| | | return true; |
| | | } |
| | | |
| | | //获取门诊结算记录 |
| | | @Transactional |
| | | public void getHisMzJsJl(TjOrder order) { |