|
|
@ -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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|