Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 11 months ago
parent
commit
a11b31442f
  1. 21
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneExportDTO.java
  2. 42
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygienePlanDTO.java
  3. 58
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneRecordDTO.java
  4. 18
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java
  5. 12
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java
  6. 34
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneZoneEntity.java
  7. 8
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneMonthVO.java
  8. 39
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygienePlanDetailVO.java
  9. 31
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordDetailVO.java
  10. 34
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordPageVO.java
  11. 41
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneZoneDetailVO.java
  12. 55
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java
  13. 17
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java
  14. 26
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml
  15. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.java
  16. 23
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml
  17. 10
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneZoneMapper.java
  18. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneZoneMapper.xml
  19. 33
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java
  20. 32
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java
  21. 23
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneZoneService.java
  22. 207
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java
  23. 148
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java
  24. 42
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneZoneServiceImpl.java
  25. 31
      hzims-service/safeproduct/src/main/resources/db/1.0.1.sql

21
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneExportDTO.java

@ -1,21 +0,0 @@
package com.hnac.hzims.safeproduct.dto;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author liwen
* @date 2023-12-27
*/
@Data
@ExcelIgnoreUnannotated
@ApiModel(value = "卫生自查数据导出DTO类")
public class HygieneExportDTO {
@ApiModelProperty("卫生自查状态")
@ExcelProperty(value = "卫生自查状态", index = 8)
private String hygieneStatus;
}

42
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygienePlanDTO.java

@ -0,0 +1,42 @@
package com.hnac.hzims.safeproduct.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
* @author liwen
* @date 2024-01-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "卫生自查计划DTO类")
public class HygienePlanDTO extends BaseEntity {
@ApiModelProperty("编码")
private String code;
@ApiModelProperty("标准总分值")
private Integer standardScore;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("计划开始时间")
private Date scheduledStartTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("计划结束时间")
private Date scheduledEndTime;
@ApiModelProperty("责任区数据列表")
private List<HygieneZoneEntity> zoneList;
}

58
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/HygieneRecordDTO.java

@ -0,0 +1,58 @@
package com.hnac.hzims.safeproduct.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
/**
* @author liwen
* @date 2024-01-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "卫生自查记录DTO类")
public class HygieneRecordDTO extends BaseEntity {
@ApiModelProperty("卫生自查计划id")
private Long hygienePlanId;
@NotNull
@Size(max = 50, message = "单位字段长度不能超过50")
@ApiModelProperty("单位")
private String unit;
@Size(max = 50, message = "编码字段长度不能超过50")
@ApiModelProperty("编码")
private String code;
@ApiModelProperty("实际开始时间")
private Date actualStartTime;
@ApiModelProperty("实际结束时间")
private Date actualEndTime;
@ApiModelProperty("检查人")
private String checkUser;
@ApiModelProperty("责任区id")
private String hygieneZoneIds;
@ApiModelProperty("检查结果")
private String checkResult;
@ApiModelProperty("综合评分")
private String comprehensiveScore;
@ApiModelProperty("周数")
private Integer weekNum;
@Size(max = 1000, message = "检查图片字段长度不能超过1000")
@ApiModelProperty("检查图片")
private String imgPath;
}

18
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java

@ -22,22 +22,8 @@ import java.util.Date;
@ApiModel(value = "卫生自查计划实体类") @ApiModel(value = "卫生自查计划实体类")
public class HygienePlanEntity extends BaseEntity { public class HygienePlanEntity extends BaseEntity {
@NotNull @ApiModelProperty("编码")
@Size(max = 50, message = "单位字段长度不能超过50") private String code;
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("责任区")
private String zone;
@ApiModelProperty("责任人")
private String principal;
@ApiModelProperty("检查项")
private String checkItem;
@ApiModelProperty("检查项分值")
private String checkItemScore;
@ApiModelProperty("标准总分值") @ApiModelProperty("标准总分值")
private Integer standardScore; private Integer standardScore;

12
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneRecordEntity.java

@ -7,6 +7,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.util.Date; import java.util.Date;
@ -23,6 +24,11 @@ public class HygieneRecordEntity extends BaseEntity {
@ApiModelProperty("卫生自查计划id") @ApiModelProperty("卫生自查计划id")
private Long hygienePlanId; private Long hygienePlanId;
@NotNull
@Size(max = 50, message = "单位字段长度不能超过50")
@ApiModelProperty("单位")
private String unit;
@Size(max = 50, message = "编码字段长度不能超过50") @Size(max = 50, message = "编码字段长度不能超过50")
@ApiModelProperty("编码") @ApiModelProperty("编码")
private String code; private String code;
@ -36,11 +42,15 @@ public class HygieneRecordEntity extends BaseEntity {
@ApiModelProperty("检查人") @ApiModelProperty("检查人")
private String checkUser; private String checkUser;
@ApiModelProperty("责任区id")
private String hygieneZoneIds;
@ApiModelProperty("检查结果") @ApiModelProperty("检查结果")
private String checkResult; private String checkResult;
@NotNull
@ApiModelProperty("综合评分") @ApiModelProperty("综合评分")
private Integer comprehensiveScore; private String comprehensiveScore;
@ApiModelProperty("周数") @ApiModelProperty("周数")
private Integer weekNum; private Integer weekNum;

34
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygieneZoneEntity.java

@ -0,0 +1,34 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
/**
* @author liwen
* @date 2024-01-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("hzims_hygiene_zone")
@ApiModel(value = "卫生自查区域实体类")
public class HygieneZoneEntity extends BaseEntity {
@ApiModelProperty("卫生自查计划id")
private Long hygienePlanId;
@ApiModelProperty("责任区")
private String zone;
@ApiModelProperty("责任人")
private String principal;
@ApiModelProperty("检查项")
private String checkItem;
@ApiModelProperty("检查项分值")
private String checkItemScore;
}

8
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneMonthVO.java

@ -1,5 +1,7 @@
package com.hnac.hzims.safeproduct.vo; package com.hnac.hzims.safeproduct.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -11,21 +13,27 @@ import java.math.BigDecimal;
* @date 2023-12-27 * @date 2023-12-27
*/ */
@Data @Data
@ExcelIgnoreUnannotated
@ApiModel(value = "卫生自查月度统计VO类") @ApiModel(value = "卫生自查月度统计VO类")
public class HygieneMonthVO { public class HygieneMonthVO {
@ApiModelProperty("单位") @ApiModelProperty("单位")
@ExcelProperty(value = "单位", index = 0)
private String unit; private String unit;
@ApiModelProperty("应检查次数") @ApiModelProperty("应检查次数")
@ExcelProperty(value = "应检查次数", index = 1)
private Long scheduledCheckNum; private Long scheduledCheckNum;
@ApiModelProperty("已检查次数") @ApiModelProperty("已检查次数")
@ExcelProperty(value = "已检查次数", index = 2)
private Long finishedCheckNum; private Long finishedCheckNum;
@ApiModelProperty("未检查次数") @ApiModelProperty("未检查次数")
@ExcelProperty(value = "未检查次数", index = 3)
private Long unfinishedCheckNum; private Long unfinishedCheckNum;
@ApiModelProperty("完成率") @ApiModelProperty("完成率")
@ExcelProperty(value = "完成率/%", index = 4)
private BigDecimal completionRate; private BigDecimal completionRate;
} }

