feat:佛山三院基础信息数据采集任务和逻辑
parent
ebe4497971
commit
c6b8f11cdd
@ -0,0 +1,108 @@
|
||||
package com.docus.server.archive.controller;
|
||||
|
||||
import com.docus.core.util.Func;
|
||||
import com.docus.infrastructure.web.api.CommonResult;
|
||||
import com.docus.server.archive.service.PatientInfoSyncService;
|
||||
import com.docus.server.fsy.entity.JswzhPatientInfoView;
|
||||
import com.docus.server.fsy.mapper.JswzhPatientInfoViewMapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author YongBin Wen
|
||||
* @date 2024/3/8 15:21
|
||||
*/
|
||||
@Slf4j
|
||||
@RequestMapping("/fssy-collect")
|
||||
@Api(tags = "佛山三院同步接口")
|
||||
@RestController
|
||||
public class FoShanSySyncController {
|
||||
@Resource
|
||||
private PatientInfoSyncService patientInfoSyncService;
|
||||
|
||||
@Resource
|
||||
private JswzhPatientInfoViewMapper jswzhPatientInfoViewMapper;
|
||||
|
||||
@ApiOperation(value = "根据时间进行同步出院数据 yyyy-MM-dd")
|
||||
@GetMapping("/sync/discharge")
|
||||
public CommonResult<String> syncDischarge(@RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate) {
|
||||
String pattern = "yyyy-MM-dd";
|
||||
int patternLen = pattern.length();
|
||||
if (startDate.length() != patternLen || endDate.length() != patternLen) {
|
||||
return CommonResult.failed("请传入正确的时间格式 yyyy-MM-dd");
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
|
||||
try {
|
||||
sdf.parse(startDate);
|
||||
sdf.parse(endDate);
|
||||
} catch (Exception ex) {
|
||||
return CommonResult.failed("请传入正确的时间格式 yyyy-MM-dd");
|
||||
}
|
||||
int page = 1;
|
||||
int size = 100;
|
||||
int total = 0;
|
||||
try {
|
||||
while (true) {
|
||||
int count = patientInfoSyncService.syncDischargeData(startDate + " 00:00:00", endDate + " 23:59:59", page, size);
|
||||
total += count;
|
||||
if (count == 0) {
|
||||
break;
|
||||
}
|
||||
page += 1;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("同步出院数据接口出错了!" + ex.getMessage(), ex);
|
||||
return CommonResult.success("同步失败");
|
||||
}
|
||||
return CommonResult.success("同步完成,共同步患者条数:" + total);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "同步在院数据")
|
||||
@GetMapping("/sync/inHospital")
|
||||
public CommonResult<String> syncInHospital() {
|
||||
try {
|
||||
patientInfoSyncService.syncInHospitalData();
|
||||
return CommonResult.success("同步完成");
|
||||
} catch (Exception ex) {
|
||||
log.error("同步在院数据接口出错!" + ex.getMessage(), ex);
|
||||
return CommonResult.success("同步出错!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation(value = "视图数据获取测试,根据时间范围获取100条出院数据(都传或者都不传) ,如果不传递时间,则获取在院数据")
|
||||
@GetMapping("/test/patientInfoViewGet")
|
||||
public CommonResult<List<JswzhPatientInfoView>> viewGet(@RequestParam(value = "startDate", required = false) String startDate, @RequestParam(value = "endDate", required = false) String endDate) {
|
||||
if (Func.isBlank(startDate) && Func.isBlank(endDate)) {
|
||||
List<JswzhPatientInfoView> inHospital = jswzhPatientInfoViewMapper.getInHospital();
|
||||
return CommonResult.success(inHospital);
|
||||
}
|
||||
if (Func.isBlank(startDate) || Func.isBlank(endDate)) {
|
||||
return CommonResult.failed("出院数据查询查询,时间都不为空!");
|
||||
}
|
||||
String pattern = "yyyy-MM-dd";
|
||||
int patternLen = pattern.length();
|
||||
if (startDate.length() != patternLen || endDate.length() != patternLen) {
|
||||
return CommonResult.failed("请传入正确的时间格式 yyyy-MM-dd");
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
|
||||
try {
|
||||
sdf.parse(startDate);
|
||||
sdf.parse(endDate);
|
||||
} catch (Exception ex) {
|
||||
return CommonResult.failed("请传入正确的时间格式 yyyy-MM-dd");
|
||||
}
|
||||
List<JswzhPatientInfoView> discharge = jswzhPatientInfoViewMapper.getDischarge(startDate + " 00:00:00", endDate + " 23:59:59", 1, 100);
|
||||
return CommonResult.success(discharge);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
package com.docus.server.archive.converter;
|
||||
|
||||
import com.docus.core.util.Func;
|
||||
import com.docus.server.archive.entity.TBasic;
|
||||
import com.docus.server.archive.utils.PingYinUtil;
|
||||
import com.docus.server.fsy.entity.JswzhPatientInfoView;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author YongBin Wen
|
||||
* @date 2024/3/27 14:52
|
||||
*/
|
||||
public class PatientInfoConverter {
|
||||
private final Map<String, String> userNameMap;
|
||||
private final Map<String, String> deptCodeNameMap;
|
||||
|
||||
public PatientInfoConverter(Map<String, String> userNameMap, Map<String, String> deptCodeNameMap) {
|
||||
this.deptCodeNameMap = deptCodeNameMap;
|
||||
this.userNameMap = userNameMap;
|
||||
}
|
||||
|
||||
public TBasic convertArchiveBasicInfo(JswzhPatientInfoView view) {
|
||||
if (view == null) {
|
||||
return null;
|
||||
}
|
||||
Objects.requireNonNull(userNameMap);
|
||||
Objects.requireNonNull(deptCodeNameMap);
|
||||
Map<String, Integer> ageMap = parseAge(view.getNL());
|
||||
|
||||
TBasic tBasic = new TBasic();
|
||||
tBasic.setJzh(view.getJZH());
|
||||
tBasic.setInpatientNo(view.getZY());
|
||||
tBasic.setAdmissTimes(view.getZYCS());
|
||||
tBasic.setName(view.getXM());
|
||||
tBasic.setNameSpell(PingYinUtil.getFirstSpell(view.getXM()));
|
||||
tBasic.setSex(sex(view.getXB()));
|
||||
tBasic.setSexName(sexName(view.getXB()));
|
||||
tBasic.setAdmissDate(view.getRYRQ());
|
||||
tBasic.setAdmissDept(view.getRYKSBQ());
|
||||
tBasic.setAdmissDeptName(view.getRYKSMC());
|
||||
tBasic.setBedNo(view.getCWDM());
|
||||
tBasic.setAttending(view.getDQYS());
|
||||
tBasic.setAttendingName(userNameMap.get(view.getDQYS()));
|
||||
tBasic.setAge(ageMap.get("age"));
|
||||
tBasic.setAgeMonth(ageMap.get("ageMonth"));
|
||||
tBasic.setAgeDay(ageMap.get("ageDay"));
|
||||
tBasic.setIdCard(view.getSFZH());
|
||||
tBasic.setTelphone(view.getLXDH());
|
||||
tBasic.setDisDate(view.getCYRQ());
|
||||
tBasic.setDisDept(view.getDQBQ());
|
||||
tBasic.setDisDeptName(view.getDQKS());
|
||||
tBasic.setTotalCost(view.getZJINE());
|
||||
tBasic.setIsDead(view.getSFSW());
|
||||
tBasic.setJzCardNo(view.getJZKH());
|
||||
tBasic.setFileSource(1);
|
||||
return tBasic;
|
||||
}
|
||||
|
||||
/**
|
||||
* age
|
||||
* ageMonth
|
||||
* ageDay
|
||||
*/
|
||||
public static Map<String, Integer> parseAge(String nl) {
|
||||
int age = 0;
|
||||
int ageMonth = 0;
|
||||
int ageDay = 0;
|
||||
if (Func.isNotBlank(nl)) {
|
||||
String[] split = nl.split("[岁月天]");
|
||||
int length = split.length;
|
||||
// 岁月天都有
|
||||
if (length == 3) {
|
||||
age = Integer.parseInt(split[0]);
|
||||
ageMonth = Integer.parseInt(split[1]);
|
||||
ageDay = Integer.parseInt(split[2]);
|
||||
}
|
||||
|
||||
if (length == 2) {
|
||||
// 情况一:岁月 情况二:月天
|
||||
if (nl.contains("岁")) {
|
||||
age = Integer.parseInt(split[0]);
|
||||
ageMonth = Integer.parseInt(split[1]);
|
||||
} else {
|
||||
ageMonth = Integer.parseInt(split[0]);
|
||||
ageDay = Integer.parseInt(split[1]);
|
||||
}
|
||||
}
|
||||
if (length == 1) {
|
||||
// 包含哪个是哪个
|
||||
if (nl.contains("岁")) {
|
||||
age = Integer.parseInt(split[0]);
|
||||
} else if (nl.contains("月")) {
|
||||
ageMonth = Integer.parseInt(split[0]);
|
||||
} else if (nl.contains("天")) {
|
||||
ageDay = Integer.parseInt(split[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
HashMap<String, Integer> map = new HashMap<>();
|
||||
map.put("age", age);
|
||||
map.put("ageMonth", ageMonth);
|
||||
map.put("ageDay", ageDay);
|
||||
return map;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(parseAge("1天"));
|
||||
System.out.println(parseAge("2月1天"));
|
||||
System.out.println(parseAge("9岁8月"));
|
||||
System.out.println(parseAge("5岁4月3天"));
|
||||
}
|
||||
|
||||
public static String sex(String sexCode) {
|
||||
return "M".equalsIgnoreCase(sexCode) ? "1" : "2";
|
||||
}
|
||||
|
||||
public static String sexName(String sexCode) {
|
||||
return "M".equalsIgnoreCase(sexCode) ? "男" : "女";
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
package com.docus.server.archive.job;
|
||||
|
||||
import com.docus.core.util.Func;
|
||||
import com.docus.infrastructure.core.utils.TableJsonRead;
|
||||
import com.docus.server.archive.service.PatientInfoSyncService;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author YongBin Wen
|
||||
* @date 2024/3/27 16:23
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class PatientInfoSyncJob {
|
||||
@Resource
|
||||
private PatientInfoSyncService patientInfoSyncService;
|
||||
|
||||
/**
|
||||
* 佛山三院基础数据同步,默认同步当天的和所有在院的
|
||||
*
|
||||
* @date 2024/3/27 16:27
|
||||
* @author YongBin Wen
|
||||
*/
|
||||
@XxlJob("FoShanSyPatientInfoSyncJob")
|
||||
public void foShanSyPatientInfoSyncJob() {
|
||||
String jobConfigPath = "data-config\\job-config";
|
||||
String jobConfigName = "FoShanSyPatientInfoSyncJob.json";
|
||||
TableJsonRead jsonReader = new TableJsonRead();
|
||||
FoShanSyPatientInfoSyncJobConfig syncJobConfig = jsonReader.Read(jobConfigPath, jobConfigName, FoShanSyPatientInfoSyncJobConfig.class);
|
||||
syncJobConfig = FoShanSyPatientInfoSyncJobConfig.checkAndInit(syncJobConfig);
|
||||
Integer pageSize = syncJobConfig.getPageSize();
|
||||
Integer pageNumber = syncJobConfig.getPageNumber();
|
||||
String startDate = syncJobConfig.getStartDate();
|
||||
String runJobDate = LocalDate.now().toString();
|
||||
|
||||
patientInfoSyncService.syncInHospitalData();
|
||||
while (true) {
|
||||
int syscCount = patientInfoSyncService.syncDischargeData(startDate + " 00:00:00", runJobDate + " 23:59:59", pageNumber, pageSize);
|
||||
if (syscCount < pageSize) {
|
||||
break;
|
||||
}
|
||||
pageNumber += 1;
|
||||
}
|
||||
syncJobConfig.setPageNumber(1);
|
||||
syncJobConfig.setStartDate(runJobDate);
|
||||
jsonReader.Save(jobConfigPath, jobConfigName, Func.toJson(syncJobConfig));
|
||||
}
|
||||
|
||||
private static class FoShanSyPatientInfoSyncJobConfig {
|
||||
private String startDate;
|
||||
private Integer pageNumber;
|
||||
private Integer pageSize;
|
||||
|
||||
public static FoShanSyPatientInfoSyncJobConfig checkAndInit(FoShanSyPatientInfoSyncJobConfig jobConfig) {
|
||||
if (Objects.isNull(jobConfig)) {
|
||||
jobConfig = new FoShanSyPatientInfoSyncJobConfig();
|
||||
}
|
||||
if (Objects.isNull(jobConfig.getPageNumber()) || jobConfig.getPageNumber() <= 0) {
|
||||
jobConfig.setPageNumber(1);
|
||||
}
|
||||
if (Objects.isNull(jobConfig.getPageSize()) || jobConfig.getPageSize() <= 0) {
|
||||
jobConfig.setPageSize(100);
|
||||
}
|
||||
if (Objects.isNull(jobConfig.getStartDate())) {
|
||||
jobConfig.setStartDate(LocalDate.now().toString());
|
||||
}
|
||||
return jobConfig;
|
||||
}
|
||||
|
||||
public String getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(String startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Integer getPageNumber() {
|
||||
return pageNumber;
|
||||
}
|
||||
|
||||
public void setPageNumber(Integer pageNumber) {
|
||||
this.pageNumber = pageNumber;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.docus.server.archive.mapper;
|
||||
|
||||
|
||||
import com.docus.server.archive.entity.TBasic;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface TBasicMapper {
|
||||
|
||||
/**
|
||||
* 根据记帐号查找基础数据
|
||||
*
|
||||
* @param jzhList 记帐号
|
||||
* @return 基础数据
|
||||
*/
|
||||
List<TBasic> getByJzh(@Param("jzhs") List<String> jzhList);
|
||||
|
||||
int insertBatch(@Param("basicList") List<TBasic> basicList);
|
||||
|
||||
int updateBatch(@Param("basicList") List<TBasic> updateList);
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.docus.server.archive.service;
|
||||
|
||||
import com.docus.server.archive.entity.TBasic;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author YongBin Wen
|
||||
* @date 2024/3/27 16:25
|
||||
*/
|
||||
public interface PatientInfoSyncService {
|
||||
|
||||
/**
|
||||
* 同步在院数据
|
||||
* @date 2024/3/27 16:56
|
||||
* @author YongBin Wen
|
||||
*/
|
||||
void syncInHospitalData();
|
||||
/**
|
||||
*
|
||||
* 根据时间和页码同步出院数据
|
||||
* @param startDateTime 开始时间
|
||||
* @param endDateTime 结束时间
|
||||
* @param pageNumber 页码
|
||||
* @param pageSize 页大小
|
||||
* @return int 同步出院数据数量
|
||||
*/
|
||||
int syncDischargeData(String startDateTime, String endDateTime, Integer pageNumber, Integer pageSize);
|
||||
|
||||
void insertOrUpdate(List<TBasic> tBasicList);
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package com.docus.server.archive.service.impl;
|
||||
|
||||
import com.docus.core.util.Func;
|
||||
import com.docus.infrastructure.redis.service.IdService;
|
||||
import com.docus.server.archive.converter.PatientInfoConverter;
|
||||
import com.docus.server.archive.entity.TBasic;
|
||||
import com.docus.server.archive.mapper.TBasicMapper;
|
||||
import com.docus.server.archive.service.PatientInfoSyncService;
|
||||
import com.docus.server.fsy.entity.JswzhPatientInfoView;
|
||||
import com.docus.server.fsy.mapper.JswzhPatientInfoViewMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author YongBin Wen
|
||||
* @date 2024/3/27 16:25
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class PatientInfoSyncServiceImpl implements PatientInfoSyncService {
|
||||
@Resource
|
||||
private TBasicMapper tBasicMapper;
|
||||
@Resource
|
||||
private JswzhPatientInfoViewMapper jswzhPatientInfoViewMapper;
|
||||
@Resource
|
||||
private IdService idService;
|
||||
|
||||
|
||||
@Override
|
||||
public void syncInHospitalData() {
|
||||
List<JswzhPatientInfoView> inHospital = jswzhPatientInfoViewMapper.getInHospital();
|
||||
// 在院数据将出院日期设置为空
|
||||
for (JswzhPatientInfoView view : inHospital) {
|
||||
view.setCYRQ(null);
|
||||
}
|
||||
convertAndSave(inHospital);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int syncDischargeData(String startDateTime, String endDateTime, Integer pageNumber, Integer pageSize) {
|
||||
int startRow = (pageNumber - 1) * pageSize + 1;
|
||||
int endRow = pageNumber * pageSize;
|
||||
List<JswzhPatientInfoView> discharge = jswzhPatientInfoViewMapper.getDischarge(startDateTime, endDateTime, startRow, endRow);
|
||||
convertAndSave(discharge);
|
||||
return discharge.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertOrUpdate(List<TBasic> tBasicList) {
|
||||
if (Func.isEmpty(tBasicList)) {
|
||||
return;
|
||||
}
|
||||
List<String> jzhList = tBasicList.stream().map(TBasic::getJzh).collect(Collectors.toList());
|
||||
Date nowDate = new Date();
|
||||
List<TBasic> existsBasicList = tBasicMapper.getByJzh(jzhList);
|
||||
|
||||
// 区分新增和更新的数据
|
||||
Map<String, TBasic> existsJzhPatientMap = Objects.isNull(existsBasicList) ? new HashMap<>() : existsBasicList.stream().collect(Collectors.toMap(TBasic::getJzh, Function.identity()));
|
||||
List<TBasic> insertList = new ArrayList<>();
|
||||
List<TBasic> updateList = new ArrayList<>();
|
||||
if (Func.isEmpty(existsBasicList)) {
|
||||
insertList = tBasicList;
|
||||
} else {
|
||||
for (TBasic basic : tBasicList) {
|
||||
String jzh = basic.getJzh();
|
||||
if (existsJzhPatientMap.containsKey(jzh)) {
|
||||
updateList.add(basic);
|
||||
} else {
|
||||
insertList.add(basic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 相应的数据进行数据填充并进行持久化,更新/新增 需要填充patientId,create_time,update_time
|
||||
if (Func.isNotEmpty(insertList)) {
|
||||
for (TBasic basic : insertList) {
|
||||
if (Func.isBlank(basic.getPatientId())) {
|
||||
basic.setPatientId(idService.getDateSeq() + "");
|
||||
}
|
||||
basic.setCreateTime(nowDate);
|
||||
basic.setUpdateTime(nowDate);
|
||||
}
|
||||
tBasicMapper.insertBatch(insertList);
|
||||
}
|
||||
if (Func.isNotEmpty(updateList)) {
|
||||
for (TBasic basic : updateList) {
|
||||
TBasic existsBasic = existsJzhPatientMap.get(basic.getJzh());
|
||||
basic.setCreateTime(existsBasic.getCreateTime());
|
||||
basic.setUpdateTime(nowDate);
|
||||
basic.setPatientId(existsBasic.getPatientId());
|
||||
}
|
||||
tBasicMapper.updateBatch(updateList);
|
||||
}
|
||||
}
|
||||
|
||||
private void convertAndSave(List<JswzhPatientInfoView> jswzhPatientInfoViews) {
|
||||
if (Func.isEmpty(jswzhPatientInfoViews)) {
|
||||
return;
|
||||
}
|
||||
Map<String, String> userNameMap = new HashMap<>();
|
||||
Map<String, String> deptCodeNameMap = new HashMap<>();
|
||||
PatientInfoConverter converter = new PatientInfoConverter(userNameMap, deptCodeNameMap);
|
||||
List<TBasic> basicList = jswzhPatientInfoViews.stream().map(converter::convertArchiveBasicInfo).collect(Collectors.toList());
|
||||
insertOrUpdate(basicList);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
<?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.docus.server.fsy.mapper.JswzhPatientInfoViewMapper">
|
||||
<sql id="JswzhPatientInfoViewField">
|
||||
JZH,ZY,ZYCS,XM,XB,RYRQ,RYKSBQ,RYKSMC,CWDM,DQYS,NL,SFZH,LXDH,CYRQ,DQBQ,DQKS,ZJINE,ZYZT,CYQK,SFSW,BRBZ,JZKH
|
||||
</sql>
|
||||
|
||||
<select id="getInHospital" resultType="com.docus.server.fsy.entity.JswzhPatientInfoView">
|
||||
SELECT <include refid="JswzhPatientInfoViewField"/>
|
||||
FROM VIEW_JSWZH_PATIENT_INFO
|
||||
WHERE ZYZT = 'I'
|
||||
</select>
|
||||
|
||||
<select id="getDischarge" resultType="com.docus.server.fsy.entity.JswzhPatientInfoView">
|
||||
SELECT * FROM (
|
||||
SELECT t.*,ROWNUM rn
|
||||
FROM VIEW_JSWZH_PATIENT_INFO t
|
||||
WHERE
|
||||
(ZYZT = 'B' OR ZYZT='O')
|
||||
AND
|
||||
CQRY BETWEEN TO_DATE(#{disDateBegin},'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{disDateEnd},'YYYY-MM-DD HH24:MI:SS')
|
||||
) WHERE rn BETWEEN ${startRow} AND ${endRow}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
@ -0,0 +1,54 @@
|
||||
<?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.docus.server.archive.mapper.TBasicMapper">
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO `docus_medicalrecord`.`t_basic`
|
||||
(`patient_id`, `admiss_times`, `inpatient_no`, `name`, `name_spell`,
|
||||
`sex`, `sex_name`,`age`, `age_month`, `age_day`, `id_card`, `telphone`,
|
||||
`admiss_date`,`admiss_dept`, `admiss_dept_name`,
|
||||
`dis_date`,`dis_dept`, `dis_dept_name`,
|
||||
`attending`, `attending_name`,
|
||||
`is_dead`,`file_source`,
|
||||
`jzh`,`bed_no`, `jz_card_no`, `total_cost`,
|
||||
`create_time`, `update_time`) VALUES
|
||||
<foreach collection="basicList" separator="," item="basic">
|
||||
(
|
||||
#{basic.patientId},#{basic.admissTimes},#{basic.inpatientNo},#{basic.name},#{basic.nameSpell},
|
||||
#{basic.sex},#{basic.sexName},#{basic.age},#{basic.ageMonth},#{basic.ageDay},#{basic.idCard},#{basic.telphone},
|
||||
#{basic.admissDate},#{basic.admissDept},#{basic.admissDeptName},
|
||||
#{basic.disDate},#{basic.disDept},#{basic.disDeptName},
|
||||
#{basic.attending},#{basic.attendingName},
|
||||
#{basic.isDead},#{basic.fileSource},
|
||||
#{basic.jzh},#{basic.bedNo},#{basic.jzCardNo},#{basic.totalCost},
|
||||
#{basic.createTime},#{basic.updateTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="updateBatch">
|
||||
<foreach collection="basicList" item="basic">
|
||||
UPDATE `docus_medicalrecord`.`t_basic`
|
||||
set inpatient_no=#{basic.inpatientNo},admiss_times=#{basic.admissTimes},name=#{basic.name},name_spell=#{basic.nameSpell},
|
||||
`sex`= #{basic.sex}, `sex_name`=#{basic.sexName},`age`=#{basic.age}, `age_month`=#{basic.ageMonth},
|
||||
`age_day`=#{basic.ageDay}, `id_card`=#{basic.idCard}, `telphone`=#{basic.telphone},
|
||||
`admiss_date`=#{basic.admissDate},`admiss_dept`=#{basic.admissDept}, `admiss_dept_name`=#{basic.admissDeptName},
|
||||
`dis_date`= #{basic.disDate},`dis_dept`=#{basic.disDept}, `dis_dept_name`=#{basic.disDeptName},
|
||||
`attending`= #{basic.attending}, `attending_name`=#{basic.attendingName},
|
||||
`is_dead`=#{basic.isDead},`file_source`=#{basic.fileSource},
|
||||
`jzh`= #{basic.jzh},`bed_no`=#{basic.bedNo}, `jz_card_no`=#{basic.jzCardNo}, `total_cost`=#{basic.totalCost},
|
||||
`create_time`= #{basic.createTime}, `update_time`=#{basic.updateTime}
|
||||
WHERE patient_id= #{basic.patientId};
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getByJzh" resultType="com.docus.server.archive.entity.TBasic">
|
||||
select patient_id as patientId,
|
||||
jzh,
|
||||
create_time as createTime
|
||||
from docus_medicalrecord.t_basic
|
||||
where jzh in <foreach collection="jzhs" item="jzh" open="(" close=")" separator=",">
|
||||
#{jzh}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue