Browse Source

改成查表

master
zxc 3 years ago
parent
commit
e18c105d9e
  1. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/YTVaccineListDTO.java
  2. 64
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java
  3. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/YTVaccineListDTO.java

@ -12,7 +12,7 @@ import java.io.Serializable;
public class YTVaccineListDTO implements Serializable {
private static final long serialVersionUID = -5583350277850076659L;
private String idCard;
private String cardno;
/**
* 接种时间

64
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java

@ -1072,30 +1072,58 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
args.put("idcards", idCards);
// todo 疫苗接种视图
String json = "[\n" +
"{\n" +
"\t\"idCard\":\"370785195001012558\",\n" +
"\t\"inoculateDate\":\"2023-01-01 10:01\",\n" +
"\t\"lastStationName\":\"北京\"\n" +
"},\n" +
"{\n" +
"\t\"idCard\":\"370785195001012558\",\n" +
"\t\"inoculateDate\":\"2022-01-01 10:01\",\n" +
"\t\"lastStationName\":\"南京\"\n" +
"}\n" +
" {\n" +
" \"id\": \"751956862490071040\",\n" +
" \"cardno\": \"370785195001012558\",\n" +
" \"name\": \"李国玺\",\n" +
" \"data\":\n" +
" {\n" +
" \"vaccineList\":\n" +
" [\n" +
" {\n" +
" \"vaccineCount\": \"1\",\n" +
" \"inoculateDate\": \"2021-04-24 16:02:46\",\n" +
" \"lastStationName\": \"烟台市只楚医院临时接种点\"\n" +
" },\n" +
" {\n" +
" \"vaccineCount\": \"2\",\n" +
" \"inoculateDate\": \"2021-06-10 16:20:30\",\n" +
" \"lastStationName\": \"烟台市芝罘岛医院临时接种点\"\n" +
" },\n" +
" {\n" +
" \"vaccineCount\": \"3\",\n" +
" \"inoculateDate\": \"2021-12-10 15:12:24\",\n" +
" \"lastStationName\": \"烟台市芝罘岛医院临时接种点\"\n" +
" }\n" +
" ],\n" +
" \"flag\": 1\n" +
" },\n" +
" \"vaccineCount\": 3\n" +
" }\n" +
"]";
List<Map<String, Object>> vaccineList = new ArrayList<>();/*yantaiNamedParamLantuJdbcTemplate.queryForList(
"select id, name,card_no, create_time from hscyxxb where card_no in (:idcards)", args);*/
Map<String, Object> m = new HashMap<>();
vaccineList.add(m);
// List<Map> vaccineList = JSON.parseArray(json,Map.class);
List<Map<String,Object>> vaccineList = yantaiNamedParamLantuJdbcTemplate.queryForList(
"select data, name, card_no, vaccineCount from t_ymjz_info where card_no in (:idcards)", args);
List<YTVaccineListDTO> ytVaccineListDTOS = new ArrayList<>();
if (CollectionUtils.isNotEmpty(vaccineList)) {
vaccineList.forEach(v -> {
if (v.containsKey("data")){
Map<String, Object> data = (Map<String, Object>) v.get("data");
if (data.containsKey("vaccineList")){
List<YTVaccineListDTO> vaccineList1 = JSON.parseArray(data.get("vaccineList").toString(), YTVaccineListDTO.class);
vaccineList1.forEach(v1 -> {
v1.setCardno(v.get("cardno").toString());
});
ytVaccineListDTOS.addAll(vaccineList1);
}
}
});
List<IcVaccineEntity> entities = new ArrayList<>();
// List<YTVaccineListDTO> ytVaccineListDTOS = ConvertUtils.sourceToTarget(vaccineList, YTVaccineListDTO.class);
List<YTVaccineListDTO> ytVaccineListDTOS = JSON.parseArray(json,YTVaccineListDTO.class);
List<YTVaccineListDTO> existVaccine = icVaccineDao.getExistVaccine(ytVaccineListDTOS);
if (CollectionUtils.isNotEmpty(existVaccine)){
for (YTVaccineListDTO e : existVaccine) {
for (int i = 0; i < ytVaccineListDTOS.size(); i++) {
if (ytVaccineListDTOS.get(i).getIdCard().equals(e.getIdCard()) && ytVaccineListDTOS.get(i).getInoculateDate().equals(e.getInoculateDate())){
if (ytVaccineListDTOS.get(i).getCardno().equals(e.getCardno()) && ytVaccineListDTOS.get(i).getInoculateDate().equals(e.getInoculateDate())){
ytVaccineListDTOS.remove(i);
}
}
@ -1104,7 +1132,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
if (CollectionUtils.isNotEmpty(ytVaccineListDTOS)){
ytVaccineListDTOS.forEach(v -> {
resiInfos.forEach(u -> {
if (v.getIdCard().equals(u.getIdCard())){
if (v.getCardno().equals(u.getIdCard())){
IcVaccineEntity e = new IcVaccineEntity();
e.setCustomerId(customerId);
e.setName(u.getName());

2
epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml

@ -236,7 +236,7 @@
WHERE DEL_FLAG = '0'
AND (
<foreach collection="list" item="l" separator=" OR ">
(ID_CARD = #{l.idCard} AND DATE_FORMAT(INOCULATE_TIME, '%Y-%m-%d %H:%i') = #{l.inoculateDate})
(ID_CARD = #{l.cardno} AND DATE_FORMAT(INOCULATE_TIME, '%Y-%m-%d %H:%i') = #{l.inoculateDate})
</foreach>
)
</select>

Loading…
Cancel
Save