医共体导入修改
This commit is contained in:
parent
043ee08082
commit
62d36627d3
@ -95,7 +95,7 @@ public class ExternalImportController extends BaseController {
|
|||||||
* 查询外部数据导入列表、不分页、sn不为空
|
* 查询外部数据导入列表、不分页、sn不为空
|
||||||
*/
|
*/
|
||||||
@PostMapping("/externalImports")
|
@PostMapping("/externalImports")
|
||||||
public List<ExternalImport> getExternalImports(ExternalImportDto externalImport) {
|
public List<ExternalImport> getExternalImports(@RequestBody ExternalImportDto externalImport) {
|
||||||
return externalImportService.getExternalImports(externalImport);
|
return externalImportService.getExternalImports(externalImport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,6 +2,7 @@ package com.xinelu.manage.mapper.externalimport;
|
|||||||
|
|
||||||
import com.xinelu.manage.domain.externalimport.ExternalImport;
|
import com.xinelu.manage.domain.externalimport.ExternalImport;
|
||||||
import com.xinelu.manage.dto.externalimport.ExternalImportDto;
|
import com.xinelu.manage.dto.externalimport.ExternalImportDto;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -90,4 +91,13 @@ public interface ExternalImportMapper {
|
|||||||
* @return Long
|
* @return Long
|
||||||
*/
|
*/
|
||||||
Long getExternalImportCount();
|
Long getExternalImportCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改医共体数据
|
||||||
|
*
|
||||||
|
* @param ids 医共体ids
|
||||||
|
* @param sn 批次号
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
int updateExternalImportSn(@Param("ids") List<Long> ids, @Param("sn") String sn);
|
||||||
}
|
}
|
||||||
@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 外部数据导入Service业务层处理
|
* 外部数据导入Service业务层处理
|
||||||
@ -95,6 +96,17 @@ public class ExternalImportServiceImpl implements IExternalImportService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ExternalImport> getExternalImports(ExternalImportDto externalImport) {
|
public List<ExternalImport> getExternalImports(ExternalImportDto externalImport) {
|
||||||
|
if (Objects.isNull(externalImport.getVisitMethod())) {
|
||||||
|
externalImport.setVisitMethod("1");
|
||||||
|
}
|
||||||
|
if (externalImport.getVisitMethod().equals("1")) {
|
||||||
|
externalImport.setDischargeDateStart(null);
|
||||||
|
externalImport.setDischargeDateEnd(null);
|
||||||
|
}
|
||||||
|
if (externalImport.getVisitMethod().equals("2")) {
|
||||||
|
externalImport.setVisitDateStart(null);
|
||||||
|
externalImport.setVisitDateEnd(null);
|
||||||
|
}
|
||||||
return externalImportMapper.getExternalImports(externalImport);
|
return externalImportMapper.getExternalImports(externalImport);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -22,6 +22,7 @@ import com.xinelu.manage.domain.residentinfo.ResidentInfo;
|
|||||||
import com.xinelu.manage.dto.patientinfoimportmain.PatientInfoImportMainDto;
|
import com.xinelu.manage.dto.patientinfoimportmain.PatientInfoImportMainDto;
|
||||||
import com.xinelu.manage.mapper.agency.AgencyMapper;
|
import com.xinelu.manage.mapper.agency.AgencyMapper;
|
||||||
import com.xinelu.manage.mapper.department.DepartmentMapper;
|
import com.xinelu.manage.mapper.department.DepartmentMapper;
|
||||||
|
import com.xinelu.manage.mapper.externalimport.ExternalImportMapper;
|
||||||
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
|
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
|
||||||
import com.xinelu.manage.mapper.patientinfoimport.PatientInfoImportMapper;
|
import com.xinelu.manage.mapper.patientinfoimport.PatientInfoImportMapper;
|
||||||
import com.xinelu.manage.mapper.patientinfoimportmain.PatientInfoImportMainMapper;
|
import com.xinelu.manage.mapper.patientinfoimportmain.PatientInfoImportMainMapper;
|
||||||
@ -39,7 +40,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -71,6 +71,8 @@ public class PatientInfoImportMainServiceImpl implements IPatientInfoImportMainS
|
|||||||
private PatientInfoMapper patientInfoMapper;
|
private PatientInfoMapper patientInfoMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private PatientVisitRecordMapper patientVisitRecordMapper;
|
private PatientVisitRecordMapper patientVisitRecordMapper;
|
||||||
|
@Resource
|
||||||
|
private ExternalImportMapper externalImportMapper;
|
||||||
|
|
||||||
|
|
||||||
@DataScope(agencyAlias = "p")
|
@DataScope(agencyAlias = "p")
|
||||||
@ -214,14 +216,14 @@ public class PatientInfoImportMainServiceImpl implements IPatientInfoImportMainS
|
|||||||
}
|
}
|
||||||
//新增导入信息
|
//新增导入信息
|
||||||
PatientInfoImportMain patientInfoImportMain = new PatientInfoImportMain();
|
PatientInfoImportMain patientInfoImportMain = new PatientInfoImportMain();
|
||||||
|
patientInfoImportMain.setImportName(patientInfoImportMainDto.getImportName());
|
||||||
patientInfoImportMain.setHospitalAgencyId(agency.getId());
|
patientInfoImportMain.setHospitalAgencyId(agency.getId());
|
||||||
patientInfoImportMain.setHospitalAgencyName(agency.getAgencyName());
|
patientInfoImportMain.setHospitalAgencyName(agency.getAgencyName());
|
||||||
patientInfoImportMain.setCreateBy(SecurityUtils.getUsername());
|
patientInfoImportMain.setCreateBy(SecurityUtils.getUsername());
|
||||||
patientInfoImportMain.setCreateTime(LocalDateTime.now());
|
patientInfoImportMain.setCreateTime(LocalDateTime.now());
|
||||||
String sn = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
String sn = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||||
patientInfoImportMain.setSn(sn);
|
patientInfoImportMain.setSn(sn);
|
||||||
patientInfoImportMain.setImportStatus(ImportStatusEnum.UNFINISHED.getInfo());
|
patientInfoImportMain.setImportStatus(ImportStatusEnum.FINISHED.getInfo());
|
||||||
patientInfoImportMain.setImportName(LocalDate.now() + "医共体获取数据");
|
|
||||||
patientInfoImportMainMapper.insertPatientInfoImportMain(patientInfoImportMain);
|
patientInfoImportMainMapper.insertPatientInfoImportMain(patientInfoImportMain);
|
||||||
List<PatientInfoImport> patientInfoImportList = new ArrayList<>();
|
List<PatientInfoImport> patientInfoImportList = new ArrayList<>();
|
||||||
Long i = 1L;
|
Long i = 1L;
|
||||||
@ -266,6 +268,8 @@ public class PatientInfoImportMainServiceImpl implements IPatientInfoImportMainS
|
|||||||
}
|
}
|
||||||
//新增缓存表
|
//新增缓存表
|
||||||
patientInfoImportMapper.insertPatientInfoImportList(patientInfoImportList);
|
patientInfoImportMapper.insertPatientInfoImportList(patientInfoImportList);
|
||||||
|
List<Long> ids = patientInfoImportMainDto.getExternalImports().stream().filter(Objects::nonNull).map(ExternalImport::getId).collect(Collectors.toList());
|
||||||
|
externalImportMapper.updateExternalImportSn(ids, sn);
|
||||||
List<ResidentInfo> residentInfos = residentInfoMapper.selectResidentInfoByPhoneList(patientInfoImportList);
|
List<ResidentInfo> residentInfos = residentInfoMapper.selectResidentInfoByPhoneList(patientInfoImportList);
|
||||||
List<PatientInfoImport> resident = new ArrayList<>();
|
List<PatientInfoImport> resident = new ArrayList<>();
|
||||||
patientInfoImportList.forEach(item -> {
|
patientInfoImportList.forEach(item -> {
|
||||||
|
|||||||
@ -320,8 +320,8 @@
|
|||||||
|
|
||||||
<select id="getExternalImports" resultType="com.xinelu.manage.dto.externalimport.ExternalImportDto">
|
<select id="getExternalImports" resultType="com.xinelu.manage.dto.externalimport.ExternalImportDto">
|
||||||
<include refid="selectExternalImportVo"/>
|
<include refid="selectExternalImportVo"/>
|
||||||
where sn is not null
|
where sn is null
|
||||||
<if test="departmentName != null and departmentNameList.size() > 0">
|
<if test="departmentNameList != null and departmentNameList.size() > 0">
|
||||||
and department_name in
|
and department_name in
|
||||||
<foreach item="deptName" collection="departmentNameList" open="(" separator="," close=")">
|
<foreach item="deptName" collection="departmentNameList" open="(" separator="," close=")">
|
||||||
#{deptName}
|
#{deptName}
|
||||||
@ -342,9 +342,19 @@
|
|||||||
<if test="dischargeDateEnd != null ">
|
<if test="dischargeDateEnd != null ">
|
||||||
and date_format(discharge_time, '%y%m%d') <= date_format(#{dischargeDateEnd}, '%y%m%d')
|
and date_format(discharge_time, '%y%m%d') <= date_format(#{dischargeDateEnd}, '%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
|
ORDER BY push_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getExternalImportCount" resultType="java.lang.Long">
|
<select id="getExternalImportCount" resultType="java.lang.Long">
|
||||||
select count(1) from external_import
|
select count(1) from external_import
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="updateExternalImportSn">
|
||||||
|
update external_import
|
||||||
|
set sn = #{sn}
|
||||||
|
where id in
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -1,6 +1,13 @@
|
|||||||
package com.xinelu.quartz.task;
|
package com.xinelu.quartz.task;
|
||||||
|
|
||||||
|
import com.xinelu.common.constant.Constants;
|
||||||
|
import com.xinelu.common.enums.NodeTypeEnum;
|
||||||
|
import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
|
||||||
|
import com.xinelu.manage.domain.agency.Agency;
|
||||||
|
import com.xinelu.manage.domain.department.Department;
|
||||||
import com.xinelu.manage.domain.externalimport.ExternalImport;
|
import com.xinelu.manage.domain.externalimport.ExternalImport;
|
||||||
|
import com.xinelu.manage.mapper.agency.AgencyMapper;
|
||||||
|
import com.xinelu.manage.mapper.department.DepartmentMapper;
|
||||||
import com.xinelu.manage.mapper.externalimport.ExternalImportMapper;
|
import com.xinelu.manage.mapper.externalimport.ExternalImportMapper;
|
||||||
import com.xinelu.quartz.domain.TbFollowUp;
|
import com.xinelu.quartz.domain.TbFollowUp;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -34,8 +41,14 @@ public class MedicalConsortiumPlatformTask {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ExternalImportMapper externalImportMapper;
|
private ExternalImportMapper externalImportMapper;
|
||||||
|
@Resource
|
||||||
|
private DepartmentMapper departmentMapper;
|
||||||
@Value("${xinyilu-database.main_hospital}")
|
@Value("${xinyilu-database.main_hospital}")
|
||||||
|
private Long mainHospitalId;
|
||||||
|
@Resource
|
||||||
|
private GenerateSystemCodeUtil generateSystemCodeUtil;
|
||||||
|
@Resource
|
||||||
|
private AgencyMapper agencyMapper;
|
||||||
|
|
||||||
static final String sql = "SELECT * FROM tb_follow_up";
|
static final String sql = "SELECT * FROM tb_follow_up";
|
||||||
static final String sql_date = "SELECT * FROM tb_follow_up where TSXJ > TO_DATE('" + LocalDate.now() + "', 'YYYY-MM-DD HH24:MI:SS') AND TSXJ < TO_DATE('" + LocalDate.now().plusDays(1) + "', 'YYYY-MM-DD HH24:MI:SS')";
|
static final String sql_date = "SELECT * FROM tb_follow_up where TSXJ > TO_DATE('" + LocalDate.now() + "', 'YYYY-MM-DD HH24:MI:SS') AND TSXJ < TO_DATE('" + LocalDate.now().plusDays(1) + "', 'YYYY-MM-DD HH24:MI:SS')";
|
||||||
@ -100,6 +113,35 @@ public class MedicalConsortiumPlatformTask {
|
|||||||
list = list.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getJZLSH())
|
list = list.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getJZLSH())
|
||||||
&& StringUtils.isNotBlank(item.getXM()) && StringUtils.isNotBlank(item.getLXDH()) && StringUtils.isNotBlank(item.getZJHM())).collect(Collectors.toList());
|
&& StringUtils.isNotBlank(item.getXM()) && StringUtils.isNotBlank(item.getLXDH()) && StringUtils.isNotBlank(item.getZJHM())).collect(Collectors.toList());
|
||||||
List<String> collect = list.stream().filter(Objects::nonNull).map(TbFollowUp::getJZLSH).collect(Collectors.toList());
|
List<String> collect = list.stream().filter(Objects::nonNull).map(TbFollowUp::getJZLSH).collect(Collectors.toList());
|
||||||
|
//科室信息组装-新增不存在科室
|
||||||
|
Agency agency = agencyMapper.selectAgencyById(mainHospitalId);
|
||||||
|
List<Department> departments = new ArrayList<>();
|
||||||
|
List<String> difference;
|
||||||
|
Department department = new Department();
|
||||||
|
department.setHospitalAgencyId(mainHospitalId);
|
||||||
|
List<Department> departmentList = departmentMapper.selectDepartmentNameCount(department);
|
||||||
|
List<String> importDepartmentName = list.stream().filter(Objects::nonNull).map(TbFollowUp::getJZKSMC).distinct().collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(departmentList)) {
|
||||||
|
List<String> dateDepartmentName = departmentList.stream().filter(Objects::nonNull).map(Department::getDepartmentName).distinct().collect(Collectors.toList());
|
||||||
|
difference = importDepartmentName.stream().filter(element -> !dateDepartmentName.contains(element)).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
difference = importDepartmentName;
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(difference) || difference.size() > 0) {
|
||||||
|
for (String s : difference) {
|
||||||
|
Department newDepartment = new Department();
|
||||||
|
newDepartment.setParentDepartmentId(0L);
|
||||||
|
newDepartment.setNodeType(NodeTypeEnum.DEPARTMENT.getInfo());
|
||||||
|
newDepartment.setDepartmentName(s);
|
||||||
|
newDepartment.setDepartmentCode(Constants.DEPARTMENT_IMPORT_CODE + generateSystemCodeUtil.generateSystemCode(Constants.DEPARTMENT_IMPORT_CODE));
|
||||||
|
newDepartment.setHospitalAgencyName(agency.getAgencyName());
|
||||||
|
newDepartment.setHospitalAgencyId(agency.getId());
|
||||||
|
newDepartment.setCreateTime(LocalDateTime.now());
|
||||||
|
newDepartment.setCreateBy("数据导入");
|
||||||
|
departments.add(newDepartment);
|
||||||
|
}
|
||||||
|
departmentMapper.insertPartDepartmentList(departments);
|
||||||
|
}
|
||||||
//筛选就诊号并根据就诊号查询数据库
|
//筛选就诊号并根据就诊号查询数据库
|
||||||
List<ExternalImport> dataExternalImports = externalImportMapper.selectExternalByPhone(collect);
|
List<ExternalImport> dataExternalImports = externalImportMapper.selectExternalByPhone(collect);
|
||||||
List<ExternalImport> externalImports = new ArrayList<>();
|
List<ExternalImport> externalImports = new ArrayList<>();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user