12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- package com.kcim.dao.repository;
- import cn.hutool.core.date.DateUtil;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import com.kcim.common.enums.DateStyleEnum;
- import com.kcim.common.util.DateUtils;
- import com.kcim.common.util.UserContext;
- import com.kcim.dao.mapper.CostDepartmentProfitMapper;
- import com.kcim.dao.model.CostDepartmentProfit;
- import org.springframework.stereotype.Repository;
- import java.util.Date;
- import java.util.List;
- /**
- * @program: CostAccount
- * @description:
- * @author: Wang.YS
- * @create: 2024-01-17 20:48
- **/
- @Repository
- public class CostDepartmentProfitRepository extends ServiceImpl<CostDepartmentProfitMapper, CostDepartmentProfit> {
- public List<CostDepartmentProfit> getByProfitIds(String computeDate, List<Long> profitId) {
- Date dateTime = DateUtils.StringToDate(computeDate, DateStyleEnum.YYYY_MM);
- int year = DateUtil.year(dateTime);
- int month = DateUtil.month(dateTime) + 1;
- LambdaQueryWrapper<CostDepartmentProfit> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(CostDepartmentProfit::getYear,year);
- queryWrapper.eq(CostDepartmentProfit::getMonth,month);
- queryWrapper.eq(CostDepartmentProfit::getHospId, UserContext.getHospId());
- queryWrapper.in(CostDepartmentProfit::getReportId,profitId);
- return this.list(queryWrapper);
- }
- public List<CostDepartmentProfit> getCurrentByReportType(Integer year, Integer month, Long hospId, String reportType, String responsibilityCode) {
- LambdaQueryWrapper<CostDepartmentProfit> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(CostDepartmentProfit::getYear,year);
- queryWrapper.eq(CostDepartmentProfit::getMonth,month);
- queryWrapper.eq(CostDepartmentProfit::getHospId, hospId);
- queryWrapper.eq(CostDepartmentProfit::getShareType,Integer.valueOf(reportType));
- queryWrapper.eq(CostDepartmentProfit::getResponsibilityCode, responsibilityCode);
- return this.list(queryWrapper);
- }
- /**
- * 获取科室损益数据
- * @param computeDate
- * @return
- */
- public List<CostDepartmentProfit> getDepartmentProfit(String computeDate) {
- Date dateTime = DateUtils.StringToDate(computeDate, DateStyleEnum.YYYY_MM);
- int year = DateUtil.year(dateTime);
- int month = DateUtil.month(dateTime) + 1;
- LambdaQueryWrapper<CostDepartmentProfit> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(CostDepartmentProfit::getYear,year);
- queryWrapper.eq(CostDepartmentProfit::getMonth,month);
- queryWrapper.eq(CostDepartmentProfit::getHospId, UserContext.getHospId());
- return this.list(queryWrapper);
- }
- public Integer getMaxYear(Long hospId) {
- return this.baseMapper.getMaxYear(hospId);
- }
- public Integer getMaxMonth(Long hospId,Integer year) {
- return this.baseMapper.getMaxMonth(hospId,year);
- }
- }
|