|
@@ -1,8 +1,11 @@
|
|
package com.boman.web.core.service.vaccineInfo.impl;
|
|
package com.boman.web.core.service.vaccineInfo.impl;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.boman.common.core.utils.DateUtils;
|
|
import com.boman.common.core.utils.DateUtils;
|
|
import com.boman.common.core.utils.SecurityUtils;
|
|
import com.boman.common.core.utils.SecurityUtils;
|
|
import com.boman.common.core.utils.StringUtils;
|
|
import com.boman.common.core.utils.StringUtils;
|
|
|
|
+import com.boman.common.core.utils.number.NumberUtils;
|
|
import com.boman.common.core.utils.obj.ObjectUtils;
|
|
import com.boman.common.core.utils.obj.ObjectUtils;
|
|
import com.boman.domain.SysDept;
|
|
import com.boman.domain.SysDept;
|
|
import com.boman.domain.dto.AjaxResult;
|
|
import com.boman.domain.dto.AjaxResult;
|
|
@@ -14,7 +17,11 @@ import com.boman.web.core.mapper.VaccineInfoMapper;
|
|
import com.boman.web.core.mapper.VaccineInfoOperationMapper;
|
|
import com.boman.web.core.mapper.VaccineInfoOperationMapper;
|
|
import com.boman.web.core.mapper.VaccineInfoUserMapper;
|
|
import com.boman.web.core.mapper.VaccineInfoUserMapper;
|
|
import com.boman.web.core.service.vaccineInfo.IVaccineInfoService;
|
|
import com.boman.web.core.service.vaccineInfo.IVaccineInfoService;
|
|
|
|
+import com.boman.web.core.service.vaccineInfo.IVaccineInfoUserService;
|
|
import com.boman.web.core.utils.AuthUtils;
|
|
import com.boman.web.core.utils.AuthUtils;
|
|
|
|
+import com.boman.web.core.utils.VaccineUtils;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Isolation;
|
|
import org.springframework.transaction.annotation.Isolation;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -26,6 +33,8 @@ import java.util.*;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
+import static com.boman.common.core.utils.StringUtils.isNotEmpty;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 疫苗信息Service业务层处理
|
|
* 疫苗信息Service业务层处理
|
|
*
|
|
*
|
|
@@ -35,6 +44,8 @@ import java.util.regex.Pattern;
|
|
@Service
|
|
@Service
|
|
public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
|
|
|
|
|
|
+ private static final Logger LOGGER = LoggerFactory.getLogger(VaccineInfoServiceImpl.class);
|
|
|
|
+
|
|
private static final String INSERT = "insert";
|
|
private static final String INSERT = "insert";
|
|
private static final String EDIT = "edit";
|
|
private static final String EDIT = "edit";
|
|
private static final String DELETE = "delete";
|
|
private static final String DELETE = "delete";
|
|
@@ -870,4 +881,89 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
|
|
String domic = vaccineInfo.getVillageTowns() + vaccineInfo.getVillage() + vaccineInfo.getVillagerGroup() + vaccineInfo.getDomicile();
|
|
String domic = vaccineInfo.getVillageTowns() + vaccineInfo.getVillage() + vaccineInfo.getVillagerGroup() + vaccineInfo.getDomicile();
|
|
vaccineInfo.setDomicile(domic);
|
|
vaccineInfo.setDomicile(domic);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 功能描述: 统计
|
|
|
|
+ *
|
|
|
|
+ * @return java.util.List<com.alibaba.fastjson.JSONObject>
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public AjaxResult statistic() {
|
|
|
|
+ List<JSONObject> result = new ArrayList<>(17);
|
|
|
|
+ List<SysDept> allTowns = remoteDeptService.getByParentId(1L);
|
|
|
|
+ List<String> townNameList = ObjectUtils.map(allTowns, SysDept::getDeptName);
|
|
|
|
+
|
|
|
|
+ LOGGER.info("开始查询");
|
|
|
|
+ long l = System.currentTimeMillis();
|
|
|
|
+ List<VaccineInfoOperation> infoList = vaccineInfoMapper.listByTotalTaskCnt();
|
|
|
|
+ LOGGER.info("查询用时: {} s", (System.currentTimeMillis() - l) / 1000);
|
|
|
|
+
|
|
|
|
+ Date todayStart = DateUtils.getTodayStart(), todayEnd = DateUtils.getTodayEnd();
|
|
|
|
+ for (String townName : townNameList) {
|
|
|
|
+ int zrws = 0, zjzs = 0, drrws = 0, drjzs = 0, dez = 0, dsz = 0;
|
|
|
|
+ JSONObject jsonObject = new JSONObject(10);
|
|
|
|
+ jsonObject.put("xz", townName);
|
|
|
|
+ for (VaccineInfoOperation info : infoList) {
|
|
|
|
+ if (!townName.equals(info.getVillageTowns())) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ // 总任务数
|
|
|
|
+ zrws++;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 总接种数
|
|
|
|
+ if (isNotEmpty(info.getJici())) {
|
|
|
|
+ if ("加强针".equals(info.getJici())) {
|
|
|
|
+ zjzs++;
|
|
|
|
+ } else if (Integer.parseInt(info.getJici()) >= 1) {
|
|
|
|
+ zjzs++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Date vaccinationTime = info.getVaccinationTime();
|
|
|
|
+ if (null != vaccinationTime && vaccinationTime.after(todayStart) && vaccinationTime.before(todayEnd)) {
|
|
|
|
+ drjzs++;
|
|
|
|
+ if ("2".equals(info.getJici())) {
|
|
|
|
+ dez++;
|
|
|
|
+ } else if ("3".equals(info.getJici())) {
|
|
|
|
+ dsz++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 接种时间和接种疫苗种类判断 当日任务数
|
|
|
|
+ if (null != vaccinationTime){
|
|
|
|
+ String vaccineName = info.getVaccineName();
|
|
|
|
+ judgeTodayTask(vaccineName, vaccinationTime, drrws, todayStart, todayEnd);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ jsonObject.put("zrws", zrws);
|
|
|
|
+ jsonObject.put("zjzs", zjzs);
|
|
|
|
+ jsonObject.put("wcl1", NumberUtils.percent(zjzs, zrws));
|
|
|
|
+ jsonObject.put("wwcs", zrws - zjzs);
|
|
|
|
+
|
|
|
|
+ jsonObject.put("drjzs", drjzs);
|
|
|
|
+ jsonObject.put("drrws", drrws);
|
|
|
|
+ jsonObject.put("dez", dez);
|
|
|
|
+ jsonObject.put("dsz", dsz);
|
|
|
|
+ jsonObject.put("hj", dez + dsz);
|
|
|
|
+ jsonObject.put("wcl2", NumberUtils.percent(dez + dsz, drjzs));
|
|
|
|
+ LOGGER.info("疫苗接种统计数据为: {}", JSON.toJSONString(jsonObject));
|
|
|
|
+ result.add(jsonObject);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return AjaxResult.success("成功", result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void judgeTodayTask(String vaccineName, Date vaccinationTime, int drrws, Date todayStart, Date todayEnd) {
|
|
|
|
+ Date nextTime = VaccineUtils.getNextTime(vaccineName, vaccinationTime);
|
|
|
|
+ if (nextTime == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (nextTime.before(todayEnd) && nextTime.after(todayStart)) {
|
|
|
|
+ drrws++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|