39
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygienePlanDetailVO.java

@ -0,0 +1,39 @@
package com.hnac.hzims.safeproduct.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
* @author liwen
* @date 2024-01-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "卫生自查计划详情VO类")
public class HygienePlanDetailVO extends BaseEntity {
@ApiModelProperty("标准总分值")
private Integer standardScore;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("计划开始时间")
private Date scheduledStartTime;
@NotNull
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("计划结束时间")
private Date scheduledEndTime;
@ApiModelProperty("责任区数据列表")
private List<HygieneZoneEntity> zoneList;
}

31
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordDetailVO.java

@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author liwen * @author liwen
@ -14,33 +15,33 @@ import java.util.Date;
@ApiModel(value = "卫生自查记录详情VO类") @ApiModel(value = "卫生自查记录详情VO类")
public class HygieneRecordDetailVO { public class HygieneRecordDetailVO {
@ApiModelProperty("责任区")
private String zone;
@ApiModelProperty("责任人")
private String principal;
@ApiModelProperty("检查项")
private String checkItem;
@ApiModelProperty("检查项分值")
private String checkItemScore;
@ApiModelProperty("编码") @ApiModelProperty("编码")
private String code; private String code;
@ApiModelProperty("检查时间") @ApiModelProperty("实际结束时间")
private Date checkTime; private Date actualEndTime;
@ApiModelProperty("检查人") @ApiModelProperty("检查人")
private String checkUser; private String checkUser;
@ApiModelProperty("责任区id")
private String hygieneZoneIds;
@ApiModelProperty("检查结果") @ApiModelProperty("检查结果")
private String checkResult; private String checkResult;
@ApiModelProperty("综合评分") @ApiModelProperty("综合评分")
private Integer comprehensiveScore; private String comprehensiveScore;
@ApiModelProperty("周数") @ApiModelProperty("周数")
private Integer weekNum; private Integer weekNum;
@ApiModelProperty("检查图片")
private String imgPath;
@ApiModelProperty("卫生自查计划id")
private Long hygienePlanId;
@ApiModelProperty("检查信息列表")
private List<HygieneZoneDetailVO> checkList;
} }

34
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneRecordPageVO.java

@ -0,0 +1,34 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author liwen
* @date 2024-01-03
*/
@Data
@ApiModel(value = "卫生自查记录页面VO类")
public class HygieneRecordPageVO {
@ApiModelProperty("卫生自查记录id")
private Long id;
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("实际开始时间")
private Date actualStartTime;
@ApiModelProperty("实际结束时间")
private Date actualEndTime;
@ApiModelProperty("检查人")
private String checkUser;
@ApiModelProperty("周数")
private Integer weekNum;
}

41
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/HygieneZoneDetailVO.java

@ -0,0 +1,41 @@
package com.hnac.hzims.safeproduct.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author liwen
* @date 2024-01-02
*/
@Data
@ExcelIgnoreUnannotated
@ApiModel(value = "卫生自查详情VO类")
public class HygieneZoneDetailVO {
@ApiModelProperty("责任区")
@ExcelProperty(value = "责任区", index = 0)
private String zone;
@ApiModelProperty("责任人")
@ExcelProperty(value = "责任人", index = 1)
private String principal;
@ApiModelProperty("检查项")
@ExcelProperty(value = "检查项", index = 2)
private String checkItem;
@ApiModelProperty("检查项分值")
@ExcelProperty(value = "检查项分值", index = 3)
private String checkItemScore;
@ApiModelProperty("检查结果")
@ExcelProperty(value = "检查结果", index = 4)
private String result;
@ApiModelProperty("综合评分")
@ExcelProperty(value = "综合评分", index = 5)
private Integer score;
}

55
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java

@ -3,12 +3,16 @@ package com.hnac.hzims.safeproduct.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.safeproduct.dto.HygienePlanDTO;
import com.hnac.hzims.safeproduct.dto.HygieneRecordDTO;
import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity;
import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity; import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity;
import com.hnac.hzims.safeproduct.service.IHygienePlanService; import com.hnac.hzims.safeproduct.service.IHygienePlanService;
import com.hnac.hzims.safeproduct.service.IHygieneRecordService; import com.hnac.hzims.safeproduct.service.IHygieneRecordService;
import com.hnac.hzims.safeproduct.vo.HygienePlanDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneMonthVO; import com.hnac.hzims.safeproduct.vo.HygieneMonthVO;
import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO; import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneRecordPageVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
@ -43,15 +47,15 @@ public class HygieneController extends BladeController {
@PostMapping("/savePlan") @PostMapping("/savePlan")
@ApiOperation(value = "新增卫生自查计划") @ApiOperation(value = "新增卫生自查计划")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
public R savePlan(@Valid @RequestBody HygienePlanEntity hygienePlanEntity) { public R savePlan(@Valid @RequestBody HygienePlanDTO hygienePlanDTO) {
return hygienePlanService.savePlan(hygienePlanEntity); return hygienePlanService.savePlan(hygienePlanDTO);
} }
@PostMapping("/updatePlan") @PostMapping("/updatePlan")
@ApiOperation(value = "修改卫生自查计划") @ApiOperation(value = "修改卫生自查计划")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
public R updatePlan(@Valid @RequestBody HygienePlanEntity hygienePlanEntity) { public R updatePlan(@Valid @RequestBody HygienePlanDTO hygienePlanDTO) {
return hygienePlanService.updatePlan(hygienePlanEntity); return hygienePlanService.updatePlan(hygienePlanDTO);
} }
@PostMapping("/removePlan") @PostMapping("/removePlan")
@ -64,14 +68,14 @@ public class HygieneController extends BladeController {
@GetMapping("/planDetail") @GetMapping("/planDetail")
@ApiOperation(value = "卫生自查计划详情") @ApiOperation(value = "卫生自查计划详情")
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
public R<HygienePlanEntity> planDetail(@RequestParam Long id) { public R<HygienePlanDetailVO> planDetail(@RequestParam Long id) {
return R.data(hygienePlanService.getById(id)); return R.data(hygienePlanService.getPlan(id));
} }
@GetMapping("/planPage") @GetMapping("/planPage")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "zone", value = "责任区", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "principal", value = "责任人", dataType = "query", paramType = "string") @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string")
}) })
@ApiOperation(value = "卫生自查计划分页") @ApiOperation(value = "卫生自查计划分页")
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@ -83,15 +87,15 @@ public class HygieneController extends BladeController {
@PostMapping("/saveRecord") @PostMapping("/saveRecord")
@ApiOperation(value = "新增卫生自查记录") @ApiOperation(value = "新增卫生自查记录")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
public R saveRecord(@Valid @RequestBody HygieneRecordEntity hygieneRecordEntity) { public R saveRecord(@Valid @RequestBody HygieneRecordDTO hygieneRecordDTO) {
return hygieneRecordService.saveRecord(hygieneRecordEntity); return hygieneRecordService.saveRecord(hygieneRecordDTO);
} }
@PostMapping("/updateRecord") @PostMapping("/updateRecord")
@ApiOperation(value = "修改卫生自查记录") @ApiOperation(value = "修改卫生自查记录")
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
public R updateRecord(@Valid @RequestBody HygieneRecordEntity hygieneRecordEntity) { public R updateRecord(@Valid @RequestBody HygieneRecordDTO hygieneRecordDTO) {
return hygieneRecordService.updateRecord(hygieneRecordEntity); return hygieneRecordService.updateRecord(hygieneRecordDTO);
} }
@PostMapping("/removeRecord") @PostMapping("/removeRecord")
@ -114,29 +118,34 @@ public class HygieneController extends BladeController {
}) })
@ApiOperation(value = "卫生自查记录分页") @ApiOperation(value = "卫生自查记录分页")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
public R<IPage<HygieneRecordEntity>> recordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { public R<IPage<HygieneRecordPageVO>> recordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<HygieneRecordEntity> page = hygieneRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(param, IPage<HygieneRecordPageVO> page = hygieneRecordService.recordPage(param, query);
HygieneRecordEntity.class));
return R.data(page); return R.data(page);
} }
@GetMapping("/dataByMonth") @GetMapping("/dataByMonth")
@ApiOperation(value = "月度统计表") @ApiOperation(value = "月度统计表")
@ApiOperationSupport(order = 11) @ApiOperationSupport(order = 11)
public R<IPage<HygieneMonthVO>> dataByMonth(@RequestParam String month, Query query) { public R<IPage<HygieneMonthVO>> dataByMonth(@RequestParam String month, String unit, Query query) {
IPage<HygieneMonthVO> page = hygienePlanService.dataByMonth(month, query); IPage<HygieneMonthVO> page = hygienePlanService.dataByMonth(month, unit, query);
return R.data(page); return R.data(page);
} }
@GetMapping("/exportHygieneData") @GetMapping("/exportHygieneData")
@ApiOperation(value = "卫生自查数据导出")
@ApiOperationSupport(order = 12)
public void exportHygieneData(@RequestParam Long hygieneRecordId, HttpServletResponse response) {
hygieneRecordService.exportHygieneData(hygieneRecordId, response);
}
@GetMapping("/exportMonthData")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "month", value = "月份", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string")
@ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string")
}) })
@ApiOperation(value = "卫生自查数据导出") @ApiOperation(value = "月度数据导出")
@ApiOperationSupport(order = 13) @ApiOperationSupport(order = 13)
public void exportHygieneData(@ApiIgnore @RequestParam Map<String, Object> param, HttpServletResponse response) { public void exportMonthData(@ApiIgnore @RequestParam Map<String, Object> param, Query query, HttpServletResponse response) {
hygienePlanService.exportHygieneData(param, response); hygienePlanService.exportMonthData(param, query, response);
} }
} }

