| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.MultifileMapper; |
| | | import com.doumee.dao.business.SettleClaimsLogMapper; |
| | | import com.doumee.dao.business.SettleClaimsMapper; |
| | | import com.doumee.dao.business.model.SettleClaims; |
| | | import com.doumee.dao.business.dto.SCSupplementDTO; |
| | | import com.doumee.dao.business.join.SettleClaimsJoinMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.service.business.SettleClaimsLogService; |
| | | import com.doumee.service.business.SettleClaimsService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.xiaoymin.knife4j.core.util.CollectionUtils; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | @Autowired |
| | | private SettleClaimsMapper settleClaimsMapper; |
| | | |
| | | @Autowired |
| | | private SettleClaimsLogMapper settleClaimsLogMapper; |
| | | |
| | | @Autowired |
| | | private MultifileMapper multifileMapper; |
| | | |
| | | @Autowired |
| | | private SettleClaimsJoinMapper settleClaimsJoinMapper; |
| | | |
| | | @Override |
| | | public Integer create(SettleClaims settleClaims) { |
| | | // if(Objects.isNull(settleClaims) |
| | | // || Objects.isNull() |
| | | // ){ |
| | | // |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(Objects.isNull(settleClaims) |
| | | || Objects.isNull(settleClaims.getMemberId()) |
| | | || Objects.isNull(settleClaims.getSolutionId()) |
| | | || Objects.isNull(settleClaims.getDuId()) |
| | | || Objects.isNull(settleClaims.getWorktypeId()) |
| | | || Objects.isNull(settleClaims.getHappenTime()) |
| | | || Objects.isNull(settleClaims.getType()) |
| | | || Objects.isNull(settleClaims.getInHospital()) |
| | | || Objects.isNull(settleClaims.getMedicalInsurance()) |
| | | || Objects.isNull(settleClaims.getContent()) |
| | | || Objects.isNull(settleClaims.getInformantName()) |
| | | || Objects.isNull(settleClaims.getInformantPhone()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(!loginUserInfo.getType().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"éä¼ä¸åå·¥æ æ³è¿è¡è¯¥æä½"); |
| | | } |
| | | //æ¥è¯¢æ¯å¦åå¨å·²ææ¥çæ°æ® æ ¹æ®äººååä¿é©æ¹æ¡è¿è¡è¿æ»¤ æ¯å¦åå¨è¿è¡ä¸çæ°æ® |
| | | if(settleClaimsMapper.selectCount(new QueryWrapper<SettleClaims>().lambda() |
| | | .eq(SettleClaims::getSolutionId,settleClaims.getSolutionId()) |
| | | .eq(SettleClaims::getMemberId,loginUserInfo.getId()) |
| | | .in(SettleClaims::getStatus,Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey(), |
| | | Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey()) |
| | | )>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"å卿æ¥ä¸çæ¥æ¡æ°æ®!"); |
| | | } |
| | | settleClaims.setCreateDate(new Date()); |
| | | settleClaims.setIsdeleted(Constants.ZERO); |
| | | settleClaims.setCreator(loginUserInfo.getId()); |
| | | settleClaims.setCheckUserId(loginUserInfo.getId()); |
| | | settleClaimsMapper.insert(settleClaims); |
| | | |
| | | |
| | | |
| | | List<Multifile> reportVideo = settleClaims.getReportFileList(); |
| | | if(CollectionUtils.isNotEmpty(reportVideo)){ |
| | | for (int i = 0; i < reportVideo.size(); i++) { |
| | | Multifile multifile = reportVideo.get(i); |
| | | if(Objects.isNull(multifile.getFileurl()) |
| | | || Objects.isNull(multifile.getType()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"éä»¶å
容å¼å¸¸"); |
| | | } |
| | | multifile.setCreator(loginUserInfo.getId()); |
| | | multifile.setCreateDate(new Date()); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setObjId(settleClaims.getId()); |
| | | multifile.setObjType(Constants.ONE); |
| | | multifile.setSortnum(i+1); |
| | | multifileMapper.insert(multifile); |
| | | } |
| | | } |
| | | //è®°å½æ¥å¿ |
| | | this.saveSettleClaimsLog(settleClaims,Constants.SettleClaimsLogType.UPLOAD,null); |
| | | return settleClaims.getId(); |
| | | } |
| | | |
| | | |
| | | public SettleClaims getSettleClaimsDetail(Integer id){ |
| | | SettleClaims settleClaims = settleClaimsJoinMapper.selectJoinOne(SettleClaims.class,new MPJLambdaWrapper<SettleClaims>() |
| | | .selectAll(SettleClaims.class) |
| | | .leftJoin(Member.class,Member::getId,SettleClaims::getMemberId) |
| | | .leftJoin(InsuranceApply.class,InsuranceApply::getId,SettleClaims::getInsuranceApplyId) |
| | | .leftJoin(DispatchUnit.class,DispatchUnit::getId,SettleClaims::getDuId) |
| | | |
| | | ); |
| | | |
| | | |
| | | return settleClaims; |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public Integer updateForCompany(SettleClaims settleClaims) { |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(Objects.isNull(settleClaims) |
| | | || Objects.isNull(settleClaims.getId()) |
| | | || Objects.isNull(settleClaims.getMemberId()) |
| | | || Objects.isNull(settleClaims.getSolutionId()) |
| | | || Objects.isNull(settleClaims.getDuId()) |
| | | || Objects.isNull(settleClaims.getWorktypeId()) |
| | | || Objects.isNull(settleClaims.getType()) |
| | | || Objects.isNull(settleClaims.getInHospital()) |
| | | || Objects.isNull(settleClaims.getMedicalInsurance()) |
| | | || Objects.isNull(settleClaims.getInformantName()) |
| | | || Objects.isNull(settleClaims.getInformantPhone()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(!loginUserInfo.getType().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"éä¼ä¸åå·¥æ æ³è¿è¡è¯¥æä½"); |
| | | } |
| | | SettleClaims oldSettleClaims = settleClaimsMapper.selectById(settleClaims.getId()); |
| | | if(Objects.isNull(oldSettleClaims)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"æªæ¥è¯¢å°ä¿®æ¹æ°æ®"); |
| | | } |
| | | if(!oldSettleClaims.getSolutionId().equals(settleClaims.getSolutionId())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"æ æ³ä¿®æ¹æ¹æ¡ä¿¡æ¯"); |
| | | } |
| | | if(!(oldSettleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE) |
| | | || oldSettleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"å½åç¶ææ æ³è¿è¡è¯¥æä½"); |
| | | } |
| | | oldSettleClaims.setEditor(loginUserInfo.getId()); |
| | | oldSettleClaims.setEditDate(new Date()); |
| | | oldSettleClaims.setDuId(settleClaims.getDuId()); |
| | | oldSettleClaims.setWorktypeId(settleClaims.getWorktypeId()); |
| | | oldSettleClaims.setInHospital(settleClaims.getInHospital()); |
| | | oldSettleClaims.setMedicalInsurance(settleClaims.getMedicalInsurance()); |
| | | oldSettleClaims.setAreaId(settleClaims.getAreaId()); |
| | | oldSettleClaims.setAreaInfo(settleClaims.getAreaInfo()); |
| | | oldSettleClaims.setType(settleClaims.getType()); |
| | | oldSettleClaims.setInformantName(settleClaims.getInformantName()); |
| | | oldSettleClaims.setInformantPhone(settleClaims.getInformantPhone()); |
| | | oldSettleClaims.setCheckUserId(loginUserInfo.getId()); |
| | | settleClaimsMapper.updateById(oldSettleClaims); |
| | | //è®°å½æ¥å¿ |
| | | Constants.SettleClaimsLogType settleClaimsLogType = Constants.SettleClaimsLogType.UPDATE_DATA; |
| | | this.saveSettleClaimsLog(settleClaims,settleClaimsLogType,null); |
| | | return oldSettleClaims.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void supplement(SCSupplementDTO scSupplementDTO){ |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(Objects.isNull(scSupplementDTO) |
| | | || Objects.isNull(scSupplementDTO.getId()) |
| | | || Objects.isNull(scSupplementDTO.getSupplement()) |
| | | || Objects.isNull(scSupplementDTO.getObjType()) |
| | | || !(scSupplementDTO.getObjType().equals(Constants.ZERO)) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | if(!loginUserInfo.getType().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"éä¼ä¸åå·¥æ æ³è¿è¡è¯¥æä½"); |
| | | } |
| | | SettleClaims settleClaims = settleClaimsMapper.selectById(scSupplementDTO.getId()); |
| | | if(!(settleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE) |
| | | || settleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"å½åç¶ææ æ³è¿è¡è¯¥æä½"); |
| | | } |
| | | settleClaims.setEditor(loginUserInfo.getId()); |
| | | settleClaims.setEditDate(new Date()); |
| | | settleClaims.setCheckUserId(loginUserInfo.getId()); |
| | | settleClaims.setCheckInfo(scSupplementDTO.getSupplement()); |
| | | settleClaimsMapper.updateById(settleClaims); |
| | | |
| | | Constants.SettleClaimsLogType settleClaimsLogType = Constants.SettleClaimsLogType.SUPPLEMENT; |
| | | String content = settleClaimsLogType.getInfo().replace("${param}", scSupplementDTO.getSupplement()); |
| | | this.saveSettleClaimsLog(settleClaims,settleClaimsLogType,content); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void claimsUploadFile(SCSupplementDTO scSupplementDTO){ |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(Objects.isNull(scSupplementDTO) |
| | | || Objects.isNull(scSupplementDTO.getId()) |
| | | || Objects.isNull(scSupplementDTO.getSupplement()) |
| | | || Objects.isNull(scSupplementDTO.getObjType()) |
| | | || Objects.isNull(scSupplementDTO.getFileUrl()) |
| | | || Objects.isNull(scSupplementDTO.getFileType()) |
| | | || scSupplementDTO.getObjType().equals(Constants.ZERO) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | |
| | | SettleClaims settleClaims = settleClaimsMapper.selectById(scSupplementDTO.getId()); |
| | | if(!(settleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE) |
| | | || settleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"å½åç¶ææ æ³è¿è¡è¯¥æä½"); |
| | | } |
| | | |
| | | Multifile multifile = new Multifile(); |
| | | if(loginUserInfo.getType().equals(Constants.ONE)){ |
| | | multifile.setCompanyId(loginUserInfo.getCompanyId()); |
| | | } |
| | | multifile.setCreator(loginUserInfo.getId()); |
| | | multifile.setCreateDate(new Date()); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setObjId(scSupplementDTO.getId()); |
| | | multifile.setName(scSupplementDTO.getFileUrl().substring(scSupplementDTO.getFileUrl().lastIndexOf("/") + 1)); |
| | | multifile.setType(scSupplementDTO.getFileType()); |
| | | multifileMapper.insert(multifile); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public void saveSettleClaimsLog(SettleClaims settleClaims, Constants.SettleClaimsLogType settleClaimsLogType, String content){ |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | SettleClaimsLog settleClaimsLog = new SettleClaimsLog(); |
| | | settleClaimsLog.setCreateDate(new Date()); |
| | | settleClaimsLog.setCreator(loginUserInfo.getId()); |
| | | settleClaimsLog.setIsdeleted(Constants.ZERO); |
| | | settleClaimsLog.setSettleClainmsId(settleClaims.getId()); |
| | | settleClaimsLog.setTitle(settleClaimsLogType.getName()); |
| | | settleClaimsLog.setContent(content); |
| | | settleClaimsLog.setObjType(settleClaimsLogType.getKey()); |
| | | settleClaimsLog.setObjId(settleClaims.getId()); |
| | | settleClaimsLogMapper.insert(settleClaimsLog); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id) { |
| | | settleClaimsMapper.deleteById(id); |