|
@@ -0,0 +1,106 @@
|
|
|
+package com.fjhx.oa.service.medical.impl;
|
|
|
+
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fjhx.common.enums.FlowStatusEnum1;
|
|
|
+import com.fjhx.flow.entity.flow.po.FlowExample;
|
|
|
+import com.fjhx.flow.enums.FlowStatusEnum;
|
|
|
+import com.fjhx.flow.service.flow.FlowExampleService;
|
|
|
+import com.fjhx.oa.entity.medical.dto.MedicalInsuranceDto;
|
|
|
+import com.fjhx.oa.entity.medical.dto.MedicalInsuranceSelectDto;
|
|
|
+import com.fjhx.oa.entity.medical.po.MedicalInsurance;
|
|
|
+import com.fjhx.oa.entity.medical.vo.MedicalInsuranceVo;
|
|
|
+import com.fjhx.oa.mapper.medical.MedicalInsuranceMapper;
|
|
|
+import com.fjhx.oa.service.medical.MedicalInsuranceService;
|
|
|
+import com.fjhx.tenant.utils.DeptUstil;
|
|
|
+import com.ruoyi.common.core.domain.BasePo;
|
|
|
+import com.ruoyi.common.utils.SecurityUtils;
|
|
|
+import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
+import com.ruoyi.common.utils.wrapper.SqlField;
|
|
|
+import com.ruoyi.system.utils.UserUtil;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 医保申请 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author
|
|
|
+ * @since 2024-04-08
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class MedicalInsuranceServiceImpl extends ServiceImpl<MedicalInsuranceMapper, MedicalInsurance> implements MedicalInsuranceService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FlowExampleService flowExampleService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<MedicalInsuranceVo> getPage(MedicalInsuranceSelectDto dto) {
|
|
|
+ IWrapper<MedicalInsurance> wrapper = getWrapper();
|
|
|
+
|
|
|
+ wrapper.keyword(dto.getKeyword(), new SqlField("mi", MedicalInsurance::getCode));
|
|
|
+
|
|
|
+ wrapper.orderByDesc("mi", MedicalInsurance::getId);
|
|
|
+ Page<MedicalInsuranceVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
+ List<MedicalInsuranceVo> records = page.getRecords();
|
|
|
+ setInfo(records);
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public MedicalInsuranceVo detail(Long id) {
|
|
|
+ MedicalInsurance medicalInsurance = this.getById(id);
|
|
|
+ MedicalInsuranceVo result = BeanUtil.toBean(medicalInsurance, MedicalInsuranceVo.class);
|
|
|
+
|
|
|
+ setInfo(Arrays.asList(result));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ void setInfo(List<MedicalInsuranceVo> records) {
|
|
|
+ if (ObjectUtil.isEmpty(records)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ UserUtil.assignmentNickName(records, MedicalInsuranceVo::getCreateUser, MedicalInsuranceVo::setCreateUserName);
|
|
|
+ DeptUstil.assignmentNickName(records, MedicalInsuranceVo::getDeptId, MedicalInsuranceVo::setDeptName);
|
|
|
+ DeptUstil.assignmentNickName(records, MedicalInsuranceVo::getCompanyId, MedicalInsuranceVo::setCompanyName);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void addOrEdit(MedicalInsuranceDto medicalInsuranceDto) {
|
|
|
+ this.saveOrUpdate(medicalInsuranceDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void delete(Long id) {
|
|
|
+ this.removeById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void cancellation(Long businessId) {
|
|
|
+ MedicalInsurance byId = getById(businessId);
|
|
|
+ this.update(q -> q
|
|
|
+ .eq(MedicalInsurance::getId, businessId)
|
|
|
+ .set(MedicalInsurance::getStatus, FlowStatusEnum1.CANCELLATION.getKey())
|
|
|
+ .set(BasePo::getUpdateTime, new Date())
|
|
|
+ .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
|
|
|
+ );
|
|
|
+
|
|
|
+ //销毁审批中的流程
|
|
|
+ flowExampleService.update(q -> q
|
|
|
+ .eq(FlowExample::getId, byId.getFlowId())
|
|
|
+ .in(FlowExample::getStatus, FlowStatusEnum.READY_START.getKey(), FlowStatusEnum.IN_PROGRESS.getKey())
|
|
|
+ .set(FlowExample::getStatus, FlowStatusEnum.CANCELLATION.getKey())
|
|
|
+ .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
|
|
|
+ .set(BasePo::getUpdateTime, new Date())
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+}
|