### Install aranyasen/hl7 Package Source: https://github.com/senaranya/hl7/blob/master/README.md Use Composer to install the HL7 package. ```bash composer require aranyasen/hl7 ``` -------------------------------- ### NK1::setStartDate Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/NK1.md Sets the start date for the NK1 segment. ```APIDOC ## NK1::setStartDate ### Description Sets the start date for the NK1 segment. ### Method This information is not available in the provided text. ### Endpoint This information is not available in the provided text. ### Parameters This function has no parameters. ### Request Example This information is not available in the provided text. ### Response #### Success Response (200) `void` #### Response Example This information is not available in the provided text. ``` -------------------------------- ### TQ1::setStartDateTime Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/TQ1.md Sets the start date and time for the TQ1 segment. ```APIDOC ## TQ1::setStartDateTime ### Description Sets the start date and time for the TQ1 segment. ### Method Not specified (likely a setter method within a class) ### Endpoint Not applicable (method within a class) ### Parameters This function has no parameters. ### Response #### Success Response (void) void ### Response Example void ``` -------------------------------- ### NK1::getStartDate Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/NK1.md Retrieves the start date associated with the NK1 segment. ```APIDOC ## NK1::getStartDate ### Description Retrieves the start date associated with the NK1 segment. ### Method GET (assumed, as it's a getter method) ### Endpoint /senaranya/hl7/NK1/getStartDate ### Parameters This function has no parameters. ### Response #### Success Response (200) - **Return Value** (void) - Indicates the function does not return a specific value, but may perform an action or set a state. ``` -------------------------------- ### HL7 PV2 Get Methods Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/PV2.md This section details the GET methods available for retrieving specific data points from the HL7 PV2 segment. ```APIDOC ## HL7 PV2 Get Endpoints ### Description These endpoints allow retrieval of specific data fields from the HL7 PV2 segment. ### Methods GET ### Endpoints - /senaranya/hl7/pv2/accommodationCode - /senaranya/hl7/pv2/actualLengthOfInpatientStay - /senaranya/hl7/pv2/admissionLevelOfCareCode - /senaranya/hl7/pv2/admitReason - /senaranya/hl7/pv2/advanceDirectiveCode - /senaranya/hl7/pv2/babyDetainedIndicator - /senaranya/hl7/pv2/billingMediaCode - /senaranya/hl7/pv2/clinicOrganizationName - /senaranya/hl7/pv2/employmentIllnessRelatedIndicator - /senaranya/hl7/pv2/estimatedLengthofInpatientStay - /senaranya/hl7/pv2/expectedAdmitDateTime - /senaranya/hl7/pv2/expectedDischargeDateTime - /senaranya/hl7/pv2/expectedDischargeDisposition - /senaranya/hl7/pv2/expectedLOAReturnDateTime - /senaranya/hl7/pv2/expectedNumberOfInsurancePlans - /senaranya/hl7/pv2/expectedSurgeryDateAndTime - /senaranya/hl7/pv2/firstSimilarIllnessDate - /senaranya/hl7/pv2/livingWillCode - /senaranya/hl7/pv2/militaryNonAvailabilityCode - /senaranya/hl7/pv2/militaryPartnershipCode - /senaranya/hl7/pv2/modeOfArrivalCode - /senaranya/hl7/pv2/newbornBabyIndicator - /senaranya/hl7/pv2/organDonorCode - /senaranya/hl7/pv2/patientChargeAdjustmentCode - /senaranya/hl7/pv2/patientConditionCode - /senaranya/hl7/pv2/patientStatusCode - /senaranya/hl7/pv2/patientStatusEffectiveDate - /senaranya/hl7/pv2/patientValuables - /senaranya/hl7/pv2/patientValuablesLocation - /senaranya/hl7/pv2/precautionCode - /senaranya/hl7/pv2/previousServiceDate - /senaranya/hl7/pv2/previousTreatmentDate - /senaranya/hl7/pv2/purgeStatusCode - /senaranya/hl7/pv2/purgeStatusDate - /senaranya/hl7/pv2/recreationalDrugUseCode - /senaranya/hl7/pv2/recurringServiceCode - /senaranya/hl7/pv2/referralSourceCode - /senaranya/hl7/pv2/retentionIndicator - /senaranya/hl7/pv2/signatureOnFileDate - /senaranya/hl7/pv2/specialProgramCode - /senaranya/hl7/pv2/transferReason - /senaranya/hl7/pv2/visitDescription - /senaranya/hl7/pv2/visitPriorityCode - /senaranya/hl7/pv2/visitProtectionIndicator - /senaranya/hl7/pv2/visitPublicityCode - /senaranya/hl7/pv2/visitUserCode ### Parameters None ### Request Example GET /senaranya/hl7/pv2/patientStatusCode ### Response #### Success Response (200) - **statusCode** (string) - The patient status code. #### Response Example { "statusCode": "A" } ``` -------------------------------- ### AIG::setStartDateTime Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/AIG.md Sets the start date-time. ```APIDOC ## AIG::setStartDateTime ### Description Sets the start date-time. ### Method POST (assumed, as it modifies state) ### Endpoint /senaranya/hl7/AIG/setStartDateTime ### Parameters This function has no parameters. ### Response #### Success Response (200) - **void** (void) - Indicates no specific return value or type. ``` -------------------------------- ### Get Pre-Certification Requirement - IN3::getPreCertificationRequirement Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN3.md Retrieves the pre-certification requirement. This function takes no parameters and returns void. ```php getPreCertificationRequirement (void) ``` -------------------------------- ### MSH Segment Usage Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/MSH.md Example of how to instantiate and use the MSH segment class. ```APIDOC ## MSH Segment Usage ### Description This code snippet demonstrates the basic instantiation and usage of the MSH segment class. ### Code Example ```php $seg = new MSH(); $seg->setField(9, "ADT^A24"); echo $seg->getField(1); ``` ### Notes The MSH segment has a unique structure where the first field is the field separator. Field indexing starts from 1 for the field separator and 2 for subsequent fields. ``` -------------------------------- ### AIG::getStartDateTimeOffset Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/AIG.md Retrieves the start date-time offset. ```APIDOC ## AIG::getStartDateTimeOffset ### Description Retrieves the start date-time offset. ### Method GET (assumed, as it's a getter method) ### Endpoint /senaranya/hl7/AIG/getStartDateTimeOffset ### Parameters This function has no parameters. ### Response #### Success Response (200) - **void** (void) - Indicates no specific return value or type. ``` -------------------------------- ### AIP::setStartDateTime Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/AIP.md Sets the start date and time for the segment. ```APIDOC ## AIP::setStartDateTime ### Description Sets the start date and time. ### Method `static` ### Endpoint N/A (Method call) ### Parameters This function has no parameters. ### Response #### Success Response (void) Returns void. ### Request Example ```php AIP::setStartDateTime(); ``` ### Response Example ``` void ``` ``` -------------------------------- ### AIG::getStartDateTimeOffsetUnits Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/AIG.md Retrieves the units for the start date-time offset. ```APIDOC ## AIG::getStartDateTimeOffsetUnits ### Description Retrieves the units for the start date-time offset. ### Method GET (assumed, as it's a getter method) ### Endpoint /senaranya/hl7/AIG/getStartDateTimeOffsetUnits ### Parameters This function has no parameters. ### Response #### Success Response (200) - **void** (void) - Indicates no specific return value or type. ``` -------------------------------- ### AIL::setStartDateTime Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/AIL.md Sets the start date-time for the segment. ```APIDOC ## AIL::setStartDateTime ### Description Sets the start date-time for the segment. ### Method `setStartDateTime (void)` ### Endpoint N/A (Class method) ### Parameters This function has no parameters. ### Return Values `void` ``` -------------------------------- ### AIP::setStartDateTimeOffsetUnits Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/AIP.md Sets the units for the start date and time offset. ```APIDOC ## AIP::setStartDateTimeOffsetUnits ### Description Sets the units for the start date and time offset. ### Method `static` ### Endpoint N/A (Method call) ### Parameters This function has no parameters. ### Response #### Success Response (void) Returns void. ### Request Example ```php AIP::setStartDateTimeOffsetUnits(); ``` ### Response Example ``` void ``` ``` -------------------------------- ### AIL::setStartDateTimeOffsetUnits Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/AIL.md Sets the units for the start date-time offset. ```APIDOC ## AIL::setStartDateTimeOffsetUnits ### Description Sets the units for the start date-time offset. ### Method `setStartDateTimeOffsetUnits (void)` ### Endpoint N/A (Class method) ### Parameters This function has no parameters. ### Return Values `void` ``` -------------------------------- ### Get Penalty - IN3::getPenalty Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN3.md Retrieves penalty information. This function takes no parameters and returns void. ```php getPenalty (void) ``` -------------------------------- ### Create and Set PID Segment Data Source: https://context7.com/senaranya/hl7/llms.txt Demonstrates creating a new PID segment and setting various patient identification and demographic fields using setter methods. Includes examples for patient identifiers, names, birth date, sex, race, marital status, address, and phone numbers. ```php setPatientIdentifierList(['12345678', '', '', 'Hospital', 'MR']); // MRN $pid->setPatientID('EXT-001'); // External ID (PID.2) $pid->setAlternatePatientID('ALT-001'); // Alternate ID (PID.4) // Set patient name (Last^First^Middle^Suffix^Prefix) $pid->setPatientName(['Doe', 'John', 'Michael', 'Jr', 'Dr']); // Set demographics $pid->setDateTimeOfBirth('19800515120000'); // YYYYMMDDHHMMSS $pid->setSex('M'); // M, F, O, U, A, N (validated) $pid->setRace('2106-3'); // Race code $pid->setEthnicGroup('2186-5'); // Ethnicity code $pid->setMaritalStatus('M'); // Marital status $pid->setReligion('CHR'); // Religion code $pid->setCitizenship('USA'); $pid->setNationality('USA'); // Set contact information $pid->setPatientAddress(['123 Main St', 'Apt 4B', 'New York', 'NY', '10001', 'USA']); $pid->setPhoneNumberHome('555-123-4567'); $pid->setPhoneNumberBusiness('555-987-6543'); $pid->setPrimaryLanguage('EN'); // Set identifiers $pid->setSSNNumber('123-45-6789'); $pid->setDriversLicenseNumber(['D1234567', 'NY']); $pid->setPatientAccountNumber('ACCT001'); // Get patient information $name = $pid->getPatientName(); // ['Doe', 'John', 'Michael', 'Jr', 'Dr'] $dob = $pid->getDateTimeOfBirth(); // '19800515120000' $sex = $pid->getSex(); // 'M' $address = $pid->getPatientAddress(); $mrn = $pid->getPatientIdentifierList(); // Parse existing PID segment $hl7String = "MSH|^~\\&|||||||ADT^A01||P|2.3|\r" . "PID|1||123456^^^HospA^MR~987654^^^SSA^SS||Smith^Jane^Marie||19901220|F|||456 Oak Ave^^Boston^MA^02101||617-555-0123|||M||ACC789|\r"; $message = HL7::from($hl7String)->keepEmptySubfields()->create(); $pid = $message->getFirstSegmentInstance('PID'); echo $pid->getID(); // 1 print_r($pid->getPatientIdentifierList()); // Multiple IDs with repetition separator echo $pid->getPatientName()[0]; // 'Smith' echo $pid->getSex(); // 'F' echo $pid->getMaritalStatus(); // 'M' // Reset PID index for new batch PID::resetIndex(1); ``` -------------------------------- ### Get Days - IN3::getDays Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN3.md Retrieves the number of days. This function takes no parameters and returns void. ```php getDays (void) ``` -------------------------------- ### Get Second Opinion Documentation Received - IN3::getSecondOpinionDocumentationReceived Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN3.md Checks if second opinion documentation has been received. This function takes no parameters and returns void. ```php getSecondOpinionDocumentationReceived (void) ``` -------------------------------- ### Get HL7 Version Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/MSH.md Retrieve the HL7 version of the message from the MSH segment. Examples include 2.1, 2.3, or 3.0. ```php public getVersionId (void) ``` -------------------------------- ### MSH::setReceivingApplication Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/MSH.md This function has no parameters and returns void. ```php setReceivingApplication (void) ``` -------------------------------- ### Connection Constructor Source: https://github.com/senaranya/hl7/blob/master/docs/Connection.md Establishes a TCP connection to an HL7 server. Throws an exception if the connection fails. ```APIDOC ## Connection::__construct ### Description Creates a connection to a HL7 server, or throws exception when a connection could not be established. ### Method CONSTRUCTOR ### Parameters #### Path Parameters - **host** (string) - Required - Host to connect to - **port** (int) - Required - Port to connect to - **timeout** (int) - Required - Connection timeout ### Response #### Success Response (200) - **void** - No return value #### Throws Exceptions - **\HL7ConnectionException** ``` -------------------------------- ### Get Multiple HL7 Segment Fields Source: https://github.com/senaranya/hl7/blob/master/docs/Segment.md Retrieve a range of fields from an HL7 segment. If only the start index is provided, all fields from that index to the end are returned. Returns an array of fields. ```php $fields = $seg->getFields(2, 5); ``` -------------------------------- ### MSH::setSendingApplication Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/MSH.md This function has no parameters and returns void. ```php setSendingApplication (void) ``` -------------------------------- ### NK1 Segment Methods Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/NK1.md This section lists the available methods for interacting with the NK1 segment, including methods for getting and setting various fields, as well as inherited methods from the base Segment class. ```APIDOC ## Methods ### Getters - `getAddress()` - `getAdministrativeSex()` - `getAmbulatoryStatus()` - `getBusinessPhoneNumber()` - `getCitizenship()` - `getContactPersonSocialSecurityNumber()` - `getContactPersonsAddress()` - `getContactPersonsName()` - `getContactPersonsTelephoneNumber()` - `getContactReason()` - `getContactRole()` - `getDateTimeOfBirth()` - `getEndDate()` - `getEthnicGroup()` - `getHandicap()` - `getID()` - `getJobStatus()` - `getLivingArrangement()` - `getLivingDependency()` - `getMaritalStatus()` - `getMothersMaidenName()` - `getNKName()` - `getNationality()` - `getNextOfKinBirthPlace()` - `getNextOfKinOrAssociatedPartiesEmployeeNumber()` - `getNextOfKinOrAssociatedPartiesJobCodeOrClass()` - `getNextOfKinOrAssociatedPartiesJobTitle()` - `getNextOfKinOrAssociatedPartysIdentifiers()` - `getOrganizationName()` - `getPhoneNumber()` - `getPrimaryLanguage()` - `getProtectionIndicator()` - `getPublicityCode()` - `getRace()` - `getRelationship()` - `getReligion()` - `getStartDate()` - `getStudentIndicator()` - `getVipIndicator()` ### Setters - `setAddress(address)` - `setAdministrativeSex(sex)` - `setAmbulatoryStatus(status)` - `setBusinessPhoneNumber(number)` - `setCitizenship(citizenship)` - `setContactPersonSocialSecurityNumber(ssn)` - `setContactPersonsAddress(address)` - `setContactPersonsName(name)` - `setContactPersonsTelephoneNumber(number)` - `setContactReason(reason)` - `setContactRole(role)` - `setDateTimeOfBirth(datetime)` - `setEndDate(date)` - `setEthnicGroup(group)` - `setHandicap(handicap)` - `setID(id)` - `setJobStatus(status)` - `setLivingArrangement(arrangement)` - `setLivingDependency(dependency)` - `setMaritalStatus(status)` - `setMothersMaidenName(name)` - `setNKName(name)` - `setNationality(nationality)` - `setNextOfKinBirthPlace(place)` - `setNextOfKinOrAssociatedPartiesEmployeeNumber(number)` - `setNextOfKinOrAssociatedPartiesJobCodeOrClass(code)` - `setNextOfKinOrAssociatedPartiesJobTitle(title)` - `setNextOfKinOrAssociatedPartysIdentifiers(identifiers)` - `setOrganizationName(name)` - `setPhoneNumber(number)` - `setPrimaryLanguage(language)` - `setProtectionIndicator(indicator)` - `setPublicityCode(code)` - `setRace(race)` - `setRelationship(relationship)` - `setReligion(religion)` - `setStartDate(date)` - `setStudentIndicator(indicator)` - `setVipIndicator(indicator)` ### Other Methods - `__destruct()` - `resetIndex()`: Reset index of this segment. ## Inherited Methods ### Constructor - `__construct()`: Create a segment. ### Field Management - `clearField(index)`: Remove any existing value from the field. - `getField(index)`: Get the field at index. - `getFields()`: Get fields from a segment. - `setField(index, value)`: Set the field specified by index to value. ### Segment Information - `getName()`: Get the name of the segment. This is basically the value at index 0. - `size()`: Get the number of fields for this segment, not including the name. ``` -------------------------------- ### Set Certification Begin Date - IN3::setCertificationBeginDate Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN3.md Sets the certification begin date. This function takes no parameters and returns void. ```php setCertificationBeginDate (void) ``` -------------------------------- ### EVN Segment Class Methods Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/EVN.md This section details the methods available for interacting with the EVN segment, including getting and setting various event-related properties. ```APIDOC ## EVN::getDateTimePlannedEvent ### Description Retrieves the planned date and time for the event. ### Method GET ### Endpoint N/A (Method within a class) ### Parameters `This function has no parameters.` ### Response #### Success Response (void) Returns void, but internally retrieves the planned event date/time. ### EVN::getEventOccurred ### Description Retrieves the date and time when the event occurred. ### Method GET ### Endpoint N/A (Method within a class) ### Parameters `This function has no parameters.` ### Response #### Success Response (void) Returns void, but internally retrieves the event occurred date/time. ### EVN::getEventReasonCode ### Description Retrieves the reason code for the event. ### Method GET ### Endpoint N/A (Method within a class) ### Parameters `This function has no parameters.` ### Response #### Success Response (void) Returns void, but internally retrieves the event reason code. ### EVN::getEventTypeCode ### Description Retrieves the type code for the event. ### Method GET ### Endpoint N/A (Method within a class) ### Parameters `This function has no parameters.` ### Response #### Success Response (void) Returns void, but internally retrieves the event type code. ### EVN::getOperatorID ### Description Retrieves the operator ID associated with the event. ### Method GET ### Endpoint N/A (Method within a class) ### Parameters `This function has no parameters.` ### Response #### Success Response (void) Returns void, but internally retrieves the operator ID. ### EVN::getRecordedDateTime ### Description Retrieves the date and time when the event was recorded. ### Method GET ### Endpoint N/A (Method within a class) ### Parameters `This function has no parameters.` ### Response #### Success Response (void) Returns void, but internally retrieves the recorded date/time. ### EVN::setDateTimePlannedEvent ### Description Sets the planned date and time for the event. ### Method SET ### Endpoint N/A (Method within a class) ### Parameters `This function has no parameters.` ### Response #### Success Response (void) Sets the planned event date/time. ### EVN::setEventOccurred ### Description Sets the date and time when the event occurred. ### Method SET ### Endpoint N/A (Method within a class) ### Parameters `This function has no parameters.` ### Response #### Success Response (void) Sets the event occurred date/time. ### EVN::setEventReasonCode ### Description Sets the reason code for the event. ### Method SET ### Endpoint N/A (Method within a class) ### Parameters `This function has no parameters.` ### Response #### Success Response (void) Sets the event reason code. ### EVN::setEventTypeCode ### Description Sets the type code for the event. ### Method SET ### Endpoint N/A (Method within a class) ### Parameters `This function has no parameters.` ### Response #### Success Response (void) Sets the event type code. ### EVN::setOperatorID ### Description Sets the operator ID associated with the event. ### Method SET ### Endpoint N/A (Method within a class) ### Parameters `This function has no parameters.` ### Response #### Success Response (void) Sets the operator ID. ### EVN::setRecordedDateTime ### Description Sets the date and time when the event was recorded. ### Method SET ### Endpoint N/A (Method within a class) ### Parameters `This function has no parameters.` ### Response #### Success Response (void) Sets the recorded date/time. ``` -------------------------------- ### SAC::getInitialSpecimenVolume Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/SAC.md Retrieves the initial specimen volume. This function takes no parameters and returns void. ```php getInitialSpecimenVolume (void) ``` -------------------------------- ### AIG::setStartDateTimeOffset Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/AIG.md Sets the start date-time offset. ```APIDOC ## AIG::setStartDateTimeOffset ### Description Sets the start date-time offset. ### Method POST (assumed, as it modifies state) ### Endpoint /senaranya/hl7/AIG/setStartDateTimeOffset ### Parameters This function has no parameters. ### Response #### Success Response (200) - **void** (void) - Indicates no specific return value or type. ``` -------------------------------- ### PV2::getVisitDescription Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/PV2.md Retrieves the Visit Description. ```APIDOC ## PV2::getVisitDescription ### Description Retrieves the Visit Description. ### Method GET ### Endpoint /senaranya/hl7/PV2/getVisitDescription ### Parameters This function has no parameters. ### Response #### Success Response (200) - **return_value** (void) - Description not specified. ``` -------------------------------- ### EQU::getEquipmentState Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/EQU.md Retrieves the equipment state. ```APIDOC ### EQU::getEquipmentState **Description** ```php getEquipmentState (void) ``` **Parameters** `This function has no parameters.` **Return Values** `void` ``` -------------------------------- ### EQU::setEquipmentState Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/EQU.md Sets the equipment state. ```APIDOC ### EQU::setEquipmentState **Description** ```php setEquipmentState (void) ``` **Parameters** `This function has no parameters.` **Return Values** `void` ``` -------------------------------- ### AIG::setStartDateTimeOffsetUnits Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/AIG.md Sets the start date-time offset units. ```APIDOC ## AIG::setStartDateTimeOffsetUnits ### Description Sets the start date-time offset units. ### Method POST (assumed, as it modifies state) ### Endpoint /senaranya/hl7/AIG/setStartDateTimeOffsetUnits ### Parameters This function has no parameters. ### Response #### Success Response (200) - **void** (void) - Indicates no specific return value or type. ``` -------------------------------- ### PV2::setVisitDescription Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/PV2.md Sets the visit description. This method does not accept any parameters and returns void. ```APIDOC ## PV2::setVisitDescription ### Description Sets the visit description. ### Method This documentation does not specify the HTTP method as it appears to be a class method. ### Endpoint This documentation does not specify an endpoint as it appears to be a class method. ### Parameters This function has no parameters. ### Response #### Success Response (void) Returns void. ### Request Example ```php PV2::setVisitDescription(); ``` ### Response Example (void) ``` -------------------------------- ### HL7 Connection Constructor Source: https://github.com/senaranya/hl7/blob/master/docs/Connection.md Use the constructor to create a connection to a HL7 server. Specify the host, port, and an optional connection timeout. An exception is thrown if the connection cannot be established. ```php public __construct (string $host, int $port, int $timeout) ``` -------------------------------- ### HL7 Factory for Message Creation (Deprecated Direct Instantiation) Source: https://github.com/senaranya/hl7/blob/master/UPGRADE.md Direct instantiation of Message is deprecated. Use the HL7 factory's `create()` method as an alternative to `createMessage()`. Refer to the README for detailed usage. ```php $message = HL7::build()->create() ``` -------------------------------- ### AIL::setStartDateTimeOffset Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/AIL.md Sets the start date-time offset for the segment. ```APIDOC ## AIL::setStartDateTimeOffset ### Description Sets the start date-time offset for the segment. ### Method `setStartDateTimeOffset (void)` ### Endpoint N/A (Class method) ### Parameters This function has no parameters. ### Return Values `void` ``` -------------------------------- ### OBX::setEquipmentInstanceIdentifier Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/OBX.md Sets the equipment instance identifier. ```APIDOC ## OBX::setEquipmentInstanceIdentifier ### Description Sets the equipment instance identifier. ### Method POST ### Endpoint /senaranya/hl7/OBX/setEquipmentInstanceIdentifier ### Parameters This function has no parameters. ### Request Body - **identifier** (string) - The equipment instance identifier. ### Response #### Success Response (200) - **status** (void) - Indicates success or failure of setting the identifier. ``` -------------------------------- ### Create and Set OBX Segment Data Source: https://context7.com/senaranya/hl7/llms.txt Shows how to create OBX segments for different observation types (numeric and string) and set their properties like value type, identifier, value, units, and status. Also demonstrates building an ORU message and parsing OBX segments from an existing HL7 string. ```php setValueType('NM'); // Numeric $obx1->setObservationIdentifier(['2345-7', 'Glucose', 'LN']); // LOINC code $obx1->setObservationSubId('1'); $obx1->setObservationValue('95'); $obx1->setUnits(['mg/dL', 'milligrams per deciliter']); $obx1->setReferenceRange('70-100'); $obx1->setAbnormalFlags('N'); // Normal $obx1->setObserveResultStatus('F'); // Final $obx2 = new OBX(); $obx2->setValueType('ST'); // String $obx2->setObservationIdentifier(['8867-4', 'Heart Rate', 'LN']); $obx2->setObservationValue('72'); $obx2->setUnits('bpm'); $obx2->setReferenceRange('60-100'); $obx2->setAbnormalFlags('N'); $obx2->setObserveResultStatus('F'); $obx2->setDateTimeOfTheObservation('20241215103045'); $obx2->setResponsibleObserver(['Smith', 'John', 'MD']); // Build complete ORU message $message = HL7::build() ->withHL7Version('2.5.1') ->create(); $msh = $message->getFirstSegmentInstance('MSH'); $msh->setMessageType('ORU'); $msh->setTriggerEvent('R01'); $msh->setSendingApplication('LabSystem'); $message->addSegment($obx1); $message->addSegment($obx2); echo $message->toString(true); // Parse OBX from existing message $hl7String = "MSH|^~\\&|Lab|||||||ORU^R01||P|2.3|\r" . "OBX|1|NM|2345-7^Glucose^LN||95|mg/dL|70-100|N|||F|||20241215103000\r" . "OBX|2|NM|6690-2^WBC^LN||7.5|K/uL|4.5-11.0|N|||F\r" . "OBX|3|NM|789-8^RBC^LN||4.8|M/uL|4.2-5.9|N|||F\r"; $message = HL7::from($hl7String)->create(); $obxSegments = $message->getSegmentsByName('OBX'); foreach ($obxSegments as $obx) { $identifier = $obx->getObservationIdentifier(); $value = $obx->getObservationValue(); $units = $obx->getUnits(); $status = $obx->getObserveResultStatus(); echo sprintf("%s: %s %s (%s)\n", is_array($identifier) ? $identifier[1] : $identifier, $value, is_array($units) ? $units[0] : $units, $status ); } // Output: // Glucose: 95 mg/dL (F) // WBC: 7.5 K/uL (F) // RBC: 4.8 M/uL (F) ``` -------------------------------- ### AIP::setStartDateTimeOffset Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/AIP.md Sets the start date and time offset for the segment. ```APIDOC ## AIP::setStartDateTimeOffset ### Description Sets the start date and time offset. ### Method `static` ### Endpoint N/A (Method call) ### Parameters This function has no parameters. ### Response #### Success Response (void) Returns void. ### Request Example ```php AIP::setStartDateTimeOffset(); ``` ### Response Example ``` void ``` ``` -------------------------------- ### MSH::setReceivingFacility Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/MSH.md This function has no parameters and returns void. ```php setReceivingFacility (void) ``` -------------------------------- ### Get ID - IN3::getID Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN3.md Retrieves the identifier. This function takes no parameters and returns void. ```php getID (void) ``` -------------------------------- ### ORC::setEnteringDevice API Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/ORC.md Sets the entering device. This function does not take any parameters and returns void. ```APIDOC ## ORC::setEnteringDevice ### Description Sets the entering device. ### Method POST (Assumed, as it's a setter) ### Endpoint /senaranya/hl7/orc/setEnteringDevice (Assumed) ### Parameters This function has no parameters. ### Request Body (No request body is specified for this function) ### Response #### Success Response (200) - **return_value** (void) - No value is returned. ``` -------------------------------- ### Segment Field Manipulation Source: https://github.com/senaranya/hl7/blob/master/docs/Segment.md Methods for clearing, getting, and setting fields within an HL7 segment. ```APIDOC ## Segment::clearField ### Description Remove any existing value from the field ### Method `clearField` ### Parameters - **index** (int) - Required - Field index ### Return Values `void` ``` ```APIDOC ## Segment::getField ### Description Get the field at index. If the field is a composite field, it returns an array. Example: ```php $field = $seg->getField(9); // Returns a string/null/array depending on what the 9th field is. ``` ### Method `getField` ### Parameters `This function has no parameters.` ### Return Values `void` ``` ```APIDOC ## Segment::setField ### Description Set the field specified by index to value. Indices start at 1, to stay with the HL7 standard. Trying to set the value at index 0 has no effect. The value may also be a reference to an array (that may itself contain arrays) to support composite fields (and sub-components). Examples: ```php $segment->setField(18, 'abcd'); // Sets 18th field to abcd $segment->setField(8, 'ab^cd'); // Sets 8th field to ab^cd $segment->setField(10, ['John', 'Doe']); // Sets 10th field to John^Doe $segment->setField(12, ['']); // Sets 12th field to '' ``` If values are not provided at all, the method will just return. ### Method `setField` ### Parameters - **index** (int) - Required - Index to set ### Return Values `void` ``` -------------------------------- ### Message::getSegmentByIndex Source: https://github.com/senaranya/hl7/blob/master/docs/Message.md Retrieves a segment from the HL7 message by its index. Segment indexing starts at 0. ```APIDOC ## Message::getSegmentByIndex ### Description Return the segment specified by $index. Note: Segment count within the message starts at 0. ### Method `public getSegmentByIndex(int $index)` ### Parameters #### Path Parameters - **index** (int) - Required - Index where segment is inserted ### Response #### Success Response (200) - **void** - Returns the segment at the specified index. ``` -------------------------------- ### EQU Methods Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/EQU.md Lists the available methods for the EQU segment, including getters, setters, and utility functions. ```APIDOC ### Methods | Name | Description | |------|-------------| |[getAlertLevel](#equgetalertlevel)| |[getEquipmentInstanceIdentifier](#equgetequipmentinstanceidentifier)| |[getEquipmentState](#equgetequipmentstate)| |[getEventDateTime](#equgeteventdatetime)| |[getLocalRemoteControlState](#equgetlocalremotecontrolstate)| |[resetIndex](#equresetindex)|Reset index of this segment| |[setAlertLevel](#equsetalertlevel)| |[setEquipmentInstanceIdentifier](#equsetequipmentinstanceidentifier)| |[setEquipmentState](#equsetequipmentstate)| |[setEventDateTime](#equseteventdatetime)| |[setLocalRemoteControlState](#equsetlocalremotecontrolstate)| ``` -------------------------------- ### PV1::getServicingFacility Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/PV1.md Retrieves the servicing facility. ```APIDOC ## PV1::getServicingFacility ### Description Retrieves the servicing facility. ### Method GET ### Endpoint /senaranya/hl7/PV1/getServicingFacility ### Parameters This function has no parameters. ### Response #### Success Response (200) - **facility** (string) - The servicing facility. ### Response Example ```json { "facility": "General Hospital" } ``` ``` -------------------------------- ### IN3::getPreCertificationRequirement Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN3.md Retrieves information about pre-certification requirements. ```APIDOC ## IN3::getPreCertificationRequirement ### Description Retrieves information about pre-certification requirements. ### Method GET ### Endpoint /senaranya/hl7/IN3/getPreCertificationRequirement ### Parameters This function has no parameters. ### Response #### Success Response (200) - **result** (string) - Description of pre-certification requirements. #### Response Example ```json { "result": "Requires prior authorization for procedures exceeding $5000." } ``` ``` -------------------------------- ### Get Operator - IN3::getOperator Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN3.md Retrieves operator information. This function takes no parameters and returns void. ```php getOperator (void) ``` -------------------------------- ### Set Coordination of Benefits Priority - IN1::setCoordOfBenPriority Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN1.md Sets the coordination of benefits priority. This function takes no parameters and returns void. ```php setCoordOfBenPriority (void) ``` -------------------------------- ### Get HL7 Segment Name Source: https://github.com/senaranya/hl7/blob/master/docs/Segment.md Retrieve the name of the HL7 segment, which is typically the value at index 0. ```php $name = $seg->getName(); ``` -------------------------------- ### ORC::getQuantityTiming Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/ORC.md Retrieves the quantity and timing information for the order. ```APIDOC ## ORC::getQuantityTiming ### Description Retrieves the quantity and timing details associated with the order. ### Method GET ### Endpoint /senaranya/hl7/orc/quantityTiming ### Parameters This function has no parameters. ### Response #### Success Response (200) - **quantityTiming** (string) - The quantity and timing information (e.g., '1 tablet daily'). #### Response Example ```json { "quantityTiming": "1 unit every 8 hours" } ``` ``` -------------------------------- ### Get Verification Status - IN1::getVerificationStatus Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN1.md Retrieves the verification status. This function takes no parameters and returns void. ```php getVerificationStatus (void) ``` -------------------------------- ### SAC::getSpecimenComponent Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/SAC.md Retrieves the specimen component. This function takes no parameters and returns void. ```php getSpecimenComponent (void) ``` -------------------------------- ### Get Certified By - IN3::getCertifiedBy Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN3.md Retrieves information about who certified the entity. This function takes no parameters and returns void. ```php getCertifiedBy (void) ``` -------------------------------- ### SAC::getSpecimenSource Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/SAC.md Retrieves the specimen source. This function takes no parameters and returns void. ```php getSpecimenSource (void) ``` -------------------------------- ### Get Certification Required - IN3::getCertificationRequired Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN3.md Checks if certification is required. This function takes no parameters and returns void. ```php getCertificationRequired (void) ``` -------------------------------- ### SAC::getInitialSpecimenVolume Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/SAC.md Retrieves the initial volume of the specimen. ```APIDOC ## SAC::getInitialSpecimenVolume ### Description Retrieves the initial volume of the specimen. ### Method GET ### Endpoint /senaranya/hl7/SAC/getInitialSpecimenVolume ### Parameters This function has no parameters. ### Response #### Success Response (200) - **result** (string) - The initial volume of the specimen. #### Response Example ```json { "result": "volume" } ``` ``` -------------------------------- ### Get Certification Number - IN3::getCertificationNumber Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN3.md Retrieves the certification number. This function takes no parameters and returns void. ```php getCertificationNumber (void) ``` -------------------------------- ### ORC::getEnteringDevice Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/ORC.md Retrieves information about the device used for entering the order. ```APIDOC ## ORC::getEnteringDevice ### Description Retrieves information about the device used to enter the order. ### Method GET ### Endpoint /senaranya/hl7/orc/enteringDevice ### Parameters This function has no parameters. ### Response #### Success Response (200) - **enteringDevice** (object) - Information about the entering device. - **type** (string) - Type of device (e.g., 'Workstation', 'Tablet'). - **identifier** (string) - Unique identifier for the device. #### Response Example ```json { "enteringDevice": { "type": "Workstation", "identifier": "WS-LAB-05" } } ``` ``` -------------------------------- ### Get HL7 Segment Size Source: https://github.com/senaranya/hl7/blob/master/docs/Segment.md Determine the number of fields present in the HL7 segment, excluding the segment name itself. ```php $size = $seg->size(); ``` -------------------------------- ### MSH::setSecurity Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/MSH.md This function has no parameters and returns void. ```php setSecurity (void) ``` -------------------------------- ### Get Verification Date/Time - IN1::getVerificationDateTime Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN1.md Retrieves the verification date and time. This function takes no parameters and returns void. ```php getVerificationDateTime (void) ``` -------------------------------- ### Segment Constructor Source: https://github.com/senaranya/hl7/blob/master/docs/Segment.md Initializes a new HL7 segment with a name and optional fields. ```APIDOC ## Segment::__construct ### Description Create a segment. A segment may be created with just a name or a name and an array of field values. The segment name should be a standard HL7 segment (e.g. MSH / PID etc.) that is three characters long, and upper case. If an array is given, all fields will be filled from that array. Note that for composed fields and sub-components, the array may hold sub-arrays and sub-sub-arrays. Repeated fields can not be supported the same way, since we can't distinguish between composed fields and repeated fields. Example: ```php $seg = new Segment("PID"); $seg->setField(3, "12345678"); echo $seg->getField(1); ``` ### Method `__construct` ### Parameters - **name** (string) - Required - Name of the segment - **fields** (array|null) - Optional - Fields for segment ### Return Values `void` ### Throws Exceptions - `\InvalidArgumentException` ``` -------------------------------- ### EQU::getEquipmentInstanceIdentifier Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/EQU.md Retrieves the equipment instance identifier. ```APIDOC ### EQU::getEquipmentInstanceIdentifier **Description** ```php getEquipmentInstanceIdentifier (void) ``` **Parameters** `This function has no parameters.` **Return Values** `void` ``` -------------------------------- ### Segment - Field Operations Source: https://context7.com/senaranya/hl7/llms.txt Provides methods to get and set fields within a segment, supporting composite fields and sub-components. ```APIDOC ## Segment - Field Operations ### Description Provides methods to get and set fields within a segment, supporting composite fields and sub-components. ### Method N/A (Class methods) ### Endpoint N/A ### Parameters N/A ### Request Example ```php setField(1, 1); // Set ID $segment->setField(2, 'ORDER001'); // Placer Order Number $segment->setField(4, 'CBC^Complete Blood Count^L'); // Universal Service ID // Set composite fields using arrays $segment->setField(16, ['Smith', 'John', 'MD']); // Ordering Provider: Smith^John^MD // Set nested sub-components $segment->setField(32, [ ['Principal', 'PI'], // First component with sub-components 'Secondary' // Second component ]); // Clear a field value $segment->clearField(3); // Get field values $orderId = $segment->getField(2); // Returns: 'ORDER001' $provider = $segment->getField(16); // Returns: ['Smith', 'John', 'MD'] $missingField = $segment->getField(99); // Returns: null // Get multiple fields at once $fields = $segment->getFields(1, 5); // Get fields 1-5 $allFields = $segment->getFields(); // Get all fields // Get segment info $name = $segment->getName(); // Returns: 'OBR' $fieldCount = $segment->size(); // Returns number of fields // Working with parsed segments $hl7String = "MSH|^~\\&|||||||ORU^R01||P|2.3|\nOBR|1|ORD123||80053^Comprehensive Metabolic Panel^L|||20241215|"; $message = HL7::from($hl7String)->create(); $obr = $message->getFirstSegmentInstance('OBR'); $serviceId = $obr->getField(4); // Returns: ['80053', 'Comprehensive Metabolic Panel', 'L'] ?> ``` ### Response N/A ``` -------------------------------- ### Get Physician Reviewer - IN3::getPhysicianReviewer Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN3.md Retrieves information about the physician reviewer. This function takes no parameters and returns void. ```php getPhysicianReviewer (void) ``` -------------------------------- ### Get Second Opinion Status - IN3::getSecondOpinionStatus Source: https://github.com/senaranya/hl7/blob/master/docs/Segments/IN3.md Retrieves the status of the second opinion. This function takes no parameters and returns void. ```php getSecondOpinionStatus (void) ```