| | |
| | | import com.kidgrow.common.model.SysOrganization; |
| | | import com.kidgrow.common.model.SysUser; |
| | | import com.kidgrow.common.utils.StringUtils; |
| | | import com.kidgrow.oprationcenter.model.ProductOrderDetail; |
| | | import com.kidgrow.oprationcenter.model.ProductOrderRecord; |
| | | import com.kidgrow.oprationcenter.service.IBusinessRecordsService; |
| | | import com.kidgrow.oprationcenter.service.IProductOrderDetailService; |
| | | import com.kidgrow.oprationcenter.service.IProductOrderRecordService; |
| | | import com.kidgrow.oprationcenter.service.IProductOrderService; |
| | | import com.kidgrow.oprationcenter.vo.ProductOrderJoinDetail; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.validation.Valid; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | public class ProductOrderRecordController extends BaseController { |
| | | @Autowired |
| | | private IProductOrderRecordService productOrderRecordService; |
| | | @Autowired |
| | | private IProductOrderDetailService productOrderDetailService; |
| | | @Autowired |
| | | private IBusinessRecordsService businessRecordsService; |
| | | @Autowired |
| | |
| | | return PageResult.<ProductOrderJoinDetail>builder().data(null).code(0).count(0L).build(); |
| | | return productOrderRecordService.findAllDataList(params); |
| | | } |
| | | /** |
| | | * 查看报告 |
| | | */ |
| | | @ApiOperation(value = "查看报告") |
| | | @PostMapping("/pdfname/{diagnosticId}/{reportType}/{hospitalId}/{departId}") |
| | | public ResultBody getPdfPathForOperation(@PathVariable("diagnosticId") String diagnosticId,@PathVariable("reportType") Integer reportType,@PathVariable("hospitalId") Long hospitalId,@PathVariable("departId") Long departId) { |
| | | if (StringUtils.isBlank(diagnosticId)) { |
| | | return ResultBody.failed("请输入diagnosticId"); |
| | | } |
| | | return productOrderRecordService.getPdfPathForOperation(diagnosticId,reportType,hospitalId,departId); |
| | | } |
| | | |
| | | /** |
| | | * 列表 |
| | |
| | | return productOrderRecordService.groupList(params); |
| | | } |
| | | |
| | | /** |
| | | * 查询用户的套餐剩余量 |
| | | */ |
| | | @ApiOperation(value = "查询") |
| | | @GetMapping("/biUserNowProduct") |
| | | public ResultBody biUserNowProduct(@RequestParam long hospitalId, Long departmentId) { |
| | | return productOrderDetailService.biUserNowProduct(hospitalId,departmentId); |
| | | } |
| | | /** |
| | | * 查询 |
| | | */ |
| | |
| | | * 删除 |
| | | */ |
| | | @ApiOperation(value = "删除") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @DeleteMapping("/{id}") |
| | | public ResultBody delete(@PathVariable Long id) { |
| | | boolean v = productOrderRecordService.removeById(id); |
| | | if (v) { |
| | | if (!businessRecordsService.recordBusinessData("删除订单明细:" + id, id.toString())) { |
| | | //log.error(String.format("删除订单明细id为:{1}",id)); |
| | | ProductOrderRecord productOrderRecord=productOrderRecordService.getById(id); |
| | | if (productOrderRecord != null) { |
| | | Map<String,Object> detailSelect=new HashMap<String,Object>(); |
| | | detailSelect.put("pro_id",productOrderRecord.getProId()); |
| | | detailSelect.put("order_id",productOrderRecord.getOrderId()); |
| | | List<ProductOrderDetail> productOrderDetailList=productOrderDetailService.listByMap(detailSelect); |
| | | if (productOrderDetailList != null&&productOrderDetailList.size()>0) { |
| | | ProductOrderDetail productOrderDetail=productOrderDetailList.get(0); |
| | | if (productOrderDetail.getAilightCount() == productOrderRecord.getAilightCount()&& |
| | | productOrderDetail.getRecordCount()==productOrderRecord.getRecordCount()) { |
| | | //读片量和报告量都没有改变 可以删除 |
| | | //删记录 |
| | | boolean isdel= productOrderRecordService.removeById(id); |
| | | //删套餐 |
| | | boolean isdelDetail=productOrderDetailService.removeById(productOrderDetail.getId()); |
| | | //写记录 |
| | | boolean record=businessRecordsService.recordBusinessData("删除订单明细:" + id, id.toString()); |
| | | log.info(String.format("删除订单明细id为:{1}",id)); |
| | | if (isdelDetail&&isdel) { |
| | | return ResultBody.ok().msg("套餐删除成功!"); |
| | | } |
| | | else |
| | | { |
| | | return ResultBody.failed().msg("当前套餐删除失败!"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return ResultBody.failed().msg("当前套餐已经使用,无法删除!"); |
| | | } |
| | | } |
| | | return ResultBody.ok().msg("删除成功"); |
| | | } else { |
| | | return ResultBody.failed().msg("删除失败"); |
| | | else |
| | | { |
| | | return ResultBody.failed().msg("无相关套餐记录!"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return ResultBody.failed().msg("不存在该条记录!"); |
| | | } |
| | | } |
| | | |