zjh
2024-06-12 5a6a1ae4f22cae6323e41d35c5f32137afddd2d0
ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiMethod.java
@@ -12,6 +12,7 @@
import com.ltkj.hosp.domain.*;
import com.ltkj.hosp.hisDto.*;
import com.ltkj.hosp.service.*;
import com.ltkj.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -46,6 +47,8 @@
    private HisApiConfigService hisApiConfigService;
    @Autowired
    private HisApiGetMethodService hisApiGetMethodService;
    @Resource
    private ISysConfigService configService;
    //将方法返回值解析成json格式
    public JSONObject getJSONObject(String builder) {
@@ -61,7 +64,6 @@
    //对接his总接口  注册挂号接诊申请单操作
    @Transactional
    public void HisApiMethods(TjCustomer customer, Long orderId) {
//        HisApiGetMethodService hisApiGetMethodService = new HisApiGetMethodService();
        Date dates = new Date();
        final String date = DateUtil.format(dates, "yyyy-MM-dd HH:mm:ss");
@@ -77,37 +79,33 @@
                if (null != pationid) {
                    customer.setPationId(pationid);
                    customerService.updateById(customer);
                    //                    OutpinregapplyDto outpinregapplyDto = new OutpinregapplyDto();
//                    outpinregapplyDto.setPationid(pationid);
////                    outpinregapplyDto.setHisRegistrationId(pationid);
//                    outpinregapplyDto.setSqysbm(SecurityUtils.getUsername());
//                    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();
//                            if (null != hisRegistrationId) {
//                                //门诊医生接诊
//                                AjaxResult result3 = controller.Outpinconapply(hisRegistrationId, date, SecurityUtils.getUsername());
//                                String result4 = getAjaxResult(result3);
//                                JSONObject object2 = getJSONObject(result4);
//                                String code2 = object2.getStr("ResultCode");
//                                if (code2.equals("0")) {
//                                    Map<String, Object> data = object2.getJSONObject("ResultData");
//                                    String toString = data.get("his_registration_id").toString();
//                                    if (null != toString) {
                    /*                  String key = configService.selectConfigByKey("getInfoFromSqlData");
                    if (null != key && key.equals("Y")) {
                        OutpinregapplyDto outpinregapplyDto = new OutpinregapplyDto();
                        outpinregapplyDto.setPationid(pationid);
                        outpinregapplyDto.setSqysbm(SecurityUtils.getUsername());
                        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) {
                                //门诊医生接诊
                                controller.Outpinconapply(customer.getCardId(), date, SecurityUtils.getUsername());
                            }
                        }
                    }
*/
                    //检验申请
                    OutpintestapplyDto dto = new OutpintestapplyDto();
                    dto.setHisRegistrationId(customer.getCardId());
@@ -124,29 +122,32 @@
                        LambdaQueryWrapper<TjProject> wq = new LambdaQueryWrapper<>();
                        wq.in(TjProject::getProId, detailList.stream().map(TbTransition::getParentProId).collect(Collectors.toList()));
                        wq.groupBy(TjProject::getHisXmbm);
                        wq.in(TjProject::getDeptId, "241");
                        wq.in(TjProject::getDeptId, "241","317");
                        List<TjProject> projects = projectService.list(wq);
                        if (null != projects && projects.size() > 0) {
                            for (TjProject project : projects) {
                                OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto();
                                if (0 == project.getProParentId() && project.getProPrice().compareTo(BigDecimal.ZERO) != 0) {
                                    if (null != project.getHisXmbm()) {
                                        OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto();
                                        detailsDto.setMxfyxmbm(project.getHisXmbm());
//                                        if(project.getHisXmbm().toLowerCase().contains("z".toLowerCase())){
                                            detailsDto.setSfzhfy("1");
//                                        }else {
//                                            detailsDto.setSfzhfy("0");
//                                        }
                                    } else {
                                        detailsDto.setMxfyxmbm("");
                                        detailsDto.setSfzhfy("0");
                                        if(project.getSfzhfy().equals("Y")){
                                        detailsDto.setSfzhfy("1");
                                        }else {
                                            detailsDto.setSfzhfy("0");
                                        }
                                        detailsDto.setSl(1);
                                        detailsDtos.add(detailsDto);
                                    }
                                    detailsDto.setSfzhfy("1");
                                    detailsDto.setSl(1);
                                    detailsDtos.add(detailsDto);
                                }
                            }
                        }
                    }
                    if (detailsDtos.size()==0) {
                        OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto();
                        detailsDto.setMxfyxmbm("");
                        detailsDto.setSfzhfy("");
                        detailsDto.setSl(0);
                        detailsDtos.add(detailsDto);
                    }
                    dto.setDetails(detailsDtos);
                    AjaxResult ajaxResult1 = controller.Outpintestapply(dto);
@@ -160,7 +161,7 @@
                        LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
                        lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpintestapply");
                        HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
                        hisApiGetMethodService.save(object4, "Outpintestapply",hisApiConfig);
                        hisApiGetMethodService.save(object4, "Outpintestapply", hisApiConfig);
                    }
                    //门诊检查申请
@@ -177,28 +178,33 @@
                        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");
                        wq.in(TjProject::getDeptId, "247", "248", "249", "250", "251", "252", "271", "273", "274", "275","298");
                        List<TjProject> projects = projectService.list(wq);
                        if (null != projects && projects.size() > 0) {
                            for (TjProject project : projects) {
                                OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto();
                                if (0 == project.getProParentId() && project.getProPrice().compareTo(BigDecimal.ZERO) != 0) {
                                    if (null != project.getHisXmbm()) {
                                        OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto();
                                        detailsDto.setMxfyxmbm(project.getHisXmbm());
//                                        if(project.getHisXmbm().toLowerCase().contains("z".toLowerCase())){
                                            detailsDto.setSfzhfy("1");
//                                        }else {
//                                            detailsDto.setSfzhfy("0");
//                                        }
                                    } else {
                                        detailsDto.setMxfyxmbm("");
                                        detailsDto.setSfzhfy("0");
                                        if(project.getSfzhfy().equals("Y")){
                                        detailsDto.setSfzhfy("1");
                                        }else {
                                            detailsDto.setSfzhfy("0");
                                        }
                                        detailsDto.setSl(1);
                                        detailsDtoss.add(detailsDto);
                                    }
                                    detailsDto.setSl(1);
                                    detailsDtoss.add(detailsDto);
                                }
                            }
                        }
                    }
                    if (detailsDtoss.size()==0) {
                        OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto();
                        detailsDto.setMxfyxmbm("");
                        detailsDto.setSfzhfy("");
                        detailsDto.setSl(0);
                        detailsDtoss.add(detailsDto);
                    }
                    outpinexamapplyDto.setDetails(detailsDtoss);
                    AjaxResult ajaxResult2 = controller.Outpinexamapply(outpinexamapplyDto);
