| | |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.enums.OrganEnum; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.bean.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.project.domain.ServiceDonatecompletioninfo; |
| | | import com.ruoyi.project.domain.ServiceDonateorgan; |
| | | import com.ruoyi.project.domain.vo.DonationCompletionVO; |
| | | import com.ruoyi.project.service.IServiceDonatecompletioninfoService; |
| | | import com.ruoyi.project.service.IServiceDonatecomporganService; |
| | | import com.ruoyi.project.service.IServiceDonateorganService; |
| | | import freemarker.template.Configuration; |
| | | import freemarker.template.Template; |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @Autowired |
| | | private IServiceDonateorganService serviceDonateorganService; |
| | | |
| | | @Autowired |
| | | private IServiceDonatecomporganService serviceDonatecomporganService; |
| | | |
| | | private static Configuration configuration = null; |
| | | |
| | | public ServiceDonatecompletioninfoController() { |
| | |
| | | * 查询捐献完成列表 |
| | | */ |
| | | @ApiOperation("查询捐献完成列表") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:list')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ServiceDonatecompletioninfo serviceDonatecompletioninfo) { |
| | | log.info("查询捐献完成列表:{}", serviceDonatecompletioninfo); |
| | |
| | | * 导出捐献完成列表 |
| | | */ |
| | | @ApiOperation("导出捐献完成列表") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:export')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:export')") |
| | | @Log(title = "捐献完成", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | public AjaxResult export(ServiceDonatecompletioninfo serviceDonatecompletioninfo) { |
| | |
| | | * 获取捐献完成详细信息 |
| | | */ |
| | | @ApiOperation("通过id获取某一条捐献完成信息") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:query')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | log.info("通过id获取某一条捐献完成信息:{}", id); |
| | |
| | | * 新增捐献完成 |
| | | */ |
| | | @ApiOperation("新增捐献完成") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:add')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:add')") |
| | | @Log(title = "捐献完成", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | @PostMapping("/add") |
| | | @RepeatSubmit(interval = 5000) |
| | | public AjaxResult add(@RequestBody ServiceDonatecompletioninfo serviceDonatecompletioninfo) { |
| | | log.info("新增捐献完成:{}", serviceDonatecompletioninfo); |
| | | serviceDonatecompletioninfoService.delDuplicateDonateCompletioninfo(serviceDonatecompletioninfo.getInfoid(), serviceDonatecompletioninfo.getCreateBy()); |
| | | return toAjax(serviceDonatecompletioninfoService.save(serviceDonatecompletioninfo)); |
| | | boolean save = serviceDonatecompletioninfoService.save(serviceDonatecompletioninfo); |
| | | log.info("新增捐献完成serviceDonatecompletioninfo的ID:{}", serviceDonatecompletioninfo.getId()); |
| | | return AjaxResult.success(serviceDonatecompletioninfo); |
| | | } |
| | | |
| | | // /** |
| | | // * 新增捐献完成详情 |
| | | // */ |
| | | // @ApiOperation("新增捐献完成详情") |
| | | // //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:add')") |
| | | // @Log(title = "新增捐献完成详情", businessType = BusinessType.INSERT) |
| | | // @PostMapping |
| | | // @RepeatSubmit(interval = 5000) |
| | | // public AjaxResult addDetail(@RequestBody ServiceDonatecompletioninfo serviceDonatecompletioninfo) { |
| | | // log.info("新增捐献完成:{}", serviceDonatecompletioninfo); |
| | | // serviceDonatecompletioninfoService.delDuplicateDonateCompletioninfo(serviceDonatecompletioninfo.getInfoid(), serviceDonatecompletioninfo.getCreateBy()); |
| | | // //新增donatecomporgan数据 |
| | | // if (CollectionUtils.isNotEmpty(serviceDonatecompletioninfo.getServiceDonatecomporganList())) { |
| | | // for (ServiceDonatecomporgan serviceDonatecomporgan : serviceDonatecompletioninfo.getServiceDonatecomporganList()) { |
| | | // if (serviceDonatecomporgan.getInfoid() == null) { |
| | | // throw new BaseException("请检查捐献器官移植信息,是否与捐献基础表进行关联"); |
| | | // } |
| | | // serviceDonatecomporganService.save(serviceDonatecomporgan); |
| | | // } |
| | | // } |
| | | // return toAjax(serviceDonatecompletioninfoService.save(serviceDonatecompletioninfo)); |
| | | // } |
| | | |
| | | @RepeatSubmit |
| | | @ApiOperation("新增或修改捐献完成") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:edit')") |
| | | @Log(title = "捐献完成", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/saveOrUpdateDonatecompletioninfo") |
| | | public AjaxResult saveOrUpdateDonatecompletioninfo(@RequestBody List<ServiceDonatecompletioninfo> serviceDonatecompletioninfoList) { |
| | | if (CollectionUtils.isEmpty(serviceDonatecompletioninfoList)) { |
| | | throw new BaseException("请检查需要新增或修改的捐献完成参数是否完整"); |
| | | } |
| | | Boolean i = null; |
| | | for (ServiceDonatecompletioninfo serviceDonatecompletioninfo : serviceDonatecompletioninfoList) { |
| | | log.info("捐献完成id是否为空 : {},基础表的id为 : {}", serviceDonatecompletioninfo.getId(), serviceDonatecompletioninfo.getInfoid()); |
| | | if (serviceDonatecompletioninfo.getId() == null) { |
| | | i = serviceDonatecompletioninfoService.save(serviceDonatecompletioninfo); |
| | | } else { |
| | | i = serviceDonatecompletioninfoService.updateById(serviceDonatecompletioninfo); |
| | | } |
| | | } |
| | | return toAjax(i); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RepeatSubmit |
| | | @ApiOperation("修改捐献完成") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:edit')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:edit')") |
| | | @Log(title = "捐献完成", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/edit") |
| | | public AjaxResult edit(@RequestBody ServiceDonatecompletioninfo serviceDonatecompletioninfo) { |
| | | ServiceDonatecompletioninfo serviceDonatecompletioninfo1 = new ServiceDonatecompletioninfo(); |
| | | serviceDonatecompletioninfo1.setInfoid(serviceDonatecompletioninfo.getInfoid()); |
| | | List<ServiceDonatecompletioninfo> list = serviceDonatecompletioninfoService.queryList(serviceDonatecompletioninfo1); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return error("案例ID,对应的完成登记信息为空"); |
| | | } |
| | | serviceDonatecompletioninfo.setId(list.get(0).getId()); |
| | | return toAjax(serviceDonatecompletioninfoService.updateById(serviceDonatecompletioninfo)); |
| | | } |
| | |
| | | * 删除捐献完成 |
| | | */ |
| | | @ApiOperation("删除捐献完成") |
| | | //@PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:remove')") |
| | | //// @PreAuthorize("@ss.hasPermi('project:donatecompletioninfo:remove')") |
| | | @Log(title = "捐献完成", businessType = BusinessType.DELETE) |
| | | @GetMapping("/remove/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) { |
| | |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("downloadUrl", "/profile/download/wordtemplate/" + name + ".doc"); |
| | | map.put("downloadName", name + ".doc"); |
| | | return map; |
| | | } |
| | | |