Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

Administrator 3 gadi atpakaļ
vecāks
revīzija
6bbf880945

+ 3 - 6
boman-modules/boman-system/src/main/java/com/boman/system/controller/SysDeptController.java

@@ -235,8 +235,8 @@ public class SysDeptController extends BaseController
             System.err.println("count: " + i + ", " + sql);
             moveData++;
         }
-/*        File file = new File("E:\\\\work\\vainfo.sql");
-//        File file = new File("//home//vainfo_update.sql");
+//        File file = new File("E:\\\\work\\vainfo.sql");
+        File file = new File("/usr/local/sql/vaccine_info.sql");
         if (!file.exists()) {
             file.createNewFile();
         }
@@ -244,10 +244,7 @@ public class SysDeptController extends BaseController
         FileWriter fileWriter = new FileWriter(file, true);
         BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
         bufferedWriter.write(stringBuilder.toString());
-        bufferedWriter.close();*/
-        for (String s : enpty) {
-            System.out.println(s);
-        }
+        bufferedWriter.close();
         return "循环了 " + moveData + " 条";
     }
 

+ 41 - 29
boman-web-core/src/main/java/com/boman/web/core/controller/MoveYmjzDataController.java

@@ -3,8 +3,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.IVaccineInfoService;
 import com.boman.web.core.service.vaccineInfo.impl.VaccineInfoServiceImpl;
 import com.boman.web.core.utils.IdUtils;