17
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.java

@ -2,12 +2,10 @@ package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.dto.HygieneExportDTO;
import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity;
import com.hnac.hzims.safeproduct.vo.HygieneMonthVO; import com.hnac.hzims.safeproduct.vo.HygieneMonthVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 卫生自查计划Mapper类 * 卫生自查计划Mapper类
@ -21,25 +19,18 @@ public interface HygienePlanMapper extends BaseMapper<HygienePlanEntity> {
/** /**
* 查询当月各单位的卫生自查总数 * 查询当月各单位的卫生自查总数
* @param page 分页类 * @param page 分页类
* @param unit 单位
* @param month 月份 * @param month 月份
* @return 当月的卫生自查总数据 * @return 当月的卫生自查总数据
*/ */
IPage<HygieneMonthVO> selectByMonth(IPage<HygieneMonthVO> page, String month); IPage<HygieneMonthVO> selectByMonth(IPage<HygieneMonthVO> page, String unit, String month);
/** /**
* 查询当月各单位已完成的卫生自查数据 * 查询当月各单位已完成的卫生自查数据
* @param page 分页类 * @param page 分页类
* @param unit 单位
* @param month 月份 * @param month 月份
* @return 当月的已完成数据 * @return 当月的已完成数据
*/ */
IPage<HygieneMonthVO> selectFinishedDataByMonth(IPage<HygieneMonthVO> page, String month); IPage<HygieneMonthVO> selectFinishedDataByMonth(IPage<HygieneMonthVO> page, String unit, String month);
/**
* 根据单位和计划时间查询卫生自查记录
* @param unit 单位
* @param startTime 计划开始时间
* @param endTime 计划结束时间
* @return 卫生自查记录
*/
List<HygieneExportDTO> getHygieneByUnitAndDate(String unit, String startTime, String endTime);
} }

26
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygienePlanMapper.xml

