| | |
| | | import com.kidgrow.common.model.SysUser; |
| | | import com.kidgrow.common.service.impl.SuperServiceImpl; |
| | | import com.kidgrow.common.utils.StringUtils; |
| | | import com.kidgrow.oprationcenter.feign.ProductOrderService; |
| | | import com.kidgrow.oprationcenter.model.ProductOrder; |
| | | import com.kidgrow.usercenter.mapper.SysDepartmentMapper; |
| | | import com.kidgrow.usercenter.mapper.SysHospitalMapper; |
| | | import com.kidgrow.usercenter.mapper.SysOrganizationMapper; |
| | |
| | | private SysRoleOrganizationServiceImpl SysRoleOrganizationServiceImpl; |
| | | @Autowired |
| | | private SysOrganizationMapper sysOrganizationMapper; |
| | | @Autowired |
| | | private ProductOrderService productOrderService; |
| | | /** |
| | | * 列表 |
| | | * @param params |
| | |
| | | return PageResult.<HospitalListVo>builder().data(null).code(0).count(page.getTotal()).build(); |
| | | } |
| | | List<HospitalListVo> list = baseMapper.findHospitalList(page, params); |
| | | for (HospitalListVo hospitalListVo : list) { |
| | | ProductOrder productOrder = new ProductOrder(); |
| | | productOrder.setHospitalId(hospitalListVo.getHospitalId()); |
| | | productOrder.setDepartmentId(hospitalListVo.getDepartmentId()); |
| | | ResultBody status = productOrderService.getStatus(productOrder); |
| | | if (status.getCode()==0) { |
| | | hospitalListVo.setOrderType(status.getData() instanceof Boolean ? ((Boolean) status.getData()) : null); |
| | | } |
| | | } |
| | | return PageResult.<HospitalListVo>builder().data(list).code(0).count(page.getTotal()).build(); |
| | | } |
| | | |
| | |
| | | //科室数据 |
| | | SysDepartment sysDepartment=departmentMapper.selectById(departmentId); |
| | | //医院数据 |
| | | SysHospital sysHospital = baseMapper.selectById(id); |
| | | if (sysHospital == null) { |
| | | return ResultBody.failed("医院数据不存在!"); |
| | | } |
| | | //SysHospital sysHospital = baseMapper.selectById(id); |
| | | // if (sysHospital == null) { |
| | | // return ResultBody.failed("医院数据不存在!"); |
| | | // } |
| | | if (sysDepartment == null) { |
| | | return ResultBody.failed("科室数据不存在!"); |
| | | } |
| | | //医院下的所有科室数据 |
| | | Map<String,Object> columnMap=new HashMap<String,Object>(); |
| | | columnMap.put("org_parent_id",sysHospital.getOrgId()); |
| | | columnMap.put("is_del",0); |
| | | columnMap.put("enabled",1); |
| | | List<SysOrganization> sysOrganizationList=sysOrganizationMapper.selectByMap(columnMap); |
| | | //如果这个医院下有多个科室,禁用只对当前科室有效,否则也要禁用医院 |
| | | if(sysOrganizationList.size()==1) |
| | | { |
| | | sysHospital.setIsDel(true); |
| | | baseMapper.updateById(sysHospital); |
| | | SysOrganization sysOrganizationH=sysOrganizationMapper.selectById(sysHospital.getOrgId()); |
| | | if (sysOrganizationH != null) { |
| | | sysOrganizationH.setIsDel(true); |
| | | sysOrganizationMapper.updateById(sysOrganizationH); |
| | | } |
| | | } |
| | | // Map<String,Object> columnMap=new HashMap<String,Object>(); |
| | | // columnMap.put("org_parent_id",sysHospital.getOrgId()); |
| | | // columnMap.put("is_del",0); |
| | | // columnMap.put("enabled",1); |
| | | // List<SysOrganization> sysOrganizationList=sysOrganizationMapper.selectByMap(columnMap); |
| | | // //如果这个医院下有多个科室,删除只对当前科室有效,否则也要删除医院 |
| | | // if(sysOrganizationList.size()==1) |
| | | // { |
| | | // sysHospital.setIsDel(true); |
| | | // baseMapper.updateById(sysHospital); |
| | | // SysOrganization sysOrganizationH=sysOrganizationMapper.selectById(sysHospital.getOrgId()); |
| | | // if (sysOrganizationH != null) { |
| | | // sysOrganizationH.setIsDel(true); |
| | | // sysOrganizationMapper.updateById(sysOrganizationH); |
| | | // } |
| | | // } |
| | | sysDepartment.setIsDel(true); |
| | | int j=departmentMapper.updateById(sysDepartment); |
| | | //删除组织数据 |
| | |
| | | sysOrganizationD.setIsDel(true); |
| | | sysOrganizationMapper.updateById(sysOrganizationD); |
| | | } |
| | | return (j>0) ? ResultBody.ok().data(sysHospital).msg("删除成功") : ResultBody.failed("删除失败"); |
| | | return (j>0) ? ResultBody.ok().data(sysDepartment).msg("科室删除成功") : ResultBody.failed("科室删除失败"); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 统计医院数量 |
| | | * @param datatype 医院类型 |
| | | * 0 试用医院 |
| | | * 1 正式医院 |
| | | * 11 筛查医院 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ResultBody chartsUserDatas() { |
| | | //正式医院数据 |
| | | int hospitalCount=baseMapper.chartHospital(1); |
| | | //试用医院数据 |
| | | int tempHospitalCount=baseMapper.chartHospital(0); |
| | | //筛查医院 |
| | | int screenHospitalCount=baseMapper.chartHospital(11); |
| | | return null; |
| | | public ResultBody chartHospital(int datatype) { |
| | | int hospitalCount=baseMapper.chartHospital(datatype); |
| | | return ResultBody.ok().data(hospitalCount).msg("获取数据成功"); |
| | | } |
| | | } |