+import com.google.common.base.Strings;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RestController;
@@ -24,6 +26,8 @@ public class MoveYmjzDataController {
 
     @Resource
     private StandardlyMapper mapper;
+    @Resource
+    private IVaccineInfoService service;
 
     @GetMapping("/moveData/{limit}/{offset}")
     public String moveYmjzData(@PathVariable("limit") int limit, @PathVariable("offset") int offset) throws Exception {
@@ -59,8 +63,9 @@ public class MoveYmjzDataController {
     @GetMapping("/moveData1")
     public String moveYmjzData() throws Exception {
         List<JSONObject> ymjzList = mapper.selectAll();
+//        List<JSONObject> idCardUserNameList = mapper.listVacc();
         StringBuilder stringBuilder = new StringBuilder();
-        for (int i = 0; i < ymjzList.size(); i++) {
+        for (int i = 0; i < 30; i++) {
             JSONObject ymjz = ymjzList.get(i);
             String 受种者编码 = ymjz.getString("受种者编码");
             String 受种者姓名 = ymjz.getString("受种者姓名");
@@ -75,49 +80,56 @@ public class MoveYmjzDataController {
             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);
+//            VaccineInfoOperation info = mapper.getByIdCard(idCard);
+            String[] split = idCard.split("\\**\\**\\**\\**\\*");
+            VaccineInfoOperation info = mapper.getByCode(受种者编码, "%" + split[1] + "%", "%" + 受种者姓名 + "%");
             String progress = VaccineInfoServiceImpl.getIsSuccess(生产厂家, 接种针次);
             if (info == null) {
-                //insert
+//                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
+                                ", `vaccination_place`, `should_be`, `progress`, `should_slow` " +
+                                ", `code`, `birthday`, `work_unit`, `crowd_classification`, `manufacturer`, `age`, `dept_id`, `status`) " +
+                                "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'); -- %s \r\n"
+                        , maxId, 受种者姓名, 受种者性别, ymjz.getString("身份证")
                         , 电话号码, "是", 生产厂家, 接种针次, 接种日期
-                        , 接种单位, "是", progress
-                        , 受种者编码, 出生日期, 工作单位, 人群分类, 生产厂家, age
+                        , 接种单位, "是", progress, "否"
+                        , 受种者编码, 出生日期, 工作单位, 人群分类, 生产厂家, 0, 1, 2
                         , 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', progress = '%s' where id_card = '%s'; -- %s \r\n"
-                        , 受种者编码, 人群分类, 生产厂家, 生产厂家, 接种针次, 接种日期, age, 出生日期, progress, idCard, i);
-                stringBuilder.append(update);
-                System.err.println("count: " + i + ", " + update);
+//                idCard = info.getIdCard();
+//                Integer age = 0;
+//                try {
+//                    age = VaccineInfoServiceImpl.getAge(info.getIdCard());
+//                } catch (Exception e) {
+//                    age = null;
+//                }
+//                VaccineInfoServiceImpl.shouldSlow(info);
+//                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', progress = '%s'" +
+//                                ", dept_id = '%s', `is_vaccination` = '是', `should_be` = '%s', `should_slow` = '%s' " +
+//                                "where code = '%s' or (id_card like '%s' and user_name like '%s' ); -- %s \r\n"
+//                        , 受种者编码, 人群分类, 生产厂家, 生产厂家
+//                        , 接种针次, 接种日期, age, 出生日期, progress
+//                        , info.getDeptId(), Strings.nullToEmpty(info.getShouldBe()), Strings.nullToEmpty(info.getShouldSlow()),
+//                        受种者编码, "%" + split[1] + "%", "%" + 受种者姓名 + "%",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');\r\n", maxId, idCard, 生产厂家, 接种针次, 接种日期, 接种单位);
-            stringBuilder.append(userInsert);
-            System.err.println("count: " + i + ", " + userInsert);
-
+//            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');\r\n", maxId, idCard, 生产厂家, 接种针次, 接种日期, 接种单位);
+//            stringBuilder.append(userInsert);
+//            System.err.println("vaccine_info_user 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");
+        File file = new File("/usr/local/sql/jmjl2021-09-18-1.sql");
         if (!file.exists()) {
             file.createNewFile();
         }

+ 8 - 1
boman-web-core/src/main/java/com/boman/web/core/mapper/StandardlyMapper.java

@@ -93,7 +93,7 @@ public interface StandardlyMapper {
     @Update({"update vaccination_statistic set is_del = 'Y'"})
     int updateAll();
 
-    @Select("select * from ymjz20210918")
+    @Select("select * from ymjz20210923")
     List<JSONObject> selectAll();
 
     @Select("select * from vaccine_info")
@@ -102,6 +102,13 @@ public interface StandardlyMapper {
     @Select("select * from vaccine_info where id_card = #{idCard}")
     VaccineInfoOperation getByIdCard(@Param("idCard") String idCard);
 
+    @Select("select dept_id deptId, id_card idCard, contraindication, suspend, other, progress " +
+            "from vaccine_info where code = #{code} or (id_card like #{idCard} and user_name like #{userName} ) limit 1")
+    VaccineInfoOperation getByCode(@Param("code") String code, @Param("idCard") String idCard, @Param("userName") String userName);
+
+    @Select("select dept_id deptId, id_card idCard, contraindication, suspend, other, progress from vaccine_info where code = #{code} limit 1")
+    VaccineInfoOperation getByIdCarUserName(@Param("idCard") String idCard, @Param("userName") String userName);
+
     @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 - 2
boman-web-core/src/main/java/com/boman/web/core/service/vaccineInfo/impl/VaccineInfoServiceImpl.java

@@ -258,7 +258,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
     }
 
     //下一针接种 时间
-    private Date vaccinationTimeNext(Date vaccinationTime, String vaccineNameLast) {
+    public static Date vaccinationTimeNext(Date vaccinationTime, String vaccineNameLast) {
         Date date = new Date();
         if ("北京科兴中维".equals(vaccineNameLast)) {
             date = DateUtils.addDayOfDate(vaccinationTime, 14);
@@ -475,7 +475,7 @@ public class VaccineInfoServiceImpl implements IVaccineInfoService {
      * @param vaccineInfoOperation
      * @return
      */
-    public VaccineInfoOperation shouldSlow(VaccineInfoOperation vaccineInfoOperation) {
+    public static VaccineInfoOperation shouldSlow(VaccineInfoOperation vaccineInfoOperation) {
         List<VaccineInfoUser> vaccineInfoUserList = vaccineInfoOperation.getVaccineInfoUserList();
         //默认是
         vaccineInfoOperation.setShouldBe("是");