@ -9,6 +9,9 @@
WHERE WHERE
is_deleted = 0 is_deleted = 0
AND scheduled_end_time like concat('%', #{month}, '%') AND scheduled_end_time like concat('%', #{month}, '%')
<if test="unit != null and unit != ''">
AND unit like concat('%', #{unit}, '%')
</if>
GROUP BY GROUP BY
unit unit
ORDER BY ORDER BY
@ -24,29 +27,12 @@
is_deleted = 0 is_deleted = 0
AND scheduled_end_time like concat('%', #{month}, '%') AND scheduled_end_time like concat('%', #{month}, '%')
AND hygiene_status = 'FINISHED' AND hygiene_status = 'FINISHED'
<if test="unit != null and unit != ''">
AND unit like concat('%', #{unit}, '%')
</if>
GROUP BY GROUP BY
unit unit
ORDER BY ORDER BY
unit unit
</select> </select>
<select id="getHygieneByUnitAndDate" resultType="com.hnac.hzims.safeproduct.dto.HygieneExportDTO">
SELECT
t1.unit, t1.zone, t1.principal, t1.check_item, t1.check_item_score, t2.code, t2.check_result, t2.comprehensive_score,
t2.check_user, t2.actual_start_time, t2.actual_end_time, t1.hygiene_status
FROM
hzims_hygiene_plan t1
LEFT JOIN hzims_hygiene_record t2 ON t1.id = t2.hygiene_plan_id
WHERE
t1.is_deleted = 0
<if test="unit != 'null' and unit != ''">
AND t1.unit like concat('%', #{unit}, '%')
</if>
<if test="startTime != 'null' and startTime != ''">
AND t1.scheduled_start_time >= #{startTime}
</if>
<if test="endTime != 'null' and endTime != ''">
AND t1.scheduled_end_time &lt; #{endTime}
</if>
</select>
</mapper> </mapper>

12
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.java

@ -1,10 +1,14 @@
package com.hnac.hzims.safeproduct.mapper; package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity; import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity;
import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO; import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneRecordPageVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.Map;
/** /**
* 卫生自查记录Mapper类 * 卫生自查记录Mapper类
* *
@ -20,4 +24,12 @@ public interface HygieneRecordMapper extends BaseMapper<HygieneRecordEntity> {
* @return 卫生自查记录详情VO类 * @return 卫生自查记录详情VO类
*/ */
HygieneRecordDetailVO getRecordDetail(Long id); HygieneRecordDetailVO getRecordDetail(Long id);
/**
* 卫生自查记录页面
* @param param 入参
* @param page 分页类
* @return 记录数据页
*/
IPage<HygieneRecordPageVO> recordPage(IPage<HygieneRecordPageVO> page, Map<String, Object> param);
} }

23
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml

@ -3,13 +3,24 @@
<select id="getRecordDetail" resultType="com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO"> <select id="getRecordDetail" resultType="com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO">
SELECT SELECT
t2.zone, t2.principal, t2.check_item, t2.check_item_score, t1.code, t1.check_time, t1.check_user, code, actual_end_time, check_user, hygiene_zone_ids, check_result,comprehensive_score, week_num,
t1.check_result, t1.comprehensive_score, t1.week_num img_path, hygiene_plan_id
FROM FROM
hzims_hygiene_record t1 hzims_hygiene_record
LEFT JOIN hzims_hygiene_plan t2 ON t1.hygiene_plan_id = h2.id
WHERE WHERE
t1.is_deleted = 0 is_deleted = 0
AND t1.id = #{id} AND id = #{id}
</select>
<select id="recordPage" resultType="com.hnac.hzims.safeproduct.vo.HygieneRecordPageVO">
SELECT
id, unit, actual_start_time, actual_end_time, check_user, week_num
FROM
hzims_hygiene_record
WHERE
is_deleted = 0
<if test="param.hygienePlanId != null and param.hygienePlanId != ''">
AND hygiene_plan_id = #{hygienePlanId}
</if>
</select> </select>
</mapper> </mapper>

10
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneZoneMapper.java

@ -0,0 +1,10 @@
package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface HygieneZoneMapper extends BaseMapper<HygieneZoneEntity> {
}

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneZoneMapper.xml

@ -0,0 +1,4 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.safeproduct.mapper.HygieneZoneMapper">
</mapper>

33
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java

@ -2,7 +2,9 @@ package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.dto.HygienePlanDTO;
import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity;
import com.hnac.hzims.safeproduct.vo.HygienePlanDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneMonthVO; import com.hnac.hzims.safeproduct.vo.HygieneMonthVO;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -35,30 +37,43 @@ public interface IHygienePlanService extends IService<HygienePlanEntity> {
/** /**
* 新增卫生自查计划 * 新增卫生自查计划
* @param hygienePlanEntity 卫生自查计划实体 * @param hygienePlanDTO 卫生自查DTO
* @return 结果封装类 * @return 结果封装类
*/ */
R savePlan(HygienePlanEntity hygienePlanEntity); R savePlan(HygienePlanDTO hygienePlanDTO);
/** /**
* 修改卫生自查计划 * 修改卫生自查计划
* @param hygienePlanEntity 卫生自查计划实体 * @param hygienePlanDTO 卫生自查DTO
* @return 结果封装类 * @return 结果封装类
*/ */
R updatePlan(HygienePlanEntity hygienePlanEntity); R updatePlan(HygienePlanDTO hygienePlanDTO);
/** /**
* 卫生自查月度数据 * 卫生自查月度数据
* @param month 月份 * @param month 月份
* @param unit 单位
* @param query 分页类 * @param query 分页类
* @return 月度统计分页 * @return 月度统计分页
*/ */
IPage<HygieneMonthVO> dataByMonth(String month, Query query); IPage<HygieneMonthVO> dataByMonth(String month, String unit, Query query);
/** /**
* 卫生自查数据导出 * 卫生自查计划数据详情
* @param param 入参 * @param id 卫生自查计划id
* @param response 响应类 * @return 卫生自查计划详情VO类
*/
HygienePlanDetailVO getPlan(Long id);
/**
* 根据编码查询卫生自查计划
* @param code 编码
* @return 卫生自查计划实体类
*/
HygienePlanEntity getPlanByCode(String code);
/**
* 月度数据导出
*/ */
void exportHygieneData(Map<String, Object> param, HttpServletResponse response); void exportMonthData(Map<String, Object> param, Query query, HttpServletResponse response);
} }

32
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneRecordService.java

@ -1,10 +1,17 @@
package com.hnac.hzims.safeproduct.service; package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.dto.HygieneRecordDTO;
import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity; import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity;
import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO; import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneRecordPageVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/** /**
* 卫生自查记录服务类 * 卫生自查记录服务类
* *
@ -22,17 +29,17 @@ public interface IHygieneRecordService extends IService<HygieneRecordEntity> {
/** /**
* 新增卫生自查记录 * 新增卫生自查记录
* @param hygieneRecordEntity 卫生自查记录实体 * @param hygieneRecordDTO 卫生自查记录DTO
* @return 封装结果类 * @return 封装结果类
*/ */
R saveRecord(HygieneRecordEntity hygieneRecordEntity); R saveRecord(HygieneRecordDTO hygieneRecordDTO);
/** /**
* 修改卫生自查记录 * 修改卫生自查记录
* @param hygieneRecordEntity 卫生自查记录实体 * @param hygieneRecordDTO 卫生自查记录DTO
* @return true-成功false-失败 * @return 封装结果类
*/ */
R updateRecord(HygieneRecordEntity hygieneRecordEntity); R updateRecord(HygieneRecordDTO hygieneRecordDTO);
/** /**
* 查询卫生自查记录详情 * 查询卫生自查记录详情
@ -40,4 +47,19 @@ public interface IHygieneRecordService extends IService<HygieneRecordEntity> {
* @return 卫生自查记录详情VO类 * @return 卫生自查记录详情VO类
*/ */
HygieneRecordDetailVO getRecordDetail(Long id); HygieneRecordDetailVO getRecordDetail(Long id);
/**
* 卫生自查记录页面
* @param param 入参
* @param query 分页类
* @return 记录数据页
*/
IPage<HygieneRecordPageVO> recordPage(Map<String, Object> param, Query query);
/**
* 卫生自查记录数据导出
* @param hygieneRecordId 卫生自查记录id
* @param response 响应类
*/
void exportHygieneData(Long hygieneRecordId, HttpServletResponse response);
} }

23
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneZoneService.java

@ -0,0 +1,23 @@
package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import java.util.List;
public interface IHygieneZoneService extends IService<HygieneZoneEntity> {
/**
* 删除关联责任区数据
* @param hygienePlanId 卫生自查计划id
* @return true-成功false-失败
*/
boolean removeReferenceZone(Long hygienePlanId);
/**
* 查询关联责任区数据
* @param hygienePlanId 卫生自查计划id
* @return 关联责任区数据
*/
List<HygieneZoneEntity> getReferenceZone(Long hygienePlanId);
}

207
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java

