Преглед на файлове

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/impl/VaccineInfoServiceImpl.java
Administrator преди 3 години
родител
ревизия
2a2c9ce8f6

+ 1 - 1
boman-modules/boman-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -100,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	
 	<select id="checkDeptNameUnique" resultMap="SysDeptResult">
 	    <include refid="selectDeptVo"/>
-		where dept_name=#{deptName} and parent_id = #{parentId} limit 1
+		where dept_name=#{deptName} and parent_id = #{parentId} and del_flag != 2 limit 1
 	</select>
     
     <insert id="insertDept" parameterType="com.boman.domain.SysDept">

+ 77 - 0
boman-web-core/src/main/java/com/boman/web/core/controller/MoveYmjzDataController.java

@@ -1,7 +1,10 @@
 package com.boman.web.core.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.boman.web.core.domain.VaccineInfoOperation;
 import com.boman.web.core.mapper.StandardlyMapper;
+import com.boman.web.core.service.vaccineInfo.impl.VaccineInfoServiceImpl;
+import com.boman.web.core.utils.IdUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RestController;
@@ -53,4 +56,78 @@ public class MoveYmjzDataController {
         return "循环了 " + moveData + " 条";
     }
 
+    @GetMapping("/moveData1")
+    public String moveYmjzData() throws Exception {
+        List<JSONObject> ymjzList = mapper.selectAll();
+        StringBuilder stringBuilder = new StringBuilder();
+        for (int i = 0; i < ymjzList.size(); i++) {
+            JSONObject ymjz = ymjzList.get(i);
+            String 受种者编码 = ymjz.getString("受种者编码");
+            String 受种者姓名 = ymjz.getString("受种者姓名");
+            String 受种者性别 = ymjz.getString("受种者性别");
+            String 出生日期 = ymjz.getString("出生日期");
+            String idCard = ymjz.getString("身份证");
+            String 电话号码 = ymjz.getString("电话号码");
+            String 工作单位 = ymjz.getString("工作单位");
+            String 人群分类 = ymjz.getString("人群分类");
+            String 接种单位 = ymjz.getString("接种单位");
+            String 接种疫苗 = ymjz.getString("接种疫苗");
+            String 生产厂家 = ymjz.getString("生产厂家");
+            String 接种针次 = ymjz.getString("接种针次");
+            String 接种日期 = ymjz.getString("接种日期");
+            VaccineInfoOperation info = mapper.getByIdCard(idCard);
+            Integer age = 0;
+            try {
+                age = VaccineInfoServiceImpl.getAge(idCard);
+            } catch (Exception e) {
+                age = null;
+            }
+            System.out.println("idCard: "+ idCard);
+            String process = VaccineInfoServiceImpl.getIsSuccess(生产厂家, 接种针次);
+            if (info == null) {
+                //insert
+                Long maxId = IdUtils.getMaxId("vaccine_info", "id");
+                String insert = String.format("insert into vaccine_info (`id`, `user_name`, `gender`, `id_card`" +
+                                ", `phone_num`, `is_vaccination`, `vaccine_name`, `jici`, `vaccination_time`" +
+                                ", `vaccination_place`, `should_be`, `progress` " +
+                                ", `code`, `birthday`, `work_unit`, `crowd_classification`, `manufacturer`, `age`) " +
+                                "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', )'; -- %s \r\n"
+                        , maxId, 受种者姓名, 受种者性别, idCard
+                        , 电话号码, "是", 生产厂家, 接种针次, 接种日期
+                        , 接种单位, "是", process
+                        , 受种者编码, 出生日期, 工作单位, 人群分类, 生产厂家, age
+                        , i);
+                stringBuilder.append(insert);
+                System.err.println("count: " + i + ", " + insert);
+            } else {
+                String update = String.format("UPDATE vaccine_info set code = '%s'" +
+                                ", crowd_classification = '%s', vaccine_name = '%s', manufacturer = '%s', jici = '%s', vaccination_time = '%s'" +
+                                ", age = '%s', birthday = '%s', process = '%s' where id_card = '%s'; -- %s \r\n"
+                        , 受种者编码, 人群分类, 生产厂家, 生产厂家, 接种针次, 接种日期, age, 出生日期, process, idCard, i);
+                stringBuilder.append(update);
+                System.err.println("count: " + i + ", " + update);
+            }
+
+            Long maxId = IdUtils.getMaxId("vaccine_info_user", "id");
+            String userInsert = String.format("insert into vaccine_info_user (id, id_card, vaccine_name, jici, vaccination_time, vaccination_place) " +
+                    "values('%s', '%s', '%s', '%s', '%s', '%s')", maxId, idCard, 生产厂家, 接种针次, 接种日期, 接种单位);
+            stringBuilder.append(userInsert);
+            System.err.println("count: " + i + ", " + userInsert);
+
+        }
+
+//        File file = new File("F:\\desk\\ymjz\\jmjl2021-09-18.sql");
+        File file = new File("/usr/local/sql/jmjl2021-09-18.sql");
+        if (!file.exists()) {
+            file.createNewFile();
+        }
+
+        FileWriter fileWriter = new FileWriter(file, true);
+        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
+        bufferedWriter.write(stringBuilder.toString());
+        bufferedWriter.close();
+
+        return "";
+    }
+
 }

