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