@ -10,18 +10,22 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.safeproduct.dto.HygieneExportDTO; import com.hnac.hzims.safeproduct.dto.HygienePlanDTO;
import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity;
import com.hnac.hzims.safeproduct.enums.HygieneStatusEnum; import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper; import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper;
import com.hnac.hzims.safeproduct.service.IHygienePlanService; import com.hnac.hzims.safeproduct.service.IHygienePlanService;
import com.hnac.hzims.safeproduct.service.IHygieneRecordService; import com.hnac.hzims.safeproduct.service.IHygieneRecordService;
import com.hnac.hzims.safeproduct.service.IHygieneZoneService;
import com.hnac.hzims.safeproduct.vo.HygienePlanDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneMonthVO; import com.hnac.hzims.safeproduct.vo.HygieneMonthVO;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -45,14 +49,24 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
@Autowired @Autowired
IHygieneRecordService hygieneRecordService; IHygieneRecordService hygieneRecordService;
@Autowired
IHygieneZoneService hygieneZoneService;
/** /**
* 删除卫生自查计划 * 删除卫生自查计划
*/ */
@Transactional(rollbackFor = Exception.class)
@Override @Override
public boolean removePlan(Long id) { public boolean removePlan(Long id) {
// 删除计划数据
boolean remove = this.removeById(id); boolean remove = this.removeById(id);
if (remove) { if (remove) {
return hygieneRecordService.removeReferenceRecord(id); // 删除记录数据
boolean removeRecord = hygieneRecordService.removeReferenceRecord(id);
if (removeRecord) {
// 删除责任区数据
return hygieneZoneService.removeReferenceZone(id);
}
} }
return false; return false;
} }
@ -63,13 +77,13 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
@Override @Override
public IPage<HygienePlanEntity> planPage(Map<String, Object> param, Query query) { public IPage<HygienePlanEntity> planPage(Map<String, Object> param, Query query) {
QueryWrapper<HygienePlanEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<HygienePlanEntity> queryWrapper = new QueryWrapper<>();
String zone = String.valueOf(param.get("zone")); String startTime = String.valueOf(param.get("scheduledStartTime"));
String principal = String.valueOf(param.get("principal")); String endTime = String.valueOf(param.get("scheduledEndTime"));
if (!zone.equals("null") && !zone.equals("")) { if (!startTime.equals("null") && !startTime.equals("")) {
queryWrapper.lambda().like(HygienePlanEntity::getZone, zone); queryWrapper.lambda().ge(HygienePlanEntity::getScheduledStartTime, startTime);
} }
if (!principal.equals("null") && !principal.equals("")) { if (!endTime.equals("null") && !endTime.equals("")) {
queryWrapper.lambda().ge(HygienePlanEntity::getPrincipal, principal); queryWrapper.lambda().le(HygienePlanEntity::getScheduledEndTime, endTime);
} }
return this.page(Condition.getPage(query), queryWrapper); return this.page(Condition.getPage(query), queryWrapper);
} }
@ -77,48 +91,84 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
/** /**
* 新增卫生自查计划 * 新增卫生自查计划
*/ */
@Transactional(rollbackFor = Exception.class)
@Override @Override
public R savePlan(HygienePlanEntity hygienePlanEntity) { public R savePlan(HygienePlanDTO hygienePlanDTO) {
String[] scores = hygienePlanEntity.getCheckItemScore().split(",|,"); // 新增卫生自查计划
Integer standardScore = hygienePlanEntity.getStandardScore(); HygienePlanEntity hygienePlanEntity = new HygienePlanEntity();
R res = getSumScore(scores, standardScore); BeanUtils.copyProperties(hygienePlanDTO, hygienePlanEntity);
return res.isSuccess() ? R.status(this.save(hygienePlanEntity)) : res; boolean savePlan = this.save(hygienePlanEntity);
List<HygieneZoneEntity> zoneList = hygienePlanDTO.getZoneList();
// 若计划新增成功,新增关联责任区数据
if (savePlan) {
HygienePlanEntity hygienePlan = getPlanByCode(hygienePlanDTO.getCode());
for (HygieneZoneEntity zone : zoneList) {
// 传计划id
if (hygienePlan != null) {
zone.setHygienePlanId(hygienePlan.getId());
}
String[] scores = zone.getCheckItemScore().split(",|,");
// 校验检查项总成绩是否为标准总成绩
R res = getSumScore(scores, hygienePlanDTO.getStandardScore());
if (!res.isSuccess()) {
return res;
}
}
// 校验通过则批量新增责任区数据
return R.status(hygieneZoneService.saveBatch(zoneList));
}
return R.status(Boolean.FALSE);
} }
/** /**
* 修改卫生自查计划 * 修改卫生自查计划
*/ */
@Override @Override
public R updatePlan(HygienePlanEntity hygienePlanEntity) { public R updatePlan(HygienePlanDTO hygienePlanDTO) {
String[] scores = hygienePlanEntity.getCheckItemScore().split(",|,"); // 修改卫生自查计划
Integer standardScore = hygienePlanEntity.getStandardScore(); HygienePlanEntity hygienePlanEntity = new HygienePlanEntity();
R res = getSumScore(scores, standardScore); BeanUtils.copyProperties(hygienePlanDTO, hygienePlanEntity);
return res.isSuccess() ? R.status(this.updateById(hygienePlanEntity)) : res; boolean updatePlan = this.updateById(hygienePlanEntity);
List<HygieneZoneEntity> zoneList = hygienePlanDTO.getZoneList();
// 若计划修改成功,修改关联责任区数据
if (updatePlan) {
for (HygieneZoneEntity zone : zoneList) {
String[] scores = zone.getCheckItemScore().split(",|,");
// 校验检查项总成绩是否为标准总成绩
R res = getSumScore(scores, hygienePlanDTO.getStandardScore());
if (!res.isSuccess()) {
return res;
}
}
// 校验通过则批量修改责任区数据
return R.status(hygieneZoneService.updateBatchById(zoneList));
}
return R.status(Boolean.FALSE);
} }
/** /**
* 卫生自查月度数据 * 卫生自查月度数据
*/ */
@Override @Override
public IPage<HygieneMonthVO> dataByMonth(String month, Query query) { public IPage<HygieneMonthVO> dataByMonth(String month, String unit, Query query) {
// 查询当月各单位的卫生自查总数 // 查询当月各单位的卫生自查总数
IPage<HygieneMonthVO> page = new Page<>(query.getCurrent(), query.getSize()); IPage<HygieneMonthVO> page = new Page<>(query.getCurrent(), query.getSize());
IPage<HygieneMonthVO> unitPage = baseMapper.selectByMonth(page, month); IPage<HygieneMonthVO> unitPage = baseMapper.selectByMonth(page, unit, month);
List<HygieneMonthVO> unitList = unitPage.getRecords(); List<HygieneMonthVO> unitList = unitPage.getRecords();
// 查询当月各单位已完成的卫生自查数据 // 查询当月各单位已完成的卫生自查数据
IPage<HygieneMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize()); IPage<HygieneMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize());
IPage<HygieneMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, month); IPage<HygieneMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, unit, month);
List<HygieneMonthVO> finishedList = finishedPage.getRecords(); List<HygieneMonthVO> finishedList = finishedPage.getRecords();
// 处理统计数据 // 处理统计数据
for (HygieneMonthVO unit : unitList) { for (HygieneMonthVO u : unitList) {
Long taskNum = unit.getScheduledCheckNum(); Long taskNum = u.getScheduledCheckNum();
Optional<HygieneMonthVO> finishedHygiene = finishedList.stream().filter(x -> x.getUnit().equals(unit.getUnit())).findFirst(); Optional<HygieneMonthVO> finishedHygiene = finishedList.stream().filter(x -> x.getUnit().equals(u.getUnit())).findFirst();
Long finishedTaskNum = finishedHygiene.isPresent() ? finishedHygiene.get().getFinishedCheckNum() : 0L; Long finishedTaskNum = finishedHygiene.isPresent() ? finishedHygiene.get().getFinishedCheckNum() : 0L;
unit.setFinishedCheckNum(finishedTaskNum); u.setFinishedCheckNum(finishedTaskNum);
unit.setUnfinishedCheckNum(taskNum - finishedTaskNum); u.setUnfinishedCheckNum(taskNum - finishedTaskNum);
BigDecimal taskDecimal = new BigDecimal(taskNum); BigDecimal taskDecimal = new BigDecimal(taskNum);
BigDecimal finishedDecimal = new BigDecimal(finishedTaskNum); BigDecimal finishedDecimal = new BigDecimal(finishedTaskNum);
unit.setCompletionRate(finishedDecimal.divide(taskDecimal, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")) u.setCompletionRate(finishedDecimal.divide(taskDecimal, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"))
.setScale(2, RoundingMode.HALF_UP)); .setScale(2, RoundingMode.HALF_UP));
} }
unitPage.setRecords(unitList); unitPage.setRecords(unitList);
@ -126,32 +176,61 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
} }
/** /**
* 卫生自查数据导出 * 卫生自查计划数据详情
*/
@Override
public HygienePlanDetailVO getPlan(Long id) {
HygienePlanEntity hygienePlanEntity = this.getById(id);
HygienePlanDetailVO hygienePlanDetailVO = new HygienePlanDetailVO();
BeanUtils.copyProperties(hygienePlanEntity, hygienePlanDetailVO);
// 查询关联责任区数据
List<HygieneZoneEntity> zoneList = hygieneZoneService.getReferenceZone(id);
hygienePlanDetailVO.setZoneList(zoneList);
return hygienePlanDetailVO;
}
/**
* 计算累计分值
* @param scores 各项分值
* @param standardScore 标准总分值
* @return 累计分值等于标准总分值时返回数据否则返回错误信息
*/
private R getSumScore(String[] scores, Integer standardScore) {
int sum = 0;
for (String score : scores) {
sum += Integer.parseInt(score);
if (sum > standardScore) {
return R.fail("累计分值已超过标准总分值");
}
}
return sum < standardScore ? R.fail("标准总分值未全部分配") : R.data(sum);
}
/**
* 根据编码查询卫生自查计划
*/
@Override
public HygienePlanEntity getPlanByCode(String code) {
QueryWrapper<HygienePlanEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(HygienePlanEntity::getCode, code);
return this.getOne(queryWrapper);
}
/**
* 月度数据导出
*/ */
@Override @Override
public void exportHygieneData(Map<String, Object> param, HttpServletResponse response) { public void exportMonthData(Map<String, Object> param, Query query, HttpServletResponse response) {
ServletOutputStream outputStream = null; ServletOutputStream outputStream = null;
try { try {
outputStream = response.getOutputStream(); outputStream = response.getOutputStream();
String unit = String.valueOf(param.get("unit")); String unit = String.valueOf(param.get("unit"));
String startTime = String.valueOf(param.get("scheduledStartTime")); String month = String.valueOf(param.get("month"));
String endTime = String.valueOf(param.get("scheduledEndTime")); IPage<HygieneMonthVO> monthPage = dataByMonth(month, unit, query);
List<HygieneExportDTO> rehearsalList = getHygieneByUnitAndDate(unit, startTime, endTime); List<HygieneMonthVO> records = monthPage.getRecords();
// 处理卫生自查状态信息
rehearsalList.forEach(record -> {
String status;
if (record.getHygieneStatus().equals(HygieneStatusEnum.WAITING.getValue())) {
status = HygieneStatusEnum.WAITING.getDesc();
} else if (record.getHygieneStatus().equals(HygieneStatusEnum.UNFINISHED.getValue())) {
status = HygieneStatusEnum.UNFINISHED.getDesc();
} else {
status = HygieneStatusEnum.FINISHED.getDesc();
}
record.setHygieneStatus(status);
});
// 设置响应头 // 设置响应头
// URLEncoder.encode防止中文乱码 // URLEncoder.encode防止中文乱码
String fileName = URLEncoder.encode("卫生自查数据表", "UTF-8"); String fileName = URLEncoder.encode("卫生自查月度统计表", "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
@ -162,52 +241,24 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
.registerConverter(new LongStringConverter()) .registerConverter(new LongStringConverter())
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(25)) .registerWriteHandler(new SimpleColumnWidthStyleStrategy(25))
.build(); .build();
WriteSheet writeSheet = EasyExcel.writerSheet(1, "卫生自查数据表").head(HygieneExportDTO.class) WriteSheet writeSheet = EasyExcel.writerSheet(1, "卫生自查月度统计表").head(HygieneMonthVO.class)
.build(); .build();
excelWriter.write(rehearsalList, writeSheet); excelWriter.write(records, writeSheet);
excelWriter.finish(); excelWriter.finish();
} catch (Exception e) { } catch (Exception e) {
// 重置response // 重置response
response.reset(); response.reset();
response.setContentType("application/json"); response.setContentType("application/json");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
throw new ServiceException("卫生自查数据导出异常: " + e.getMessage()); throw new ServiceException("卫生自查月度数据导出异常: " + e.getMessage());
} finally { } finally {
if (outputStream != null) { if (outputStream != null) {
try { try {
outputStream.close(); outputStream.close();
} catch (IOException e) { } catch (IOException e) {
log.error("卫生自查导出响应头输出流关闭异常: " + e.getMessage()); log.error("卫生自查月度数据导出输出流关闭异常: " + e.getMessage());
} }
} }
} }
} }
/**
* 计算累计分值
* @param scores 各项分值
* @param standardScore 标准总分值
* @return 累计分值等于标准总分值时返回数据否则返回错误信息
*/
private R getSumScore(String[] scores, Integer standardScore) {
int sum = 0;
for (String score : scores) {
sum += Integer.parseInt(score);
if (sum > standardScore) {
return R.fail("累计分值已超过标准总分值");
}
}
return sum < standardScore ? R.fail("标准总分值未全部分配") : R.data(sum);
}
/**
* 根据单位和计划时间查询卫生自查记录
* @param unit 单位
* @param startTime 计划开始时间
* @param endTime 计划结束时间
* @return 卫生自查记录
*/
public List<HygieneExportDTO> getHygieneByUnitAndDate(String unit, String startTime, String endTime) {
return baseMapper.getHygieneByUnitAndDate(unit, startTime, endTime);
}
} }

