CostAccountShareServiceImpl.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. package com.imed.costaccount.service.impl;
  2. import cn.hutool.core.util.StrUtil;
  3. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  5. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  6. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  7. import com.fasterxml.jackson.core.type.TypeReference;
  8. import com.imed.costaccount.common.exception.CostException;
  9. import com.imed.costaccount.common.util.BeanUtil;
  10. import com.imed.costaccount.common.util.JacksonUtil;
  11. import com.imed.costaccount.common.util.PageUtils;
  12. import com.imed.costaccount.constants.NumberConstant;
  13. import com.imed.costaccount.mapper.CostAccountShareMapper;
  14. import com.imed.costaccount.model.*;
  15. import com.imed.costaccount.model.dto.AccountShareCopyDto;
  16. import com.imed.costaccount.model.dto.CostAccountShareEditDto;
  17. import com.imed.costaccount.model.dto.CostAccountShareSaveDto;
  18. import com.imed.costaccount.model.dto.ShareParamEditDto;
  19. import com.imed.costaccount.model.vo.CostAccountShareVO;
  20. import com.imed.costaccount.model.vo.CostShareParamStatusVO;
  21. import com.imed.costaccount.model.vo.CostShareParamVO;
  22. import com.imed.costaccount.model.vo.ShareParamProportionVO;
  23. import com.imed.costaccount.service.*;
  24. import lombok.extern.slf4j.Slf4j;
  25. import org.apache.shiro.SecurityUtils;
  26. import org.springframework.stereotype.Service;
  27. import org.springframework.transaction.annotation.Propagation;
  28. import org.springframework.transaction.annotation.Transactional;
  29. import org.springframework.util.CollectionUtils;
  30. import org.springframework.util.StringUtils;
  31. import java.util.*;
  32. import java.util.concurrent.atomic.AtomicReference;
  33. import java.util.stream.Collectors;
  34. @Slf4j
  35. @Service("costAccountShareService")
  36. public class CostAccountShareServiceImpl extends ServiceImpl<CostAccountShareMapper, CostAccountShare> implements CostAccountShareService {
  37. private final ResponsibilityService responsibilityService;
  38. private final AccountingService accountingService;
  39. private final CostShareLevelService costShareLevelService;
  40. private final CostShareParamService costShareParamService;
  41. public CostAccountShareServiceImpl(ResponsibilityService responsibilityService, AccountingService accountingService, CostShareLevelService costShareLevelService, CostShareParamService costShareParamService) {
  42. this.responsibilityService = responsibilityService;
  43. this.accountingService = accountingService;
  44. this.costShareLevelService = costShareLevelService;
  45. this.costShareParamService = costShareParamService;
  46. }
  47. /**
  48. * 分页查询责任中心成本对照相关数据
  49. *
  50. * @param current
  51. * @param pageSize
  52. * @param name
  53. * @return
  54. */
  55. @Override
  56. public PageUtils queryList(Integer current, Integer pageSize, String name, Long hospId) {
  57. Page<CostAccountShare> costAccountSharePage = new Page<>(current, pageSize);
  58. Page<CostAccountShare> pages = this.page(costAccountSharePage, new QueryWrapper<CostAccountShare>().lambda()
  59. .eq(!StringUtils.isEmpty(hospId), CostAccountShare::getHospId, hospId)
  60. .like(!StringUtils.isEmpty(name), CostAccountShare::getResponsibilityName, name)
  61. .orderByAsc(CostAccountShare::getShareLevel));
  62. List<CostAccountShare> costAccountShareList = pages.getRecords();
  63. List<CostAccountShareVO> costAccountShareVOList = BeanUtil.convertList(costAccountShareList, CostAccountShareVO.class);
  64. costAccountShareVOList.forEach(i -> {
  65. String accountingIds = i.getAccountingIds();
  66. if (StrUtil.isNotBlank(accountingIds)) {
  67. List<String> list = Arrays.asList(accountingIds.split(StrUtil.COMMA));
  68. i.setAccountingIdList(list);
  69. } else {
  70. i.setAccountingIdList(null);
  71. }
  72. });
  73. // getMessage(hospId, costAccountShareVOList);
  74. PageUtils pageUtils = new PageUtils(pages);
  75. pageUtils.setList(costAccountShareVOList);
  76. return pageUtils;
  77. }
  78. // private void getMessage(Long hospId, List<CostAccountShareVO> costAccountShareList) {
  79. // // 设置责任中心的数据 与 会计科目的数据从对应的id里面获取
  80. // List<Responsibility> list = responsibilityService.list(new QueryWrapper<Responsibility>().lambda().eq(Responsibility::getHospId, hospId));
  81. // List<Accounting> accountingList = accountingService.list(new QueryWrapper<Accounting>().lambda().eq(Accounting::getHospId, hospId));
  82. // Map<Long, List<Responsibility>> resMap = list.stream().collect(Collectors.groupingBy(Responsibility::getId));
  83. // Map<Long, List<Accounting>> accountMap = accountingList.stream().collect(Collectors.groupingBy(Accounting::getId));
  84. // costAccountShareList.forEach(i->{
  85. // Long id = i.getResponsibilityId();
  86. // List<Responsibility> responsibilities = resMap.get(id);
  87. // if (!CollectionUtils.isEmpty(responsibilities)){
  88. // i.setResponsibilityId(id);
  89. // i.setResponsibilityName(responsibilities.get(0).getResponsibilityName());
  90. // i.setResponsibilityCode(responsibilities.get(0).getResponsibilityCode());
  91. //
  92. // }
  93. // Long accountingId = i.getAccountingId();
  94. // if (accountingId>0){
  95. // List<Accounting> accountingList1 = accountMap.get(accountingId);
  96. // if (!CollectionUtils.isEmpty(accountingList1)){
  97. // i.setAccountingId(accountingId);
  98. // i.setAccountingName(accountingList1.get(0).getAccountingName());
  99. // i.setAccountingCode(accountingList1.get(0).getAccountingCode());
  100. // i.setAllParentIds(accountingList1.get(0).getAllParentIds());
  101. // }
  102. // }
  103. // });
  104. // }
  105. /**
  106. * 保存成本参数对应成本对照表
  107. *
  108. * @param costAccountShareSaveDto {@link CostAccountShareSaveDto}
  109. */
  110. @Override
  111. @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
  112. public void addCostAccountShare(CostAccountShareSaveDto costAccountShareSaveDto) {
  113. User user = (User) SecurityUtils.getSubject().getPrincipal();
  114. Long hospId = user.getHospId();
  115. // 检验输入的数据的合理性
  116. checkAccountShare(costAccountShareSaveDto, hospId);
  117. CostAccountShare costAccountShareRequest = BeanUtil.convertObj(costAccountShareSaveDto, CostAccountShare.class);
  118. costAccountShareRequest.setHospId(hospId);
  119. costAccountShareRequest.setCreateTime(System.currentTimeMillis());
  120. baseMapper.insert(costAccountShareRequest);
  121. }
  122. /**
  123. * 检验输入数据的合理性
  124. *
  125. * @param costAccountShareSaveDto
  126. * @param hospId
  127. */
  128. private void checkAccountShare(CostAccountShareSaveDto costAccountShareSaveDto, Long hospId) {
  129. Long responsibilityId = costAccountShareSaveDto.getResponsibilityId();
  130. Responsibility responsibility = responsibilityService.getOne(new QueryWrapper<Responsibility>().lambda().eq(Responsibility::getHospId, hospId).eq(Responsibility::getId, responsibilityId));
  131. if (Objects.isNull(responsibility)) {
  132. throw new CostException(500, "输入的责任不存在");
  133. }
  134. costAccountShareSaveDto.setResponsibilityId(responsibilityId);
  135. costAccountShareSaveDto.setResponsibilityCode(responsibility.getResponsibilityCode());
  136. costAccountShareSaveDto.setResponsibilityName(responsibility.getResponsibilityName());
  137. costAccountShareSaveDto.setShareLevel(responsibility.getShareLevel());
  138. List<CostAccountShare> costAccountShareList = baseMapper.selectList(new QueryWrapper<CostAccountShare>().lambda().eq(CostAccountShare::getHospId, hospId).eq(CostAccountShare::getResponsibilityId, costAccountShareSaveDto.getResponsibilityId()));
  139. if (!StringUtils.isEmpty(costAccountShareSaveDto.getAccountingIds())) {
  140. // 这个责任中心允许输入会计科目
  141. List<Long> accountIdList = Arrays.stream(costAccountShareSaveDto.getAccountingIds().split(StrUtil.COMMA)).map(Long::valueOf).collect(Collectors.toList());
  142. List<Accounting> accountingList = accountingService.list(new QueryWrapper<Accounting>().lambda().eq(Accounting::getHospId, hospId).in(Accounting::getId, accountIdList).orderByDesc(Accounting::getCreateTime));
  143. if (CollectionUtils.isEmpty(accountingList)) {
  144. throw new CostException(500, "输入的会计科目不存在");
  145. } else {
  146. String accountIds = accountingList.stream().map(Accounting::getId).collect(Collectors.toList()).stream().map(String::valueOf).collect(Collectors.joining(StrUtil.COMMA));
  147. costAccountShareSaveDto.setAccountingIds(accountIds);
  148. String accountNames = accountingList.stream().map(Accounting::getAccountingName).map(String::valueOf).collect(Collectors.joining(StrUtil.COMMA));
  149. costAccountShareSaveDto.setAccountingNames(accountNames);
  150. String accountCodes = accountingList.stream().map(Accounting::getAccountingCode).map(String::valueOf).collect(Collectors.joining(StrUtil.COMMA));
  151. costAccountShareSaveDto.setAccountingCodes(accountCodes);
  152. }
  153. // Map<String, List<CostAccountShare>> costAccountMap = costAccountShareList.stream().collect(Collectors.groupingBy(CostAccountShare::getResponsibilityCode));
  154. // List<CostAccountShare> list = costAccountMap.get(costAccountShareSaveDto.getResponsibilityCode());
  155. if (!CollectionUtils.isEmpty(costAccountShareList)) {
  156. costAccountShareList.forEach(i -> {
  157. String accountingIds = i.getAccountingIds();
  158. Integer isShareCost = i.getIsShareCost();
  159. List<Long> accountIdListRequest = Arrays.stream(accountingIds.split(StrUtil.COMMA)).map(Long::valueOf).collect(Collectors.toList());
  160. if (!Collections.disjoint(accountIdListRequest, accountIdList)) {
  161. throw new CostException(500, "存在相同的会计科目数据");
  162. }
  163. if (NumberConstant.ONE.equals(isShareCost) && NumberConstant.ONE.equals(costAccountShareSaveDto.getIsShareCost())) {
  164. throw new CostException(500, "同个责任中心只允许一条设置包含分摊成本");
  165. }
  166. });
  167. }
  168. } else {
  169. // 此时是
  170. // 责任中心只允许出现一次
  171. if (!CollectionUtils.isEmpty(costAccountShareList)) {
  172. throw new CostException(500, "该责任中心合并计算已存在");
  173. }
  174. if (!NumberConstant.ONE.equals(costAccountShareSaveDto.getIsShareCost())) {
  175. throw new CostException(500, "合并计算责任中心必须要设置成包含分摊参数");
  176. }
  177. }
  178. // 检验输入的这个责任中心是否允许输入会计科目
  179. Long shareId = responsibility.getShareId();
  180. CostShareLevel costShareLevel = costShareLevelService.getOne(new QueryWrapper<CostShareLevel>().lambda()
  181. .eq(CostShareLevel::getHospId, hospId).eq(CostShareLevel::getId, shareId));
  182. if (Objects.nonNull(costShareLevel)) {
  183. if ((!StringUtils.isEmpty(costAccountShareSaveDto.getAccountingIds())) && NumberConstant.ZERO.equals(costShareLevel.getCalcType())) {
  184. throw new CostException(500, "合并计算不允许选择会计科目");
  185. }
  186. if ((StringUtils.isEmpty(costAccountShareSaveDto.getAccountingIds())) && NumberConstant.ONE.equals(costShareLevel.getCalcType())) {
  187. throw new CostException(500, "分开计算的责任中心需要选择会计科目");
  188. }
  189. } else {
  190. throw new CostException(500, "对不起该责任中心没有对应分摊层级");
  191. }
  192. }
  193. /**
  194. * 修改成本分摊参数对应表
  195. *
  196. * @param costAccountShareEditDto
  197. */
  198. @Override
  199. @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
  200. public void updateByCostAccountShare(CostAccountShareEditDto costAccountShareEditDto) {
  201. User user = (User) SecurityUtils.getSubject().getPrincipal();
  202. Long hospId = user.getHospId();
  203. Long id = costAccountShareEditDto.getId();
  204. CostAccountShare costAccountShare = baseMapper.selectById(id);
  205. if (Objects.isNull(costAccountShare)) {
  206. throw new CostException(500, "成本分摊参数对应数据不存在");
  207. }
  208. baseMapper.deleteById(id);
  209. // 新增责任中心成本对照数据
  210. CostAccountShareSaveDto costAccountShareSaveDto = BeanUtil.convertObj(costAccountShareEditDto, CostAccountShareSaveDto.class);
  211. // 检验输入的数据是否符合规则
  212. checkAccountShare(costAccountShareSaveDto, hospId);
  213. CostAccountShareEditDto accountShareEditDto = BeanUtil.convertObj(costAccountShareSaveDto, CostAccountShareEditDto.class);
  214. CostAccountShare costAccountShareRequest = BeanUtil.convertObj(accountShareEditDto, CostAccountShare.class);
  215. costAccountShareRequest.setId(null);
  216. costAccountShareRequest.setHospId(hospId);
  217. costAccountShareRequest.setParamList(costAccountShare.getParamList());
  218. costAccountShareRequest.setCreateTime(System.currentTimeMillis());
  219. baseMapper.insert(costAccountShareRequest);
  220. }
  221. /**
  222. * 修改成本分摊参数的设置
  223. *
  224. * @param shareParamEditDto
  225. */
  226. @Override
  227. @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
  228. public void updateShareParam(ShareParamEditDto shareParamEditDto) {
  229. List<ShareParamProportionVO> shareParamProportionVOList1 = shareParamEditDto.getShareParamProportionVOList();
  230. User user = (User) SecurityUtils.getSubject().getPrincipal();
  231. Long hospId = user.getHospId();
  232. Long id = shareParamEditDto.getId();
  233. CostAccountShare costAccountShare = baseMapper.selectOne(new QueryWrapper<CostAccountShare>().lambda()
  234. .eq(CostAccountShare::getHospId, hospId)
  235. .eq(CostAccountShare::getId, id));
  236. if (Objects.isNull(costAccountShare)) {
  237. throw new CostException(500, "分摊参数对应数据不存在");
  238. }
  239. if (!CollectionUtils.isEmpty(shareParamProportionVOList1)) {
  240. List<ShareParamProportionVO> shareParamProportionVOList = shareParamEditDto.getShareParamProportionVOList();
  241. // 检验输入的成本分摊参数是否存在
  242. List<CostShareParamVO> costShareParamServiceAll = costShareParamService.getAll(hospId);
  243. Map<Long, List<CostShareParamVO>> listMap = costShareParamServiceAll.stream().collect(Collectors.groupingBy(CostShareParamVO::getId));
  244. shareParamProportionVOList.forEach(i -> {
  245. if (CollectionUtils.isEmpty(listMap.get(i.getId()))) {
  246. throw new CostException(500, "分摊名称:" + i.getShareParamName() + "未找到");
  247. }
  248. });
  249. // 检验输入的数据的和是否是100
  250. AtomicReference<Integer> sum = new AtomicReference<>(0);
  251. shareParamProportionVOList.forEach(i -> {
  252. sum.updateAndGet(v -> v + i.getShareParamPopout());
  253. });
  254. int max = Integer.parseInt(sum.toString());
  255. if (!NumberConstant.ONE_HUNDRED.equals(max)) {
  256. throw new CostException(500, "分摊比例的和不是100");
  257. }
  258. // 判断添加的分摊是否存在一样的
  259. HashMap<Long, ShareParamProportionVO> hashMap = new HashMap<>();
  260. shareParamProportionVOList.forEach(i -> {
  261. Long paramId = i.getId();
  262. if (hashMap.containsKey(paramId)) {
  263. throw new CostException(500, "不可以添加相同的分摊参数");
  264. }
  265. hashMap.put(paramId, i);
  266. });
  267. //
  268. // String paramList = JsonUtil.toJSONString(shareParamProportionVOList);
  269. String paramList = JacksonUtil.obj2StrPretty(shareParamProportionVOList);
  270. costAccountShare.setParamList(paramList);
  271. } else {
  272. costAccountShare.setParamList(null);
  273. }
  274. baseMapper.updateById(costAccountShare);
  275. }
  276. /**
  277. * 获取责任中心成本表的分摊参数的集合
  278. *
  279. * @param id
  280. * @param hospId
  281. * @return
  282. */
  283. @Override
  284. public List<ShareParamProportionVO> selectShareParamById(Integer id, Long hospId) {
  285. CostAccountShare costAccountShare = baseMapper.selectOne(new QueryWrapper<CostAccountShare>().lambda()
  286. .eq(CostAccountShare::getHospId, hospId).eq(CostAccountShare::getId, id));
  287. if (Objects.isNull(costAccountShare)) {
  288. throw new CostException(500, "责任中心成本不存在");
  289. }
  290. String paramList = costAccountShare.getParamList();
  291. // return JsonUtil.toList(paramList, ShareParamProportionVO.class);
  292. // return JacksonUtil.string2ObjList(paramList, List.class, ShareParamProportionVO.class);
  293. return JacksonUtil.str2ObjList(paramList, new TypeReference<List<ShareParamProportionVO>>() {});
  294. }
  295. /**
  296. * 成本分摊参数中被分摊参数对应选中的状态
  297. *
  298. * @param id
  299. * @param hospId
  300. * @return
  301. */
  302. @Override
  303. public List<CostShareParamStatusVO> getAllShareParamStatusById(Integer id, Long hospId) {
  304. List<CostShareParamVO> costShareParamServiceAll = costShareParamService.getAll(hospId);
  305. CostAccountShare costAccountShare = baseMapper.selectById(id);
  306. if (Objects.isNull(costAccountShare)) {
  307. throw new CostException(500, "成本分摊对应数据不存在");
  308. }
  309. String paramList = costAccountShare.getParamList();
  310. List<CostShareParamStatusVO> costShareParamStatusVOList = BeanUtil.convertList(costShareParamServiceAll, CostShareParamStatusVO.class);
  311. if (!StringUtils.isEmpty(paramList)) {
  312. // List<ShareParamProportionVO> shareParamProportionVOList = JsonUtil.toList(paramList, ShareParamProportionVO.class);
  313. List<ShareParamProportionVO> shareParamProportionVOList = JacksonUtil.str2ObjList(paramList, new TypeReference<List<ShareParamProportionVO>>() {});
  314. Map<Long, List<ShareParamProportionVO>> map = shareParamProportionVOList.stream().collect(Collectors.groupingBy(ShareParamProportionVO::getId));
  315. costShareParamStatusVOList.forEach(i -> {
  316. Long paramId = i.getId();
  317. if (!CollectionUtils.isEmpty(map.get(paramId))) {
  318. i.setShareParamStatus(NumberConstant.ONE);
  319. }
  320. });
  321. }
  322. return costShareParamStatusVOList;
  323. }
  324. /**
  325. * 拷贝
  326. *
  327. * @param accountShareCopyDto 赋值数据
  328. * @param hospId 医院Id
  329. */
  330. @Override
  331. @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
  332. public void copyAccountShareData(AccountShareCopyDto accountShareCopyDto, Long hospId) {
  333. Long id = accountShareCopyDto.getId();
  334. CostAccountShare costAccountShare = this.getById(id);
  335. if (Objects.isNull(costAccountShare)) {
  336. throw new CostException(500, "成本分摊参数设置对应数据不存在");
  337. }
  338. List<CostAccountShare> accountShareList = new ArrayList<>();
  339. List<Long> responsibilityIds = accountShareCopyDto.getResponsibilityIds();
  340. Map<Long, Responsibility> responsibilityMap = responsibilityService.list(new QueryWrapper<Responsibility>().lambda()
  341. .eq(Responsibility::getHospId, hospId)).stream().collect(Collectors.toMap(Responsibility::getId, synOne -> synOne));
  342. long millis = System.currentTimeMillis();
  343. responsibilityIds.forEach(i -> {
  344. CostAccountShare accountShareRequest = BeanUtil.convertObj(costAccountShare, CostAccountShare.class);
  345. accountShareRequest.setId(null);
  346. accountShareRequest.setCreateTime(millis);
  347. Responsibility responsibility = responsibilityMap.get(i);
  348. accountShareRequest.setResponsibilityId(i);
  349. accountShareRequest.setResponsibilityCode(responsibility.getResponsibilityCode());
  350. accountShareRequest.setResponsibilityName(responsibility.getResponsibilityName());
  351. accountShareRequest.setShareLevel(responsibility.getShareLevel());
  352. accountShareList.add(accountShareRequest);
  353. });
  354. this.saveBatch(accountShareList);
  355. }
  356. /**
  357. * 获取指定类型的责任中心集合 分开计算还是合并计算
  358. *
  359. * @param accountShareId
  360. * @param hospId
  361. * @return
  362. */
  363. @Override
  364. public List<Responsibility> getResponsibilityCalType(Long accountShareId, Long hospId) {
  365. CostAccountShare costAccountShare = this.getById(accountShareId);
  366. if (Objects.isNull(costAccountShare)) {
  367. throw new CostException(500, "成本分摊参数设置对应数据不存在");
  368. }
  369. Long responsibilityId = costAccountShare.getResponsibilityId();
  370. Responsibility responsibility = responsibilityService.getById(responsibilityId);
  371. Long shareId = responsibility.getShareId();
  372. CostShareLevel costShareLevel = costShareLevelService.getById(shareId);
  373. Integer calcType = costShareLevel.getCalcType();
  374. // 分摊参数设置对饮的责任中心的id集合
  375. // List<Long> responsibilityIds = this.list(new QueryWrapper<CostAccountShare>().lambda().eq(CostAccountShare::getHospId, hospId)).stream().map(CostAccountShare::getResponsibilityId).distinct().collect(Collectors.toList());
  376. // 执行类型的分摊级别的Id的集合
  377. List<Long> costShareIds = costShareLevelService.list(new QueryWrapper<CostShareLevel>().lambda()
  378. .eq(CostShareLevel::getHospId, hospId).eq(CostShareLevel::getCalcType, calcType))
  379. .stream().map(CostShareLevel::getId).distinct().collect(Collectors.toList());
  380. String accountingIds = costAccountShare.getAccountingIds();
  381. // List<Long> responsibilityIdList=null;
  382. // if (StrUtil.isNotBlank(accountingIds)){
  383. // List<String> accountIdList = Arrays.asList(accountingIds.split(StrUtil.COMMA));
  384. // responsibilityIdList= baseMapper.getResponsibilityIdsByAccountId(accountIdList);
  385. // }
  386. // 筛选指定类型的责任中心 并且当前没有设置的责任中心
  387. // List<Long> finalResponsibilityIdList = responsibilityIdList;
  388. List<Responsibility> responsibilityList = responsibilityService.list(new QueryWrapper<Responsibility>().lambda()
  389. .eq(Responsibility::getHospId, hospId)
  390. .ne(Responsibility::getShareId,NumberConstant.ZERO))
  391. .stream().filter(i -> costShareIds.contains(i.getShareId()) && !responsibilityId.equals(i.getId())).collect(Collectors.toList());
  392. // && (CollUtil.isNotEmpty(finalResponsibilityIdList) && !finalResponsibilityIdList.contains(i.getId()))
  393. return responsibilityList;
  394. }
  395. /**
  396. * 通过责任中心得到对应的成本分摊参数对应
  397. *
  398. * @param responsibilityCode 责任中心code
  399. * @param hospId 医院id
  400. * @return 成本分摊参数对应列表
  401. */
  402. @Override
  403. public List<CostAccountShare> getByResponsibility(String responsibilityCode, Long hospId) {
  404. List<CostAccountShare> list = this.list(
  405. new LambdaQueryWrapper<CostAccountShare>()
  406. .eq(CostAccountShare::getResponsibilityCode, responsibilityCode)
  407. .eq(CostAccountShare::getHospId, hospId)
  408. );
  409. return list;
  410. }
  411. @Override
  412. public List<CostAccountShare> getByShareLevelSort(List<Integer> levelSorts, Long hospId) {
  413. return this.list(
  414. new LambdaQueryWrapper<CostAccountShare>()
  415. .eq(CostAccountShare::getHospId, hospId)
  416. .in(CostAccountShare::getShareLevel, levelSorts)
  417. );
  418. }
  419. }