测试userviewjob,编写user view的逻辑

segment2.0
beeajax 2 years ago
parent 912240c873
commit dd4e946254

@ -24,7 +24,7 @@ public class RabbitMQProducer {
// */
// @RequestMapping(value = "/topicMQ01", method = {RequestMethod.GET})
// public List<TaskConfig> topicMQ01() {
// List<TaskConfig> users = userService.list(null);
// List<TaskConfig> users = userService.page(null);
// for (TaskConfig user : users) {
// rabbitTemplate.convertAndSend("topic.exchange", "jd.reg.msg", user.getName());
// }
@ -33,7 +33,7 @@ public class RabbitMQProducer {
//
// @RequestMapping(value = "/topicMQ02", method = {RequestMethod.GET})
// public List<TaskConfig> topicMQ02() {
// List<TaskConfig> users = userService.list(null);
// List<TaskConfig> users = userService.page(null);
// for (TaskConfig user : users) {
// rabbitTemplate.convertAndSend("topic.exchange", "tm.reg.msg", user.getName());
// }
@ -42,7 +42,7 @@ public class RabbitMQProducer {
//
// @RequestMapping(value = "/topicMQ03", method = {RequestMethod.GET})
// public List<TaskConfig> topicMQ03() {
// List<TaskConfig> users = userService.list(null);
// List<TaskConfig> users = userService.page(null);
// for (TaskConfig user : users) {
// rabbitTemplate.convertAndSend("topic.exchange", "super.fzb.reg.msg", user.getName());
// }

@ -13,92 +13,92 @@ spring:
#公司病案的文件服务数据库
master:
url: jdbc:log4jdbc:mysql://db.docus.cn:3306/docus_archivefile?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: docus
password: docus702
username: root
password: root
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
#公司病案的系统服务数据库
system:
url: jdbc:log4jdbc:mysql://db.docus.cn:3306/docus_system?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: docus
password: docus702
username: root
password: root
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
#公司病案的基础服务数据库
record:
url: jdbc:log4jdbc:mysql://db.docus.cn:3306/docus_medicalrecord?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: docus
password: docus702
username: root
password: root
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
#医院的用户/科室/基础数据的数据库
his:
url: jdbc:log4jdbc:mysql://127.0.0.1:3306/his?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root@123456
password: root
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
#病理数据
bl:
url: jdbc:log4jdbc:mysql://127.0.0.1:3306/his?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root@123456
password: root
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
#电生理系统数据
ecg:
url: jdbc:log4jdbc:mysql://127.0.0.1:3306/his?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root@123456
password: root
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
#电子病历系统数据
emr:
url: jdbc:log4jdbc:mysql://127.0.0.1:3306/his?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root@123456
password: root
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
#护理文书系统数据
hl:
url: jdbc:log4jdbc:mysql://127.0.0.1:3306/his?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root@123456
password: root
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
#手麻系统数据
issubmit:
url: jdbc:log4jdbc:mysql://127.0.0.1:3306/his?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root@123456
password: root
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
#lis系统数据
lis:
url: jdbc:log4jdbc:mysql://127.0.0.1:3306/lis?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root@123456
password: root
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
#Pacs系统数据视图
pacs:
url: jdbc:log4jdbc:mysql://127.0.0.1:3306/his?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root@123456
password: root
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
#vte静脉血栓栓塞症
vte:
url: jdbc:log4jdbc:mysql://127.0.0.1:3306/his?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root@123456
password: root
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
#重症系统数据
zz:
url: jdbc:log4jdbc:mysql://127.0.0.1:3306/his?autoReconnect=true&allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root@123456
password: root
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
type: com.alibaba.druid.pool.DruidDataSource
# rabbitmq:
@ -108,7 +108,7 @@ spring:
# password: guest
redis:
host: redis.docus.cn
password: JSdocus@702
# password: JSdocus@702
cloud:
nacos:
discovery:
@ -120,12 +120,47 @@ spring:
file-extension: yml
shared-configs:
- comm.${spring.cloud.nacos.config.file-extension}
rabbitmq:
addresses: 127.0.0.1
username: guest
password: guest
template:
mandatory: true
queue:
isAck: false
retryTimes: 5
publisher-confirms: true
publisher-returns: true
listener:
direct:
retry:
enabled: true
simple:
retry:
max-attempts: 3
docus:
dbtype: mysql
user:
# 用户默认密码
defpwd: fd29cd53ec12616e5f36b77d4afffbff
job:
enabled: false
doctorsyscode: 8
doctorassortid: AFB9FBE656D7492C80AEDE6E685A851A
#农垦重症
# lkzz:
# syscode: 15
# assortid: AFB9FBE656D7492C80AEDE6E685A851A
# url: http://localhost:9295/api/lkzz/icu/patientInfoIcuQueue/getPatientInfoIcuQueue?IcuQueueId=%s
# reportname: 危重症监护单
#0:默认1顺德
priority: 0
dispose:
#队列生成方式mq rabbitmq,redis
mode: redis
task:
taskurl: http://localhost:9296/api/noviewtask/GetTask
downurl: http://localhost:9291/api/downplatform/report
mybatis-plus:
configuration:
@ -172,3 +207,11 @@ xxl:
# name-server: 127.0.01:9876
# producer:
# group: ta-cipher-encode
basic:
#患者数据采集每页笔数
pageSize: 100
#限速笔数0:为不限数
ratelimit: 10000
#间隔时间,单位毫秒
ratetime: 10000

@ -44,13 +44,13 @@ public class LisViewCollectJob extends AbstractCollectJob<Map<String, Object>> {
@Override
public void batchInsertOrUpdate(List<Map<String, Object>> t) {
collectService.processJobView(t, DSKeyConstants.DS_KEY);
collectService.handle(t, DSKeyConstants.DS_KEY);
}
@SuppressWarnings("unchecked")
@Override
public List<Map<String, Object>> execute(Date startDate, Date endDate, int pageNum, int pageSize) {
//每家医院按照固定的格式写sql不同医院需要替换不同的sql即可。
return lisService.list(startDate, endDate, pageNum, pageSize);
return lisService.page(startDate, endDate, pageNum, pageSize);
}
}

@ -12,7 +12,7 @@ public class DocusProperties {
@Value("${docus.doctorassortid:}")
private String doctorassortid;
/**
*
*
*/
@Value("${docus.lkzz.syscode:}")
private String lkzzsyscode;
@ -29,64 +29,64 @@ public class DocusProperties {
private String priority;
/**
* mq rabbitmq,redis
* mq rabbitmq,redis
*/
@Value("${docus.dispose.mode:mq}")
@Value("${docus.dispose.mode:redis}")
private String mode;
/**
* url
* url
*/
@Value("${docus.task.taskurl:}")
private String taskurl;
/**
* url
* url
*/
@Value("${docus.task.downurl:}")
private String downurl;
/**
*
*
*/
@Value("${docus.noviewoutcollectionjobcron:0 0 0 * * ?}")
private String noviewoutcollectionjobcron;
/**
*
*
*/
@Value("${docus.taskrestartjobcron:0 0/30 * * * ?}")
private String taskrestartjobcron;
/**
*
*
*/
@Value("${docus.collectaddbasicdatajobcron:0/5 * * * * ?}")
private String collectaddbasicdatajobcron;
/**
*
*
*/
@Value("${docus.collectlkzzjobcron:0 0/10 * * * ?}")
private String collectlkzzjobcron;
/**
*
*
*/
@Value("${docus.collectlkzznotoutjobcron:0 0/30 * * * ?}")
private String collectlkzznotoutjobcron;
/**
*
*
*/
@Value("${docus.collectionrequiretimedatajobcron:0 0/30 * * * ?}")
private String collectionrequiretimedatajobcron;
/**
*
*
*/
@Value("${docus.noviewcollectionjobcron:0 0 0 * * ?}")
private String noviewcollectionjobcron;
/**
*
*
*/
@Value("${docus.collectionmakeupcron:0 0 0 * * ?}")
private String collectionmakeupcron;

@ -2,11 +2,15 @@ package com.docus.server.collect.web.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.docus.core.util.Func;
import com.docus.infrastructure.redis.service.IdService;
import com.docus.server.archivefile.pojo.entity.AfViewCollectionLog;
import com.docus.server.archivefile.service.IAfViewCollectionLogService;
import com.docus.server.collect.web.common.BasicProperties;
import com.docus.server.collect.web.common.DocusProperties;
import com.docus.server.collect.web.common.dto.BasicQueryDto;
import com.docus.server.collect.web.common.dto.CollectionForJZHDto;
import com.docus.server.collect.web.common.dto.CollectionSaveDto;
import com.docus.server.collect.web.enums.ColectNameEnum;
@ -17,6 +21,7 @@ import com.docus.server.collect.web.utils.MqQueueUtils;
import com.docus.server.collect.web.utils.RedisMq;
import com.docus.server.collect.web.utils.SpringRestTemplateUtils;
import com.docus.server.common.message.MqMessage;
import com.docus.server.lis.service.ILisService;
import com.docus.server.record.common.pojo.dto.TBasicDTO;
import com.docus.server.record.service.ITBasicService;
import com.docus.server.sys.common.pojo.dto.DeptDTO;
@ -37,13 +42,7 @@ import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
@Service
@ -66,13 +65,16 @@ public class CollectService {
private DocusProperties docusProperties;
@Resource
MqQueueUtils mqQueueUtils;
@Resource
Environment environment;
private String jzhkey = "FVISIT_ID";
private String syscodekey = "SYS_CODE";
private ILisService lisService;
@Resource
private Environment environment;
@Resource(name = "defRedis")
private RedisMq redisMq;
@Resource
private IAfViewCollectionLogService afViewCollectionLogService;
private String jzhkey = "FVISIT_ID";
private String syscodekey = "SYS_CODE";
/**
* 3
@ -126,7 +128,7 @@ public class CollectService {
&& operateType.contains(delType);
}
public void processJobView(List<Map<String, Object>> datas, String key) {
public void handle(List<Map<String, Object>> datas, String key) {
String mqKey = String.format("topic_task_%s_queue", key);
MqMessage mqMessage = new MqMessage();
//将key转为大写以免出错
@ -139,10 +141,10 @@ public class CollectService {
if (datas.get(0).containsKey(ColectNameEnum.EXAMTIME.value())
&& ((!datas.get(0).containsKey(ColectNameEnum.JZH.value())) || StringUtils.isEmpty(datas.get(0).get(ColectNameEnum.JZH.value())))) {
//根据住院号取得患者数据,根据报告时间属于哪个出入院时间之间,如无则按最近算
list = BatchForEXAMTIME(dto, datas);
list = BatchForEXAMTIME(datas);
} else {
//正常数据处理根据jzh取得患者本次病案采集器全部文件
list = BatchForJZH(dto, datas);
list = BatchForJZH(datas);
}
list = GenerateSDPriority(list);
if (list.size() > 0) {
@ -213,17 +215,19 @@ public class CollectService {
/**
* jzh
*
* @param dto
* @param datas
*/
private List<Map<String, Object>> BatchForJZH(BasicQueryDto dto, List<Map<String, Object>> datas) {
private List<Map<String, Object>> BatchForJZH(List<Map<String, Object>> datas) {
String oldJzhkey = "";
String syscode = String.valueOf(datas.get(0).get(syscodekey));
List<String> jzhs = datas.stream().map(t -> String.valueOf(t.get(jzhkey))).distinct().collect(Collectors.toList());
FieldJsonDto fieldJsonDto = dto.getFields().stream().filter(t -> t.getNewfield().equals(jzhkey)).findFirst().orElse(null);
if (fieldJsonDto != null) {
oldJzhkey = fieldJsonDto.getOldfield();
}
BasicQueryDto dto = new BasicQueryDto();
//没用
// FieldJsonDto fieldJsonDto = dto.getFields().stream().filter(t -> t.getNewfield().equals(jzhkey)).findFirst().orElse(null);
// if (fieldJsonDto != null) {
// oldJzhkey = fieldJsonDto.getOldfield();
// }
if (datas.get(0).containsKey(ColectNameEnum.MedicalRecord.value())) {
String MedicalRecord = String.valueOf(datas.get(0).get(ColectNameEnum.MedicalRecord.value()));
if (MedicalRecord.equals(MedicalRecordEnum.jzhAndTimes.value())) {
@ -238,13 +242,13 @@ public class CollectService {
}
private List<Map<String, Object>> GetColectionForJZHAndAdmissTimes(BasicQueryDto dto, String oldJzhkey, String syscode, List<String> jzhs, List<Map<String, Object>> datas) {
List<Map<String, Object>> batchcollects = repositiory.BatchForJZHAndAdmissTimes(dto, datas);
List<Map<String, Object>> batchcollects = lisService.BatchForJZHAndAdmissTimes(datas);
toReplaceBlank(batchcollects);
return GetColectionForJZH(syscode, jzhs, batchcollects);
}
private List<Map<String, Object>> GetColectionForZYHAndAdmissTimes(BasicQueryDto dto, String oldJzhkey, String syscode, List<String> jzhs, List<Map<String, Object>> datas) {
List<Map<String, Object>> batchcollects = repositiory.BatchForZYHAndAdmissTimes(dto, datas);
List<Map<String, Object>> batchcollects = lisService.BatchForZYHAndAdmissTimes(datas);
toReplaceBlank(batchcollects);
return GetColectionForJZH(syscode, jzhs, batchcollects);
}
@ -287,7 +291,10 @@ public class CollectService {
}
}
log.debug("recordlog:{}", recordlog);
List<AfViewCollectionLog> oldcollects = getOldConllectionLog(jzhs, syscode);
LambdaQueryWrapper<AfViewCollectionLog> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.in(AfViewCollectionLog::getJzh, jzhs).eq(AfViewCollectionLog::getSysCode, syscode);
List<AfViewCollectionLog> oldcollects = afViewCollectionLogService.find(queryWrapper);
// List<AfViewCollectionLog> oldcollects = getOldConllectionLog(jzhs, syscode);
List<Map<String, Object>> newcollects = new ArrayList<>();
List<AfViewCollectionLog> updates = new ArrayList<>();
List<AfViewCollectionLog> adds = new ArrayList<>();
@ -334,7 +341,10 @@ public class CollectService {
newcollects.add(o);
}
}
SaveConllectionLog(adds, updates);
afViewCollectionLogService.saveOrUpdateBatch(adds);
afViewCollectionLogService.saveOrUpdateBatch(updates);
return newcollects;
}
@ -388,7 +398,7 @@ public class CollectService {
}
}
private List<Map<String, Object>> BatchForEXAMTIME(BasicQueryDto dto, List<Map<String, Object>> datas) {
private List<Map<String, Object>> BatchForEXAMTIME(List<Map<String, Object>> datas) {
String oldJzhkey = "";
String syscode = String.valueOf(datas.get(0).get(ColectNameEnum.COLLECTID.value()));
List<String> zyhs = datas.stream().map(t -> String.valueOf(t.get(ColectNameEnum.ZYH.value()))).distinct().collect(Collectors.toList());
@ -459,7 +469,7 @@ public class CollectService {
}
//取得该患者全部住院文件
List<Map<String, Object>> batchcollects = repositiory.BatchForEXAMTIME(dto, list);
List<Map<String, Object>> batchcollects = lisService.BatchForEXAMTIME(list);
toReplaceBlank(batchcollects);
//添加记帐号
for (Map<String, Object> k : batchcollects) {
@ -482,8 +492,8 @@ public class CollectService {
private List<Map<String, Object>> GetColectionForJZH(BasicQueryDto dto, String oldJzhkey, String syscode, List<String> jzhs) {
jzhs = jzhs.stream().distinct().collect(Collectors.toList());
List<Map<String, Object>> batchcollects = repositiory.BatchForJZH(dto, oldJzhkey, jzhs);
log.debug("oldJzhKey:{} ,条件 {} 查询 table: {},size:{}", oldJzhkey, jzhs, dto.getTable().getOldtable(), batchcollects.size());
List<Map<String, Object>> batchcollects = lisService.BatchForJZH(jzhs);
log.debug("size:{}", batchcollects.size());
toReplaceBlank(batchcollects);
return GetColectionForJZH(syscode, jzhs, batchcollects);
}

@ -1,19 +1,16 @@
package com.docus.server.collect.web.utils;
import com.alibaba.fastjson.JSONArray;
import com.docus.viewtaskcollect.web.domain.dto.HoliDay;
import com.docus.server.collect.web.common.dto.HoliDay;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.*;
public class HoliDayUtil {
/**
*
*
* @param startTime
* @param endTime
* @return
@ -25,7 +22,7 @@ public class HoliDayUtil {
Date flag = startTime;
Calendar cal = Calendar.getInstance();
//循环遍历每个日期
while (flag.compareTo(endTime) <=0) {
while (flag.compareTo(endTime) <= 0) {
cal.setTime(flag);
//判断是否为周六日
int week = cal.get(Calendar.DAY_OF_WEEK) - 1;
@ -42,25 +39,27 @@ public class HoliDayUtil {
}
return holiDays;
}
/**
*
*
* @param startTime
* @param endTime
* @return
*/
public List<HoliDay> Getholidays(Date startTime, Date endTime){
public List<HoliDay> Getholidays(Date startTime, Date endTime) {
TableJsonRead tableJsonRead = new TableJsonRead();
String content = tableJsonRead.ReadContent("dataformat","holiday");
List<HoliDay> holiDays= JSONArray.parseArray(content,HoliDay.class);
String startdate = DateUtils.toString(startTime,DateUtils.DEFAULT_DATE_FORMAT);
String enddate = DateUtils.toString(endTime,DateUtils.DEFAULT_DATE_FORMAT);
List<HoliDay> reutnholiDays=new ArrayList<>();
if(null==holiDays||holiDays.size()<=0){
String content = tableJsonRead.ReadContent("dataformat", "holiday");
List<HoliDay> holiDays = JSONArray.parseArray(content, HoliDay.class);
String startdate = DateUtils.toString(startTime, DateUtils.DEFAULT_DATE_FORMAT);
String enddate = DateUtils.toString(endTime, DateUtils.DEFAULT_DATE_FORMAT);
List<HoliDay> reutnholiDays = new ArrayList<>();
if (null == holiDays || holiDays.size() <= 0) {
return reutnholiDays;
}
holiDays.sort(Comparator.comparing(t->t.getDate()));
for (HoliDay o: holiDays){
if(o.getDate().compareTo(startdate)>0 && o.getDate().compareTo(enddate)<=0){
holiDays.sort(Comparator.comparing(t -> t.getDate()));
for (HoliDay o : holiDays) {
if (o.getDate().compareTo(startdate) > 0 && o.getDate().compareTo(enddate) <= 0) {
reutnholiDays.add(o);
}
}

@ -7,7 +7,7 @@ import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Component("defRedis")
public class RedisMq {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@ -24,8 +24,7 @@ public class RedisMq {
stringRedisTemplate.opsForList().leftPush(Key, message);
}
public void deleteKey(String Key)
{
public void deleteKey(String Key) {
try {
redisTemplate.delete(Key);
} catch (Exception e) {
@ -33,8 +32,7 @@ public class RedisMq {
}
}
public void deleteAllKey(List<String> ids)
{
public void deleteAllKey(List<String> ids) {
try {
redisTemplate.delete(ids);
} catch (Exception e) {
@ -48,7 +46,6 @@ public class RedisMq {
}
/**
* ,null
* rightPop1.key,2.3.
@ -56,7 +53,7 @@ public class RedisMq {
* @return
*/
public String pop(String messageKey) {
String Key = messageKey;
String Key = messageKey;
try {
return stringRedisTemplate.opsForList().rightPop(Key);
} catch (Exception e) {
@ -68,10 +65,11 @@ public class RedisMq {
/**
* key
*
* @param messageKey
* @return
*/
public boolean IsExist(String messageKey){
public boolean IsExist(String messageKey) {
return stringRedisTemplate.hasKey(messageKey);
}

@ -0,0 +1,16 @@
package com.docus.server.common.db;
import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator;
import java.util.UUID;
public class KeyGenerator implements IKeyGenerator {
public static String genId() {
return UUID.randomUUID().toString().replace("-", "").toUpperCase();
}
@Override
public String executeSql(String incrementerName) {
return genId();
}
}

@ -0,0 +1,91 @@
package com.docus.server.common.db.type.handler;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedTypes;
import java.sql.*;
import java.time.LocalDateTime;
//用于兼容gbase localdatetime 转换
@MappedTypes(value = LocalDateTime.class)
public class LocalDateTimeTypeHandler extends BaseTypeHandler<LocalDateTime> {
//驱动是否原生支持
private Boolean isJdbcSupport;
private boolean getIsJdbcSupport(ResultSet rs, String columnName) {
if (isJdbcSupport == null) {
try {
rs.getObject(columnName, LocalDateTime.class);
isJdbcSupport = true;
} catch (Exception e) {
isJdbcSupport = false;
}
}
return isJdbcSupport;
}
private boolean getIsJdbcSupport(CallableStatement cs, int columnIndex) {
if (isJdbcSupport == null) {
try {
cs.getObject(columnIndex, LocalDateTime.class);
isJdbcSupport = true;
} catch (Exception e) {
isJdbcSupport = false;
}
}
return isJdbcSupport;
}
private boolean getIsJdbcSupport(ResultSet rs, int columnIndex) {
if (isJdbcSupport == null) {
try {
rs.getObject(columnIndex, LocalDateTime.class);
isJdbcSupport = true;
} catch (Exception e) {
isJdbcSupport = false;
}
}
return isJdbcSupport;
}
@Override
public void setNonNullParameter(PreparedStatement ps, int i, LocalDateTime localDateTime, JdbcType jdbcType) throws SQLException {
if (isJdbcSupport != null && isJdbcSupport) {
ps.setObject(i, localDateTime);
} else {
ps.setObject(i, Timestamp.valueOf(localDateTime));
}
}
@Override
public LocalDateTime getNullableResult(ResultSet resultSet, String columnName) throws SQLException {
if (getIsJdbcSupport(resultSet, columnName)) {
return resultSet.getObject(columnName, LocalDateTime.class);
} else {
Timestamp timestamp = resultSet.getTimestamp(columnName);
return timestamp == null ? null : timestamp.toLocalDateTime();
}
}
@Override
public LocalDateTime getNullableResult(ResultSet resultSet, int columnIndex) throws SQLException {
if (getIsJdbcSupport(resultSet, columnIndex)) {
return resultSet.getObject(columnIndex, LocalDateTime.class);
} else {
Timestamp timestamp = resultSet.getTimestamp(columnIndex);
return timestamp == null ? null : timestamp.toLocalDateTime();
}
}
@Override
public LocalDateTime getNullableResult(CallableStatement callableStatement, int columnIndex) throws SQLException {
if (getIsJdbcSupport(callableStatement, columnIndex)) {
return callableStatement.getObject(columnIndex, LocalDateTime.class);
} else {
Timestamp timestamp = callableStatement.getTimestamp(columnIndex);
return timestamp == null ? null : timestamp.toLocalDateTime();
}
}
}

@ -0,0 +1,91 @@
package com.docus.server.common.db.type.handler;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedTypes;
import java.sql.*;
import java.time.LocalDate;
//用于兼容gbase LocalDate 转换
@MappedTypes(value = LocalDate.class)
public class LocalDateTypeHandler extends BaseTypeHandler<LocalDate> {
//驱动是否原生支持
private Boolean isJdbcSupport;
private boolean getIsJdbcSupport(ResultSet rs, String columnName) {
if (isJdbcSupport == null) {
try {
rs.getObject(columnName, LocalDate.class);
isJdbcSupport = true;
} catch (Exception e) {
isJdbcSupport = false;
}
}
return isJdbcSupport;
}
private boolean getIsJdbcSupport(CallableStatement cs, int columnIndex) {
if (isJdbcSupport == null) {
try {
cs.getObject(columnIndex, LocalDate.class);
isJdbcSupport = true;
} catch (Exception e) {
isJdbcSupport = false;
}
}
return isJdbcSupport;
}
private boolean getIsJdbcSupport(ResultSet rs, int columnIndex) {
if (isJdbcSupport == null) {
try {
rs.getObject(columnIndex, LocalDate.class);
isJdbcSupport = true;
} catch (Exception e) {
isJdbcSupport = false;
}
}
return isJdbcSupport;
}
@Override
public void setNonNullParameter(PreparedStatement ps, int i, LocalDate localDate, JdbcType jdbcType) throws SQLException {
if (isJdbcSupport != null && isJdbcSupport) {
ps.setObject(i, localDate);
} else {
ps.setObject(i, Date.valueOf(localDate));
}
}
@Override
public LocalDate getNullableResult(ResultSet resultSet, String columnName) throws SQLException {
if (getIsJdbcSupport(resultSet, columnName)) {
return resultSet.getObject(columnName, LocalDate.class);
} else {
Date date = resultSet.getDate(columnName);
return date == null ? null : date.toLocalDate();
}
}
@Override
public LocalDate getNullableResult(ResultSet resultSet, int columnIndex) throws SQLException {
if (getIsJdbcSupport(resultSet, columnIndex)) {
return resultSet.getObject(columnIndex, LocalDate.class);
} else {
Date date = resultSet.getDate(columnIndex);
return date == null ? null : date.toLocalDate();
}
}
@Override
public LocalDate getNullableResult(CallableStatement callableStatement, int columnIndex) throws SQLException {
if (getIsJdbcSupport(callableStatement, columnIndex)) {
return callableStatement.getObject(columnIndex, LocalDate.class);
} else {
Date date = callableStatement.getDate(columnIndex);
return date == null ? null : date.toLocalDate();
}
}
}

@ -0,0 +1,91 @@
package com.docus.server.common.db.type.handler;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedTypes;
import java.sql.*;
import java.time.LocalTime;
//用于兼容gbase LocalTime 转换
@MappedTypes(value = LocalTime.class)
public class LocalTimeTypeHandler extends BaseTypeHandler<LocalTime> {
//驱动是否原生支持
private Boolean isJdbcSupport;
private boolean getIsJdbcSupport(ResultSet rs, String columnName) {
if (isJdbcSupport == null) {
try {
rs.getObject(columnName, LocalTime.class);
isJdbcSupport = true;
} catch (Exception e) {
isJdbcSupport = false;
}
}
return isJdbcSupport;
}
private boolean getIsJdbcSupport(CallableStatement cs, int columnIndex) {
if (isJdbcSupport == null) {
try {
cs.getObject(columnIndex, LocalTime.class);
isJdbcSupport = true;
} catch (Exception e) {
isJdbcSupport = false;
}
}
return isJdbcSupport;
}
private boolean getIsJdbcSupport(ResultSet rs, int columnIndex) {
if (isJdbcSupport == null) {
try {
rs.getObject(columnIndex, LocalTime.class);
isJdbcSupport = true;
} catch (Exception e) {
isJdbcSupport = false;
}
}
return isJdbcSupport;
}
@Override
public void setNonNullParameter(PreparedStatement ps, int i, LocalTime LocalTime, JdbcType jdbcType) throws SQLException {
if (isJdbcSupport != null && isJdbcSupport) {
ps.setObject(i, LocalTime);
} else {
ps.setObject(i, Time.valueOf(LocalTime));
}
}
@Override
public LocalTime getNullableResult(ResultSet resultSet, String columnName) throws SQLException {
if (getIsJdbcSupport(resultSet, columnName)) {
return resultSet.getObject(columnName, LocalTime.class);
} else {
Time time = resultSet.getTime(columnName);
return time == null ? null : time.toLocalTime();
}
}
@Override
public LocalTime getNullableResult(ResultSet resultSet, int columnIndex) throws SQLException {
if (getIsJdbcSupport(resultSet, columnIndex)) {
return resultSet.getObject(columnIndex, LocalTime.class);
} else {
Time time = resultSet.getTime(columnIndex);
return time == null ? null : time.toLocalTime();
}
}
@Override
public LocalTime getNullableResult(CallableStatement callableStatement, int columnIndex) throws SQLException {
if (getIsJdbcSupport(callableStatement, columnIndex)) {
return callableStatement.getObject(columnIndex, LocalTime.class);
} else {
Time time = callableStatement.getTime(columnIndex);
return time == null ? null : time.toLocalTime();
}
}
}

@ -13,10 +13,17 @@ import java.util.Map;
@DS(DSKeyConstants.DS_KEY)
public interface LisDeptMapper {
List<Map<String, Object>> list(@Param("startDate") Date startDate,
List<Map<String, Object>> page(@Param("startDate") Date startDate,
@Param("endDate") Date endDate,
@Param("offset") int offset,
@Param("pageSize") int pageSize);
List<Map<String, Object>> BatchForJZH(@Param("jzhs") List<String> jzhs);
List<Map<String, Object>> BatchForJZHAndAdmissTimes(@Param("datas") List<Map<String, Object>> datas);
List<Map<String, Object>> BatchForZYHAndAdmissTimes(@Param("datas") List<Map<String, Object>> datas);
List<Map<String, Object>> BatchForEXAMTIME(@Param("datas") List<Map<String, Object>> datas);
}

@ -8,9 +8,50 @@ import java.util.List;
import java.util.Map;
public interface ILisService {
List<Map<String, Object>> list(Date startDate, Date endDate, int pageNum, int pageSize);
/**
*
*
* @param startDate
* @param endDate
* @param pageNum
* @param pageSize
* @return
*/
List<Map<String, Object>> page(Date startDate, Date endDate, int pageNum, int pageSize);
List<UserDTO> getUserListView(Date startDate, Date endDate, int pageNum, int pageSize);
List<TBasicDTO> getTBasicListView(Date startDate, Date endDate, int pageNum, int pageSize);
/**
*
*
* @param jzhs
* @return
*/
List<Map<String, Object>> BatchForJZH(List<String> jzhs);
/**
* +
*
* @param datas
* @return
*/
List<Map<String, Object>> BatchForJZHAndAdmissTimes(List<Map<String, Object>> datas);
/**
* +
*
* @param datas
* @return
*/
List<Map<String, Object>> BatchForZYHAndAdmissTimes(List<Map<String, Object>> datas);
/**
*
*
* @param list
* @return
*/
List<Map<String, Object>> BatchForEXAMTIME(List<Map<String, Object>> list);
}

@ -22,8 +22,8 @@ public class LisServiceImpl implements ILisService {
private final LisTBasicMapper hisTBasicMapper;
@Override
public List<Map<String, Object>> list(Date startDate, Date endDate, int pageNum, int pageSize) {
return hisDeptMapper.list(startDate, endDate, (pageNum - 1) * pageSize, pageSize);
public List<Map<String, Object>> page(Date startDate, Date endDate, int pageNum, int pageSize) {
return hisDeptMapper.page(startDate, endDate, (pageNum - 1) * pageSize, pageSize);
}
@ -37,4 +37,24 @@ public class LisServiceImpl implements ILisService {
return hisTBasicMapper.getTBasicListView(startDate, endDate, (pageNum - 1) * pageSize, pageSize);
}
@Override
public List<Map<String, Object>> BatchForJZH(List<String> jzhs) {
return hisDeptMapper.BatchForJZH(jzhs);
}
@Override
public List<Map<String, Object>> BatchForJZHAndAdmissTimes(List<Map<String, Object>> datas) {
return hisDeptMapper.BatchForJZHAndAdmissTimes(datas);
}
@Override
public List<Map<String, Object>> BatchForZYHAndAdmissTimes(List<Map<String, Object>> datas) {
return hisDeptMapper.BatchForZYHAndAdmissTimes(datas);
}
@Override
public List<Map<String, Object>> BatchForEXAMTIME(List<Map<String, Object>> datas) {
return hisDeptMapper.BatchForEXAMTIME(datas);
}
}

@ -3,8 +3,8 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.docus.server.lis.infrastructure.mapper.LisDeptMapper">
<select id="list" resultType="java.util.Map">
<!--根据更新时间分页查询-->
<select id="page" resultType="java.util.Map">
SELECT DISTINCT
'6' AS SYS_CODE,
ZYH AS ZYH,
@ -19,7 +19,7 @@
0 AS state,
'' AS jch,
'' AS checktime,
AFFIRM_TIME AS MODIFYTIME
date_format(AFFIRM_TIME, '%Y-%m-%d %H:%i:%s') AS MODIFYTIME
FROM
V_JSWZH_LISRECORD
WHERE
@ -27,13 +27,123 @@
AND AFFIRM_TIME <![CDATA[ > ]]> #{startDate}
AND AFFIRM_TIME <![CDATA[ <= ]]> #{endDate}
ORDER BY
AFFIRM_TIME DESC
date_format(AFFIRM_TIME, '%Y-%m-%d %H:%i:%s') DESC
LIMIT #{offset}, #{pageSize}
</select>
<!--根据jzh取得所需采集的批量数据-->
<select id="BatchForJZH" resultType="java.util.Map">
SELECT
'6' AS SYS_CODE,
ZYH AS ZYH,
JZH AS FVISIT_ID,
FILE_NAME AS REPORT_NAME,
'' AS BGLX,
'1503577916225949698' AS ASSORTID,
EXAM_NO AS RP_EXAM_NO,
1 AS PATH_TYPE,
FILE_PATHFILE_PATH AS FILE_PATH,
0 AS ISDELETE,
0 AS state,
'' AS jch,
'' AS checktime,
AFFIRM_TIME AS MODIFYTIME
FROM
V_JSWZH_LISRECORD
WHERE
1 = 1
AND JZH IN
<foreach item="item" index="index" collection="jzhs" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<!--记账号+住院次数-->
<select id="BatchForJZHAndAdmissTimes" resultType="java.util.Map">
SELECT
'6' AS SYS_CODE,
ZYH AS ZYH,
JZH AS FVISIT_ID,
FILE_NAME AS REPORT_NAME,
'' AS BGLX,
'1503577916225949698' AS ASSORTID,
EXAM_NO AS RP_EXAM_NO,
1 AS PATH_TYPE,
FILE_PATHFILE_PATH AS FILE_PATH,
0 AS ISDELETE,
0 AS state,
'' AS jch,
'' AS checktime,
AFFIRM_TIME AS MODIFYTIME
FROM
V_JSWZH_LISRECORD
WHERE
1 = 1
and (
<foreach item="item" index="index" collection="datas" open="(" separator="," close=")">
(JZH =#{item.FVISIT_ID} and ADMISS_TIMES=#{item.ADMISS_TIMES}) or
</foreach>
)
</select>
<select id="BatchForZYHAndAdmissTimes" resultType="java.util.Map">
SELECT
'6' AS SYS_CODE,
ZYH AS ZYH,
JZH AS FVISIT_ID,
FILE_NAME AS REPORT_NAME,
'' AS BGLX,
'1503577916225949698' AS ASSORTID,
EXAM_NO AS RP_EXAM_NO,
1 AS PATH_TYPE,
FILE_PATHFILE_PATH AS FILE_PATH,
0 AS ISDELETE,
0 AS state,
'' AS jch,
'' AS checktime,
AFFIRM_TIME AS MODIFYTIME
FROM
V_JSWZH_LISRECORD
WHERE
1 = 1
and (
<foreach item="item" index="index" collection="datas" open="(" separator="," close=")">
(ZYH =#{item.ZYH} and ADMISS_TIMES=#{item.ADMISS_TIMES}) or
</foreach>
)
</select>
<select id="BatchForEXAMTIME" resultType="java.util.Map">
SELECT
'6' AS SYS_CODE,
ZYH AS ZYH,
JZH AS FVISIT_ID,
FILE_NAME AS REPORT_NAME,
'' AS BGLX,
'1503577916225949698' AS ASSORTID,
EXAM_NO AS RP_EXAM_NO,
1 AS PATH_TYPE,
FILE_PATHFILE_PATH AS FILE_PATH,
0 AS ISDELETE,
0 AS state,
'' AS jch,
'' AS checktime,
AFFIRM_TIME AS MODIFYTIME
FROM
V_JSWZH_LISRECORD
WHERE
1 = 1
and (
<foreach item="item" index="index" collection="datas" open="(" separator="," close=")">
(ZYH =#{item.ZYH} and EXAM_TIME <![CDATA[ >= ]]> STR_TO_DATE(#{item.admiss_date})
<if test="item.dis_date != null">
and EXAM_TIME <![CDATA[ <= ]]> STR_TO_DATE(#{item.dis_date})
</if>
</foreach>
)
</select>
<!-- mysql
<select id="list" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
<select id="page" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
SELECT `update_time` as update_time ,`dept_code` as dept_code,`dept_name` as dept_name FROM `his`.`his_dept`
WHERE update_time between #{startDate} and #{endDate}
order by update_time asc
@ -43,7 +153,7 @@
<!-- mssqsql
<select id="list" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
<select id="page" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
select top pageSize `update_time` as update_time ,`dept_code` as dept_code,`dept_name` as dept_name
from (select row_number()
over(order by sno asc) as rownumber,*
@ -53,7 +163,7 @@
-->
<!-- oracle
<select id="list" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
<select id="page" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
SELECT * FROM
(SELECT tt.*,ROWNUM AS RN FROM
(SELECT t.* FROM ${tableName} t

@ -13,7 +13,7 @@
<!-- mysql
<select id="list" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
<select id="page" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
SELECT `update_time` as update_time ,`dept_code` as dept_code,`dept_name` as dept_name FROM `his`.`his_dept`
WHERE update_time between #{startDate} and #{endDate}
order by update_time asc
@ -23,7 +23,7 @@
<!-- mssqsql
<select id="list" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
<select id="page" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
select top pageSize `update_time` as update_time ,`dept_code` as dept_code,`dept_name` as dept_name
from (select row_number()
over(order by sno asc) as rownumber,*
@ -33,7 +33,7 @@
-->
<!-- oracle
<select id="list" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
<select id="page" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
SELECT * FROM
(SELECT tt.*,ROWNUM AS RN FROM
(SELECT t.* FROM ${tableName} t

@ -13,7 +13,7 @@
<!-- mysql
<select id="list" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
<select id="page" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
SELECT `update_time` as update_time ,`dept_code` as dept_code,`dept_name` as dept_name FROM `his`.`his_dept`
WHERE update_time between #{startDate} and #{endDate}
order by update_time asc
@ -23,7 +23,7 @@
<!-- mssqsql
<select id="list" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
<select id="page" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
select top pageSize `update_time` as update_time ,`dept_code` as dept_code,`dept_name` as dept_name
from (select row_number()
over(order by sno asc) as rownumber,*
@ -33,7 +33,7 @@
-->
<!-- oracle
<select id="list" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
<select id="page" resultType="com.docus.server.sys.common.pojo.dto.DeptDTO">
SELECT * FROM
(SELECT tt.*,ROWNUM AS RN FROM
(SELECT t.* FROM ${tableName} t

Loading…
Cancel
Save