|
|
|
@ -14,6 +14,7 @@ import com.ccsens.system.persist.dao.DockDao; |
|
|
|
import com.ccsens.system.persist.mapper.*; |
|
|
|
import com.ccsens.system.service.DmsDataValueService; |
|
|
|
import com.ccsens.system.service.DockService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
@ -21,6 +22,8 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author zzc |
|
|
|
@ -28,6 +31,7 @@ import java.util.List; |
|
|
|
* @Date 2026/2/9 14:55 |
|
|
|
* @description: |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|
|
|
public class DockServiceImpl implements DockService { |
|
|
|
@ -249,4 +253,433 @@ public class DockServiceImpl implements DockService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void synchrodata(){ |
|
|
|
//患者信息
|
|
|
|
try { |
|
|
|
syncPmsPatient(); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("患者信息同步失败",e); |
|
|
|
} |
|
|
|
//就诊信息
|
|
|
|
try { |
|
|
|
syncPmsPatientVisitInfo(); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("就诊信息同步失败",e); |
|
|
|
} |
|
|
|
//诊断信息
|
|
|
|
try { |
|
|
|
syncPmsPatientDiagnosis(); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("诊断信息同步失败",e); |
|
|
|
} |
|
|
|
//用药信息
|
|
|
|
try { |
|
|
|
syncPmsPatientParentIllness(); |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("用药信息同步失败",e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void syncPmsPatient() { |
|
|
|
DockPatientBaseInfoExample dockPatientBaseInfoExample = new DockPatientBaseInfoExample(); |
|
|
|
dockPatientBaseInfoExample.createCriteria().andSyncEqualTo("0").andDelFlagEqualTo((byte) 0); |
|
|
|
List<DockPatientBaseInfo> dockPatientBaseInfos = dockPatientBaseInfoMapper.selectByExample(dockPatientBaseInfoExample); |
|
|
|
if (CollUtil.isEmpty(dockPatientBaseInfos)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
for (DockPatientBaseInfo dockPatientBaseInfo : dockPatientBaseInfos) { |
|
|
|
if(ObjectUtil.isNull(dockPatientBaseInfo.getIdCard())){ |
|
|
|
continue; |
|
|
|
} |
|
|
|
//根据患者身份证号查询业务表内患者信息
|
|
|
|
PmsPatient pmsPatient; |
|
|
|
PmsPatientExample pmsPatientExample = new PmsPatientExample(); |
|
|
|
pmsPatientExample.createCriteria().andIdcardEqualTo(dockPatientBaseInfo.getIdCard()).andDelFlagEqualTo((byte) 0); |
|
|
|
List<PmsPatient> pmsPatients = pmsPatientMapper.selectByExample(pmsPatientExample); |
|
|
|
if (CollUtil.isNotEmpty(pmsPatients)) { |
|
|
|
//存在就更新
|
|
|
|
pmsPatient = pmsPatients.get(0); |
|
|
|
disposePmsPatient(dockPatientBaseInfo, pmsPatient); |
|
|
|
pmsPatientMapper.updateByPrimaryKeySelective(pmsPatient); |
|
|
|
}else { |
|
|
|
//不存在则插入
|
|
|
|
pmsPatient = new PmsPatient(); |
|
|
|
pmsPatient.setId(IdUtil.getSnowflake().nextId()); |
|
|
|
disposePmsPatient(dockPatientBaseInfo, pmsPatient); |
|
|
|
pmsPatientMapper.insertSelective(pmsPatient); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void syncPmsPatientVisitInfo() { |
|
|
|
//查询同步表内的就诊信息表
|
|
|
|
DockPatientVisitInfoExample dockPatientVisitInfoExample = new DockPatientVisitInfoExample(); |
|
|
|
dockPatientVisitInfoExample.createCriteria().andSyncEqualTo("0"); |
|
|
|
List<DockPatientVisitInfo> dockPatientVisitInfos = dockPatientVisitInfoMapper.selectByExample(dockPatientVisitInfoExample); |
|
|
|
if(CollUtil.isEmpty(dockPatientVisitInfos)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
for (DockPatientVisitInfo dockPatientVisitInfo : dockPatientVisitInfos) { |
|
|
|
savePatientBady(dockPatientVisitInfo); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private PmsPatientBody savePatientBady(DockPatientVisitInfo dockPatientVisitInfo) { |
|
|
|
//根据身份证号查找业务表内患者信息
|
|
|
|
PmsPatient pmsPatient; |
|
|
|
PmsPatientExample pmsPatientExample = new PmsPatientExample(); |
|
|
|
pmsPatientExample.createCriteria().andIdcardEqualTo(dockPatientVisitInfo.getIdCard()).andDelFlagEqualTo((byte) 0); |
|
|
|
List<PmsPatient> pmsPatients = pmsPatientMapper.selectByExample(pmsPatientExample); |
|
|
|
if (CollUtil.isEmpty(pmsPatients)) { |
|
|
|
//根据身份证号查找同步表的患者信息
|
|
|
|
DockPatientBaseInfoExample dockPatientBaseInfoExample = new DockPatientBaseInfoExample(); |
|
|
|
dockPatientBaseInfoExample.createCriteria().andIdCardEqualTo(dockPatientVisitInfo.getIdCard()).andDelFlagEqualTo((byte) 0); |
|
|
|
List<DockPatientBaseInfo> dockPatientBaseInfos = dockPatientBaseInfoMapper.selectByExample(dockPatientBaseInfoExample); |
|
|
|
if (CollUtil.isNotEmpty(dockPatientBaseInfos)) { |
|
|
|
//存在则更新
|
|
|
|
pmsPatient = new PmsPatient(); |
|
|
|
pmsPatient.setId(IdUtil.getSnowflake().nextId()); |
|
|
|
disposePmsPatient(dockPatientBaseInfos.get(0), pmsPatient); |
|
|
|
pmsPatientMapper.insertSelective(pmsPatient); |
|
|
|
}else { |
|
|
|
//不存在表示患者确实不存在,直接跳过这个就诊信息
|
|
|
|
return null; |
|
|
|
} |
|
|
|
}else { |
|
|
|
pmsPatient = pmsPatients.get(0); |
|
|
|
} |
|
|
|
//根据就诊流水号查询业务表内患者就诊信息
|
|
|
|
PmsPatientBody pmsPatientBody; |
|
|
|
PmsPatientBodyExample pmsPatientBodyExample = new PmsPatientBodyExample(); |
|
|
|
pmsPatientBodyExample.createCriteria().andOutpatientNoEqualTo(dockPatientVisitInfo.getVisitNo()).andDelFlagEqualTo((byte) 0); |
|
|
|
List<PmsPatientBody> pmsPatientBodies = pmsPatientBodyMapper.selectByExample(pmsPatientBodyExample); |
|
|
|
if (CollUtil.isNotEmpty(pmsPatientBodies)) { |
|
|
|
pmsPatientBody = pmsPatientBodies.get(0); |
|
|
|
pmsPatientBody.setPatientId(pmsPatient.getId()); |
|
|
|
disposePmsPatientBody(dockPatientVisitInfo, pmsPatientBody); |
|
|
|
pmsPatientBodyMapper.updateByPrimaryKeySelective(pmsPatientBody); |
|
|
|
}else { |
|
|
|
pmsPatientBody = new PmsPatientBody(); |
|
|
|
pmsPatientBody.setId(IdUtil.getSnowflake().nextId()); |
|
|
|
pmsPatientBody.setPatientId(pmsPatient.getId()); |
|
|
|
disposePmsPatientBody(dockPatientVisitInfo, pmsPatientBody); |
|
|
|
pmsPatientBodyMapper.insertSelective(pmsPatientBody); |
|
|
|
} |
|
|
|
return pmsPatientBody; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void syncPmsPatientDiagnosis() { |
|
|
|
//查找同步表的诊断信息
|
|
|
|
DockPatientDiagnosisExample dockPatientDiagnosisExample = new DockPatientDiagnosisExample(); |
|
|
|
dockPatientDiagnosisExample.createCriteria().andSyncEqualTo("0"); |
|
|
|
List<DockPatientDiagnosis> dockPatientDiagnosiss = dockPatientDiagnosisMapper.selectByExample(dockPatientDiagnosisExample); |
|
|
|
if (CollUtil.isEmpty(dockPatientDiagnosiss)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
//将诊断数据根据就诊流水号进行分组
|
|
|
|
Map<String, List<DockPatientDiagnosis>> dockPatientDiagnosisMap = dockPatientDiagnosiss.stream().collect(Collectors.groupingBy(DockPatientDiagnosis::getVisitNo)); |
|
|
|
for (String key : dockPatientDiagnosisMap.keySet()) { |
|
|
|
//根据就诊流水号查找业务表内患者就诊信息
|
|
|
|
PmsPatientBody pmsPatientBody; |
|
|
|
PmsPatientBodyExample pmsPatientBodyExample = new PmsPatientBodyExample(); |
|
|
|
pmsPatientBodyExample.createCriteria().andOutpatientNoEqualTo(key).andDelFlagEqualTo((byte) 0); |
|
|
|
List<PmsPatientBody> pmsPatientBodies = pmsPatientBodyMapper.selectByExample(pmsPatientBodyExample); |
|
|
|
if (CollUtil.isNotEmpty(pmsPatientBodies)) { |
|
|
|
pmsPatientBody = pmsPatientBodies.get(0); |
|
|
|
} else { |
|
|
|
//不存在则查找同步表的就诊信息
|
|
|
|
DockPatientVisitInfoExample dockPatientVisitInfoExample = new DockPatientVisitInfoExample(); |
|
|
|
dockPatientVisitInfoExample.createCriteria().andVisitNoEqualTo(key).andDelFlagEqualTo((byte) 0); |
|
|
|
List<DockPatientVisitInfo> dockPatientVisitInfos = dockPatientVisitInfoMapper.selectByExample(dockPatientVisitInfoExample); |
|
|
|
if (CollUtil.isNotEmpty(dockPatientVisitInfos)) { |
|
|
|
pmsPatientBody = savePatientBady(dockPatientVisitInfos.get(0)); |
|
|
|
if (pmsPatientBody == null) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
}else { |
|
|
|
//不存在则跳过
|
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
//根据流水号删除业务表内的旧数据
|
|
|
|
PmsPatientDiagnosisExample pmsPatientDiagnosisExample = new PmsPatientDiagnosisExample(); |
|
|
|
pmsPatientDiagnosisExample.createCriteria().andVisitNoEqualTo(key); |
|
|
|
pmsPatientDiagnosisMapper.deleteByExample(pmsPatientDiagnosisExample); |
|
|
|
for (DockPatientDiagnosis dockPatientDiagnosis : dockPatientDiagnosisMap.get(key)) { |
|
|
|
//添加业务表
|
|
|
|
PmsPatientDiagnosis pmsPatientDiagnosis = new PmsPatientDiagnosis(); |
|
|
|
pmsPatientDiagnosis.setId(IdUtil.getSnowflake().nextId()); |
|
|
|
pmsPatientDiagnosis.setPatientId(pmsPatientBody.getPatientId()); |
|
|
|
pmsPatientDiagnosis.setVisitNo(dockPatientDiagnosis.getVisitNo()); |
|
|
|
pmsPatientDiagnosis.setDiagnosisType(dockPatientDiagnosis.getDiagnosisType()); |
|
|
|
pmsPatientDiagnosis.setIsMainDiagnosis(dockPatientDiagnosis.getIsMainDiagnosis().toString()); |
|
|
|
pmsPatientDiagnosis.setDiagnosisCode(dockPatientDiagnosis.getDiagnosisCode()); |
|
|
|
pmsPatientDiagnosis.setDiagnosisName(dockPatientDiagnosis.getDiagnosisName()); |
|
|
|
pmsPatientDiagnosis.setDiagnosisDate(DateUtil.format(dockPatientDiagnosis.getDiagnosisDate(), "yyyy-MM-dd HH:mm:ss")); |
|
|
|
pmsPatientDiagnosisMapper.insertSelective(pmsPatientDiagnosis); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void syncPmsPatientParentIllness() { |
|
|
|
//查找同步表的疾病信息
|
|
|
|
DockPatientMedicationInfoExample dockPatientMedicationInfoExample = new DockPatientMedicationInfoExample(); |
|
|
|
dockPatientMedicationInfoExample.createCriteria().andSyncEqualTo("0"); |
|
|
|
List<DockPatientMedicationInfo> dockPatientMedicationInfos = dockPatientMedicationInfoMapper.selectByExample(dockPatientMedicationInfoExample); |
|
|
|
if (CollUtil.isEmpty(dockPatientMedicationInfos)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
//将疾病信息根据就诊流水号进行分组
|
|
|
|
Map<String, List<DockPatientMedicationInfo>> dockPatientMedicationInfoMap = dockPatientMedicationInfos.stream().collect(Collectors.groupingBy(DockPatientMedicationInfo::getVisitNo)); |
|
|
|
for (String key : dockPatientMedicationInfoMap.keySet()) { |
|
|
|
//根据就诊流水号查找业务表内患者就诊信息
|
|
|
|
PmsPatientBody pmsPatientBody; |
|
|
|
PmsPatientBodyExample pmsPatientBodyExample = new PmsPatientBodyExample(); |
|
|
|
pmsPatientBodyExample.createCriteria().andOutpatientNoEqualTo(key).andDelFlagEqualTo((byte) 0); |
|
|
|
List<PmsPatientBody> pmsPatientBodies = pmsPatientBodyMapper.selectByExample(pmsPatientBodyExample); |
|
|
|
if (CollUtil.isNotEmpty(pmsPatientBodies)) { |
|
|
|
pmsPatientBody = pmsPatientBodies.get(0); |
|
|
|
}else { |
|
|
|
//不存在则查找同步表的就诊信息
|
|
|
|
DockPatientVisitInfoExample dockPatientVisitInfoExample = new DockPatientVisitInfoExample(); |
|
|
|
dockPatientVisitInfoExample.createCriteria().andVisitNoEqualTo(key).andDelFlagEqualTo((byte) 0); |
|
|
|
List<DockPatientVisitInfo> dockPatientVisitInfos = dockPatientVisitInfoMapper.selectByExample(dockPatientVisitInfoExample); |
|
|
|
if (CollUtil.isNotEmpty(dockPatientVisitInfos)){ |
|
|
|
pmsPatientBody = savePatientBady(dockPatientVisitInfos.get(0)); |
|
|
|
if (pmsPatientBody == null) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
}else { |
|
|
|
//不存在则跳过
|
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
//根据流水号删除业务表内的旧数据
|
|
|
|
PmsPatientParentIllnessExample pmsPatientParentIllnessExample = new PmsPatientParentIllnessExample(); |
|
|
|
pmsPatientParentIllnessExample.createCriteria().andVisitNoEqualTo(key); |
|
|
|
pmsPatientParentIllnessMapper.deleteByExample(pmsPatientParentIllnessExample); |
|
|
|
for (DockPatientMedicationInfo dockPatientMedicationInfo : dockPatientMedicationInfoMap.get(key)) { |
|
|
|
PmsPatientParentIllness pmsPatientParentIllness = new PmsPatientParentIllness(); |
|
|
|
pmsPatientParentIllness.setId(IdUtil.getSnowflake().nextId()); |
|
|
|
pmsPatientParentIllness.setPatientId(pmsPatientBody.getPatientId()); |
|
|
|
pmsPatientParentIllness.setVisitNo(dockPatientMedicationInfo.getVisitNo()); |
|
|
|
pmsPatientParentIllness.setDrugName(dockPatientMedicationInfo.getDrugName()); |
|
|
|
pmsPatientParentIllness.setDose(dockPatientMedicationInfo.getDose().toString()); |
|
|
|
pmsPatientParentIllness.setUnit(dockPatientMedicationInfo.getUnit()); |
|
|
|
pmsPatientParentIllness.setFrequency(dockPatientMedicationInfo.getFrequency()); |
|
|
|
pmsPatientParentIllnessMapper.insertSelective(pmsPatientParentIllness); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void disposePmsPatientBody(DockPatientVisitInfo dockPatientVisitInfo, PmsPatientBody pmsPatientBody) { |
|
|
|
pmsPatientBody.setVisitType(dockPatientVisitInfo.getVisitType()); |
|
|
|
pmsPatientBody.setOutpatientNo(dockPatientVisitInfo.getVisitNo()); |
|
|
|
pmsPatientBody.setAge(dockPatientVisitInfo.getAge() != null ? String.valueOf(dockPatientVisitInfo.getAge()) : null); |
|
|
|
pmsPatientBody.setDepartment(dockPatientVisitInfo.getDepartment()); |
|
|
|
pmsPatientBody.setDoctor(dockPatientVisitInfo.getDoctor()); |
|
|
|
// 入院信息
|
|
|
|
pmsPatientBody.setAdmissionDate(dockPatientVisitInfo.getAdmissionDate() != null ? dockPatientVisitInfo.getAdmissionDate().toString() : null); |
|
|
|
pmsPatientBody.setAdmissionCount(dockPatientVisitInfo.getAdmissionCount() != null ? String.valueOf(dockPatientVisitInfo.getAdmissionCount()) : null); |
|
|
|
pmsPatientBody.setAdmissionMethod(dockPatientVisitInfo.getAdmissionMethod()); |
|
|
|
pmsPatientBody.setBedNumber(dockPatientVisitInfo.getBedNumber()); |
|
|
|
pmsPatientBody.setDischargeDate(dockPatientVisitInfo.getDischargeDate() != null ? dockPatientVisitInfo.getDischargeDate().toString() : null); |
|
|
|
pmsPatientBody.setDischargeMethod(dockPatientVisitInfo.getDischargeMethod()); |
|
|
|
// 身体指标
|
|
|
|
pmsPatientBody.setHeight(dockPatientVisitInfo.getHeight() != null ? String.valueOf(dockPatientVisitInfo.getHeight()) : null); |
|
|
|
pmsPatientBody.setWeight(dockPatientVisitInfo.getWeight() != null ? String.valueOf(dockPatientVisitInfo.getWeight()) : null); |
|
|
|
pmsPatientBody.setTz(dockPatientVisitInfo.getTz() != null ? String.valueOf(dockPatientVisitInfo.getTz()) : null); |
|
|
|
pmsPatientBody.setTemperature(dockPatientVisitInfo.getTemperature() != null ? String.valueOf(dockPatientVisitInfo.getTemperature()) : null); |
|
|
|
pmsPatientBody.setBloodPressureShrink(dockPatientVisitInfo.getBloodPressureShrink() != null ? String.valueOf(dockPatientVisitInfo.getBloodPressureShrink()) : null); |
|
|
|
pmsPatientBody.setBloodPressureDiastole(dockPatientVisitInfo.getBloodPressureDiastole() != null ? String.valueOf(dockPatientVisitInfo.getBloodPressureDiastole()) : null); |
|
|
|
pmsPatientBody.setPulse(dockPatientVisitInfo.getPulse() != null ? String.valueOf(dockPatientVisitInfo.getPulse()) : null); |
|
|
|
// 化验指标
|
|
|
|
pmsPatientBody.setCreatinine(dockPatientVisitInfo.getCreatinine() != null ? String.valueOf(dockPatientVisitInfo.getCreatinine()) : null); |
|
|
|
pmsPatientBody.setOxygenSaturation(dockPatientVisitInfo.getOxygenSaturation() != null ? String.valueOf(dockPatientVisitInfo.getOxygenSaturation()) : null); |
|
|
|
pmsPatientBody.setAlbumin(dockPatientVisitInfo.getAlbumin() != null ? String.valueOf(dockPatientVisitInfo.getAlbumin()) : null); |
|
|
|
pmsPatientBody.setTotalProtein(dockPatientVisitInfo.getTotalProtein() != null ? String.valueOf(dockPatientVisitInfo.getTotalProtein()) : null); |
|
|
|
pmsPatientBody.setVitaminD3(dockPatientVisitInfo.getVitaminD3() != null ? String.valueOf(dockPatientVisitInfo.getVitaminD3()) : null); |
|
|
|
pmsPatientBody.setHematocrit(dockPatientVisitInfo.getHematocrit() != null ? String.valueOf(dockPatientVisitInfo.getHematocrit()) : null); |
|
|
|
pmsPatientBody.setDimer(dockPatientVisitInfo.getDimer() != null ? String.valueOf(dockPatientVisitInfo.getDimer()) : null); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void disposePmsPatient(DockPatientBaseInfo dockPatientBaseInfo, PmsPatient pmsPatient) { |
|
|
|
// pmsPatient.setName(dockPatientBaseInfo.getName());
|
|
|
|
// pmsPatient.setNameFull(PinyinUtil.getPinyin(pmsPatient.getName(), ""));
|
|
|
|
// pmsPatient.setNameInitial(PinyinUtil.getFirstLetter(pmsPatient.getName(), ""));
|
|
|
|
// pmsPatient.setIdcard(dockPatientBaseInfo.getIdCard());
|
|
|
|
// pmsPatient.setPhone(dockPatientBaseInfo.getPhone());
|
|
|
|
// pmsPatient.setSex(Byte.parseByte(dockPatientBaseInfo.getSex()));
|
|
|
|
// pmsPatient.setBirthday(DateUtil.format(dockPatientBaseInfo.getBirthday(), "yyyy-MM-dd"));
|
|
|
|
// pmsPatient.setEducationalStatus(Byte.parseByte(dockPatientBaseInfo.getEducationalStatus()));
|
|
|
|
// pmsPatient.setCareer(Byte.parseByte(dockPatientBaseInfo.getCareer()));
|
|
|
|
// pmsPatient.setMaritalStatus(Byte.parseByte(dockPatientBaseInfo.getMaritalStatus()));
|
|
|
|
// pmsPatient.setNation(dockPatientBaseInfo.getNation());
|
|
|
|
// pmsPatient.setNativePlace(dockPatientBaseInfo.getNativePlace());
|
|
|
|
// pmsPatient.setAddress(dockPatientBaseInfo.getAddress());
|
|
|
|
// pmsPatient.setDwellingState(Byte.parseByte(dockPatientBaseInfo.getDwellingState()));
|
|
|
|
// pmsPatient.setContactName(dockPatientBaseInfo.getContactName());
|
|
|
|
// pmsPatient.setContactMobile(dockPatientBaseInfo.getContactMobile());
|
|
|
|
// pmsPatient.setContactRelation(dockPatientBaseInfo.getContactRelation());
|
|
|
|
// pmsPatient.setAboBloodType(dockPatientBaseInfo.getAboBloodType());
|
|
|
|
// pmsPatient.setRhBloodType(dockPatientBaseInfo.getRhBloodType());
|
|
|
|
// pmsPatient.setBelief(dockPatientBaseInfo.getBelief());
|
|
|
|
// pmsPatient.setHobby(dockPatientBaseInfo.getHobby());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 姓名相关
|
|
|
|
pmsPatient.setName(dockPatientBaseInfo.getName()); |
|
|
|
pmsPatient.setNameFull(PinyinUtil.getPinyin(pmsPatient.getName(), "")); |
|
|
|
pmsPatient.setNameInitial(PinyinUtil.getFirstLetter(pmsPatient.getName(), "")); |
|
|
|
|
|
|
|
// 证件信息
|
|
|
|
pmsPatient.setIdcard(dockPatientBaseInfo.getIdCard()); |
|
|
|
pmsPatient.setPhone(dockPatientBaseInfo.getPhone()); |
|
|
|
|
|
|
|
// 性别转换:将"男"/"女"转换为 0/1
|
|
|
|
String sex = dockPatientBaseInfo.getSex(); |
|
|
|
if ("男".equals(sex)) { |
|
|
|
pmsPatient.setSex((byte)0); |
|
|
|
} else if ("女".equals(sex)) { |
|
|
|
pmsPatient.setSex((byte)1); |
|
|
|
} else { |
|
|
|
// 如果已经有数字代码,直接转换
|
|
|
|
try { |
|
|
|
pmsPatient.setSex(Byte.parseByte(sex)); |
|
|
|
} catch (NumberFormatException e) { |
|
|
|
pmsPatient.setSex((byte)0); // 默认值
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 出生日期
|
|
|
|
pmsPatient.setBirthday(DateUtil.format(dockPatientBaseInfo.getBirthday(), "yyyy-MM-dd")); |
|
|
|
|
|
|
|
// 教育程度转换
|
|
|
|
String educationalStatus = dockPatientBaseInfo.getEducationalStatus(); |
|
|
|
if ("文盲".equals(educationalStatus)) { |
|
|
|
pmsPatient.setEducationalStatus((byte)1); |
|
|
|
} else if ("小学".equals(educationalStatus)) { |
|
|
|
pmsPatient.setEducationalStatus((byte)2); |
|
|
|
} else if ("初中".equals(educationalStatus)) { |
|
|
|
pmsPatient.setEducationalStatus((byte)3); |
|
|
|
} else if ("高中".equals(educationalStatus)) { |
|
|
|
pmsPatient.setEducationalStatus((byte)4); |
|
|
|
} else if ("大学".equals(educationalStatus)) { |
|
|
|
pmsPatient.setEducationalStatus((byte)5); |
|
|
|
} else if ("大学以上".equals(educationalStatus)) { |
|
|
|
pmsPatient.setEducationalStatus((byte)6); |
|
|
|
} else if ("其他".equals(educationalStatus)) { |
|
|
|
pmsPatient.setEducationalStatus((byte)7); |
|
|
|
} else { |
|
|
|
try { |
|
|
|
pmsPatient.setEducationalStatus(Byte.parseByte(educationalStatus)); |
|
|
|
} catch (NumberFormatException e) { |
|
|
|
pmsPatient.setEducationalStatus((byte)7); // 默认其他
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 职业转换
|
|
|
|
String career = dockPatientBaseInfo.getCareer(); |
|
|
|
if ("农林牧渔水利生产人员".equals(career)) { |
|
|
|
pmsPatient.setCareer((byte)1); |
|
|
|
} else if ("教师".equals(career)) { |
|
|
|
pmsPatient.setCareer((byte)2); |
|
|
|
} else if ("医务工作者".equals(career)) { |
|
|
|
pmsPatient.setCareer((byte)3); |
|
|
|
} else if ("专业技术人员".equals(career)) { |
|
|
|
pmsPatient.setCareer((byte)4); |
|
|
|
} else if ("生产、运输设备操作人员及有关人员".equals(career)) { |
|
|
|
pmsPatient.setCareer((byte)5); |
|
|
|
} else if ("商业、服务业人员".equals(career)) { |
|
|
|
pmsPatient.setCareer((byte)6); |
|
|
|
} else if ("国家机关、事业单位、企业负责人".equals(career)) { |
|
|
|
pmsPatient.setCareer((byte)7); |
|
|
|
} else if ("国家机关、事业单位、企业办事人员和有关人员".equals(career)) { |
|
|
|
pmsPatient.setCareer((byte)8); |
|
|
|
} else if ("军人".equals(career)) { |
|
|
|
pmsPatient.setCareer((byte)9); |
|
|
|
} else if ("媒体、文体类工作人员".equals(career)) { |
|
|
|
pmsPatient.setCareer((byte)10); |
|
|
|
} else if ("在校学生".equals(career)) { |
|
|
|
pmsPatient.setCareer((byte)11); |
|
|
|
} else if ("未就业".equals(career)) { |
|
|
|
pmsPatient.setCareer((byte)12); |
|
|
|
} else if ("家务".equals(career)) { |
|
|
|
pmsPatient.setCareer((byte)13); |
|
|
|
} else if ("其他".equals(career)) { |
|
|
|
pmsPatient.setCareer((byte)14); |
|
|
|
} else { |
|
|
|
try { |
|
|
|
pmsPatient.setCareer(Byte.parseByte(career)); |
|
|
|
} catch (NumberFormatException e) { |
|
|
|
pmsPatient.setCareer(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 婚姻状况转换
|
|
|
|
String maritalStatus = dockPatientBaseInfo.getMaritalStatus(); |
|
|
|
if ("未婚".equals(maritalStatus)) { |
|
|
|
pmsPatient.setMaritalStatus((byte)1); |
|
|
|
} else if ("已婚".equals(maritalStatus)) { |
|
|
|
pmsPatient.setMaritalStatus((byte)2); |
|
|
|
} else if ("离异".equals(maritalStatus)) { |
|
|
|
pmsPatient.setMaritalStatus((byte)3); |
|
|
|
} else if ("分居".equals(maritalStatus)) { |
|
|
|
pmsPatient.setMaritalStatus((byte)4); |
|
|
|
} else if ("丧偶".equals(maritalStatus)) { |
|
|
|
pmsPatient.setMaritalStatus((byte)5); |
|
|
|
} else if ("同居".equals(maritalStatus)) { |
|
|
|
pmsPatient.setMaritalStatus((byte)6); |
|
|
|
} else if ("其他".equals(maritalStatus)) { |
|
|
|
pmsPatient.setMaritalStatus((byte)7); |
|
|
|
} else { |
|
|
|
try { |
|
|
|
pmsPatient.setMaritalStatus(Byte.parseByte(maritalStatus)); |
|
|
|
} catch (NumberFormatException e) { |
|
|
|
pmsPatient.setMaritalStatus(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 其他字段直接设置
|
|
|
|
pmsPatient.setNation(dockPatientBaseInfo.getNation()); |
|
|
|
pmsPatient.setNativePlace(dockPatientBaseInfo.getNativePlace()); |
|
|
|
pmsPatient.setAddress(dockPatientBaseInfo.getAddress()); |
|
|
|
|
|
|
|
// 居住状态转换
|
|
|
|
String dwellingState = dockPatientBaseInfo.getDwellingState(); |
|
|
|
if ("独居".equals(dwellingState)) { |
|
|
|
pmsPatient.setDwellingState((byte)1); |
|
|
|
} else if ("与配偶或对象或子女".equals(dwellingState)) { |
|
|
|
pmsPatient.setDwellingState((byte)2); |
|
|
|
} else if ("与亲戚或朋友居住".equals(dwellingState)) { |
|
|
|
pmsPatient.setDwellingState((byte)3); |
|
|
|
} else { |
|
|
|
try { |
|
|
|
pmsPatient.setDwellingState(Byte.parseByte(dwellingState)); |
|
|
|
} catch (NumberFormatException e) { |
|
|
|
pmsPatient.setDwellingState(null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 联系人信息
|
|
|
|
pmsPatient.setContactName(dockPatientBaseInfo.getContactName()); |
|
|
|
pmsPatient.setContactMobile(dockPatientBaseInfo.getContactMobile()); |
|
|
|
pmsPatient.setContactRelation(dockPatientBaseInfo.getContactRelation()); |
|
|
|
|
|
|
|
// 血型信息
|
|
|
|
pmsPatient.setAboBloodType(dockPatientBaseInfo.getAboBloodType()); |
|
|
|
pmsPatient.setRhBloodType(dockPatientBaseInfo.getRhBloodType()); |
|
|
|
|
|
|
|
// 其他信息
|
|
|
|
pmsPatient.setBelief(dockPatientBaseInfo.getBelief()); |
|
|
|
pmsPatient.setHobby(dockPatientBaseInfo.getHobby()); |
|
|
|
} |
|
|
|
} |
|
|
|
|