导入修改
This commit is contained in:
parent
a04040e9b8
commit
d10ce132bd
@ -150,7 +150,7 @@ public class PatientInfoController extends BaseController {
|
||||
|
||||
@ApiOperation("未识别科室名称导入")
|
||||
@PostMapping("/secondaryUpload")
|
||||
public AjaxResult secondaryUpload(PatientInfoImportVO patientInfoImportVO) {
|
||||
public AjaxResult secondaryUpload(@RequestBody PatientInfoImportVO patientInfoImportVO) {
|
||||
return patientInfoService.secondaryUpload(patientInfoImportVO);
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,6 +125,12 @@ public class PatientInfoImport extends BaseEntity {
|
||||
@Excel(name = "所属医院名称")
|
||||
private String hospitalAgencyName;
|
||||
|
||||
private Long patientInfoImportId;
|
||||
|
||||
private Long residentId;
|
||||
|
||||
private Long patientInfoId;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
||||
@ -5,9 +5,10 @@ import com.xinelu.manage.dto.patientvisitrecord.PatientVisitRecordDto;
|
||||
import com.xinelu.manage.dto.statistics.FollowUpRateDto;
|
||||
import com.xinelu.manage.vo.patientvisitrecord.PatientVisitRecordStatisticVo;
|
||||
import com.xinelu.manage.vo.patientvisitrecord.PatientVisitRecordVo;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 患者就诊记录基本信息Mapper接口
|
||||
*
|
||||
@ -80,4 +81,11 @@ public interface PatientVisitRecordMapper {
|
||||
|
||||
List<PatientVisitRecordStatisticVo> getVisitPatientList(FollowUpRateDto queryDto);
|
||||
|
||||
/**
|
||||
* 批量新增就诊记录
|
||||
*
|
||||
* @param patientVisitRecordList 就诊记录
|
||||
* @return int
|
||||
*/
|
||||
int insertPatientVisitRecordList(List<PatientVisitRecord> patientVisitRecordList);
|
||||
}
|
||||
|
||||
@ -403,8 +403,10 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
}
|
||||
patientInfoImportList.add(patientInfoImport);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(patientInfoImportList)) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
//组装返回数据
|
||||
List<PatientInfoImport> patientInfoImports = new ArrayList<>(patientInfoImportList);
|
||||
patientInfoImportVO.setSn(sn);
|
||||
if (CollectionUtils.isNotEmpty(departmentList) && departmentList.size() > 0) {
|
||||
patientInfoImportVO.setDepartments(departmentList);
|
||||
@ -431,35 +433,35 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
if (CollectionUtils.isNotEmpty(deptAliasVOS)) {
|
||||
return AjaxResult.error("科室名称不存在", patientInfoImportVO);
|
||||
} else {
|
||||
//新增居民表
|
||||
patientInfoImportList.forEach(item -> item.setPatientInfoImportId(item.getId()));
|
||||
int residentCount = residentInfoMapper.insertResidentInfoList(patientInfoImportList);
|
||||
if (residentCount <= 0) {
|
||||
return AjaxResult.error("导入失败,请联系管理员!");
|
||||
}
|
||||
patientInfoImportList.forEach(item -> item.setResidentId(item.getId()));
|
||||
//新增患者表
|
||||
int i = patientInfoMapper.insertPatientInfoList(patientInfoImportList);
|
||||
if (i <= 0) {
|
||||
return AjaxResult.error("导入失败,请联系管理员!");
|
||||
}
|
||||
//新增居民表
|
||||
List<PatientInfoImport> patientInfoIds = new ArrayList<>(patientInfoImportList);
|
||||
int residentCount = residentInfoMapper.insertResidentInfoList(patientInfoImportList);
|
||||
if (residentCount <= 0) {
|
||||
return AjaxResult.error("导入失败,请联系管理员!");
|
||||
}
|
||||
patientInfoImportList.forEach(item -> item.setPatientInfoId(item.getId()));
|
||||
//新增就诊记录表
|
||||
List<PatientInfoImport> residentIds = new ArrayList<>(patientInfoImportList);
|
||||
List<PatientVisitRecord> patientVisitRecords = new ArrayList<>();
|
||||
for (PatientInfoImport patientInfoImport : patientInfoImports) {
|
||||
PatientInfoImport patientInfoId = patientInfoIds.stream().filter(Objects::nonNull).filter(item -> patientInfoImport.getPatientName().equals(item.getPatientName()) && patientInfoImport.getPatientPhone().equals(item.getPatientPhone())).findFirst().orElse(new PatientInfoImport());
|
||||
PatientInfoImport residentId = residentIds.stream().filter(Objects::nonNull).filter(item -> patientInfoImport.getPatientName().equals(item.getPatientName()) && patientInfoImport.getPatientPhone().equals(item.getPatientPhone())).findFirst().orElse(new PatientInfoImport());
|
||||
for (PatientInfoImport patientInfoImport : patientInfoImportList) {
|
||||
PatientVisitRecord patientVisitRecord = new PatientVisitRecord();
|
||||
patientVisitRecord.setPatientId(patientInfoId.getId());
|
||||
patientVisitRecord.setResidentId(residentId.getId());
|
||||
patientVisitRecord.setPatientId(patientInfoImport.getPatientInfoId());
|
||||
patientVisitRecord.setResidentId(patientInfoImport.getResidentId());
|
||||
BeanUtils.copyProperties(patientInfoImport, patientVisitRecord);
|
||||
patientVisitRecord.setDelFlag(0);
|
||||
patientVisitRecord.setHospitalAgencyId(agency.getId());
|
||||
patientVisitRecord.setHospitalAgencyName(agency.getAgencyName());
|
||||
patientVisitRecord.setCreateBy(SecurityUtils.getUsername());
|
||||
patientVisitRecord.setCreateTime(LocalDateTime.now());
|
||||
patientVisitRecord.setVisitDate(patientInfoImport.getVisitDate().atTime(0, 0, 0));
|
||||
patientVisitRecords.add(patientVisitRecord);
|
||||
}
|
||||
int patientVisitRecordCount = patientVisitRecordMapper.insertBatch(patientVisitRecords);
|
||||
int patientVisitRecordCount = patientVisitRecordMapper.insertPatientVisitRecordList(patientVisitRecords);
|
||||
if (patientVisitRecordCount <= 0) {
|
||||
return AjaxResult.error("导入失败,请联系管理员!");
|
||||
}
|
||||
@ -554,7 +556,7 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
patientVisitRecord.setCreateTime(LocalDateTime.now());
|
||||
patientVisitRecords.add(patientVisitRecord);
|
||||
}
|
||||
int patientVisitRecordCount = patientVisitRecordMapper.insertBatch(patientVisitRecords);
|
||||
int patientVisitRecordCount = patientVisitRecordMapper.insertPatientVisitRecordList(patientVisitRecords);
|
||||
if (patientVisitRecordCount <= 0) {
|
||||
return AjaxResult.error("导入失败,请联系管理员!");
|
||||
}
|
||||
|
||||
@ -875,6 +875,7 @@
|
||||
|
||||
<insert id="insertPatientInfoList" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into patient_info(
|
||||
resident_id,
|
||||
patient_info_import_id,
|
||||
visit_date,
|
||||
in_hospital_number,
|
||||
@ -895,6 +896,7 @@
|
||||
<foreach item="PatientInfoImport" index="index" collection="list" separator=",">
|
||||
(
|
||||
#{PatientInfoImport.id},
|
||||
#{PatientInfoImport.patientInfoImportId},
|
||||
#{PatientInfoImport.visitDate},
|
||||
#{PatientInfoImport.inHospitalNumber},
|
||||
#{PatientInfoImport.patientName},
|
||||
|
||||
@ -529,4 +529,39 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertPatientVisitRecordList">
|
||||
insert into patient_visit_record(resident_id,patient_id,card_no,
|
||||
patient_name,patient_phone,family_member_phone,
|
||||
address,sex,birth_date,
|
||||
age,nation,visit_method,
|
||||
visit_date,visit_name,hospital_agency_id,
|
||||
hospital_agency_name,campus_agency_id,campus_agency_name,
|
||||
department_id,department_name,ward_id,
|
||||
ward_name,attending_physician_id,attending_physician_name,
|
||||
main_diagnosis,marriage,medical_history_narrator,
|
||||
admission_time,discharge_time,record_time,
|
||||
outpatient_visit_info,hospitalization_days,in_hospital_info,
|
||||
out_hospital_info,visit_serial_number,in_hospital_number,
|
||||
responsible_nurse,surgical_name,surgical_record,del_flag,
|
||||
create_by,create_time,update_by,update_time)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(#{item.residentId,jdbcType=BIGINT},#{item.patientId,jdbcType=BIGINT},#{item.cardNo,jdbcType=VARCHAR},
|
||||
#{item.patientName,jdbcType=VARCHAR},#{item.patientPhone,jdbcType=VARCHAR},#{item.familyMemberPhone,jdbcType=VARCHAR},
|
||||
#{item.address,jdbcType=VARCHAR},#{item.sex,jdbcType=VARCHAR},#{item.birthDate,jdbcType=TIMESTAMP},
|
||||
#{item.age,jdbcType=NUMERIC},#{item.nation,jdbcType=VARCHAR},#{item.visitMethod,jdbcType=VARCHAR},
|
||||
#{item.visitDate,jdbcType=TIMESTAMP},#{item.visitName,jdbcType=VARCHAR},#{item.hospitalAgencyId,jdbcType=NUMERIC},
|
||||
#{item.hospitalAgencyName,jdbcType=VARCHAR},#{item.campusAgencyId,jdbcType=NUMERIC},#{item.campusAgencyName,jdbcType=VARCHAR},
|
||||
#{item.departmentId,jdbcType=NUMERIC},#{item.departmentName,jdbcType=VARCHAR},#{item.wardId,jdbcType=NUMERIC},
|
||||
#{item.wardName,jdbcType=VARCHAR},#{item.attendingPhysicianId,jdbcType=NUMERIC},#{item.attendingPhysicianName,jdbcType=VARCHAR},
|
||||
#{item.mainDiagnosis,jdbcType=VARCHAR},#{item.marriage,jdbcType=VARCHAR},#{item.medicalHistoryNarrator,jdbcType=VARCHAR},
|
||||
#{item.admissionTime,jdbcType=TIMESTAMP},#{item.dischargeTime,jdbcType=TIMESTAMP},#{item.recordTime,jdbcType=TIMESTAMP},
|
||||
#{item.outpatientVisitInfo,jdbcType=VARCHAR},#{item.hospitalizationDays,jdbcType=NUMERIC},#{item.inHospitalInfo,jdbcType=VARCHAR},
|
||||
#{item.outHospitalInfo,jdbcType=VARCHAR},#{item.visitSerialNumber,jdbcType=VARCHAR},#{item.inHospitalNumber,jdbcType=VARCHAR},
|
||||
#{item.responsibleNurse,jdbcType=VARCHAR},#{item.surgicalName,jdbcType=VARCHAR},#{item.surgicalRecord,jdbcType=VARCHAR},#{item.delFlag,jdbcType=TINYINT},
|
||||
#{item.createBy,jdbcType=VARCHAR},#{item.createTime,jdbcType=TIMESTAMP},#{item.updateBy,jdbcType=VARCHAR},
|
||||
#{item.updateTime,jdbcType=TIMESTAMP})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user