use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7PatientFHIRConversionTest method patient_multiple_birth_conversion_test.
@Test
void patient_multiple_birth_conversion_test() {
/**
* Simplified logic for multiple birth
*
* Y + number = number
* N + number = N
* Y + blank = Y
* N + blank = N
* blank + number = number
* blank + blank = nothing.
*/
String patientMsgEmptyMultiple = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^||||||||||||||||||Born in USA|||USA||||\n";
Patient patientObjEmptyMultiple = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgEmptyMultiple);
assertThat(patientObjEmptyMultiple.hasMultipleBirth()).isFalse();
assertThat(patientObjEmptyMultiple.hasMultipleBirthIntegerType()).isFalse();
assertThat(patientObjEmptyMultiple.hasMultipleBirthBooleanType()).isFalse();
String patientMsgMultipleN = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^||||||||||||||||||Born in USA|N||USA||||\n";
Patient patientObjMultipleN = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgMultipleN);
assertThat(patientObjMultipleN.hasMultipleBirth()).isTrue();
assertThat(patientObjMultipleN.hasMultipleBirthIntegerType()).isFalse();
assertThat(patientObjMultipleN.hasMultipleBirthBooleanType()).isTrue();
assertThat(patientObjMultipleN.getMultipleBirthBooleanType().booleanValue()).isFalse();
String patientMsgMultipleNumberOnly = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^||||||||||||||||||Born in USA||2|USA||||\n";
// A number when the boolean is missing presumes the number has meaning. An integer is created.
Patient patientObjMultipleNumberOnly = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgMultipleNumberOnly);
assertThat(patientObjMultipleNumberOnly.hasMultipleBirth()).isTrue();
assertThat(patientObjMultipleNumberOnly.hasMultipleBirthIntegerType()).isTrue();
assertThat(patientObjMultipleNumberOnly.hasMultipleBirthBooleanType()).isFalse();
assertThat(patientObjMultipleNumberOnly.getMultipleBirthIntegerType().asStringValue()).isEqualTo("2");
String patientMsgMultipleBooleanYOnly = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^||||||||||||||||||Born in USA|Y||USA||||\n";
Patient patientObjMultipleBooleanYOnly = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgMultipleBooleanYOnly);
assertThat(patientObjMultipleBooleanYOnly.hasMultipleBirth()).isTrue();
assertThat(patientObjMultipleBooleanYOnly.hasMultipleBirthIntegerType()).isFalse();
assertThat(patientObjMultipleBooleanYOnly.hasMultipleBirthBooleanType()).isTrue();
assertThat(patientObjMultipleBooleanYOnly.getMultipleBirthBooleanType().booleanValue()).isTrue();
String patientMsgMultipleNumberAndBooleanY = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^||||||||||||||||||Born in USA|Y|3|USA||||\n";
Patient patientObjMultipleNumberAndBooleanY = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgMultipleNumberAndBooleanY);
assertThat(patientObjMultipleNumberAndBooleanY.hasMultipleBirth()).isTrue();
assertThat(patientObjMultipleNumberAndBooleanY.hasMultipleBirthIntegerType()).isTrue();
assertThat(patientObjMultipleNumberAndBooleanY.hasMultipleBirthBooleanType()).isFalse();
// DateUtil.formatToDate
assertThat(patientObjMultipleNumberAndBooleanY.getMultipleBirthIntegerType().asStringValue()).isEqualTo("3");
String patientMsgMultipleN16 = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^||||||||||||||||||Born in USA|N|16|USA||||\n";
Patient patientObjMultipleN16 = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgMultipleN16);
assertThat(patientObjMultipleN16.hasMultipleBirth()).isTrue();
assertThat(patientObjMultipleN16.hasMultipleBirthIntegerType()).isFalse();
assertThat(patientObjMultipleN16.hasMultipleBirthBooleanType()).isTrue();
assertThat(patientObjMultipleN16.getMultipleBirthBooleanType().booleanValue()).isFalse();
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7PatientFHIRConversionTest method patientNameTest.
@Test
void patientNameTest() {
String patientHasMiddleName = "MSH|^~\\&|MyEMR|DE-000001| |CAIRLO|20160701123030-0700||VXU^V04^VXU_V04|CA0001|P|2.6|||ER|AL|||||Z22^CDCPHINVS|DE-000001\r" + // PID 5 fields (name) are extracted and tested
"PID|1||PA123456^^^MYEMR^MR||JONES^GEORGE^Q^III^MR^^B||||||||||||||||||||\r";
Patient patientObjUsualName = PatientUtils.createPatientFromHl7Segment(ftv, patientHasMiddleName);
java.util.List<org.hl7.fhir.r4.model.HumanName> name = patientObjUsualName.getName();
List<StringType> givenName = name.get(0).getGiven();
List<StringType> suffixes = name.get(0).getSuffix();
assertThat(suffixes).hasSize(1);
List<StringType> prefixes = name.get(0).getPrefix();
assertThat(prefixes).hasSize(1);
String fullName = name.get(0).getText();
assertThat(prefixes.get(0).toString()).hasToString("MR");
assertThat(givenName.get(0).toString()).hasToString("GEORGE");
assertThat(givenName.get(1).toString()).hasToString("Q");
assertThat(suffixes.get(0).toString()).hasToString("III");
assertThat(fullName).isEqualTo("MR GEORGE Q JONES III");
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7PatientFHIRConversionTest method patient_deceased_conversion_test1.
/**
* In order to generate messageHeader resource, MSH should have MSH.24.2 as this is required
* attribute for source attribute, and source is required for MessageHeader resource.
*/
@Test
void patient_deceased_conversion_test1() {
String patientMsgDeceasedEmpty = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|12345 testing ave^^Minneapolis^MN^55407^^^^MN053|USAA|^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|Y|2|USA||||\n";
String patientMsgNotDeadBooleanN = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|12345 testing ave^^Minneapolis^MN^55407^^^^MN053|USAA|^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|Y|2|USA||||N\n";
String patientMsgDeceasedDateOnlyYYYY = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|12345 testing ave^^Minneapolis^MN^55407^^^^MN053|USAA|^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|Y|2|USA|||2006|\n";
String patientMsgDeceasedDateOnlyYYYYMM = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|12345 testing ave^^Minneapolis^MN^55407^^^^MN053|USAA|^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|Y|2|USA|||200611|\n";
Patient patientObjDeceasedEmpty = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgDeceasedEmpty);
assertThat(patientObjDeceasedEmpty.hasDeceased()).isFalse();
assertThat(patientObjDeceasedEmpty.hasDeceasedBooleanType()).isFalse();
assertThat(patientObjDeceasedEmpty.hasDeceasedDateTimeType()).isFalse();
Patient patientObjNotDeadBooleanN = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgNotDeadBooleanN);
assertThat(patientObjNotDeadBooleanN.hasDeceased()).isTrue();
assertThat(patientObjNotDeadBooleanN.hasDeceasedBooleanType()).isTrue();
assertThat(patientObjNotDeadBooleanN.getDeceasedBooleanType().booleanValue()).isFalse();
Patient patientObjDeceasedDateOnlyYYYY = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgDeceasedDateOnlyYYYY);
assertThat(patientObjDeceasedDateOnlyYYYY.hasDeceased()).isTrue();
assertThat(patientObjDeceasedDateOnlyYYYY.hasDeceasedDateTimeType()).isTrue();
assertThat(patientObjDeceasedDateOnlyYYYY.hasDeceasedBooleanType()).isFalse();
assertThat(patientObjDeceasedDateOnlyYYYY.getDeceasedDateTimeType().asStringValue()).isEqualTo("2006");
Patient patientObjDeceasedDateOnlyYYYYMM = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgDeceasedDateOnlyYYYYMM);
assertThat(patientObjDeceasedDateOnlyYYYYMM.hasDeceased()).isTrue();
assertThat(patientObjDeceasedDateOnlyYYYYMM.hasDeceasedDateTimeType()).isTrue();
assertThat(patientObjDeceasedDateOnlyYYYYMM.hasDeceasedBooleanType()).isFalse();
assertThat(patientObjDeceasedDateOnlyYYYYMM.getDeceasedDateTimeType().asStringValue()).isEqualTo("2006-11");
// More related tests in patient_deceased_conversion_test2
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7PatientFHIRConversionTest method patient_deceased_conversion_test2.
@Test
void patient_deceased_conversion_test2() {
String patientMsgDeceasedDateOnlyYYYYMMDDHHMMSSZZZZ = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|12345 testing ave^^Minneapolis^MN^55407^^^^MN053|USAA|^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|Y|2|USA|||20061120115930+0100|\n";
String patientMsgDeceasedBooleanYOnly = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|12345 testing ave^^Minneapolis^MN^55407^^^^MN053|USAA|^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|Y|2|USA||||Y\n";
String patientMsgDeceasedDateAndBooleanY = "MSH|^~\\&|MIICEHRApplication|MIIC|MIIC|MIIC|201705130822||VXU^V04^VXU_V04|test1100|P|2.5.1|||AL|AL|||||Z22^CDCPHINVS|^^^^^MIIC^SR^^^MIIC|MIIC\n" + "PID|1||12345678^^^^MR|ALTID|Mouse^Mickey^J^III^^^|Mother^Micky|20060504|M|Alias^Alias|2106-3^White^ HL70005|12345 testing ave^^Minneapolis^MN^55407^^^^MN053|USAA|^PRN^^^PH^555^5555555|^PRN^^^PH^555^666666|english|married|bhuddist|1234567_account|111-22-3333|||2186-5^not Hispanic or Latino^CDCREC|Born in USA|Y|2|USA|||20061120|Y\n";
Patient patientObjDeceasedBooleanYOnly = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgDeceasedBooleanYOnly);
assertThat(patientObjDeceasedBooleanYOnly.hasDeceased()).isTrue();
assertThat(patientObjDeceasedBooleanYOnly.hasDeceasedDateTimeType()).isFalse();
assertThat(patientObjDeceasedBooleanYOnly.hasDeceasedBooleanType()).isTrue();
assertThat(patientObjDeceasedBooleanYOnly.getDeceasedBooleanType().booleanValue()).isTrue();
Patient patientObjDeceasedDateOnlyYYYYMMDDHHMMSSZZZZ = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgDeceasedDateOnlyYYYYMMDDHHMMSSZZZZ);
assertThat(patientObjDeceasedDateOnlyYYYYMMDDHHMMSSZZZZ.hasDeceased()).isTrue();
assertThat(patientObjDeceasedDateOnlyYYYYMMDDHHMMSSZZZZ.hasDeceasedDateTimeType()).isTrue();
assertThat(patientObjDeceasedDateOnlyYYYYMMDDHHMMSSZZZZ.hasDeceasedBooleanType()).isFalse();
assertThat(patientObjDeceasedDateOnlyYYYYMMDDHHMMSSZZZZ.getDeceasedDateTimeType().asStringValue()).isEqualTo("2006-11-20T11:59:30+01:00");
Patient patientObjDeceasedDateAndBooleanY = PatientUtils.createPatientFromHl7Segment(ftv, patientMsgDeceasedDateAndBooleanY);
assertThat(patientObjDeceasedDateAndBooleanY.hasDeceased()).isTrue();
assertThat(patientObjDeceasedDateAndBooleanY.hasDeceasedDateTimeType()).isTrue();
assertThat(patientObjDeceasedDateAndBooleanY.hasDeceasedBooleanType()).isFalse();
// DateUtil.formatToDate
assertThat(patientObjDeceasedDateAndBooleanY.getDeceasedDateTimeType().asStringValue()).isEqualTo("2006-11-20");
}
use of org.hl7.fhir.r4.model.codesystems.V3Hl7PublishingDomain.MR in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7PatientFHIRConversionTest method patientCommunicationLanguage.
@Test
void patientCommunicationLanguage() {
String patientSpeaksEnglishWithSystem = "MSH|^~\\&|MyEMR|DE-000001| |CAIRLO|20160701123030-0700||VXU^V04^VXU_V04|CA0001|P|2.6|||ER|AL|||||Z22^CDCPHINVS|DE-000001\r" + "PID|1||PA123456^^^MYEMR^MR||DOE^JOHN|||M|||||||ENG^English^HL70296|||||||||Y|2\r";
// NO coding system given in the CWE
String patientEnglishNoSystem = "MSH|^~\\&|MyEMR|DE-000001| |CAIRLO|20160701123030-0700||VXU^V04^VXU_V04|CA0001|P|2.6|||ER|AL|||||Z22^CDCPHINVS|DE-000001\r" + "PID|1||PA123456^^^MYEMR^MR||DOE^JANE|||M|||||||ENG^English|||||||||Y|2\r";
// NO coding system given in the CWE
String patientEnglishCodeOnly = "MSH|^~\\&|MyEMR|DE-000001| |CAIRLO|20160701123030-0700||VXU^V04^VXU_V04|CA0001|P|2.6|||ER|AL|||||Z22^CDCPHINVS|DE-000001\r" + "PID|1||PA123456^^^MYEMR^MR||DOE^JANE|||M|||||||ENG|||||||||Y|2\r";
Patient patientObjEnglish = PatientUtils.createPatientFromHl7Segment(ftv, patientSpeaksEnglishWithSystem);
assertThat(patientObjEnglish.hasCommunication()).isTrue();
assertThat(patientObjEnglish.getCommunication().get(0).getPreferred()).isTrue();
assertThat(patientObjEnglish.getCommunication()).hasSize(1);
Patient.PatientCommunicationComponent cc = patientObjEnglish.getCommunication().get(0);
assertThat(cc.getPreferred()).isTrue();
assertThat(cc.getLanguage().getText()).isEqualTo("English");
Coding code = cc.getLanguage().getCodingFirstRep();
assertThat(code.getCode()).isEqualTo("ENG");
assertThat(code.getSystem()).isEqualTo("urn:id:v2-0296");
assertThat(code.getDisplay()).isEqualTo("English");
Patient patientObjNoSystem = PatientUtils.createPatientFromHl7Segment(ftv, patientEnglishNoSystem);
assertThat(patientObjNoSystem.hasCommunication()).isTrue();
assertThat(patientObjNoSystem.getCommunication().get(0).getPreferred()).isTrue();
assertThat(patientObjNoSystem.getCommunication()).hasSize(1);
Patient.PatientCommunicationComponent ccNoCode = patientObjNoSystem.getCommunication().get(0);
assertThat(ccNoCode.getPreferred()).isTrue();
assertThat(ccNoCode.getLanguage().getText()).isEqualTo("English");
Coding codeNo = ccNoCode.getLanguage().getCodingFirstRep();
assertThat(codeNo.getCode()).isEqualTo("ENG");
assertThat(code.getDisplay()).isEqualTo("English");
assertThat(codeNo.hasDisplay()).isTrue();
Patient patientObjCodeOnly = PatientUtils.createPatientFromHl7Segment(ftv, patientEnglishCodeOnly);
assertThat(patientObjCodeOnly.hasCommunication()).isTrue();
assertThat(patientObjCodeOnly.getCommunication().get(0).getPreferred()).isTrue();
assertThat(patientObjCodeOnly.getCommunication()).hasSize(1);
Patient.PatientCommunicationComponent ccCodeOnly = patientObjCodeOnly.getCommunication().get(0);
assertThat(ccCodeOnly.getPreferred()).isTrue();
assertThat(ccCodeOnly.getLanguage().hasText()).isFalse();
Coding coding = ccCodeOnly.getLanguage().getCodingFirstRep();
assertThat(coding.getCode()).isEqualTo("ENG");
assertThat(coding.getSystem()).isNull();
assertThat(coding.getDisplay()).isNull();
}
Aggregations