+ 4 - 0
boman-web-core/src/main/java/com/boman/web/core/controller/VaccinationController.java

@@ -30,5 +30,9 @@ public class VaccinationController {
         return service.statistic();
     }
 
+    @GetMapping("/statisticYmjz")
+    public AjaxResult statisticYmjz() {
+        return AjaxResult.success(service.list());
+    }
 
 }

+ 19 - 0
boman-web-core/src/main/java/com/boman/web/core/mapper/StandardlyMapper.java

@@ -1,6 +1,7 @@
 package com.boman.web.core.mapper;
 
 import com.alibaba.fastjson.JSONObject;
+import com.boman.web.core.domain.VaccineInfoOperation;
 import com.boman.web.core.utils.ColumnUtils;
 import com.google.common.collect.Lists;
 import org.apache.commons.lang3.StringUtils;
@@ -83,6 +84,24 @@ public interface StandardlyMapper {
     @Select({"select count(1) FROM ${tableName} where ID = #{id} limit 1"})
     boolean existsById(@Param("tableName") String var1, @Param("id") long var2);
 
+    @Select({"select * from vaccination_statistic where is_del = 'N'"})
+    List<JSONObject> list();
+
+    @Select({"select * from vaccination_statistic where is_del = 'N' and xz = #{deptName}"})
+    List<JSONObject> list1(@Param("deptName") String deptName);
+
+    @Update({"update vaccination_statistic set is_del = 'Y'"})
+    int updateAll();
+
+    @Select("select * from ymjz20210918")
+    List<JSONObject> selectAll();
+
+    @Select("select * from vaccine_info")
+    List<JSONObject> listVacc();
+
+    @Select("select * from vaccine_info where id_card = #{idCard}")
+    VaccineInfoOperation getByIdCard(@Param("idCard") String idCard);
+
     @Select({"select count(1) FROM ${tableName} where id <> #{id} and ${column} = #{value} limit 1"})
     boolean existsWithoutId(@Param("tableName") String var1, @Param("id") long var2, @Param("column") String var4, @Param("value") Object var5);
 

+ 2 - 0
boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/IVaccineInfoService.java

@@ -75,4 +75,6 @@ public interface IVaccineInfoService
      * @return java.util.List<com.alibaba.fastjson.JSONObject>
      */
     AjaxResult statistic();
+
+    List<JSONObject> list();
 }

+ 27 - 2
boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/impl/VaccineInfoServiceImpl.java

@@ -17,12 +17,15 @@ import com.boman.system.api.RemoteDeptService;
 import com.boman.system.api.RemoteDictDataService;
 import com.boman.web.core.domain.VaccineInfoOperation;
 import com.boman.web.core.domain.VaccineInfoUser;