148
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java

@ -1,26 +1,48 @@
package com.hnac.hzims.safeproduct.service.impl; package com.hnac.hzims.safeproduct.service.impl;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.converters.longconverter.LongStringConverter;
import com.alibaba.excel.util.CollectionUtils; import com.alibaba.excel.util.CollectionUtils;
import com.alibaba.excel.write.merge.LoopMergeStrategy;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.safeproduct.dto.HygieneRecordDTO;
import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity;
import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity; import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper; import com.hnac.hzims.safeproduct.mapper.HygienePlanMapper;
import com.hnac.hzims.safeproduct.mapper.HygieneRecordMapper; import com.hnac.hzims.safeproduct.mapper.HygieneRecordMapper;
import com.hnac.hzims.safeproduct.service.IHygieneRecordService; import com.hnac.hzims.safeproduct.service.IHygieneRecordService;
import com.hnac.hzims.safeproduct.service.IHygieneZoneService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.HygieneRecordPageVO;
import com.hnac.hzims.safeproduct.vo.HygieneZoneDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO; import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.ss.usermodel.CellStyle;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.temporal.WeekFields; import java.time.temporal.WeekFields;
import java.util.Date; import java.util.*;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -35,6 +57,9 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
@Resource @Resource
HygienePlanMapper hygienePlanMapper; HygienePlanMapper hygienePlanMapper;
@Autowired
IHygieneZoneService hygieneZoneService;
/** /**
* 删除关联卫生自查记录 * 删除关联卫生自查记录
*/ */
@ -56,36 +81,28 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
* 新增卫生自查记录 * 新增卫生自查记录
*/ */
@Override @Override
public R saveRecord(HygieneRecordEntity hygieneRecordEntity) { public R saveRecord(HygieneRecordDTO hygieneRecordDTO) {
HygieneRecordEntity hygieneRecordEntity = new HygieneRecordEntity();
BeanUtils.copyProperties(hygieneRecordDTO, hygieneRecordEntity);
// 编码生成 // 编码生成
// 获取当月时间(yyyymm) // 获取当月时间(yyyymm)
String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date()); String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date());
// 查询是否存在同月编号 // 查询是否存在同月编号
String lastCode = getLastCode(currentMonth); String lastCode = getLastCode(currentMonth);
// 若不存在,新增编号 // 若不存在,新增编号
String code; String code = BaseUtil.getUniqueCode("WSZC", lastCode, currentMonth);
if (StringUtils.isNull(lastCode)) {
code = "WSZC" + currentMonth + "001";
} else { // 若存在,编号递增
String oldNum = lastCode.substring(lastCode.length() - 3);
int value = Integer.parseInt(oldNum) + 1;
// 根据数位拼接编号
if (value < 10) {
code = "WSZC" + currentMonth + "00" + value;
} else if (value < 100) {
code = "WSZC" + currentMonth + "0" + value;
} else {
code = "WSZC" + currentMonth + value;
}
}
hygieneRecordEntity.setCode(code); hygieneRecordEntity.setCode(code);
// 周数计算 // 周数计算
int weekNum = getWeekNum(hygieneRecordEntity.getActualEndTime()); int weekNum = getWeekNum(hygieneRecordEntity.getActualEndTime());
hygieneRecordEntity.setWeekNum(weekNum); hygieneRecordEntity.setWeekNum(weekNum);
// 综合评分判断 // 综合评分判断
HygienePlanEntity hygienePlanEntity = hygienePlanMapper.selectById(hygieneRecordEntity.getHygienePlanId()); HygienePlanEntity hygienePlanEntity = hygienePlanMapper.selectById(hygieneRecordEntity.getHygienePlanId());
if (hygieneRecordEntity.getComprehensiveScore().compareTo(hygienePlanEntity.getStandardScore()) > 0) { String[] scores = hygieneRecordEntity.getComprehensiveScore().split(",|,");
return R.fail("评分不能大于标准总分值"); for (String score : scores) {
int sc = Integer.parseInt(score);
if (sc > hygienePlanEntity.getStandardScore()) {
return R.fail("评分不能大于标准总分值");
}
} }
return R.status(this.save(hygieneRecordEntity)); return R.status(this.save(hygieneRecordEntity));
} }
@ -94,14 +111,20 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
* 修改卫生自查记录 * 修改卫生自查记录
*/ */
@Override @Override
public R updateRecord(HygieneRecordEntity hygieneRecordEntity) { public R updateRecord(HygieneRecordDTO hygieneRecordDTO) {
HygieneRecordEntity hygieneRecordEntity = new HygieneRecordEntity();
BeanUtils.copyProperties(hygieneRecordDTO, hygieneRecordEntity);
// 周数计算 // 周数计算
int weekNum = getWeekNum(hygieneRecordEntity.getActualEndTime()); int weekNum = getWeekNum(hygieneRecordEntity.getActualEndTime());
hygieneRecordEntity.setWeekNum(weekNum); hygieneRecordEntity.setWeekNum(weekNum);
// 综合评分判断 // 综合评分判断
HygienePlanEntity hygienePlanEntity = hygienePlanMapper.selectById(hygieneRecordEntity.getHygienePlanId()); HygienePlanEntity hygienePlanEntity = hygienePlanMapper.selectById(hygieneRecordEntity.getHygienePlanId());
if (hygieneRecordEntity.getComprehensiveScore().compareTo(hygienePlanEntity.getStandardScore()) > 0) { String[] scores = hygieneRecordEntity.getComprehensiveScore().split(",|,");
return R.fail("评分不能大于标准总分值"); for (String score : scores) {
int sc = Integer.parseInt(score);
if (sc > hygienePlanEntity.getStandardScore()) {
return R.fail("评分不能大于标准总分值");
}
} }
return R.status(this.updateById(hygieneRecordEntity)); return R.status(this.updateById(hygieneRecordEntity));
} }
@ -111,7 +134,80 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
*/ */
@Override @Override
public HygieneRecordDetailVO getRecordDetail(Long id) { public HygieneRecordDetailVO getRecordDetail(Long id) {
return baseMapper.getRecordDetail(id); HygieneRecordDetailVO recordDetailVO = baseMapper.getRecordDetail(id);
String[] zoneIds = recordDetailVO.getHygieneZoneIds().split(",|,");
String[] results = recordDetailVO.getCheckResult().split(",|,");
String[] scores = recordDetailVO.getComprehensiveScore().split(",|,");
List<HygieneZoneDetailVO> checkDetailVOList = new ArrayList<>();
for (int i = 0; i < zoneIds.length ; i++) {
HygieneZoneDetailVO zoneDetailVO = new HygieneZoneDetailVO();
HygieneZoneEntity hygieneZoneEntity = hygieneZoneService.getById(zoneIds[i]);
BeanUtils.copyProperties(hygieneZoneEntity, zoneDetailVO);
zoneDetailVO.setResult(results[i]);
zoneDetailVO.setScore(Integer.parseInt(scores[i]));
checkDetailVOList.add(zoneDetailVO);
}
recordDetailVO.setCheckList(checkDetailVOList);
return recordDetailVO;
}
/**
* 卫生自查记录页面
*/
@Override
public IPage<HygieneRecordPageVO> recordPage(Map<String, Object> param, Query query) {
IPage<HygieneRecordPageVO> page = new Page<>(query.getCurrent(), query.getSize());
return baseMapper.recordPage(page, param);
}
/**
* 卫生自查数据导出
*/
@Override
public void exportHygieneData(Long hygieneRecordId, HttpServletResponse response) {
ServletOutputStream outputStream = null;
try {
outputStream = response.getOutputStream();
HygieneRecordDetailVO recordDetailVO = getRecordDetail(hygieneRecordId);
List<HygieneZoneDetailVO> records = recordDetailVO.getCheckList();
// 设置响应头
// URLEncoder.encode防止中文乱码
String fileName = URLEncoder.encode("卫生自查记录数据表", "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
// ExcelWriter初始化
ExcelWriter excelWriter = EasyExcel
.write(response.getOutputStream())
.autoCloseStream(Boolean.TRUE)
.registerConverter(new LongStringConverter())
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(25))
.build();
Date endTime = recordDetailVO.getActualEndTime();
String name = DateUtil.format(endTime, "yyyy年mm月") + "第" + recordDetailVO.getWeekNum() + "周卫生自查表";
List<String> head = new ArrayList<>();
head.add(name);
WriteSheet writeSheet = EasyExcel.writerSheet(1, "卫生自查记录数据表")
.head(Collections.singletonList(head))
.head(HygieneZoneDetailVO.class)
.build();
excelWriter.write(records, writeSheet);
excelWriter.finish();
} catch (Exception e) {
// 重置response
response.reset();
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
throw new ServiceException("卫生自查记录数据导出异常: " + e.getMessage());
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
log.error("卫生自查记录数据导出输出流关闭异常: " + e.getMessage());
}
}
}
} }
/** /**

42
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneZoneServiceImpl.java

@ -0,0 +1,42 @@
package com.hnac.hzims.safeproduct.service.impl;
import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import com.hnac.hzims.safeproduct.mapper.HygieneZoneMapper;
import com.hnac.hzims.safeproduct.service.IHygieneZoneService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class HygieneZoneServiceImpl extends ServiceImpl<HygieneZoneMapper, HygieneZoneEntity> implements IHygieneZoneService {
/**
* 删除关联责任区数据
*/
@Override
public boolean removeReferenceZone(Long hygienePlanId) {
QueryWrapper<HygieneZoneEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(HygieneZoneEntity::getHygienePlanId, hygienePlanId);
List<HygieneZoneEntity> zoneList = this.list(queryWrapper);
// 若无关联卫生自查责任区,直接返回true
if (CollectionUtils.isEmpty(zoneList)) {
return true;
}
List<Long> ids = zoneList.stream().map(HygieneZoneEntity::getId).collect(Collectors.toList());
return this.removeByIds(ids);
}
/**
* 查询关联责任区数据
*/
@Override
public List<HygieneZoneEntity> getReferenceZone(Long hygienePlanId) {
QueryWrapper<HygieneZoneEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(HygieneZoneEntity::getHygienePlanId, hygienePlanId);
return this.list(queryWrapper);
}
}