@@ -212,7 +218,7 @@
                        LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
                        lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpinexamapply");
                        HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
                        hisApiGetMethodService.save(jsonObject, "Outpinexamapply",hisApiConfig);
                        hisApiGetMethodService.save(jsonObject, "Outpinexamapply", hisApiConfig);
                    }
@@ -235,24 +241,28 @@
                        List<TjProject> projects = projectService.list(wq);
                        if (null != projects && projects.size() > 0) {
                            for (TjProject project : projects) {
                                OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto();
                                if (0 == project.getProParentId() && project.getProPrice().compareTo(BigDecimal.ZERO) != 0) {
                                    if (null != project.getHisXmbm()) {
                                        OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto();
                                        detailsDto.setMxfyxmbm(project.getHisXmbm());
                                        if(project.getHisXmbm().toLowerCase().contains("z".toLowerCase())){
                                        if (project.getSfzhfy().equals("Y")) {
                                            detailsDto.setSfzhfy("1");
                                        }else {
                                        } else {
                                            detailsDto.setSfzhfy("0");
                                        }
                                    } else {
                                        detailsDto.setMxfyxmbm("");
                                        detailsDto.setSfzhfy("0");
                                        detailsDto.setSl(1);
                                        detailDtos.add(detailsDto);
                                    }
                                    detailsDto.setSl(1);
                                    detailDtos.add(detailsDto);
                                }
                            }
                        }
                    }
                    if (detailDtos.size()==0) {
                        OutpintestapplyDetailsDto detailsDto = new OutpintestapplyDetailsDto();
                        detailsDto.setMxfyxmbm("");
                        detailsDto.setSfzhfy("");
                        detailsDto.setSl(0);
                        detailDtos.add(detailsDto);
                    }
                    dao.setDetails(detailDtos);
                    AjaxResult mzylyzsq1 = controller.Outpintreatapply(dao);
@@ -266,21 +276,14 @@
                        LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
                        lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, "Outpinmedapply");
                        HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
                        hisApiGetMethodService.save(jsonObject, "Outpinmedapply",hisApiConfig);
                        hisApiGetMethodService.save(jsonObject, "Outpinmedapply", hisApiConfig);
                    }
//                                    }
                }
            }
        }
//                    }
    }
//            }
//}
//        }
//    }
    //退费后取消接诊作废申请单等操作