| | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.project.domain.BaseOrganization; |
| | | import com.ruoyi.project.domain.ServiceDonatebaseinfo; |
| | | import com.ruoyi.common.utils.bean.DtoConversionUtils; |
| | | import com.ruoyi.project.domain.*; |
| | | import com.ruoyi.project.domain.vo.DonateOrganVO; |
| | | import com.ruoyi.project.domain.vo.NumberOfOrgans; |
| | | import com.ruoyi.project.domain.vo.TimeVO; |
| | | import com.ruoyi.project.mapper.BaseOrganizationMapper; |
| | | import com.ruoyi.project.service.IServiceDonatebaseinfoService; |
| | | import com.ruoyi.project.service.IServiceOrganallocationService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.project.domain.ServiceDonateorgan; |
| | | import com.ruoyi.project.service.IServiceDonateorganService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | |
| | | /** |
| | | * 捐献器官管理Controller |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | * @date 2021-11-10 |
| | | */ |
| | | @Api("捐献器官管理") |
| | | @RestController |
| | | @RequestMapping("/project/donateorgan") |
| | | public class ServiceDonateorganController extends BaseController |
| | | { |
| | | public class ServiceDonateorganController extends BaseController { |
| | | @Autowired |
| | | private IServiceDonateorganService serviceDonateorganService; |
| | | |
| | | @Autowired |
| | | private IServiceOrganallocationService serviceOrganallocationService; |
| | | |
| | | |
| | | /** |
| | |
| | | @ApiOperation("捐献器官列表") |
| | | //@PreAuthorize("@ss.hasPermi('project:donateorgan:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ServiceDonateorgan serviceDonateorgan) |
| | | { |
| | | public TableDataInfo list(ServiceDonateorgan serviceDonateorgan) { |
| | | startPage(); |
| | | List<ServiceDonateorgan> list = serviceDonateorganService.queryList(serviceDonateorgan); |
| | | if (!CollectionUtils.isEmpty(list)) { |
| | | List<ServiceDonateorganVO> serviceDonateorganVOS = DtoConversionUtils.sourceToTarget(list, ServiceDonateorganVO.class); |
| | | for (ServiceDonateorganVO serviceDonateorganVO : serviceDonateorganVOS) { |
| | | ServiceOrganallocation serviceOrganallocation = new ServiceOrganallocation(); |
| | | serviceOrganallocation.setOrganid(serviceDonateorganVO.getId()); |
| | | List<ServiceOrganallocation> serviceOrganallocations = serviceOrganallocationService.selectServiceOrganallocationList(serviceOrganallocation); |
| | | serviceDonateorganVO.setServiceOrganallocations(serviceOrganallocations); |
| | | } |
| | | return getDataTable(serviceDonateorganVOS); |
| | | } |
| | | |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @GetMapping("/listnew") |
| | | public TableDataInfo listnew (DonateOrganVO donateOrganVO) |
| | | { |
| | | public TableDataInfo listnew(DonateOrganVO donateOrganVO) { |
| | | startPage(); |
| | | List<DonateOrganVO> list = serviceDonateorganService.selectVOList(donateOrganVO); |
| | | return getDataTable(list); |
| | |
| | | //@PreAuthorize("@ss.hasPermi('project:donateorgan:export')") |
| | | @Log(title = "捐献器官管理", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | public AjaxResult export(ServiceDonateorgan serviceDonateorgan) |
| | | { |
| | | public AjaxResult export(ServiceDonateorgan serviceDonateorgan) { |
| | | List<ServiceDonateorgan> list = serviceDonateorganService.queryList(serviceDonateorgan); |
| | | ExcelUtil<ServiceDonateorgan> util = new ExcelUtil<ServiceDonateorgan>(ServiceDonateorgan.class); |
| | | return util.exportExcel(list, "捐献器官管理数据"); |
| | |
| | | @ApiOperation("通过id获得捐献器官信息") |
| | | //@PreAuthorize("@ss.hasPermi('project:donateorgan:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | return AjaxResult.success(serviceDonateorganService.getById(id)); |
| | | } |
| | | |
| | |
| | | @Log(title = "捐献器官管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | @RepeatSubmit |
| | | public AjaxResult add(@RequestBody ServiceDonateorgan serviceDonateorgan) |
| | | { |
| | | public AjaxResult add(@RequestBody ServiceDonateorgan serviceDonateorgan) { |
| | | String organNumber = serviceDonateorgan.getDonorno() + "." + serviceDonateorgan.getOrganno(); |
| | | if (organNumber == "") |
| | | { |
| | | if (organNumber == "") { |
| | | return AjaxResult.error("新增时生成的编号为空,创建失败!"); |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | ServiceDonateorgan serviceDonateorgan1 = new ServiceDonateorgan(); |
| | | serviceDonateorgan1.setOrgannumber(organNumber); |
| | | List<ServiceDonateorgan> listrecord = serviceDonateorganService.queryList(serviceDonateorgan); |
| | | if (listrecord.size()>0) |
| | | { |
| | | return AjaxResult.error("新增时生成的编号"+ organNumber +"已存在,无法保存!"); |
| | | if (listrecord.size() > 0) { |
| | | return AjaxResult.error("新增时生成的编号" + organNumber + "已存在,无法保存!"); |
| | | } |
| | | } |
| | | serviceDonateorgan.setOrgannumber(organNumber); |
| | | return toAjax(serviceDonateorganService.save(serviceDonateorgan)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增捐献器官管理 |
| | | */ |
| | | @ApiOperation("新增捐献器官信息") |
| | | //@PreAuthorize("@ss.hasPermi('project:donateorgan:add')") |
| | | @Log(title = "捐献器官管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addData") |
| | | @RepeatSubmit |
| | | public TableDataInfo addData(@RequestBody List<ServiceDonateorgan> serviceDonateorgans) { |
| | | List<ServiceDonateorgan> serviceDonateorgans1 = serviceDonateorganService.saveData(serviceDonateorgans); |
| | | return saveDataTable(serviceDonateorgans1); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation("修改捐献器官信息") |
| | | //@PreAuthorize("@ss.hasPermi('project:donateorgan:edit')") |
| | | @Log(title = "捐献器官管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | @RepeatSubmit |
| | | public AjaxResult edit(@RequestBody ServiceDonateorgan serviceDonateorgan) |
| | | { |
| | | @PostMapping("/edit") |
| | | @RepeatSubmit |
| | | public AjaxResult edit(@RequestBody ServiceDonateorgan serviceDonateorgan) { |
| | | return toAjax(serviceDonateorganService.updateById(serviceDonateorgan)); |
| | | } |
| | | |
| | |
| | | @ApiOperation("删除捐献器官信息") |
| | | //@PreAuthorize("@ss.hasPermi('project:donateorgan:remove')") |
| | | @Log(title = "捐献器官管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | | { |
| | | @GetMapping("/remove/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) { |
| | | return toAjax(serviceDonateorganService.removeByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @ApiOperation("得到浙江各市下的捐献信息") |
| | | @GetMapping("/numberOfOrgans") |
| | | public AjaxResult numberOfOrgans(){ |
| | | public AjaxResult numberOfOrgans() { |
| | | return AjaxResult.success(serviceDonateorganService.getNumberOfOrgans()); |
| | | } |
| | | |
| | | @ApiOperation("得到各医院的捐献信息") |
| | | @PostMapping("/OrgansOfHospital") |
| | | public AjaxResult OrgansOfHospital(String cityName){ |
| | | public AjaxResult OrgansOfHospital(String cityName) { |
| | | return AjaxResult.success(serviceDonateorganService.getOrgansOfHospital(cityName)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("全省捐献器官信息汇总") |
| | | @GetMapping("/allOrgansInfo") |
| | | public AjaxResult allOrgansInfo(TimeVO timeVO){ |
| | | public AjaxResult allOrgansInfo(TimeVO timeVO) { |
| | | return AjaxResult.success(serviceDonateorganService.getAllOrgansInfo(timeVO)); |
| | | } |
| | | |
| | |
| | | |
| | | @ApiOperation("按月度统计的各医院的捐献信息") |
| | | @GetMapping("/OrgansOfHospitalByMonth") |
| | | public AjaxResult OrgansOfHospitalByMonth(TimeVO timeVO){ |
| | | public AjaxResult OrgansOfHospitalByMonth(TimeVO timeVO) { |
| | | return AjaxResult.success(serviceDonateorganService.OrgansOfHospitalByMonth(timeVO)); |
| | | } |
| | | |
| | | @ApiOperation("按时间统计的各医院的捐献信息") |
| | | @GetMapping("/OrgansOfHospitalByTime") |
| | | public AjaxResult OrgansOfHospitalByTime(TimeVO timeVO){ |
| | | public AjaxResult OrgansOfHospitalByTime(TimeVO timeVO) { |
| | | return AjaxResult.success(serviceDonateorganService.OrgansOfHospitalByTime(timeVO)); |
| | | } |
| | | |
| | | @ApiOperation("每百万人口的捐献率") |
| | | @GetMapping("/getPMPRate") |
| | | public AjaxResult getPMPRate(TimeVO timeVO){ |
| | | public AjaxResult getPMPRate(TimeVO timeVO) { |
| | | return AjaxResult.success(serviceDonateorganService.getPMPRate(timeVO)); |
| | | } |
| | | |
| | | @ApiOperation("根据地市返回捐献、完成、器官数") |
| | | @GetMapping("/getDistrictDonateCalculate") |
| | | public AjaxResult getDistrictDonateCalculate(){ |
| | | public AjaxResult getDistrictDonateCalculate() { |
| | | return AjaxResult.success(serviceDonateorganService.getDistrictDonateCalculate()); |
| | | } |
| | | |
| | | @ApiOperation("根据时间地市返回捐献、完成、器官数") |
| | | @GetMapping("/getDistrictDonateCalculateByTime") |
| | | public AjaxResult getDistrictDonateCalculateByTime(TimeVO timeVO){ |
| | | public AjaxResult getDistrictDonateCalculateByTime(TimeVO timeVO) { |
| | | return AjaxResult.success(serviceDonateorganService.getDistrictDonateCalculateByTime(timeVO)); |
| | | } |
| | | |
| | | @ApiOperation("根据机构返回器官总数") |
| | | @GetMapping("/getOrganNumberByOrg") |
| | | public AjaxResult getOrganNumberByOrg(TimeVO timeVO){ |
| | | public AjaxResult getOrganNumberByOrg(TimeVO timeVO) { |
| | | return AjaxResult.success(serviceDonateorganService.getOrganNumberByOrg(timeVO)); |
| | | } |
| | | |
| | | @ApiOperation("返回器官总数") |
| | | @GetMapping("/getOrganCount") |
| | | public AjaxResult getOrganCount(TimeVO timeVO){ |
| | | public AjaxResult getOrganCount(TimeVO timeVO) { |
| | | return AjaxResult.success(serviceDonateorganService.getOrganCount(timeVO)); |
| | | } |
| | | |
| | | |
| | | |
| | | } |