连州人民生成目录
parent
e54404474c
commit
a5d2f314dc
@ -1,85 +0,0 @@
|
||||
package com.example.duplicate.controller;
|
||||
|
||||
import com.example.duplicate.controller.vo.CommomtableCopyVo;
|
||||
import com.example.duplicate.infrastructure.configOneDao.CommomtableMapper;
|
||||
import com.example.duplicate.service.MessageLogService;
|
||||
import com.example.duplicate.service.MessageLogTwoService;
|
||||
import com.example.duplicate.service.MessageSubordinateService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ZJYYController
|
||||
* @Description 湛江医院接口
|
||||
* @Author linjj
|
||||
* @Date 2023/10/13 13:49
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@Api(value = "湛江医院接口", tags = "湛江医院相关接口", description = "湛江医院相关接口")
|
||||
@RequestMapping("/ZJYY")
|
||||
@Slf4j
|
||||
public class ZJYYController {
|
||||
|
||||
@Autowired
|
||||
MessageSubordinateService messageSubordinateService;
|
||||
@Autowired
|
||||
MessageLogService messageLogService;
|
||||
@Autowired
|
||||
MessageLogTwoService messageLogTwoService;
|
||||
@Autowired
|
||||
CommomtableMapper commomtableMapper;
|
||||
@RequestMapping(value = "delMessage" , method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "删除messageSubordinate内容" , notes = "删除messageSubordinate内容")
|
||||
public int delMessage() {
|
||||
return messageSubordinateService.delMessage();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "delMessageLog" , method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "删除messageLog内容" , notes = "删除messageLog内容")
|
||||
public int delMessageLog() {
|
||||
return messageLogService.delMessageLog();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "addMessageLog" , method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "移动messageLog内容" , notes = "移动messageLog内容")
|
||||
public int addMessageLog(){
|
||||
return messageLogTwoService.addMessageLog();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "addMessage" , method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "移动messageScanning表数据" , notes = "移动messageScanning表数据")
|
||||
public int addMessage(){
|
||||
return messageSubordinateService.addMessage();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "com" , method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public String com(){
|
||||
List<CommomtableCopyVo> com = commomtableMapper.com();
|
||||
for (CommomtableCopyVo list:com){
|
||||
StringBuffer sb=new StringBuffer();
|
||||
sb.append("(inp_no =' "+list.getInpatientNo()+" 'and visit_id = '"+list.getAdmissTimes()+" ' ) or");
|
||||
log.info(sb.toString());
|
||||
}
|
||||
return"";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
package com.example.duplicate.infrastructure.configTwoDao;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.duplicate.controller.vo.MessageLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName MessageLogMapper
|
||||
* @Description
|
||||
* @Author linjj
|
||||
* @Date 2023/10/13 13:58
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface MessageLogTwoMapper {
|
||||
|
||||
int addAll(@Param("list")List<MessageLog> list);
|
||||
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
package com.example.duplicate.infrastructure.configTwoDao;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.duplicate.controller.vo.MessageLog;
|
||||
import com.example.duplicate.controller.vo.MessageSubordinate;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName MessageLogMapper
|
||||
* @Description
|
||||
* @Author linjj
|
||||
* @Date 2023/10/13 13:58
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface MessageSubordinateTwoMapper {
|
||||
|
||||
int addAll(@Param("list")List<MessageSubordinate> list);
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.example.duplicate.infrastructure.configOneDao;
|
||||
package com.example.duplicate.infrastructure.dao;
|
||||
|
||||
import com.example.duplicate.controller.vo.AddArchiveDetail;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.example.duplicate.infrastructure.configOneDao;
|
||||
package com.example.duplicate.infrastructure.dao;
|
||||
|
||||
import com.example.duplicate.controller.vo.AddArchiveMasterVo;
|
||||
import com.example.duplicate.controller.vo.ArchiveMasterVo;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.example.duplicate.infrastructure.configOneDao;
|
||||
package com.example.duplicate.infrastructure.dao;
|
||||
|
||||
|
||||
import com.example.duplicate.controller.vo.*;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.example.duplicate.infrastructure.configOneDao;
|
||||
package com.example.duplicate.infrastructure.dao;
|
||||
|
||||
import com.example.duplicate.controller.vo.CommomtableCopyVo;
|
||||
import com.example.duplicate.controller.vo.ZdAssortVo;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.example.duplicate.infrastructure.configOneDao;
|
||||
package com.example.duplicate.infrastructure.dao;
|
||||
|
||||
|
||||
import com.example.duplicate.controller.vo.MessageLog;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.example.duplicate.infrastructure.configOneDao;
|
||||
package com.example.duplicate.infrastructure.dao;
|
||||
|
||||
|
||||
import com.example.duplicate.controller.vo.MessageSubordinate;
|
||||
@ -1,6 +1,5 @@
|
||||
package com.example.duplicate.infrastructure.configOneDao;
|
||||
package com.example.duplicate.infrastructure.dao;
|
||||
|
||||
import com.example.duplicate.controller.vo.AddArchiveDetail;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.example.duplicate.infrastructure.configOneDao;
|
||||
package com.example.duplicate.infrastructure.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.example.duplicate.controller.vo.FliePath;
|
||||
@ -1,15 +0,0 @@
|
||||
package com.example.duplicate.service;
|
||||
|
||||
/**
|
||||
* @ClassName MessageLogService
|
||||
* @Description MessageLog接口
|
||||
* @Author linjj
|
||||
* @Date 2023/10/13 15:19
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface MessageLogService {
|
||||
|
||||
int delMessageLog();
|
||||
|
||||
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
package com.example.duplicate.service;
|
||||
|
||||
/**
|
||||
* @ClassName MessageLogService
|
||||
* @Description MessageLog接口
|
||||
* @Author linjj
|
||||
* @Date 2023/10/13 15:19
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface MessageLogTwoService {
|
||||
|
||||
int addMessageLog();
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
package com.example.duplicate.service;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName ZJYYService
|
||||
* @Description 湛江医院接口
|
||||
* @Author linjj
|
||||
* @Date 2023/10/13 13:49
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface MessageSubordinateService {
|
||||
int delMessage();
|
||||
|
||||
int addMessage();
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
package com.example.duplicate.service.impl;
|
||||
|
||||
import com.example.duplicate.controller.vo.MessageLogVo;
|
||||
import com.example.duplicate.infrastructure.configOneDao.MessageLogMapper;
|
||||
import com.example.duplicate.service.MessageLogService;
|
||||
import com.example.utils.ListUtilsNew;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName MessageLogServiceImpl
|
||||
* @Description 湛江医院接口
|
||||
* @Author linjj
|
||||
* @Date 2023/10/13 15:19
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
public class MessageLogServiceImpl implements MessageLogService {
|
||||
@Autowired
|
||||
MessageLogMapper messageLogMapper;
|
||||
@Value("${ZJ_DATE_TIME_LOG}")
|
||||
private String dateTime;
|
||||
@Override
|
||||
public int delMessageLog() {
|
||||
//查询需要删除数据条数
|
||||
int messageLogNum = messageLogMapper.getMessageLogNum(dateTime);
|
||||
//需要次数
|
||||
double num = ((double) messageLogNum) / 100;
|
||||
int circulateNum= (int) Math.ceil(num);
|
||||
for (int i=0;i<circulateNum;i++){
|
||||
//查询需要删除数据的id每次查100条
|
||||
List<MessageLogVo> list = messageLogMapper.getAllByIds(dateTime);
|
||||
//id集合
|
||||
List<String> idList = ListUtilsNew.distinctSelect(list, MessageLogVo::getId);
|
||||
//转成逗号拼接
|
||||
String ids = String.join(",", idList);
|
||||
messageLogMapper.del(ids);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,52 +0,0 @@
|
||||
package com.example.duplicate.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.example.duplicate.controller.vo.MessageLog;
|
||||
import com.example.duplicate.infrastructure.configOneDao.MessageLogMapper;
|
||||
import com.example.duplicate.infrastructure.configTwoDao.MessageLogTwoMapper;
|
||||
import com.example.duplicate.service.MessageLogTwoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName MessageLogServiceImpl
|
||||
* @Description 湛江医院接口
|
||||
* @Author linjj
|
||||
* @Date 2023/10/13 15:19
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
public class MessageLogTwoServiceImpl implements MessageLogTwoService {
|
||||
@Autowired
|
||||
private MessageLogMapper messageLogMapper;
|
||||
@Autowired
|
||||
private MessageLogTwoMapper messageLogTwoMapper;
|
||||
@Value("${ZJ_DATE_TIME_LOG}")
|
||||
private String dateTime;
|
||||
|
||||
|
||||
@Override
|
||||
public int addMessageLog() {
|
||||
//查询需要移动数据条数
|
||||
int messageLogNum = messageLogMapper.getMessageLogNum(dateTime);
|
||||
//需要次数
|
||||
double num = ((double) messageLogNum) / 100;
|
||||
int circulateNum= (int) Math.ceil(num);
|
||||
for (int i=0;i<circulateNum;i++){
|
||||
//查询同步时间
|
||||
String synchronousTime = messageLogMapper.getSynchronousTime();
|
||||
//查询需要同步的数据每次查100条
|
||||
List<MessageLog> allBy = messageLogMapper.getAllBy(synchronousTime);
|
||||
//插入新数据库
|
||||
messageLogTwoMapper.addAll(allBy);
|
||||
//记录更新时间
|
||||
String dischargeDateTime = allBy.get(allBy.size() - 1).getDischargeDateTime();
|
||||
messageLogMapper.updateSynchronousTime(dischargeDateTime);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -1,143 +0,0 @@
|
||||
package com.example.duplicate.service.impl;
|
||||
|
||||
|
||||
import com.example.duplicate.controller.vo.ArchiveMasterVo;
|
||||
import com.example.duplicate.controller.vo.MessageLog;
|
||||
import com.example.duplicate.controller.vo.MessageSubordinate;
|
||||
import com.example.duplicate.controller.vo.MessageSubordinateVo;
|
||||
import com.example.duplicate.infrastructure.configOneDao.ArchiveMasterMapper;
|
||||
import com.example.duplicate.infrastructure.configOneDao.MessageLogMapper;
|
||||
import com.example.duplicate.infrastructure.configOneDao.MessageSubordinateMapper;
|
||||
import com.example.duplicate.infrastructure.configTwoDao.MessageLogTwoMapper;
|
||||
import com.example.duplicate.infrastructure.configTwoDao.MessageSubordinateTwoMapper;
|
||||
import com.example.duplicate.service.MessageSubordinateService;
|
||||
import com.example.utils.ListUtilsNew;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName ZJYYServiceImpl
|
||||
* @Description 湛江医院接口实现类
|
||||
* @Author linjj
|
||||
* @Date 2023/10/13 13:50
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MessageSubordinateServiceImpl implements MessageSubordinateService {
|
||||
|
||||
static final Logger logger = LoggerFactory.getLogger(MessageSubordinateServiceImpl.class);
|
||||
|
||||
@Value("${ZJ_DATE_TIME_MESSAGE}")
|
||||
private String dateTime;
|
||||
@Autowired
|
||||
MessageSubordinateMapper messageSubordinateMapper;
|
||||
@Autowired
|
||||
MessageSubordinateTwoMapper messageSubordinateTwoMapper;
|
||||
@Autowired
|
||||
ArchiveMasterMapper archiveMasterMapper;
|
||||
@Autowired
|
||||
MessageLogMapper messageLogMapper;
|
||||
@Autowired
|
||||
MessageLogTwoMapper messageLogTwoMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public int delMessage() {
|
||||
//查询需要删除数据条数
|
||||
int messageNum = messageSubordinateMapper.getMessageNum(dateTime);
|
||||
//需要次数
|
||||
double num = ((double) messageNum) / 100;
|
||||
int circulateNum = (int) Math.ceil(num);
|
||||
for (int i = 0; i < circulateNum; i++) {
|
||||
//查询需要删除数据的id每次查100条
|
||||
List<MessageSubordinateVo> list = messageSubordinateMapper.getAllByIds();
|
||||
//id集合
|
||||
List<String> idList = ListUtilsNew.distinctSelect(list, MessageSubordinateVo::getId);
|
||||
//转成逗号拼接
|
||||
String ids = String.join(",", idList);
|
||||
messageSubordinateMapper.del(ids);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addMessage() {
|
||||
//查询一共有多少份病历需要同步
|
||||
int masterIdNum = archiveMasterMapper.masterIdNum(dateTime);
|
||||
//需要次数
|
||||
double num = ((double) masterIdNum) / 100;
|
||||
//少数往前进1确保不丢失数据
|
||||
int circulateNum = (int) Math.ceil(num);
|
||||
for (int i = 0; i < circulateNum; i++) {
|
||||
//每次查询100份病历
|
||||
List<ArchiveMasterVo> masterId = archiveMasterMapper.getMasterId(dateTime);
|
||||
if (masterId.size() == 0) {
|
||||
return 0;
|
||||
}
|
||||
//masterId集合
|
||||
List<String> idList = ListUtilsNew.distinctSelect(masterId, ArchiveMasterVo::getId);
|
||||
//转成逗号拼接
|
||||
String masterIds = String.join(",", idList);
|
||||
//根据masterId查询message_log表
|
||||
List<MessageLog> messageLogList = messageLogMapper.getAllByMasterId(masterIds);
|
||||
//获取message_log表id集合
|
||||
List<String> messageLogId = ListUtilsNew.distinctSelect(messageLogList, MessageLog::getId);
|
||||
//如果档次100条记录没有messageLogId那么保存记录后结束本次循环
|
||||
if (messageLogId.size() == 0) {
|
||||
//保存处理过的masterId
|
||||
archiveMasterMapper.add(idList);
|
||||
continue;
|
||||
}
|
||||
//根据message_log表id操作message_subordinate表
|
||||
messageSubordinate(messageLogId);
|
||||
//操作完message_subordinate表操作message_log表
|
||||
messageLog(messageLogList);
|
||||
//保存处理过的masterId
|
||||
archiveMasterMapper.add(idList);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void messageSubordinate(List<String> messageLogId) {
|
||||
//分批次
|
||||
List<List<String>> newList = ListUtils.partition(messageLogId, 100);
|
||||
for (List<String> messageList : newList) {
|
||||
//转成字符串类型逗号拼接
|
||||
String messageLogIds = String.join(",", messageList);
|
||||
//查询100条
|
||||
List<MessageSubordinate> list = messageSubordinateMapper.getAllByMessageLogId(messageLogIds);
|
||||
if (list.size()==0){
|
||||
continue;
|
||||
}
|
||||
//往新表插入
|
||||
messageSubordinateTwoMapper.addAll(list);
|
||||
//新表插入完成删除旧表
|
||||
messageSubordinateMapper.del(messageLogIds);
|
||||
}
|
||||
}
|
||||
|
||||
private void messageLog(List<MessageLog> messageLogList) {
|
||||
List<List<MessageLog>> newList = ListUtils.partition(messageLogList, 100);
|
||||
for (List<MessageLog> messageList : newList) {
|
||||
//往新表中拆入数据
|
||||
messageLogTwoMapper.addAll(messageList);
|
||||
//获取这100条message_log表id集合
|
||||
List<String> ids = ListUtilsNew.distinctSelect(messageList, MessageLog::getId);
|
||||
//移除旧表数据
|
||||
String messageLogIds = String.join(",", ids);
|
||||
messageLogMapper.del(messageLogIds);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.example.duplicate.infrastructure.configTwoDao.MessageLogTwoMapper">
|
||||
<insert id="addAll">
|
||||
insert into message_log (id,create_time,end_time,execution_time,input_content,
|
||||
interface_name,out_content,out_json,remark,result,type,xml_create_time,xml_execution_time,
|
||||
master_id,webservice_info)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">(#{item.id},#{item.createTime},#{item.endTime},
|
||||
#{item.executionTime},#{item.inputContent},#{item.interfaceName},#{item.outContent},
|
||||
#{item.outJson},#{item.remark},#{item.result},#{item.type},#{item.xmlCreateTime},#{item.xmlExecutionTime},
|
||||
#{item.masterId},#{item.webserviceInfo}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.example.duplicate.infrastructure.configTwoDao.MessageSubordinateTwoMapper">
|
||||
|
||||
|
||||
<insert id="addAll">
|
||||
insert into message_subordinate (id,content_json,message_id,patient_main,status,remark,runs)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">(#{item.id},#{item.contentJson},#{item.messageId},
|
||||
#{item.patientMain},#{item.status},#{item.remark},#{item.runs}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue