拆分取消住院

广东省中医_gdszy
宇宙皮皮娃 1 year ago
parent 11fce9d130
commit 09995ef181

@ -12,6 +12,8 @@ public interface ITBasicService {
public void updateTBasic(TBasicDto dto) throws Exception;
public void cancelHospital(TBasicDto dto) throws Exception;
public void updateAdmissTBasic(TBasicDto dto) throws Exception;
public void setBedDoctor(BedDoctorDto dto) throws Exception;

@ -226,11 +226,6 @@ public class TBasicServiceImpl implements ITBasicService {
} else if (tBasic.getIsOther() == 0) {
tBasic.setIsOther(0);
}
//是否取消住院
if ("2".equals(tBasicDto.getStatu())) {
applicationEventPublisher.publishEvent(new BackPushEventEntity(this, tBasic));
tBasic.setDisDate(null);
}
String sdryIndex = tBasicDto.getSdryIndex();
TBasicExtend tBasicExtend = new TBasicExtend();
tBasicExtend.setPatientId(patientId);
@ -244,6 +239,95 @@ public class TBasicServiceImpl implements ITBasicService {
confirmAndUpdIcuRecordState(tBasic.getInpatientNo(), tBasic.getAdmissTimes());
}
@Override
public void cancelHospital(TBasicDto tBasicDto) throws Exception {
//判断jzh是否存在
String patientId = tBasicMapper.getPatientId(tBasicDto.getJzh());
if (Func.isEmpty(patientId)) {
throw new BaseException("取消住院出错 jzh:"+tBasicDto.getJzh()+"不存在记录");
}
//数据类型转化,格式处理
//数据类型转化,格式处理
Date admissDate = null;
if (Func.isNotEmpty(tBasicDto.getAdmissDate())) {
admissDate = Func.parseDate(tBasicDto.getAdmissDate(), DateUtil.PATTERN_DATETIME_MINI);
}
Date disDate = null;
if (Func.isNotEmpty(tBasicDto.getDisDate())) {
disDate = Func.parseDate(tBasicDto.getDisDate(), DateUtil.PATTERN_DATETIME_MINI);
}
String admissTimesStr = tBasicDto.getAdmissTimes();
Integer admissTimes = null;
if (NumberUtil.isInteger(admissTimesStr)) {
admissTimes = Integer.parseInt(admissTimesStr);
}
String ageStr = tBasicDto.getAge();
if (Func.isNotEmpty(ageStr)) {
ageStr = ageStr.substring(0, ageStr.length() - 1);
}
Integer age = null;
if (NumberUtil.isInteger(ageStr)) {
age = Integer.parseInt(ageStr);
}
String sexName = tBasicDto.getSexName();
if (Func.isNotEmpty(sexName) && sexName.length() > 1) {
sexName = sexName.substring(0, 1);
}
String admissDaysStr = tBasicDto.getAdmissDays();
Integer admissDays = null;
if (NumberUtil.isInteger(admissDaysStr)) {
admissDays = Integer.parseInt(admissDaysStr);
}
String isDeadStr = tBasicDto.getIsDead();
Integer isDead = 0;
if ("死亡".equals(isDeadStr)) {
isDead = 1;
}
//组装数据
TBasic tBasic = new TBasic();
tBasic.setJzh(tBasicDto.getJzh());
tBasic.setPatientId(patientId);
tBasic.setInpatientNo(tBasicDto.getInpatientNo());
tBasic.setAdmissTimes(admissTimes);
tBasic.setName(tBasicDto.getName());
tBasic.setAdmissDate(admissDate);
tBasic.setDisDate(disDate);
tBasic.setAdmissDept(tBasicDto.getAdmissDept());
tBasic.setAdmissDeptName(tBasicDto.getAdmissDeptName());
tBasic.setDisDeptName(tBasicDto.getDisDeptName());
tBasic.setAttending(tBasicDto.getAttending());
tBasic.setAttendingName(tBasicDto.getAttendingName());
tBasic.setAge(age);
tBasic.setSex(tBasicDto.getSex());
tBasic.setIdCard(tBasicDto.getIdCard());
tBasic.setDisDept(tBasicDto.getDisDept());
tBasic.setSexName(sexName);
tBasic.setBedNum(tBasicDto.getBedNum());
tBasic.setAdmissDays(admissDays);
tBasic.setIsDead(isDead);
tBasic.setWardCode(tBasicDto.getWardCode());
tBasic.setWardName(tBasicDto.getWardName());
tBasic.setIsOther(tBasicDto.getIsOther());
//设置是否婴儿
String inpatientNo = tBasicDto.getInpatientNo();
if (tBasic.getIsOther() == 0 && (inpatientNo.contains("B") || inpatientNo.contains("b"))) {
tBasic.setIsOther(1);
} else if (tBasic.getIsOther() == 0) {
tBasic.setIsOther(0);
}
//是否取消住院
if ("2".equals(tBasicDto.getStatu())) {
applicationEventPublisher.publishEvent(new BackPushEventEntity(this, tBasic));
tBasic.setDisDate(null);
//持久化
tBasicMapper.update(tBasic);
return;
}
throw new BaseException("未取消住院,状态 statusCode"+tBasicDto.getStatu());
}
@Override
@Transactional
public void updateAdmissTBasic(TBasicDto tBasicDto) throws Exception {

@ -29,4 +29,9 @@ public interface BasicService {
*/
public String setBedDoctor(String message);
/**
* @description
*/
public String cancelHospital(String message);
}

@ -120,4 +120,10 @@ public interface ReceiveServer {
* @return
*/
String pushMaternalInfantRelationship(String maternalInfantRelationshipMessage);
/**
* @description
*/
String cancelHospital(String message);
}

@ -73,6 +73,28 @@ public class BasicServiceImpl implements BasicService {
}
@Override
public String cancelHospital(String body) {
log.info("取消住院基础数据:{}", body);
if (Func.isEmpty(body)) {
return Result.failed(null,"参数为空",null,null);
}
//解析xml
TBasicDto tBasicDto = null;
try {
tBasicDto=getCancelHospitalDto(body);
//持久化
tBasicService.cancelHospital(tBasicDto);
}catch (Exception e){
e.printStackTrace();
log.error(e.getMessage(), e);
return Result.failed(tBasicDto.getSerialId(),e.getMessage(),tBasicDto.getReceive(),tBasicDto.getSend());
}
return Result.success(tBasicDto.getSerialId(),tBasicDto.getReceive(),tBasicDto.getSend());
}
@Override
public String setAdmissTBasic(String message) {
log.info("新增入院基础数据:{}", message);
@ -497,6 +519,192 @@ public class BasicServiceImpl implements BasicService {
return dto;
}
public TBasicDto getCancelHospitalDto(String str) {
XmlUtil xml=XmlUtil.of(str);
//id-消息流水号
String serialId=null;
Node serialIdNode = xml.getNode("/PRPA_HIP1235/id/@extension");
if(Func.isNotEmpty(serialIdNode)){
serialId=serialIdNode.getNodeValue();
}
//接受方
String receive=null;
Node receiveNode = xml.getNode("/PRPA_HIP1235/receiver/device/id/item/@extension");
if(Func.isNotEmpty(receiveNode)){
receive=receiveNode.getNodeValue();
}
//发送方
String send=null;
Node sendNode = xml.getNode("/PRPA_HIP1235/sender/device/id/item/@extension");
if(Func.isNotEmpty(sendNode)){
send=sendNode.getNodeValue();
}
//住院流水号
String jzh=null;
Node jzhNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/item/@extension");
if(Func.isNotEmpty(jzhNode)){
jzh=jzhNode.getNodeValue();
}
//住院号标识
String inpatientNo=null;
Node inpatientNoNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/id/item/@extension");
if(Func.isNotEmpty(inpatientNoNode)){
inpatientNo=inpatientNoNode.getNodeValue();
}
//住院次数[]
String admissTimes=null;
Node admissTimesNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/lengthOfStayQuantity[@unit='次']/@value");
if(Func.isNotEmpty(admissTimesNode)){
admissTimes=admissTimesNode.getNodeValue();
}
//姓名
String name=null;
Node nameNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/subject/patient/patientPerson/name/item/part/@value");
if(Func.isNotEmpty(nameNode)){
name=nameNode.getNodeValue();
}
//入院日期时间
String admissDate=null;
Node admissDateNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/effectiveTime/low/@value");
if(Func.isNotEmpty(admissDateNode)){
admissDate=admissDateNode.getNodeValue();
}
//出院日期时间
String disDate=null;
Node disDateNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/effectiveTime/high/@value");
if(Func.isNotEmpty(disDateNode)){
disDate=disDateNode.getNodeValue();
}
//入院诊断科室名称[]
String admissDeptName=null;
Node admissDeptNameNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/component[@displayName='入院诊断']/section/entry[@displayName='入院诊断-西医条目']/observation/performer/assignedEntity/representedOrganization/name");
if(Func.isNotEmpty(admissDeptNameNode)){
admissDeptNameNode.getTextContent();
}
//出院诊断科室名称[]
String disDeptName=null;
Node disDeptNameNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/component[@displayName='出院诊断']/section/entry[@displayName='出院诊断-西医条目']/observation/performer/assignedEntity/representedOrganization/name");
if(Func.isNotEmpty(disDeptNameNode)){
disDeptName=disDeptNameNode.getTextContent();
}
//主治医师[]
String attending=null;
Node attendingNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/authenticator[@displayName='住院医师']/assignedEntity/id/@extension");
if(Func.isNotEmpty(attendingNode)){
attending=attendingNode.getTextContent();
}
//主治医师[]
String attendingName=null;
Node attendingNameNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/authenticator[@displayName='住院医师']/assignedEntity/assignedPerson/name");
if(Func.isNotEmpty(attendingNameNode)){
attendingName=attendingNameNode.getTextContent();
}
//年龄
String age=null;
Node ageNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/subject/patient/patientPerson/age[@unit='岁']/@value");
if(Func.isNotEmpty(ageNode)){
age=ageNode.getNodeValue();
}
//性别
String sex=null;
Node sexNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/subject/patient/patientPerson/administrativeGenderCode/@code");
if(Func.isNotEmpty(sexNode)){
sex=sexNode.getNodeValue();
}
//身份证号
String idCard=null;
Node idCardNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/subject/patient/patientPerson/id/item/@extension");
if(Func.isNotEmpty(idCardNode)){
idCard=idCardNode.getNodeValue();
}
//出院科室
String disDept=null;
Node disDeptCardNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/componentOf/encompassingEncounter/location/healthCareFacility/serviceProviderOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/id/@extension");
if(Func.isNotEmpty(disDeptCardNode)){
disDept=disDeptCardNode.getNodeValue();
}
//性别名称
String sexName=null;
Node sexNameNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/subject/patient/patientPerson/administrativeGenderCode/@displayName");
if(Func.isNotEmpty(sexNameNode)){
sexName=sexNameNode.getNodeValue();
}
//床位号
String bedNum=null;
Node bedNumNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/componentOf/encompassingEncounter/location/healthCareFacility/serviceProviderOrganization/asOrganizationPartOf/wholeOrganization/id/@extension");
if(Func.isNotEmpty(bedNumNode)){
bedNum=bedNumNode.getNodeValue();
}
//住院天数数[]
String admissDays=null;
Node admissDaysNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/lengthOfStayQuantity[@unit='天']/@value");
if(Func.isNotEmpty(admissDaysNode)){
admissDays=admissDaysNode.getNodeValue();
}
//是否死亡[]
String isDead=null;
Node isDeadNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/component[@displayName='出院诊断']/section/entry[@displayName='出院情况']/observation/value");
if(Func.isNotEmpty(isDeadNode)){
isDead=isDeadNode.getTextContent();
}
//病区编号
String wardCode=null;
Node wardCodeNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/componentOf/encompassingEncounter/location/healthCareFacility/serviceProviderOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/id/@extension");
if(Func.isNotEmpty(wardCodeNode)){
wardCode=wardCodeNode.getNodeValue();
}
//病区名称
String wardName=null;
Node wardNameNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/componentOf/encompassingEncounter/location/healthCareFacility/serviceProviderOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/asOrganizationPartOf/wholeOrganization/name");
if(Func.isNotEmpty(wardNameNode)){
wardName=wardNameNode.getTextContent();
}
//顺德人医第三方索引
String sdryIndex=null;
Node sdryIndexNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/subject/patient/id/item/@extension");
if(Func.isNotEmpty(sdryIndexNode)){
sdryIndex=sdryIndexNode.getNodeValue();
}
//出院状态
String statusCode=null;
Node statusCodeNode = xml.getNode("/PRPA_HIP1235/controlActProcess/subject/encounterEvent/statusCode/@code");
if(Func.isNotEmpty(statusCodeNode)){
statusCode=statusCodeNode.getNodeValue();
}
//设置dto
TBasicDto dto=new TBasicDto();
dto.setSerialId(serialId);
dto.setSend(send);
dto.setReceive(receive);
dto.setInpatientNo(inpatientNo);
dto.setName(name);
dto.setJzh(jzh);
dto.setAdmissDeptName(admissDeptName);
dto.setDisDeptName(disDeptName);
dto.setAdmissDate(admissDate);
dto.setDisDate(disDate);
dto.setAdmissTimes(admissTimes);
dto.setAttending(attending);
dto.setAttendingName(attendingName);
dto.setAge(age);
dto.setSex(sex);
dto.setIdCard(idCard);
dto.setDisDept(disDept);
dto.setSexName(sexName);
dto.setBedNum(bedNum);
dto.setIsDead(isDead);
dto.setAdmissDays(admissDays);
dto.setWardCode(wardCode);
dto.setWardName(wardName);
dto.setSdryIndex(sdryIndex);
dto.setIsOther(0);
dto.setStatu(statusCode);
return dto;
}
public TBasicDto getAdmissTBasicDto(String message) {
XmlUtil xml=XmlUtil.of(message);
//id-消息流水号

@ -108,6 +108,11 @@ public class ReceiveServerImpl implements ReceiveServer {
return reportServer.pushMaternalInfantRelationship(maternalInfantRelationshipMessage);
}
@Override
public String cancelHospital(String message) {
return basicService.cancelHospital(message);
}
@Override
public String querySdJxIndexTest(String xml) {
System.out.println("收到那个人想查报告的动机,参数为:"+xml);

Loading…
Cancel
Save