+import com.boman.web.core.mapper.StandardlyMapper;
 import com.boman.web.core.mapper.VaccineInfoMapper;
 import com.boman.web.core.mapper.VaccineInfoOperationMapper;
 import com.boman.web.core.mapper.VaccineInfoUserMapper;
+import com.boman.web.core.service.save.IBaseSaveService;
 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.IdUtils;
 import com.boman.web.core.utils.VaccineUtils;
 import com.github.pagehelper.PageHelper;
 import org.slf4j.Logger;
@@ -34,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.Size;
+import java.sql.Timestamp;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -67,6 +71,10 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
     private RemoteDictDataService remoteDictDataService;
     @Resource
     private RemoteDeptService remoteDeptService;
+    @Resource
+    private IBaseSaveService saveService;
+    @Resource
+    private StandardlyMapper standardlyMapper;
 
     /**
      * 查询疫苗信息
@@ -406,7 +414,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
      * @param jici
      * @return
      */
-    private String getIsSuccess(String vaccineName, String jici) {
+    public static String getIsSuccess(String vaccineName, String jici) {
         if ("北京科兴中维".equals(vaccineName)) {
             if ("2".equals(jici)) {
                 return "是";
@@ -884,6 +892,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
      * @return java.util.List<com.alibaba.fastjson.JSONObject>
      */
     @Override
+    @Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class)
     public AjaxResult statistic() {
         List<JSONObject> result = new ArrayList<>(17);
         List<SysDept> allTowns = remoteDeptService.getByParentId(1L);
@@ -893,7 +902,8 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
         long l = System.currentTimeMillis();
         List<VaccineInfoOperation> infoList = vaccineInfoMapper.listByTotalTaskCnt();
         LOGGER.info("查询用时: {} s", (System.currentTimeMillis() - l) / 1000);
-
+        // 暂且如此
+        standardlyMapper.updateAll();
         Date todayStart = DateUtils.getTodayStart(), todayEnd = DateUtils.getTodayEnd();
         for (String townName : townNameList) {
             int zrws = 0, zjzs = 0, drrws = 0, drjzs = 0, dez = 0, dsz = 0;
@@ -946,6 +956,12 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
             jsonObject.put("wcl2", NumberUtils.percent(dez + dsz, drjzs));
             LOGGER.info("疫苗接种统计数据为: {}", JSON.toJSONString(jsonObject));
             result.add(jsonObject);
+            jsonObject.put("create_time", new Timestamp(System.currentTimeMillis()));
+            jsonObject.put("update_time", new Timestamp(System.currentTimeMillis()));
+            jsonObject.put("update_by", SecurityUtils.getUsername());
+            Long maxId = IdUtils.getMaxId("vaccination_statistic", "id");
+            jsonObject.put("id", maxId);
+            saveService.insertRow("vaccination_statistic", jsonObject);
         }
 
         return AjaxResult.success("成功", result);
@@ -962,4 +978,13 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
         }
     }
 
+    @Override
+    public List<JSONObject> list() {
+        String deptName = AuthUtils.getLoginUser().getSysUser().getDept().getDeptName();
+        if("潜山市".equals(deptName)){
+            return standardlyMapper.list();
+        }
+
+        return standardlyMapper.list1(deptName);
+    }
 }

+ 5 - 6
boman-web-core/src/main/resources/mapper/VaccineInfoMapper.xml

@@ -328,12 +328,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT id_card, village_towns, vaccination_time, age, jici, vaccine_name
         FROM vaccine_info
         WHERE age > 18
-          AND (
-                contraindication IS NULL
-                OR suspend IS NULL
-                OR other IS NULL
-            );
     </select>
-
+<!--    AND (-->
+<!--    contraindication IS NULL-->
+<!--    OR suspend IS NULL-->
+<!--    OR other IS NULL-->
+<!--    );-->
 
 </mapper>