healthbody
This commit is contained in:
parent
9d0284a032
commit
dd28640b3b
|
|
@ -0,0 +1,9 @@
|
|||
package com.bonus.canteen.core.nutrition.common.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bonus.canteen.core.nutrition.common.model.HealthCustMedicalReportProject;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface HealthCustMedicalReportProMapper extends BaseMapper<HealthCustMedicalReportProject> {
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
package com.bonus.canteen.core.nutrition.common.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@TableName("health_cust_medical_report_project")
|
||||
@ApiModel("人员体检报告项目表")
|
||||
public class HealthCustMedicalReportProject implements Serializable {
|
||||
@TableId
|
||||
@ApiModelProperty("主键自增")
|
||||
private Long id;
|
||||
@ApiModelProperty("体检id")
|
||||
private Long medicalId;
|
||||
@ApiModelProperty("体检项目id")
|
||||
private Long medicalProjectId;
|
||||
@ApiModelProperty("体检项目名称")
|
||||
private String medicalProjectName;
|
||||
@ApiModelProperty("创建人")
|
||||
private String crby;
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime crtime;
|
||||
@ApiModelProperty("更新人")
|
||||
private String upby;
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime uptime;
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public Long getMedicalId() {
|
||||
return this.medicalId;
|
||||
}
|
||||
|
||||
public Long getMedicalProjectId() {
|
||||
return this.medicalProjectId;
|
||||
}
|
||||
|
||||
public String getMedicalProjectName() {
|
||||
return this.medicalProjectName;
|
||||
}
|
||||
|
||||
public String getCrby() {
|
||||
return this.crby;
|
||||
}
|
||||
|
||||
public LocalDateTime getCrtime() {
|
||||
return this.crtime;
|
||||
}
|
||||
|
||||
public String getUpby() {
|
||||
return this.upby;
|
||||
}
|
||||
|
||||
public LocalDateTime getUptime() {
|
||||
return this.uptime;
|
||||
}
|
||||
|
||||
public void setId(final Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setMedicalId(final Long medicalId) {
|
||||
this.medicalId = medicalId;
|
||||
}
|
||||
|
||||
public void setMedicalProjectId(final Long medicalProjectId) {
|
||||
this.medicalProjectId = medicalProjectId;
|
||||
}
|
||||
|
||||
public void setMedicalProjectName(final String medicalProjectName) {
|
||||
this.medicalProjectName = medicalProjectName;
|
||||
}
|
||||
|
||||
public void setCrby(final String crby) {
|
||||
this.crby = crby;
|
||||
}
|
||||
|
||||
public void setCrtime(final LocalDateTime crtime) {
|
||||
this.crtime = crtime;
|
||||
}
|
||||
|
||||
public void setUpby(final String upby) {
|
||||
this.upby = upby;
|
||||
}
|
||||
|
||||
public void setUptime(final LocalDateTime uptime) {
|
||||
this.uptime = uptime;
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
Long var10000 = this.getId();
|
||||
return "HealthCustMedicalReportProject(id=" + var10000 + ", medicalId=" + this.getMedicalId() + ", medicalProjectId=" + this.getMedicalProjectId() + ", medicalProjectName=" + this.getMedicalProjectName() + ", crby=" + this.getCrby() + ", crtime=" + String.valueOf(this.getCrtime()) + ", upby=" + this.getUpby() + ", uptime=" + String.valueOf(this.getUptime()) + ")";
|
||||
}
|
||||
}
|
||||
|
|
@ -3,9 +3,13 @@ package com.bonus.canteen.core.nutrition.common.service;
|
|||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.bonus.canteen.core.nutrition.common.dto.HealthCustMedicalReportEditDTO;
|
||||
import com.bonus.canteen.core.nutrition.common.mapper.HealthCustMedicalReportDetailMapper;
|
||||
import com.bonus.canteen.core.nutrition.common.mapper.HealthCustMedicalReportProMapper;
|
||||
import com.bonus.canteen.core.nutrition.common.model.HealthCustMedicalReport;
|
||||
import com.bonus.canteen.core.nutrition.common.model.HealthCustMedicalReportDetail;
|
||||
import com.bonus.canteen.core.nutrition.common.model.HealthCustMedicalReportProject;
|
||||
import com.bonus.canteen.core.nutrition.common.vo.HealthCustMedicalReportDetailVO;
|
||||
import com.bonus.canteen.core.nutrition.common.vo.HealthCustMedicalReportProjectVO;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
|
|
@ -13,12 +17,11 @@ import com.bonus.canteen.core.customer.api.CustCasualApi;
|
|||
import com.bonus.canteen.core.nutrition.common.mapper.HealthCustMedicalReportMapper;
|
||||
import com.bonus.canteen.core.nutrition.common.vo.HealthCustMedicalReportVO;
|
||||
import com.bonus.common.houqin.i18n.I18n;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.bonus.common.houqin.utils.LeBeanUtil;
|
||||
import com.bonus.common.houqin.utils.id.Id;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.invoke.SerializedLambda;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -28,8 +31,8 @@ public class HealthCustMedicalReportService {
|
|||
private CustCasualApi custCasualApi;
|
||||
@Resource
|
||||
private HealthCustMedicalReportMapper healthCustMedicalReportMapper;
|
||||
// @Resource
|
||||
// private HealthCustMedicalReportProMapper healthCustMedicalReportProMapper;
|
||||
@Resource
|
||||
private HealthCustMedicalReportProMapper healthCustMedicalReportProMapper;
|
||||
@Resource
|
||||
private HealthCustMedicalReportDetailMapper healthCustMedicalReportDetailMapper;
|
||||
|
||||
|
|
@ -59,4 +62,71 @@ public class HealthCustMedicalReportService {
|
|||
return reportProjectVOS;
|
||||
}
|
||||
}
|
||||
|
||||
public Long editMedicalReport(HealthCustMedicalReportEditDTO reportEditDTO) {
|
||||
Long count = this.healthCustMedicalReportMapper.selectCount(Wrappers.lambdaQuery(HealthCustMedicalReport.class)
|
||||
.eq(HealthCustMedicalReport::getMedicalDate, reportEditDTO.getMedicalDate())
|
||||
.eq(HealthCustMedicalReport::getMedicalTemplateId, reportEditDTO.getMedicalTemplateId())
|
||||
.eq(HealthCustMedicalReport::getCustId, reportEditDTO.getCustId()));
|
||||
Long medicalId = reportEditDTO.getMedicalId();
|
||||
if (ObjectUtil.isNotEmpty(medicalId)) {
|
||||
if (count > 1L) {
|
||||
throw new ServiceException(I18n.getMessage("nutrition.report-existing", new Object[0]));
|
||||
}
|
||||
|
||||
this.deleteMedicalReport(medicalId);
|
||||
} else {
|
||||
if (count > 0L) {
|
||||
throw new ServiceException(I18n.getMessage("nutrition.report-existing", new Object[0]));
|
||||
}
|
||||
|
||||
medicalId = Id.next();
|
||||
reportEditDTO.setMedicalId(medicalId);
|
||||
}
|
||||
|
||||
HealthCustMedicalReport report = (HealthCustMedicalReport) LeBeanUtil.copyCreateProperties(reportEditDTO, HealthCustMedicalReport.class);
|
||||
this.healthCustMedicalReportMapper.insert(report);
|
||||
if (ObjectUtil.isEmpty(reportEditDTO.getReportProjectVOS())) {
|
||||
return medicalId;
|
||||
} else {
|
||||
Iterator var5 = reportEditDTO.getReportProjectVOS().iterator();
|
||||
|
||||
while(true) {
|
||||
HealthCustMedicalReportProjectVO projectEditDTO;
|
||||
do {
|
||||
if (!var5.hasNext()) {
|
||||
return medicalId;
|
||||
}
|
||||
|
||||
projectEditDTO = (HealthCustMedicalReportProjectVO)var5.next();
|
||||
HealthCustMedicalReportProject reportProject = new HealthCustMedicalReportProject();
|
||||
reportProject.setMedicalId(medicalId);
|
||||
reportProject.setMedicalProjectId(projectEditDTO.getMedicalProjectId());
|
||||
reportProject.setMedicalProjectName(projectEditDTO.getMedicalProjectName());
|
||||
this.healthCustMedicalReportProMapper.insert(reportProject);
|
||||
} while(CollectionUtil.isEmpty(projectEditDTO.getMedicalReportDetailVOList()));
|
||||
|
||||
Iterator var8 = projectEditDTO.getMedicalReportDetailVOList().iterator();
|
||||
|
||||
while(var8.hasNext()) {
|
||||
HealthCustMedicalReportDetailVO detailEditDTO = (HealthCustMedicalReportDetailVO)var8.next();
|
||||
HealthCustMedicalReportDetail reportDetail = new HealthCustMedicalReportDetail();
|
||||
reportDetail.setMedicalId(medicalId);
|
||||
reportDetail.setMedicalProjectId(projectEditDTO.getMedicalProjectId());
|
||||
reportDetail.setMedicalProjectDetailId(detailEditDTO.getMedicalProjectDetailId());
|
||||
reportDetail.setMedicalProjectDetailName(detailEditDTO.getMedicalProjectDetailName());
|
||||
reportDetail.setResult(detailEditDTO.getResult());
|
||||
this.healthCustMedicalReportDetailMapper.insert(reportDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteMedicalReport(Long medicalId) {
|
||||
this.healthCustMedicalReportMapper.deleteCustReport(medicalId);
|
||||
this.healthCustMedicalReportProMapper.delete((Wrapper)Wrappers.lambdaQuery(HealthCustMedicalReportProject.class)
|
||||
.eq(HealthCustMedicalReportProject::getMedicalId, medicalId));
|
||||
this.healthCustMedicalReportMapper.delete((Wrapper)Wrappers.lambdaQuery(HealthCustMedicalReport.class).eq(HealthCustMedicalReport::getMedicalId, medicalId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class HealthMobileMedicalReportController {
|
|||
// @RequiresGuest
|
||||
@ApiOperation("编辑人员体检报告")
|
||||
public AjaxResult editMedicalReport(@RequestBody HealthCustMedicalReportEditDTO dto) {
|
||||
return this.healthCustMedicalReportService.editMedicalReport(dto);
|
||||
return AjaxResult.success(this.healthCustMedicalReportService.editMedicalReport(dto));
|
||||
}
|
||||
|
||||
@PostMapping({"/delete-medicalreport"})
|
||||
|
|
|
|||
Loading…
Reference in New Issue