31
hzims-service/safeproduct/src/main/resources/db/1.0.1.sql

@ -80,7 +80,7 @@ CREATE TABLE `hzims_train_record` (
`train_record_name` varchar(50) NOT NULL DEFAULT '' COMMENT '培训记录名称', `train_record_name` varchar(50) NOT NULL DEFAULT '' COMMENT '培训记录名称',
`code` varchar(50) NOT NULL COMMENT '编号', `code` varchar(50) NOT NULL COMMENT '编号',
`people_name` varchar(5000) DEFAULT '' COMMENT '培训学员', `people_name` varchar(5000) DEFAULT '' COMMENT '培训学员',
`content` varchar(5000) DEFAULT '' COMMENT '培训内容', `content` mediumtext DEFAULT '' COMMENT '培训内容',
`actual_start_time` datetime DEFAULT NULL COMMENT '实际培训开始时间', `actual_start_time` datetime DEFAULT NULL COMMENT '实际培训开始时间',
`actual_end_time` datetime DEFAULT NULL COMMENT '实际培训结束时间', `actual_end_time` datetime DEFAULT NULL COMMENT '实际培训结束时间',
`command` varchar(250) DEFAULT NULL COMMENT '培训评价', `command` varchar(250) DEFAULT NULL COMMENT '培训评价',
@ -164,7 +164,7 @@ CREATE TABLE `hzims_conference_record` (
`actual_start_time` datetime DEFAULT NULL COMMENT '会议实际开始时间', `actual_start_time` datetime DEFAULT NULL COMMENT '会议实际开始时间',
`actual_end_time` datetime DEFAULT NULL COMMENT '会议实际结束时间', `actual_end_time` datetime DEFAULT NULL COMMENT '会议实际结束时间',
`recorder` varchar(20) DEFAULT '' COMMENT '记录人', `recorder` varchar(20) DEFAULT '' COMMENT '记录人',
`content` varchar(250) DEFAULT '' DEFAULT '' COMMENT '会议内容', `content` mediumtext DEFAULT '' DEFAULT '' COMMENT '会议内容',
`img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '会议图片', `img_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '会议图片',
`file_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '会议附件', `file_path` varchar(1000) NOT NULL DEFAULT '' COMMENT '会议附件',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',
@ -179,15 +179,27 @@ CREATE TABLE `hzims_conference_record` (
CREATE TABLE `hzims_hygiene_plan` ( CREATE TABLE `hzims_hygiene_plan` (
`id` bigint(20) NOT NULL COMMENT '主键id', `id` bigint(20) NOT NULL COMMENT '主键id',
`unit` varchar(50) NOT NULL COMMENT '单位', `code` varchar(50) NOT NULL COMMENT '编码',
`standard_score` int(10) NOT NULL DEFAULT '100' COMMENT '标准总分值',
`scheduled_start_time` date NOT NULL COMMENT '计划开始时间',
`scheduled_end_time` date NOT NULL COMMENT '计划结束时间',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',
`create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_user` bigint(20) DEFAULT '-1' COMMENT '更新人',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
`status` int(2) NOT NULL DEFAULT '1' COMMENT '状态',
`is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='卫生自查计划表' ROW_FORMAT=Dynamic;
CREATE TABLE `hzims_hygiene_zone` (
`id` bigint(20) NOT NULL COMMENT '主键id',
`hygiene_plan_id` bigint(20) NOT NULL COMMENT '卫生自查计划id',
`zone` varchar(50) NOT NULL COMMENT '责任区', `zone` varchar(50) NOT NULL COMMENT '责任区',
`principal` varchar(20) NOT NULL COMMENT '责任人', `principal` varchar(20) NOT NULL COMMENT '责任人',
`check_item` mediumtext NOT NULL COMMENT '检查项', `check_item` mediumtext NOT NULL COMMENT '检查项',
`check_item_score` varchar(255) NOT NULL COMMENT '检查项分值', `check_item_score` varchar(255) NOT NULL COMMENT '检查项分值',
`standard_score` int(10) NOT NULL DEFAULT '100' COMMENT '标准总分值',
`scheduled_start_time` date NOT NULL COMMENT '计划开始时间',
`scheduled_end_time` date NOT NULL COMMENT '计划结束时间',
`hygiene_status` varchar(20) NOT NULL DEFAULT 'WAITING' COMMENT '卫生自查状态',
`create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人', `create_user` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建人',
`create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门', `create_dept` bigint(20) NOT NULL DEFAULT '-1' COMMENT '创建部门',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
@ -196,14 +208,17 @@ CREATE TABLE `hzims_hygiene_plan` (
`status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态',
`is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (`id`) USING BTREE
) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='卫生自查表' ROW_FORMAT=Dynamic; ) ENGINE=INNODB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='卫生自查区域' ROW_FORMAT=Dynamic;
CREATE TABLE `hzims_hygiene_record` ( CREATE TABLE `hzims_hygiene_record` (
`id` bigint(20) NOT NULL COMMENT '主键id', `id` bigint(20) NOT NULL COMMENT '主键id',
`hygiene_plan_id` bigint(20) NOT NULL COMMENT '卫生自查计划id',
`unit` varchar(50) NOT NULL COMMENT '单位',
`code` varchar(50) NOT NULL COMMENT '编号', `code` varchar(50) NOT NULL COMMENT '编号',
`actual_start_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '实际开始时间', `actual_start_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '实际开始时间',
`actual_end_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '实际结束时间', `actual_end_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '实际结束时间',
`check_user` varchar(20) NOT NULL DEFAULT '' COMMENT '检查人', `check_user` varchar(20) NOT NULL DEFAULT '' COMMENT '检查人',
`hygiene_zone_ids` varchar(1000) NOT NULL COMMENT '卫生自查区域id',
`check_result` mediumtext NOT NULL COMMENT '检查结果', `check_result` mediumtext NOT NULL COMMENT '检查结果',
`comprehensive_score` int(10) NOT NULL COMMENT '综合评分', `comprehensive_score` int(10) NOT NULL COMMENT '综合评分',
`week_num` int(10) NOT NULL COMMENT '周数', `week_num` int(10) NOT NULL COMMENT '周数',

Loading…
Cancel
Save