Uploaded From CV. Swandhana Server
This commit is contained in:
No files matched your search
@@ -0,0 +1,42 @@
|
||||
name: tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
php-versions: [ '8.0', '8.1', '8.2' ]
|
||||
name: PHP ${{ matrix.php-versions }} Test on ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Install PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extensions: pcntl, mbstring, sockets
|
||||
- name: Check PHP Version
|
||||
run: php -v
|
||||
# - name: Validate composer.json and composer.lock
|
||||
# run: composer validate --strict
|
||||
- name: Cache Composer packages
|
||||
id: composer-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: vendor
|
||||
key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-php-
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --dev --prefer-dist --no-progress
|
||||
- name: Run linter
|
||||
run: composer run-script lint
|
||||
- name: Run test suite
|
||||
run: composer run-script test
|
||||
@@ -0,0 +1,5 @@
|
||||
composer.lock
|
||||
composer.phar
|
||||
vendor
|
||||
/.idea/
|
||||
/.phpunit.result.cache
|
||||
Vendored
+45
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Aranyasen\HL7;
|
||||
use Aranyasen\HL7\Segments\PV1;
|
||||
use Aranyasen\HL7\Segments\ORC;
|
||||
use Aranyasen\HL7\Segments\OBX;
|
||||
use Aranyasen\HL7\Segments\OBR;
|
||||
use Aranyasen\HL7\Segments\DG1;
|
||||
use Aranyasen\HL7\Segments\NTE;
|
||||
use Aranyasen\HL7\Segments\IN3;
|
||||
use Aranyasen\HL7\Segments\IN1;
|
||||
use Aranyasen\HL7\Segments\PID;
|
||||
use Aranyasen\HL7\Segments\MSH;
|
||||
use Aranyasen\HL7\Segments\EVN;
|
||||
use Aranyasen\HL7\Segments\EQU;
|
||||
use Aranyasen\HL7\Segments\SAC;
|
||||
use Aranyasen\HL7\Segment;
|
||||
use Aranyasen\HL7\Messages\ACK;
|
||||
use Aranyasen\HL7\Message;
|
||||
use Aranyasen\HL7\Connection;
|
||||
|
||||
return (object)[
|
||||
'rootNamespace' => HL7::class,
|
||||
'destDirectory' => 'docs',
|
||||
'format' => 'github',
|
||||
'classes' => [
|
||||
Connection::class,
|
||||
Message::class,
|
||||
ACK::class,
|
||||
Segment::class,
|
||||
MSH::class,
|
||||
PID::class,
|
||||
IN1::class,
|
||||
IN3::class,
|
||||
NTE::class,
|
||||
DG1::class,
|
||||
OBR::class,
|
||||
OBX::class,
|
||||
ORC::class,
|
||||
PV1::class,
|
||||
EVN::class,
|
||||
EQU::class,
|
||||
SAC::class,
|
||||
],
|
||||
];
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at sen.aranya@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
* Contributions are more than welcome!
|
||||
* Please review [issues](https://github.com/senaranya/HL7/issues) if you want to pick up from existing tickets. New tickets/features/CRs/PRs are welcome!
|
||||
* The goal of this library is to keep it generic and minimal. The focus should only be on basic HL7-related operations like creation/parsing/sending/receiving etc. No project-specific business logic should be included.
|
||||
* This library follows PSR-12 standards for coding style. You may use [phpcs](https://github.com/squizlabs/PHP_CodeSniffer#getting-started) to verify your code.
|
||||
* Add unit tests for code changes/updates. There are a number of existing tests, follow those as reference
|
||||
* Contributors are requested to add or update phpdoc for any new or existing methods being worked on. After updating/adding, please update the API documentation as well (details below)
|
||||
|
||||
##### Generate/update API documentation (in Markdown format) from docblocks
|
||||
* Install [clean/phpdoc-md](https://github.com/clean/phpdoc-md): `composer require --dev clean/phpdoc-md`
|
||||
* Update _.phpdoc-md_ if a new class is added
|
||||
* Issue `vendor/bin/phpdoc-md`. This generates .md files under doc/ folder
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Aranya Sen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
Vendored
+205
@@ -0,0 +1,205 @@
|
||||
<p align="center">
|
||||
<a href="https://github.com/senaranya/HL7/actions"><img src="https://github.com/senaranya/hl7/actions/workflows/main_ci.yml/badge.svg?branch=master" alt="CI Status"></a>
|
||||
<a href="https://packagist.org/packages/aranyasen/hl7"><img src="https://poser.pugx.org/aranyasen/hl7/downloads" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/aranyasen/hl7"><img src="https://poser.pugx.org/aranyasen/hl7/v/stable" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/aranyasen/hl7"><img src="https://poser.pugx.org/aranyasen/hl7/license" alt="License"></a>
|
||||
</p>
|
||||
|
||||
**Important: Minimum supported PHP version has been updated to 8.0 <br>
|
||||
Last supported versions: <br>
|
||||
-> PHP 7.0 or 7.1 => [1.5.4](https://github.com/senaranya/HL7/tree/1.5.4)<br>
|
||||
-> PHP 7.2 => [2.0.2](https://github.com/senaranya/HL7/tree/2.0.2)<br>
|
||||
-> PHP 7.4 => [2.1.7](https://github.com/senaranya/HL7/tree/2.1.7)**
|
||||
|
||||
## Introduction
|
||||
|
||||
A PHP-based HL7 v2.x Parsing, Generation and Sending library, inspired from the famous Perl Net-HL7 package.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
composer require aranyasen/hl7
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Import library
|
||||
```php
|
||||
// First, import classes from the library as needed...
|
||||
use Aranyasen\HL7; // HL7 factory class
|
||||
use Aranyasen\HL7\Message; // If Message is used
|
||||
use Aranyasen\HL7\Segment; // If Segment is used
|
||||
use Aranyasen\HL7\Segments\MSH; // If MSH is used
|
||||
// ... and so on
|
||||
```
|
||||
|
||||
### Parsing
|
||||
```php
|
||||
// Create a Message object from a HL7 string
|
||||
$message = HL7::from("MSH|^~\\&|1|")->createMessage(); // Returns Message object
|
||||
|
||||
// Or, using Message class...
|
||||
$message = new Message("MSH|^~\\&|1|\rPID|||abcd|\r"); // Either \n or \r can be used as segment endings
|
||||
|
||||
// Get string form of the message
|
||||
echo $message->toString(true);
|
||||
|
||||
// Extracting segments and fields from a Message object...
|
||||
$message->getSegmentByIndex(1); // Get the first segment
|
||||
$message->getSegmentsByName('ABC'); // Get an array of all 'ABC' segments
|
||||
$message->getFirstSegmentInstance('ABC'); // Returns the first ABC segment. Same as $message->getSegmentsByName('ABC')[0];
|
||||
|
||||
// Check if a segment is present in the message object
|
||||
$message->hasSegment('ABC'); // return true or false based on whether PID is present in the $message object
|
||||
|
||||
// Check if a message is empty
|
||||
$message = new Message();
|
||||
$message->isempty(); // Returns true
|
||||
```
|
||||
|
||||
### Composing new messages
|
||||
```php
|
||||
// The class `HL7` can be used to build HL7 object. It is a factory class with various helper methods to help build a hl7.
|
||||
$message = HL7::build()->createMessage(); // Creates an empty message
|
||||
|
||||
// The HL7 factory class provides methods that can be chained together in a fluent fashion
|
||||
$message = HL7::build()
|
||||
->withComponentSeparator('#')
|
||||
->withFieldSeparator('-')
|
||||
->createMessage();
|
||||
|
||||
// Or, using Message class...
|
||||
$message = new Message();
|
||||
```
|
||||
#### Message constructor parameters
|
||||
```php
|
||||
// When a message is composed using Message class, there are multiple parameters available to define the properties of the HL7.
|
||||
// Note: All of these properties are available as fluent methods in HL7 factory class (shown above). So it's recommended to use that for readability
|
||||
|
||||
// Creating multiple message objects may have an unexpected side effect: segments start with wrong index values (Check tests/MessageTest for explanation)...
|
||||
// Use 4th argument as true, or call resetSegmentIndices() on $message object to reset segment indices to 1
|
||||
$message = new Message("MSH|^~\&|||||||ORM^O01||P|2.3.1|", null, true, true);
|
||||
// ... any segments added here will now start index from 1, as expected.
|
||||
```
|
||||
```php
|
||||
// Sometimes you may want to have exact index values, rather than auto-incrementing for each instance of a segment
|
||||
// Use 5th argument as false...
|
||||
$hl7String = "MSH|^~\&|||||||ORU^R01|00001|P|2.3.1|\n" . "OBX|1||11^AA|\n" . "OBX|1||22^BB|\n";
|
||||
$message = new Message($hl7String, null, true, true, false); $// $message contains both OBXs with given indexes in the string
|
||||
```
|
||||
```php
|
||||
// Create a segment with empty sub-fields retained
|
||||
$message = new Message("MSH|^~\\&|1|\rPV1|1|O|^AAAA1^^^BB|", null, true); // Third argument 'true' forces to keep all sub-fields
|
||||
$pv1 = $message->getSegmentByIndex(1);
|
||||
$fields = $pv1->getField(3); // $fields is ['', 'AAAA1', '', '', 'BB']
|
||||
|
||||
// Create/send message with segment-ending bar character (|) removed
|
||||
$message = new Message("MSH|^~\\&|1|\nABC|||xxx\n", ['SEGMENT_ENDING_BAR' => false]);
|
||||
$message->toString(true); // Returns "MSH|^~\&|1\nABC|||xxx\n"
|
||||
(new Connection($ip, $port))->send($message); // Sends the message without ending bar-characters (details on Connection below)
|
||||
|
||||
// Specify custom values for separators, HL7 version etc.
|
||||
$message = new Message("MSH|^~\\&|1|\rPV1|1|O|^AAAA1^^^BB|", ['SEGMENT_SEPARATOR' => '\r\n', 'HL7_VERSION' => '2.3']);
|
||||
|
||||
// Segment with separator character (~) creates sub-arrays containing each sub-segment
|
||||
$message = new Message("MSH|^~\&|||||||ADT^A01||P|2.3.1|\nPID|||3^0~4^1"); // Creates [[3,0], [4,1]]
|
||||
|
||||
// To create a single array instead, pass 'true' as 6th argument. This may be used to retain behavior from previous releases
|
||||
// Notice: Since this leads to a non-standard behavior, it may be removed in future
|
||||
$message = new Message("MSH|^~\&|||||||ADT^A01||P|2.3.1|\nPID|||3^0~4^1", null, false, false, true, true); // Creates ['3', '0~4', '1']
|
||||
// or
|
||||
$message = new Message("MSH|^~\&|||||||ADT^A01||P|2.3.1|\nPID|||3^0~4^1", doNotSplitRepetition: true); // Creates ['3', '0~4', '1']
|
||||
```
|
||||
|
||||
#### Handling segments and fields
|
||||
```php
|
||||
// Once a message object is created, we can now add, insert, set segments and fields.
|
||||
|
||||
// Create a MSH segment and add to message object
|
||||
$msh = new MSH();
|
||||
$message->addSegment($msh); // Message is: "MSH|^~\&|||||20171116140058|||2017111614005840157||2.3|\n"
|
||||
|
||||
// Create a custom segment
|
||||
$abc = new Segment('ABC');
|
||||
$abc->setField(1, 'xyz');
|
||||
$abc->setField(2, 0);
|
||||
$abc->setField(4, ['']); // Set an empty field at 4th position. 2nd and 3rd positions will be automatically set to empty
|
||||
$abc->clearField(2); // Clear the value from field 2
|
||||
$message->setSegment($abc, 1); // Message is now: "MSH|^~\&|||||20171116140058|||2017111614005840157||2.3|\nABC|xyz|\n"
|
||||
|
||||
// Create a defined segment (To know which segments are defined in this package, look into Segments/ directory)
|
||||
// Advantages of defined segments over custom ones (shown above) are 1) Helpful setter methods, 2) Auto-incrementing segment index
|
||||
$pid = new PID(); // Automatically creates PID segment, and adds segment index at PID.1
|
||||
$pid->setPatientName([$lastname, $firstname, $middlename, $suffix]); // Use a setter method to add patient's name at standard position (PID.5)
|
||||
$pid->setField('abcd', 5); // Apart from standard setter methods, you can manually set a value at any position too
|
||||
unset($pid); // Destroy the segment and decrement the id number. Useful when you want to discard a segment.
|
||||
```
|
||||
|
||||
### Send messages to remote listeners
|
||||
|
||||
Side note: In order to run Connection you need to install PHP ext-sockets [https://www.php.net/manual/en/sockets.installation.php](https://www.php.net/manual/en/sockets.installation.php)
|
||||
|
||||
```php
|
||||
$ip = '127.0.0.1'; // An IP
|
||||
$port = '12001'; // And Port where a HL7 listener is listening
|
||||
$message = new Message($hl7String); // Create a Message object from your HL7 string
|
||||
|
||||
// Create a Socket and get ready to send message. Optionally add timeout in seconds as 3rd argument (default: 10 sec)
|
||||
$connection = new Connection($ip, $port);
|
||||
$response = $connection->send($message); // Send to the listener, and get a response back
|
||||
echo $response->toString(true); // Prints ACK from the listener
|
||||
```
|
||||
### ACK
|
||||
Handle ACK message returned from a remote HL7 listener...
|
||||
```php
|
||||
$ack = (new Connection($ip, $port))->send($message); // Send a HL7 to remote listener
|
||||
$returnString = $ack->toString(true);
|
||||
if (strpos($returnString, 'MSH') === false) {
|
||||
echo "Failed to send HL7 to 'IP' => $ip, 'Port' => $port";
|
||||
}
|
||||
$msa = $ack->getFirstSegmentInstance('MSA');
|
||||
$ackCode = $msa->getAcknowledgementCode();
|
||||
if ($ackCode[1] === 'A') {
|
||||
echo "Received ACK from remote\n";
|
||||
}
|
||||
else {
|
||||
echo "Received NACK from remote\n";
|
||||
echo "Error text: " . $msa->getTextMessage();
|
||||
}
|
||||
```
|
||||
Create an ACK response from a given HL7 message:
|
||||
```php
|
||||
$msg = new Message("MSH|^~\\&|1|\rABC|1||^AAAA1^^^BB|", null, true);
|
||||
$ackResponse = new ACK($msg);
|
||||
```
|
||||
Options can be passed while creating ACK object:
|
||||
```php
|
||||
$msg = new Message("MSH|^~\\&|1|\rABC|1||^AAAA1^^^BB|", null, true);
|
||||
$ackResponse = new ACK($msg, null, ['SEGMENT_SEPARATOR' => '\r\n', 'HL7_VERSION' => '2.5']);
|
||||
```
|
||||
|
||||
## APIs
|
||||
This package exposes a number of public methods for convenient HL7 handling. Some examples are:
|
||||
1) Considering you have a Message object (say, `$msg = new Message(file_get_contents('somefile.hl7'));`)
|
||||
```php
|
||||
$msg->toFile('/path/to/some.hl7'); // Write to a file
|
||||
$msg->isOru(); // Check if it's an ORU
|
||||
$msg->isOrm(); // Check if it's an ORM
|
||||
```
|
||||
|
||||
Visit [docs\README](docs/README.md) for details on available APIs
|
||||
|
||||
All segment level getter/setter APIs can be used in two ways -
|
||||
* If a position index isn't provided as argument (1st argument for getters, 2nd for setters), a standard index is used.
|
||||
`$pid->setPatientName('John Doe')` -> Set patient name at position 5 as per HL7 v2.3 [standard](https://corepointhealth.com/resource-center/hl7-resources/hl7-pid-segment)
|
||||
`$pid->getPatientAddress()` -> Get patient address from standard 11th position
|
||||
|
||||
|
||||
* To use a custom position index, provide it in the argument:
|
||||
`$pid->setPatientName('John Doe', 6)` -> Set patient name at 6th position in PID segment
|
||||
`$pid->getPatientAddress(12)` -> Get patient address from 12th position
|
||||
|
||||
### Issues
|
||||
Bug reports and feature requests can be submitted on the [Github Issue Tracker](https://github.com/senaranya/HL7/issues).
|
||||
|
||||
### Contributing
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md) for information.
|
||||
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "aranyasen/hl7",
|
||||
"description": "HL7 parser, generator and sender.",
|
||||
"type": "library",
|
||||
"license": "MIT",
|
||||
"keyword": ["HL7", "Parse", "Generate", "Send"],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Aranya Sen",
|
||||
"email": "[email protected]",
|
||||
"role": "Owner"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable" : true,
|
||||
"require": {
|
||||
"php": "^8.0",
|
||||
"ext-mbstring": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9",
|
||||
"dms/phpunit-arraysubset-asserts": "^0.2",
|
||||
"ext-pcntl": "*",
|
||||
"ext-sockets": "*",
|
||||
"squizlabs/php_codesniffer": "^3.6"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Aranyasen\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Aranyasen\\HL7\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vendor/bin/phpunit tests/ --coverage-text",
|
||||
"lint": "vendor/bin/phpcs"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "0.1.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
# Aranyasen\HL7\Connection
|
||||
|
||||
Usage:
|
||||
```php
|
||||
$connection = new Connection('127.0.0.1', 5002);
|
||||
$req = new Message();
|
||||
// .
|
||||
|
||||
.. set some request attributes
|
||||
$response = $connection->send($req);
|
||||
$response->toString(); // Read ACK message from remote
|
||||
```
|
||||
|
||||
The Connection object represents the tcp connection to the HL7 message broker. The Connection has only one public
|
||||
method (apart from the constructor), send(). The 'send' method takes a Message object as argument, and also
|
||||
returns a Message object. The send method can be used more than once, before the connection is closed.
|
||||
Connection is closed automatically when the connection object is destroyed.
|
||||
|
||||
The Connection object holds the following fields:
|
||||
|
||||
MESSAGE_PREFIX
|
||||
|
||||
The prefix to be sent to the HL7 server to initiate the
|
||||
message. Defaults to \013.
|
||||
|
||||
MESSAGE_SUFFIX
|
||||
End of message signal for HL7 server. Defaults to \034\015.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
|[__construct](#connection__construct)|Creates a connection to a HL7 server, or throws exception when a connection could not be established.|
|
||||
|[__destruct](#connection__destruct)||
|
||||
|[send](#connectionsend)|Sends a Message object over this connection.|
|
||||
|
||||
|
||||
|
||||
|
||||
### Connection::__construct
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public __construct (string $host, string $port)
|
||||
```
|
||||
|
||||
Creates a connection to a HL7 server, or throws exception when a connection could not be established.
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(string) $host`
|
||||
: Host to connect to
|
||||
* `(string) $port`
|
||||
: Port to connect to
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Connection::__destruct
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public __destruct (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Connection::send
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public send (\Message $req, string $responseCharEncoding)
|
||||
```
|
||||
|
||||
Sends a Message object over this connection.
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(\Message) $req`
|
||||
* `(string) $responseCharEncoding`
|
||||
: The expected character encoding of the response.
|
||||
|
||||
**Return Values**
|
||||
|
||||
`\Message`
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
Vendored
+355
@@ -0,0 +1,355 @@
|
||||
# Aranyasen\HL7\Message
|
||||
|
||||
Class specifying the HL7 message, both request and response.
|
||||
|
||||
In general one needn't create an instance of the Message class directly, but use the HL7 factory class to create one.
|
||||
When adding segments, note that the segment index starts at 0, so to get the first segment, do
|
||||
```php $msg->getSegmentByIndex(0) ```
|
||||
|
||||
The segment separator defaults to \015. To change this, set the global variable $SEGMENT_SEPARATOR.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
|[__construct](#message__construct)|Constructor for Message. Consider using the HL7 factory to obtain a message instead.|
|
||||
|[addSegment](#messageaddsegment)|Append a segment to the end of the message|
|
||||
|[getSegmentAsString](#messagegetsegmentasstring)|Get the segment identified by index as string, using the messages separators.|
|
||||
|[getSegmentByIndex](#messagegetsegmentbyindex)|Return the segment specified by $index.|
|
||||
|[getSegmentFieldAsString](#messagegetsegmentfieldasstring)|Get the field identified by $fieldIndex from segment $segmentIndex.|
|
||||
|[getSegments](#messagegetsegments)|Return an array containing all segments in the right order.|
|
||||
|[getSegmentsByName](#messagegetsegmentsbyname)|Return an array of all segments with the given name|
|
||||
|[insertSegment](#messageinsertsegment)|Insert a segment.|
|
||||
|[removeSegmentByIndex](#messageremovesegmentbyindex)|Remove the segment indexed by $index.|
|
||||
|[segmentToString](#messagesegmenttostring)|Convert Segment object to string|
|
||||
|[setSegment](#messagesetsegment)|Set the segment on index.|
|
||||
|[toString](#messagetostring)|Return a string representation of this message.|
|
||||
|
||||
|
||||
|
||||
|
||||
### Message::__construct
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public __construct (string $msgStr, array $hl7Globals)
|
||||
```
|
||||
|
||||
Constructor for Message. Consider using the HL7 factory to obtain a message instead.
|
||||
|
||||
The constructor takes an optional string argument that is a string representation of a HL7 message. If the
|
||||
string representation is not a valid HL7 message. according to the specifications, undef is returned instead of
|
||||
a new instance. This means that segments should be separated within the message with the segment separator
|
||||
(defaults to \015) or a newline, and segments should be syntactically correct. When using the string argument
|
||||
constructor, make sure that you have escaped any characters that would have special meaning in PHP.
|
||||
|
||||
The control characters and field separator will take the values from the MSH segment, if set. Otherwise defaults
|
||||
will be used. Changing the MSH fields specifying the field separator and control characters after the MSH has
|
||||
been added to the message will result in setting these values for the message.
|
||||
|
||||
If the message couldn't be created, for example due to a erroneous HL7 message string, an error is raised.
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(string) $msgStr`
|
||||
* `(array) $hl7Globals`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Message::addSegment
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public addSegment (\Segment $segment)
|
||||
```
|
||||
|
||||
Append a segment to the end of the message
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(\Segment) $segment`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`bool`
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Message::getSegmentAsString
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getSegmentAsString (int $index)
|
||||
```
|
||||
|
||||
Get the segment identified by index as string, using the messages separators.
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(int) $index`
|
||||
: Index for segment to get
|
||||
|
||||
**Return Values**
|
||||
|
||||
`string|null`
|
||||
|
||||
> String representation of segment
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Message::getSegmentByIndex
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getSegmentByIndex (int $index)
|
||||
```
|
||||
|
||||
Return the segment specified by $index.
|
||||
|
||||
Note: Segment count within the message starts at 0.
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(int) $index`
|
||||
: Index where segment is inserted
|
||||
|
||||
**Return Values**
|
||||
|
||||
`\Segment`
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Message::getSegmentFieldAsString
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getSegmentFieldAsString (int $segmentIndex, int $fieldIndex)
|
||||
```
|
||||
|
||||
Get the field identified by $fieldIndex from segment $segmentIndex.
|
||||
|
||||
Returns empty string if field is not set.
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(int) $segmentIndex`
|
||||
: Index for segment to get
|
||||
* `(int) $fieldIndex`
|
||||
: Index for field to get
|
||||
|
||||
**Return Values**
|
||||
|
||||
`mixed`
|
||||
|
||||
> String representation of field
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Message::getSegments
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getSegments (void)
|
||||
```
|
||||
|
||||
Return an array containing all segments in the right order.
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`array`
|
||||
|
||||
> List of all segments
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Message::getSegmentsByName
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getSegmentsByName (string $name)
|
||||
```
|
||||
|
||||
Return an array of all segments with the given name
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(string) $name`
|
||||
: Segment name
|
||||
|
||||
**Return Values**
|
||||
|
||||
`array`
|
||||
|
||||
> List of segments identified by name
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Message::insertSegment
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public insertSegment (\Segment $segment, null|int $index)
|
||||
```
|
||||
|
||||
Insert a segment.
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(\Segment) $segment`
|
||||
* `(null|int) $index`
|
||||
: Index where segment is inserted
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Message::removeSegmentByIndex
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public removeSegmentByIndex (int $index)
|
||||
```
|
||||
|
||||
Remove the segment indexed by $index.
|
||||
|
||||
If it doesn't exist, nothing happens, if it does, all segments
|
||||
after this one will be moved one index up.
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(int) $index`
|
||||
: Index where segment is removed
|
||||
|
||||
**Return Values**
|
||||
|
||||
`boolean`
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Message::segmentToString
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public segmentToString ( $seg)
|
||||
```
|
||||
|
||||
Convert Segment object to string
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `() $seg`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`string`
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Message::setSegment
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setSegment (\Segment $segment, int $index)
|
||||
```
|
||||
|
||||
Set the segment on index.
|
||||
|
||||
If index is out of range, or not provided, do nothing. Setting MSH on index 0 will re-validate field separator,
|
||||
control characters and hl7 version, based on MSH(1), MSH(2) and MSH(12).
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(\Segment) $segment`
|
||||
* `(int) $index`
|
||||
: Index where segment is set
|
||||
|
||||
**Return Values**
|
||||
|
||||
`boolean`
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Message::toString
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public toString (boolean $pretty)
|
||||
```
|
||||
|
||||
Return a string representation of this message.
|
||||
|
||||
This can be used to send the message over a socket to an HL7 server. To print to other output, use the $pretty
|
||||
argument as some true value. This will not use the default segment separator, but '\n' instead.
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(boolean) $pretty`
|
||||
: Whether to use \n as separator or default (\r).
|
||||
|
||||
**Return Values**
|
||||
|
||||
`mixed`
|
||||
|
||||
> String representation of HL7 message
|
||||
|
||||
<hr />
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
# Aranyasen\HL7\Messages\ACK
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Extend:
|
||||
|
||||
Aranyasen\HL7\Message
|
||||
|
||||
## Methods
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
|[setAckCode](#acksetackcode)|Set the acknowledgement code for the acknowledgement.|
|
||||
|[setErrorMessage](#ackseterrormessage)|Set the error message for the acknowledgement.|
|
||||
|
||||
## Inherited methods
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
|__construct|Constructor for Message. Consider using the HL7 factory to obtain a message instead.|
|
||||
|addSegment|Append a segment to the end of the message|
|
||||
|getSegmentAsString|Get the segment identified by index as string, using the messages separators.|
|
||||
|getSegmentByIndex|Return the segment specified by $index.|
|
||||
|getSegmentFieldAsString|Get the field identified by $fieldIndex from segment $segmentIndex.|
|
||||
|getSegments|Return an array containing all segments in the right order.|
|
||||
|getSegmentsByName|Return an array of all segments with the given name|
|
||||
|insertSegment|Insert a segment.|
|
||||
|removeSegmentByIndex|Remove the segment indexed by $index.|
|
||||
|segmentToString|Convert Segment object to string|
|
||||
|setSegment|Set the segment on index.|
|
||||
|toString|Return a string representation of this message.|
|
||||
|
||||
|
||||
|
||||
### ACK::setAckCode
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setAckCode (string $code, string $msg)
|
||||
```
|
||||
|
||||
Set the acknowledgement code for the acknowledgement.
|
||||
|
||||
Code should be one of: A, E, R. Codes can be prepended with C or A, denoting enhanced or normal acknowledge mode.
|
||||
This denotes: accept, general error and reject respectively. The ACK module will determine the right answer mode
|
||||
(normal or enhanced) based upon the request, if not provided. The message provided in $msg will be set in MSA 3.
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(string) $code`
|
||||
: Code to use in acknowledgement
|
||||
* `(string) $msg`
|
||||
: Acknowledgement message
|
||||
|
||||
**Return Values**
|
||||
|
||||
`boolean`
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### ACK::setErrorMessage
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setErrorMessage (string $msg)
|
||||
```
|
||||
|
||||
Set the error message for the acknowledgement.
|
||||
|
||||
This will also set the error code to either AE or CE, depending on the mode of the incoming message.
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(string) $msg`
|
||||
: Error message
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
# Aranyasen\HL7
|
||||
|
||||
* [Connection](Connection.md)
|
||||
* [Message](Message.md)
|
||||
* [Messages\ACK](Messages/ACK.md)
|
||||
* [Segment](Segment.md)
|
||||
* [Segments\MSH](Segments/MSH.md)
|
||||
* [Segments\PID](Segments/PID.md)
|
||||
* [Segments\IN1](Segments/IN1.md)
|
||||
* [Segments\IN3](Segments/IN3.md)
|
||||
* [Segments\NTE](Segments/NTE.md)
|
||||
* [Segments\DG1](Segments/DG1.md)
|
||||
* [Segments\OBR](Segments/OBR.md)
|
||||
* [Segments\OBX](Segments/OBX.md)
|
||||
* [Segments\ORC](Segments/ORC.md)
|
||||
* [Segments\PV1](Segments/PV1.md)
|
||||
Vendored
+208
@@ -0,0 +1,208 @@
|
||||
# Aranyasen\HL7\Segment
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
|[__construct](#segment__construct)|Create a segment.|
|
||||
|[getField](#segmentgetfield)|Get the field at index.|
|
||||
|[getFields](#segmentgetfields)|Get fields from a segment|
|
||||
|[getName](#segmentgetname)|Get the name of the segment. This is basically the value at index 0|
|
||||
|[setField](#segmentsetfield)|Set the field specified by index to value.|
|
||||
|[size](#segmentsize)|Get the number of fields for this segment, not including the name|
|
||||
|
||||
|
||||
|
||||
|
||||
### Segment::__construct
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public __construct (string $name, array|null $fields)
|
||||
```
|
||||
|
||||
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);
|
||||
```
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(string) $name`
|
||||
: Name of the segment
|
||||
* `(array|null) $fields`
|
||||
: Fields for segment
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Segment::getField
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getField (int $index)
|
||||
```
|
||||
|
||||
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.
|
||||
```
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(int) $index`
|
||||
: Index of field
|
||||
|
||||
**Return Values**
|
||||
|
||||
`null|string|array`
|
||||
|
||||
> The value of the field
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Segment::getFields
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getFields (int $from, int|null $to)
|
||||
```
|
||||
|
||||
Get fields from a segment
|
||||
|
||||
Get the fields in the specified range, or all if nothing specified. If only the 'from' value is provided, all
|
||||
fields from this index till the end of the segment will be returned.
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(int) $from`
|
||||
: Start range at this index
|
||||
* `(int|null) $to`
|
||||
: Stop range at this index
|
||||
|
||||
**Return Values**
|
||||
|
||||
`array`
|
||||
|
||||
> List of fields
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Segment::getName
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getName (void)
|
||||
```
|
||||
|
||||
Get the name of the segment. This is basically the value at index 0
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`mixed`
|
||||
|
||||
> Name of segment
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Segment::setField
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setField (int $index, string|array $value)
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(int) $index`
|
||||
: Index to set
|
||||
* `(string|array) $value`
|
||||
: Value for field
|
||||
|
||||
**Return Values**
|
||||
|
||||
`boolean`
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### Segment::size
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public size (void)
|
||||
```
|
||||
|
||||
Get the number of fields for this segment, not including the name
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`int`
|
||||
|
||||
> number of fields
|
||||
|
||||
<hr />
|
||||
|
||||
+940
@@ -0,0 +1,940 @@
|
||||
# Aranyasen\HL7\Segments\DG1
|
||||
|
||||
DG1 segment class
|
||||
Ref: http://hl7-definition.caristix.com:9010/HL7%20v2.3.1/segment/DG1
|
||||
|
||||
|
||||
|
||||
## Extend:
|
||||
|
||||
Aranyasen\HL7\Segment
|
||||
|
||||
## Methods
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
|[getAttestationDateTime](#dg1getattestationdatetime)||
|
||||
|[getConfidentialIndicator](#dg1getconfidentialindicator)||
|
||||
|[getDRGApprovalIndicator](#dg1getdrgapprovalindicator)||
|
||||
|[getDRGGrouperReviewCode](#dg1getdrggrouperreviewcode)||
|
||||
|[getDiagnosingClinician](#dg1getdiagnosingclinician)||
|
||||
|[getDiagnosisClassification](#dg1getdiagnosisclassification)||
|
||||
|[getDiagnosisCodeDG1](#dg1getdiagnosiscodedg1)||
|
||||
|[getDiagnosisCodingMethod](#dg1getdiagnosiscodingmethod)||
|
||||
|[getDiagnosisDateTime](#dg1getdiagnosisdatetime)||
|
||||
|[getDiagnosisDescription](#dg1getdiagnosisdescription)||
|
||||
|[getDiagnosisPriority](#dg1getdiagnosispriority)||
|
||||
|[getDiagnosisType](#dg1getdiagnosistype)||
|
||||
|[getDiagnosticRelatedGroup](#dg1getdiagnosticrelatedgroup)||
|
||||
|[getGrouperVersionAndType](#dg1getgrouperversionandtype)||
|
||||
|[getID](#dg1getid)||
|
||||
|[getMajorDiagnosticCategory](#dg1getmajordiagnosticcategory)||
|
||||
|[getOutlierCost](#dg1getoutliercost)||
|
||||
|[getOutlierDays](#dg1getoutlierdays)||
|
||||
|[getOutlierType](#dg1getoutliertype)||
|
||||
|[setAttestationDateTime](#dg1setattestationdatetime)||
|
||||
|[setConfidentialIndicator](#dg1setconfidentialindicator)||
|
||||
|[setDRGApprovalIndicator](#dg1setdrgapprovalindicator)||
|
||||
|[setDRGGrouperReviewCode](#dg1setdrggrouperreviewcode)||
|
||||
|[setDiagnosingClinician](#dg1setdiagnosingclinician)||
|
||||
|[setDiagnosisClassification](#dg1setdiagnosisclassification)||
|
||||
|[setDiagnosisCodeDG1](#dg1setdiagnosiscodedg1)||
|
||||
|[setDiagnosisCodingMethod](#dg1setdiagnosiscodingmethod)||
|
||||
|[setDiagnosisDateTime](#dg1setdiagnosisdatetime)||
|
||||
|[setDiagnosisDescription](#dg1setdiagnosisdescription)||
|
||||
|[setDiagnosisPriority](#dg1setdiagnosispriority)||
|
||||
|[setDiagnosisType](#dg1setdiagnosistype)||
|
||||
|[setDiagnosticRelatedGroup](#dg1setdiagnosticrelatedgroup)||
|
||||
|[setGrouperVersionAndType](#dg1setgrouperversionandtype)||
|
||||
|[setID](#dg1setid)||
|
||||
|[setMajorDiagnosticCategory](#dg1setmajordiagnosticcategory)||
|
||||
|[setOutlierCost](#dg1setoutliercost)||
|
||||
|[setOutlierDays](#dg1setoutlierdays)||
|
||||
|[setOutlierType](#dg1setoutliertype)||
|
||||
|
||||
## Inherited methods
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
|__construct|Create a segment.|
|
||||
|getField|Get the field at index.|
|
||||
|getFields|Get fields from a segment|
|
||||
|getName|Get the name of the segment. This is basically the value at index 0|
|
||||
|setField|Set the field specified by index to value.|
|
||||
|size|Get the number of fields for this segment, not including the name|
|
||||
|
||||
|
||||
|
||||
### DG1::getAttestationDateTime
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getAttestationDateTime (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getConfidentialIndicator
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getConfidentialIndicator (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getDRGApprovalIndicator
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getDRGApprovalIndicator (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getDRGGrouperReviewCode
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getDRGGrouperReviewCode (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getDiagnosingClinician
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getDiagnosingClinician (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getDiagnosisClassification
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getDiagnosisClassification (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getDiagnosisCodeDG1
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getDiagnosisCodeDG1 (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getDiagnosisCodingMethod
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getDiagnosisCodingMethod (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getDiagnosisDateTime
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getDiagnosisDateTime (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getDiagnosisDescription
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getDiagnosisDescription (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getDiagnosisPriority
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getDiagnosisPriority (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getDiagnosisType
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getDiagnosisType (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getDiagnosticRelatedGroup
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getDiagnosticRelatedGroup (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getGrouperVersionAndType
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getGrouperVersionAndType (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getID
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getID (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getMajorDiagnosticCategory
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getMajorDiagnosticCategory (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getOutlierCost
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getOutlierCost (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getOutlierDays
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getOutlierDays (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::getOutlierType
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getOutlierType (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setAttestationDateTime
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setAttestationDateTime (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setConfidentialIndicator
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setConfidentialIndicator (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setDRGApprovalIndicator
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setDRGApprovalIndicator (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setDRGGrouperReviewCode
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setDRGGrouperReviewCode (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setDiagnosingClinician
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setDiagnosingClinician (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setDiagnosisClassification
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setDiagnosisClassification (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setDiagnosisCodeDG1
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setDiagnosisCodeDG1 (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setDiagnosisCodingMethod
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setDiagnosisCodingMethod (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setDiagnosisDateTime
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setDiagnosisDateTime (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setDiagnosisDescription
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setDiagnosisDescription (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setDiagnosisPriority
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setDiagnosisPriority (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setDiagnosisType
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setDiagnosisType (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setDiagnosticRelatedGroup
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setDiagnosticRelatedGroup (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setGrouperVersionAndType
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setGrouperVersionAndType (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setID
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setID (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setMajorDiagnosticCategory
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setMajorDiagnosticCategory (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setOutlierCost
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setOutlierCost (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setOutlierDays
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setOutlierDays (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### DG1::setOutlierType
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setOutlierType (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
+303
@@ -0,0 +1,303 @@
|
||||
# Aranyasen\HL7\Segments\EQU
|
||||
|
||||
EQU segment class
|
||||
Ref: https://www.interfaceware.com/hl7-standard/hl7-segment-EQU.html
|
||||
|
||||
|
||||
|
||||
## Extend:
|
||||
|
||||
Aranyasen\HL7\Segment
|
||||
|
||||
## 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)||
|
||||
|
||||
## Inherited methods
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
|__construct|Create a segment.|
|
||||
|getField|Get the field at index.|
|
||||
|getFields|Get fields from a segment|
|
||||
|getName|Get the name of the segment. This is basically the value at index 0|
|
||||
|setField|Set the field specified by index to value.|
|
||||
|size|Get the number of fields for this segment, not including the name|
|
||||
|
||||
|
||||
|
||||
### EQU::getAlertLevel
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
getAlertLevel (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### EQU::getEquipmentInstanceIdentifier
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
getEquipmentInstanceIdentifier (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### EQU::getEquipmentState
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
getEquipmentState (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### EQU::getEventDateTime
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
getEventDateTime (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### EQU::getLocalRemoteControlState
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
getLocalRemoteControlState (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### EQU::resetIndex
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public static resetIndex (int $index)
|
||||
```
|
||||
|
||||
Reset index of this segment
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(int) $index`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### EQU::setAlertLevel
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
setAlertLevel (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### EQU::setEquipmentInstanceIdentifier
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
setEquipmentInstanceIdentifier (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### EQU::setEquipmentState
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
setEquipmentState (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### EQU::setEventDateTime
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
setEventDateTime (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### EQU::setLocalRemoteControlState
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
setLocalRemoteControlState (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
+2380
File diff suppressed because it is too large
Load diff
+1228
File diff suppressed because it is too large
Load diff
+747
@@ -0,0 +1,747 @@
|
||||
# Aranyasen\HL7\Segments\MSH
|
||||
|
||||
MSH (message header) segment class
|
||||
|
||||
Usage:
|
||||
```php
|
||||
$seg = new MSH();
|
||||
|
||||
$seg->setField(9, "ADT^A24");
|
||||
echo $seg->getField(1);
|
||||
```
|
||||
|
||||
The MSH is an implementation of the Segment class. The MSH segment is a bit different from other segments, in that
|
||||
the first field is the field separator after the segment name. Other fields thus start counting from 2! The setting
|
||||
for the field separator for a whole message can be changed by the setField method on index 1 of the MSH for that
|
||||
message. The MSH segment also contains the default settings for field 2, COMPONENT_SEPARATOR, REPETITION_SEPARATOR,
|
||||
ESCAPE_CHARACTER and SUBCOMPONENT_SEPARATOR. These fields default to ^, ~, \ and & respectively.
|
||||
|
||||
Reference: https://corepointhealth.com/resource-center/hl7-resources/hl7-msh-message-header
|
||||
|
||||
|
||||
|
||||
## Extend:
|
||||
|
||||
Aranyasen\HL7\Segment
|
||||
|
||||
## Methods
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
|[getDateTimeOfMessage](#mshgetdatetimeofmessage)||
|
||||
|[getMessageControlId](#mshgetmessagecontrolid)||
|
||||
|[getMessageType](#mshgetmessagetype)|ORM / ORU etc.|
|
||||
|[getProcessingId](#mshgetprocessingid)||
|
||||
|[getReceivingApplication](#mshgetreceivingapplication)||
|
||||
|[getReceivingFacility](#mshgetreceivingfacility)||
|
||||
|[getSendingApplication](#mshgetsendingapplication)||
|
||||
|[getSendingFacility](#mshgetsendingfacility)||
|
||||
|[getTriggerEvent](#mshgettriggerevent)||
|
||||
|[getVersionId](#mshgetversionid)|Get HL7 version, e.g. 2.1, 2.3, 3.0 etc.|
|
||||
|[setAcceptAcknowledgementType](#mshsetacceptacknowledgementtype)||
|
||||
|[setApplicationAcknowledgementType](#mshsetapplicationacknowledgementtype)||
|
||||
|[setCharacterSet](#mshsetcharacterset)||
|
||||
|[setContinuationPointer](#mshsetcontinuationpointer)||
|
||||
|[setCountryCode](#mshsetcountrycode)||
|
||||
|[setDateTimeOfMessage](#mshsetdatetimeofmessage)||
|
||||
|[setMessageControlId](#mshsetmessagecontrolid)||
|
||||
|[setMessageType](#mshsetmessagetype)|Sets message type to MSH segment.|
|
||||
|[setPrincipalLanguage](#mshsetprincipallanguage)||
|
||||
|[setProcessingId](#mshsetprocessingid)||
|
||||
|[setReceivingApplication](#mshsetreceivingapplication)||
|
||||
|[setReceivingFacility](#mshsetreceivingfacility)||
|
||||
|[setSecurity](#mshsetsecurity)||
|
||||
|[setSendingApplication](#mshsetsendingapplication)||
|
||||
|[setSendingFacility](#mshsetsendingfacility)||
|
||||
|[setSequenceNumber](#mshsetsequencenumber)||
|
||||
|[setTriggerEvent](#mshsettriggerevent)|Sets trigger event to MSH segment.|
|
||||
|[setVersionId](#mshsetversionid)||
|
||||
|
||||
## Inherited methods
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
|__construct|Create a segment.|
|
||||
|getField|Get the field at index.|
|
||||
|getFields|Get fields from a segment|
|
||||
|getName|Get the name of the segment. This is basically the value at index 0|
|
||||
|setField|Set the field specified by index to value.|
|
||||
|size|Get the number of fields for this segment, not including the name|
|
||||
|
||||
|
||||
|
||||
### MSH::getDateTimeOfMessage
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getDateTimeOfMessage (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::getMessageControlId
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getMessageControlId (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::getMessageType
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getMessageType (int $position)
|
||||
```
|
||||
|
||||
ORM / ORU etc.
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(int) $position`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`string`
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::getProcessingId
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getProcessingId (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::getReceivingApplication
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getReceivingApplication (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::getReceivingFacility
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getReceivingFacility (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::getSendingApplication
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getSendingApplication (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::getSendingFacility
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getSendingFacility (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::getTriggerEvent
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getTriggerEvent (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::getVersionId
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getVersionId (int $position)
|
||||
```
|
||||
|
||||
Get HL7 version, e.g. 2.1, 2.3, 3.0 etc.
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(int) $position`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`array|null|string`
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setAcceptAcknowledgementType
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setAcceptAcknowledgementType (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setApplicationAcknowledgementType
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setApplicationAcknowledgementType (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setCharacterSet
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setCharacterSet (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setContinuationPointer
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setContinuationPointer (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setCountryCode
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setCountryCode (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setDateTimeOfMessage
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setDateTimeOfMessage (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setMessageControlId
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setMessageControlId (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setMessageType
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setMessageType (string $value, int $position)
|
||||
```
|
||||
|
||||
Sets message type to MSH segment.
|
||||
|
||||
If trigger event is already set, then it is preserved
|
||||
|
||||
Example:
|
||||
|
||||
If field value is ORU^R01 and you call
|
||||
|
||||
```
|
||||
$msh->setMessageType('ORM');
|
||||
```
|
||||
|
||||
Then the new field value will be ORM^R01.
|
||||
If it was empty then the new value will be just ORM.
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(string) $value`
|
||||
* `(int) $position`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`bool`
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setPrincipalLanguage
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setPrincipalLanguage (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setProcessingId
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setProcessingId (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setReceivingApplication
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setReceivingApplication (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setReceivingFacility
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setReceivingFacility (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setSecurity
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setSecurity (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setSendingApplication
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setSendingApplication (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setSendingFacility
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setSendingFacility (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setSequenceNumber
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setSequenceNumber (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setTriggerEvent
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setTriggerEvent (string $value, int $position)
|
||||
```
|
||||
|
||||
Sets trigger event to MSH segment.
|
||||
|
||||
If meessage type is already set, then it is preserved
|
||||
|
||||
Example:
|
||||
|
||||
If field value is ORU^R01 and you call
|
||||
|
||||
```
|
||||
$msh->setTriggerEvent('R30');
|
||||
```
|
||||
|
||||
Then the new field value will be ORU^R30.
|
||||
If trigger event was not set then it will set the new value.
|
||||
|
||||
**Parameters**
|
||||
|
||||
* `(string) $value`
|
||||
* `(int) $position`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`bool`
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### MSH::setVersionId
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setVersionId (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
+220
@@ -0,0 +1,220 @@
|
||||
# Aranyasen\HL7\Segments\NTE
|
||||
|
||||
NTE segment class
|
||||
Ref: https://corepointhealth.com/resource-center/hl7-resources/hl7-nte-notes-comments
|
||||
|
||||
|
||||
|
||||
## Extend:
|
||||
|
||||
Aranyasen\HL7\Segment
|
||||
|
||||
## Methods
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
|[getComment](#ntegetcomment)||
|
||||
|[getCommentType](#ntegetcommenttype)||
|
||||
|[getID](#ntegetid)||
|
||||
|[getSourceOfComment](#ntegetsourceofcomment)||
|
||||
|[setComment](#ntesetcomment)||
|
||||
|[setCommentType](#ntesetcommenttype)||
|
||||
|[setID](#ntesetid)||
|
||||
|[setSourceOfComment](#ntesetsourceofcomment)||
|
||||
|
||||
## Inherited methods
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
|__construct|Create a segment.|
|
||||
|getField|Get the field at index.|
|
||||
|getFields|Get fields from a segment|
|
||||
|getName|Get the name of the segment. This is basically the value at index 0|
|
||||
|setField|Set the field specified by index to value.|
|
||||
|size|Get the number of fields for this segment, not including the name|
|
||||
|
||||
|
||||
|
||||
### NTE::getComment
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getComment (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### NTE::getCommentType
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getCommentType (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### NTE::getID
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getID (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### NTE::getSourceOfComment
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getSourceOfComment (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### NTE::setComment
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setComment (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### NTE::setCommentType
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setCommentType (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### NTE::setID
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setID (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### NTE::setSourceOfComment
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setSourceOfComment (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
+2092
File diff suppressed because it is too large
Load diff
+844
@@ -0,0 +1,844 @@
|
||||
# Aranyasen\HL7\Segments\OBX
|
||||
|
||||
OBX segment class
|
||||
Ref: https://corepointhealth.com/resource-center/hl7-resources/hl7-obx-segment
|
||||
|
||||
|
||||
|
||||
## Extend:
|
||||
|
||||
Aranyasen\HL7\Segment
|
||||
|
||||
## Methods
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
|[getAbnormalFlags](#obxgetabnormalflags)||
|
||||
|[getDataLastObsNormalValues](#obxgetdatalastobsnormalvalues)||
|
||||
|[getDateTimeOfTheObservation](#obxgetdatetimeoftheobservation)||
|
||||
|[getID](#obxgetid)||
|
||||
|[getNatureOfAbnormalTest](#obxgetnatureofabnormaltest)||
|
||||
|[getObservationIdentifier](#obxgetobservationidentifier)||
|
||||
|[getObservationMethod](#obxgetobservationmethod)||
|
||||
|[getObservationSubId](#obxgetobservationsubid)||
|
||||
|[getObservationValue](#obxgetobservationvalue)||
|
||||
|[getObserveResultStatus](#obxgetobserveresultstatus)||
|
||||
|[getProbability](#obxgetprobability)||
|
||||
|[getProducersId](#obxgetproducersid)||
|
||||
|[getReferenceRange](#obxgetreferencerange)||
|
||||
|[getResponsibleObserver](#obxgetresponsibleobserver)||
|
||||
|[getUnits](#obxgetunits)||
|
||||
|[getUserDefinedAccessChecks](#obxgetuserdefinedaccesschecks)||
|
||||
|[getValueType](#obxgetvaluetype)||
|
||||
|[setAbnormalFlags](#obxsetabnormalflags)||
|
||||
|[setDataLastObsNormalValues](#obxsetdatalastobsnormalvalues)||
|
||||
|[setDateTimeOfTheObservation](#obxsetdatetimeoftheobservation)||
|
||||
|[setID](#obxsetid)||
|
||||
|[setNatureOfAbnormalTest](#obxsetnatureofabnormaltest)||
|
||||
|[setObservationIdentifier](#obxsetobservationidentifier)||
|
||||
|[setObservationMethod](#obxsetobservationmethod)||
|
||||
|[setObservationSubId](#obxsetobservationsubid)||
|
||||
|[setObservationValue](#obxsetobservationvalue)||
|
||||
|[setObserveResultStatus](#obxsetobserveresultstatus)||
|
||||
|[setProbability](#obxsetprobability)||
|
||||
|[setProducersId](#obxsetproducersid)||
|
||||
|[setReferenceRange](#obxsetreferencerange)||
|
||||
|[setResponsibleObserver](#obxsetresponsibleobserver)||
|
||||
|[setUnits](#obxsetunits)||
|
||||
|[setUserDefinedAccessChecks](#obxsetuserdefinedaccesschecks)||
|
||||
|[setValueType](#obxsetvaluetype)||
|
||||
|
||||
## Inherited methods
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
|__construct|Create a segment.|
|
||||
|getField|Get the field at index.|
|
||||
|getFields|Get fields from a segment|
|
||||
|getName|Get the name of the segment. This is basically the value at index 0|
|
||||
|setField|Set the field specified by index to value.|
|
||||
|size|Get the number of fields for this segment, not including the name|
|
||||
|
||||
|
||||
|
||||
### OBX::getAbnormalFlags
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getAbnormalFlags (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getDataLastObsNormalValues
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getDataLastObsNormalValues (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getDateTimeOfTheObservation
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getDateTimeOfTheObservation (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getID
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getID (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getNatureOfAbnormalTest
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getNatureOfAbnormalTest (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getObservationIdentifier
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getObservationIdentifier (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getObservationMethod
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getObservationMethod (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getObservationSubId
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getObservationSubId (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getObservationValue
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getObservationValue (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getObserveResultStatus
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getObserveResultStatus (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getProbability
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getProbability (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getProducersId
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getProducersId (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getReferenceRange
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getReferenceRange (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getResponsibleObserver
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getResponsibleObserver (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getUnits
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getUnits (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getUserDefinedAccessChecks
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getUserDefinedAccessChecks (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::getValueType
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public getValueType (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setAbnormalFlags
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setAbnormalFlags (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setDataLastObsNormalValues
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setDataLastObsNormalValues (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setDateTimeOfTheObservation
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setDateTimeOfTheObservation (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setID
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setID (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setNatureOfAbnormalTest
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setNatureOfAbnormalTest (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setObservationIdentifier
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setObservationIdentifier (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setObservationMethod
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setObservationMethod (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setObservationSubId
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setObservationSubId (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setObservationValue
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setObservationValue (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setObserveResultStatus
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setObserveResultStatus (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setProbability
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setProbability (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setProducersId
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setProducersId (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setReferenceRange
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setReferenceRange (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setResponsibleObserver
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setResponsibleObserver (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setUnits
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setUnits (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setUserDefinedAccessChecks
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setUserDefinedAccessChecks (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
### OBX::setValueType
|
||||
|
||||
**Description**
|
||||
|
||||
```php
|
||||
public setValueType (void)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
**Parameters**
|
||||
|
||||
`This function has no parameters.`
|
||||
|
||||
**Return Values**
|
||||
|
||||
`void`
|
||||
|
||||
<hr />
|
||||
|
||||
+1516
File diff suppressed because it is too large
Load diff
+1472
File diff suppressed because it is too large
Load diff
+2671
File diff suppressed because it is too large
Load diff
+2253
File diff suppressed because it is too large
Load diff
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<ruleset name="PHP_CodeSniffer">
|
||||
<description>PHPCS configuration file.</description>
|
||||
|
||||
<rule ref="PSR12"/>
|
||||
|
||||
<file>src</file>
|
||||
<file>tests</file>
|
||||
|
||||
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
|
||||
<exclude-pattern>*/tests/*</exclude-pattern>
|
||||
</rule>
|
||||
</ruleset>
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
||||
<coverage>
|
||||
<include>
|
||||
<directory>./</directory>
|
||||
</include>
|
||||
<exclude>
|
||||
<directory>./tests</directory>
|
||||
<directory>./docs</directory>
|
||||
<directory>./vendor</directory>
|
||||
</exclude>
|
||||
</coverage>
|
||||
<testsuites>
|
||||
<testsuite name="HL7 test suite">
|
||||
<directory>./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Aranyasen\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
class HL7ConnectionException extends Exception
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Aranyasen\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
class HL7Exception extends Exception
|
||||
{
|
||||
//
|
||||
}
|
||||
Vendored
+219
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen;
|
||||
|
||||
use Aranyasen\Exceptions\HL7Exception;
|
||||
use Exception;
|
||||
use Aranyasen\HL7\Message;
|
||||
use Aranyasen\HL7\Segments\MSH;
|
||||
|
||||
/**
|
||||
* The HL7 class is a factory class for HL7 messages.
|
||||
*
|
||||
* The factory class provides the convenience of changing several defaults for HL7 messaging globally, like separators,
|
||||
* etc. Note that some default settings use characters that have special meaning in PHP, like the HL7 escape character.
|
||||
* To be able to set these values, escape the special characters.
|
||||
*
|
||||
*/
|
||||
class HL7
|
||||
{
|
||||
private array $hl7Globals;
|
||||
private string $hl7String;
|
||||
private bool $emptySubFields = false;
|
||||
private bool $resetIndices = false;
|
||||
private bool $autoIncrementIndices = true;
|
||||
private ?bool $doNotSplitRepetition = null;
|
||||
|
||||
/**
|
||||
* Create a new instance of the HL7 factory, and set global
|
||||
* defaults.
|
||||
*/
|
||||
private function __construct(string $hl7String = '')
|
||||
{
|
||||
$this->setDefaults();
|
||||
$this->hl7String = $hl7String;
|
||||
}
|
||||
|
||||
public static function build(): self
|
||||
{
|
||||
return new static();
|
||||
}
|
||||
|
||||
public static function from(string $hl7String): self
|
||||
{
|
||||
return new static($hl7String);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Message, using the global HL7 variables as defaults.
|
||||
*
|
||||
* @throws Exception | HL7Exception
|
||||
*/
|
||||
public function createMessage(): Message
|
||||
{
|
||||
if (empty($this->hl7String)) {
|
||||
$msh = $this->createMSH();
|
||||
$message = new Message(
|
||||
$this->hl7String,
|
||||
$this->hl7Globals,
|
||||
$this->emptySubFields,
|
||||
$this->resetIndices,
|
||||
$this->autoIncrementIndices,
|
||||
$this->doNotSplitRepetition
|
||||
);
|
||||
$message->addSegment($msh);
|
||||
return $message;
|
||||
}
|
||||
return new Message(
|
||||
$this->hl7String,
|
||||
$this->hl7Globals,
|
||||
$this->emptySubFields,
|
||||
$this->resetIndices,
|
||||
$this->autoIncrementIndices,
|
||||
$this->doNotSplitRepetition
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new MSH segment, using the global HL7 variables as defaults.
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createMSH(): MSH
|
||||
{
|
||||
return new MSH(hl7Globals: $this->hl7Globals);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the component separator to be used by the factory. Should be a single character. Default ^
|
||||
*
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function withComponentSeparator(string $value): self
|
||||
{
|
||||
$this->checkIfSingleCharacter($value);
|
||||
|
||||
return $this->setGlobal('COMPONENT_SEPARATOR', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the subcomponent separator to be used by the factory. Should be a single character. Default: &
|
||||
*
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function withSubcomponentSeparator(string $value): self
|
||||
{
|
||||
$this->checkIfSingleCharacter($value);
|
||||
|
||||
return $this->setGlobal('SUBCOMPONENT_SEPARATOR', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the repetition separator to be used by the factory. Should be a single character. Default: ~
|
||||
*
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function withRepetitionSeparator(string $value): self
|
||||
{
|
||||
$this->checkIfSingleCharacter($value);
|
||||
|
||||
return $this->setGlobal('REPETITION_SEPARATOR', $value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the field separator to be used by the factory. Should be a single character. Default: |
|
||||
*
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function withFieldSeparator(string $value): self
|
||||
{
|
||||
$this->checkIfSingleCharacter($value);
|
||||
|
||||
return $this->setGlobal('FIELD_SEPARATOR', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the segment separator to be used by the factory. Should be a single character. Default: \015
|
||||
*
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function withSegmentSeparator(string $value): self
|
||||
{
|
||||
$this->checkIfSingleCharacter($value);
|
||||
|
||||
return $this->setGlobal('SEGMENT_SEPARATOR', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the escape character to be used by the factory. Should be a single character. Default: \
|
||||
*
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function withEscapeCharacter(string $value): self
|
||||
{
|
||||
$this->checkIfSingleCharacter($value);
|
||||
|
||||
return $this->setGlobal('ESCAPE_CHARACTER', $value);
|
||||
}
|
||||
|
||||
public function withHL7Version(string $hl7Version): self
|
||||
{
|
||||
return $this->setGlobal('HL7_VERSION', $hl7Version);
|
||||
}
|
||||
|
||||
public function keepEmptySubfields(bool $value = true): self
|
||||
{
|
||||
$this->emptySubFields = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function resetIndices(bool $value = true): self
|
||||
{
|
||||
$this->resetIndices = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function autoIncrementIndices(bool $value = true): self
|
||||
{
|
||||
$this->autoIncrementIndices = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function doNotSplitRepetition(bool $value = true): self
|
||||
{
|
||||
$this->doNotSplitRepetition = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function setGlobal(string $name, string $value): self
|
||||
{
|
||||
$this->hl7Globals[$name] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function setDefaults(): void
|
||||
{
|
||||
$this->hl7Globals['SEGMENT_SEPARATOR'] = '\n';
|
||||
$this->hl7Globals['SEGMENT_ENDING_BAR'] = true;
|
||||
$this->hl7Globals['FIELD_SEPARATOR'] = '|';
|
||||
$this->hl7Globals['COMPONENT_SEPARATOR'] = '^';
|
||||
$this->hl7Globals['SUBCOMPONENT_SEPARATOR'] = '&';
|
||||
$this->hl7Globals['REPETITION_SEPARATOR'] = '~';
|
||||
$this->hl7Globals['ESCAPE_CHARACTER'] = '\\';
|
||||
$this->hl7Globals['HL7_VERSION'] = '2.3';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return void
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
private function checkIfSingleCharacter(string $value): void
|
||||
{
|
||||
if (strlen($value) !== 1) {
|
||||
throw new HL7Exception("Parameter should be a single character. Received: '$value'");
|
||||
}
|
||||
}
|
||||
}
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7;
|
||||
|
||||
use Aranyasen\Exceptions\HL7ConnectionException;
|
||||
use Aranyasen\Exceptions\HL7Exception;
|
||||
use Exception;
|
||||
use Socket;
|
||||
|
||||
/**
|
||||
* Usage:
|
||||
* ```php
|
||||
* $connection = new Connection('127.0.0.1', 5002);
|
||||
* $req = new Message();
|
||||
* // ... set some request attributes
|
||||
* $response = $connection->send($req);
|
||||
* $response->toString(); // Read ACK message from remote
|
||||
* ```
|
||||
*
|
||||
* The Connection object represents the tcp connection to the HL7 message broker. The Connection has only one public
|
||||
* method (apart from the constructor), send(). The 'send' method takes a Message object as argument, and also
|
||||
* returns a Message object. The send method can be used more than once, before the connection is closed.
|
||||
* Connection is closed automatically when the connection object is destroyed.
|
||||
*
|
||||
* The Connection object holds the following fields:
|
||||
*
|
||||
* MESSAGE_PREFIX
|
||||
*
|
||||
* The prefix to be sent to the HL7 server to initiate the
|
||||
* message. Defaults to \013.
|
||||
*
|
||||
* MESSAGE_SUFFIX
|
||||
* End of message signal for HL7 server. Defaults to \034\015.
|
||||
*
|
||||
*/
|
||||
class Connection
|
||||
{
|
||||
protected Socket $socket;
|
||||
protected int $timeout;
|
||||
|
||||
/** # Octal 13 (Hex: 0B): Vertical Tab */
|
||||
protected string $MESSAGE_PREFIX = "\013";
|
||||
|
||||
/** # 34 (Hex: 1C): file separator character, 15 (Hex: 0D): Carriage return */
|
||||
protected string $MESSAGE_SUFFIX = "\034\015";
|
||||
|
||||
/**
|
||||
* Creates a connection to a HL7 server, or throws exception when a connection could not be established.
|
||||
*
|
||||
* @param string $host Host to connect to
|
||||
* @param int $port Port to connect to
|
||||
* @param int $timeout Connection timeout
|
||||
* @throws HL7ConnectionException
|
||||
*/
|
||||
public function __construct(string $host, int $port, int $timeout = 10)
|
||||
{
|
||||
if (!extension_loaded('sockets')) {
|
||||
throw new HL7ConnectionException('Please install ext-sockets to run Connection');
|
||||
}
|
||||
$this->setSocket($host, $port, $timeout);
|
||||
$this->timeout = $timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a client-side TCP socket
|
||||
*
|
||||
* @param int $timeout Connection timeout
|
||||
* @throws HL7ConnectionException
|
||||
*/
|
||||
protected function setSocket(string $host, int $port, int $timeout = 10): void
|
||||
{
|
||||
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||
if (!$socket) {
|
||||
$this->throwSocketError('Failed to create socket');
|
||||
}
|
||||
|
||||
if (!socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, ['sec' => $timeout, 'usec' => 0])) {
|
||||
$this->throwSocketError('Unable to set timeout on socket');
|
||||
}
|
||||
|
||||
if (!socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, ['sec' => $timeout, 'usec' => 0])) {
|
||||
$this->throwSocketError('Unable to set timeout on socket');
|
||||
}
|
||||
|
||||
if (!socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1)) {
|
||||
$this->throwSocketError('Unable to set reuse-address on socket');
|
||||
}
|
||||
|
||||
// Uncomment this if server requires a certain client-side port to be used
|
||||
// if (!socket_bind($socket, "0.0.0.0", $localPort)) {
|
||||
// $this->throwSocketError('Unable to bind socket');
|
||||
// }
|
||||
|
||||
$result = null;
|
||||
try {
|
||||
$result = socket_connect($socket, $host, $port);
|
||||
} catch (Exception) {
|
||||
$this->throwSocketError("Failed to connect to server ($host:$port)");
|
||||
}
|
||||
if (!$result) {
|
||||
$this->throwSocketError("Failed to connect to server ($host:$port)");
|
||||
}
|
||||
|
||||
$this->socket = $socket;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws HL7ConnectionException
|
||||
*/
|
||||
protected function throwSocketError(string $message): void
|
||||
{
|
||||
throw new HL7ConnectionException($message . ': ' . socket_strerror(socket_last_error()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a Message object over this connection.
|
||||
*
|
||||
* @param string $responseCharEncoding The expected character encoding of the response.
|
||||
* @param bool $noWait Do no wait for ACK. Helpful for building load testing tools...
|
||||
* @throws HL7ConnectionException
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function send(Message $msg, string $responseCharEncoding = 'UTF-8', bool $noWait = false): ?Message
|
||||
{
|
||||
$message = $this->MESSAGE_PREFIX . $msg->toString(true) . $this->MESSAGE_SUFFIX; // As per MLLP protocol
|
||||
if (!socket_write($this->socket, $message, strlen($message))) {
|
||||
throw new HL7Exception("Could not send data to server: " . socket_strerror(socket_last_error()));
|
||||
}
|
||||
|
||||
if ($noWait) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$data = null;
|
||||
|
||||
$startTime = time();
|
||||
while (($buf = socket_read($this->socket, 1024)) !== false) { // Read ACK / NACK from server
|
||||
$data .= $buf;
|
||||
if (preg_match('/' . $this->MESSAGE_SUFFIX . '$/', $data)) {
|
||||
break;
|
||||
}
|
||||
if ((time() - $startTime) > $this->timeout) {
|
||||
throw new HL7ConnectionException(
|
||||
"Response partially received. Timed out listening for end-of-message from server"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($data)) {
|
||||
throw new HL7ConnectionException("No response received within {$this->timeout} seconds");
|
||||
}
|
||||
|
||||
// Remove message prefix and suffix added by the MLLP server
|
||||
$data = preg_replace('/^' . $this->MESSAGE_PREFIX . '/', '', $data);
|
||||
$data = preg_replace('/' . $this->MESSAGE_SUFFIX . '$/', '', $data);
|
||||
|
||||
// set character encoding
|
||||
$data = mb_convert_encoding($data, $responseCharEncoding);
|
||||
|
||||
return new Message($data, null, true, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the raw socket opened/used by this class
|
||||
*/
|
||||
public function getSocket(): Socket
|
||||
{
|
||||
return $this->socket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the socket
|
||||
* TODO: Close only when the socket is open
|
||||
*/
|
||||
private function close(): void
|
||||
{
|
||||
try {
|
||||
socket_close($this->socket);
|
||||
} catch (Exception $e) {
|
||||
echo 'Failed to close socket: ' . socket_strerror(socket_last_error()) . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->close();
|
||||
}
|
||||
}
|
||||
+483
@@ -0,0 +1,483 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7;
|
||||
|
||||
use Aranyasen\Exceptions\HL7Exception;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Class specifying the HL7 message, both request and response.
|
||||
*
|
||||
* In general one needn't create an instance of the Message class directly, but use the HL7 factory class to create one.
|
||||
* When adding segments, note that the segment index starts at 0, so to get the first segment, do
|
||||
* ```php $msg->getSegmentByIndex(0) ```
|
||||
*
|
||||
* The segment separator defaults to \015. To change this, set the global variable $SEGMENT_SEPARATOR.
|
||||
*/
|
||||
class Message
|
||||
{
|
||||
use MessageHelpersTrait;
|
||||
|
||||
protected array $segments = [];
|
||||
|
||||
protected string $segmentSeparator;
|
||||
protected bool $segmentEndingBar; # true, if '|' at end of each segment is needed
|
||||
protected $fieldSeparator;
|
||||
protected string $componentSeparator;
|
||||
protected string $subcomponentSeparator;
|
||||
protected string $repetitionSeparator;
|
||||
protected string $escapeChar;
|
||||
protected $hl7Version;
|
||||
|
||||
// Split (or not) repeated subfields joined by ~. E.g. if true, parses 3^0~4^1 to [3, '0~4', 1]
|
||||
protected bool $doNotSplitRepetition;
|
||||
|
||||
/**
|
||||
* Constructor for Message. Consider using the HL7 factory to obtain a message instead.
|
||||
*
|
||||
* The constructor takes an optional string argument that is a string representation of a HL7 message. If the
|
||||
* string representation is not a valid HL7 message. according to the specifications, undef is returned instead of
|
||||
* a new instance. This means that segments should be separated within the message with the segment separator
|
||||
* (defaults to \015) or a newline, and segments should be syntactically correct. When using the string argument
|
||||
* constructor, make sure that you have escaped any characters that would have special meaning in PHP.
|
||||
*
|
||||
* The control characters and field separator will take the values from the MSH segment, if set. Otherwise defaults
|
||||
* will be used. Changing the MSH fields specifying the field separator and control characters after the MSH has
|
||||
* been added to the message will result in setting these values for the message.
|
||||
*
|
||||
* If the message couldn't be created, for example due to a erroneous HL7 message string, an error is raised.
|
||||
* @param string|null $msgStr
|
||||
* @param array|null $hl7Globals Set control characters or HL7 properties. e.g., ['HL7_VERSION' => '2.5']
|
||||
* @param bool $keepEmptySubFields Set this to true to retain empty sub-fields
|
||||
* @param bool $resetIndices Reset Indices of each segment to 1.
|
||||
* @param bool $autoIncrementIndices True: auto-increment for each instance of same segment.
|
||||
* @param bool|null $doNotSplitRepetition If true, repeated segments will be in single array instead of sub-arrays.
|
||||
* Note: Since this is non-standard, it may be removed in future!
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function __construct(
|
||||
?string $msgStr = null,
|
||||
?array $hl7Globals = null,
|
||||
bool $keepEmptySubFields = false,
|
||||
bool $resetIndices = false,
|
||||
bool $autoIncrementIndices = true,
|
||||
?bool $doNotSplitRepetition = null
|
||||
) {
|
||||
// Control characters and other HL7 properties
|
||||
$this->segmentSeparator = $hl7Globals['SEGMENT_SEPARATOR'] ?? '\n';
|
||||
$this->segmentEndingBar = $hl7Globals['SEGMENT_ENDING_BAR'] ?? true;
|
||||
$this->fieldSeparator = $hl7Globals['FIELD_SEPARATOR'] ?? '|';
|
||||
$this->componentSeparator = $hl7Globals['COMPONENT_SEPARATOR'] ?? '^';
|
||||
$this->subcomponentSeparator = $hl7Globals['SUBCOMPONENT_SEPARATOR'] ?? '&';
|
||||
$this->repetitionSeparator = $hl7Globals['REPETITION_SEPARATOR'] ?? '~';
|
||||
$this->escapeChar = $hl7Globals['ESCAPE_CHARACTER'] ?? '\\';
|
||||
$this->hl7Version = $hl7Globals['HL7_VERSION'] ?? '2.3';
|
||||
|
||||
$this->doNotSplitRepetition = (bool) $doNotSplitRepetition;
|
||||
|
||||
if ($resetIndices) {
|
||||
$this->resetSegmentIndices();
|
||||
}
|
||||
|
||||
// If no HL7 string is passed to the constructor, nothing else to do
|
||||
if (!$msgStr) {
|
||||
return;
|
||||
}
|
||||
|
||||
$segments = preg_split("/[\n\r" . $this->segmentSeparator . ']/', $msgStr, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$this->setSeparators($segments[0]); // First segment is MSH, the control segment
|
||||
|
||||
// Do all segments
|
||||
foreach ($segments as $index => $segmentString) {
|
||||
$fields = preg_split("/\\" . $this->fieldSeparator . '/', $segmentString);
|
||||
$segmentName = array_shift($fields);
|
||||
|
||||
foreach ($fields as $j => $field) {
|
||||
// Skip control field (i.e. first field in MSH segment)
|
||||
if ($index === 0 && $j === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fields[$j] = $this->extractComponentsFromField($field, $keepEmptySubFields);
|
||||
}
|
||||
|
||||
$segment = $this->getSegmentClass($segmentName, $fields, $autoIncrementIndices);
|
||||
|
||||
$this->addSegment($segment);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a segment to the end of the message
|
||||
*/
|
||||
public function addSegment(Segment $segment): bool
|
||||
{
|
||||
if (count($this->segments) === 0) {
|
||||
$this->resetCtrl($segment);
|
||||
}
|
||||
|
||||
$this->segments[] = $segment;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a segment.
|
||||
*
|
||||
* @param null|int $index Index where segment is inserted
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function insertSegment(Segment $segment, ?int $index = null): void
|
||||
{
|
||||
if ($index > count($this->segments)) {
|
||||
throw new InvalidArgumentException("Index out of range. Index: $index, Total segments: " .
|
||||
count($this->segments));
|
||||
}
|
||||
|
||||
if ($index === 0) {
|
||||
$this->resetCtrl($segment);
|
||||
array_unshift($this->segments, $segment);
|
||||
} elseif ($index === count($this->segments)) {
|
||||
$this->segments[] = $segment;
|
||||
} else {
|
||||
$this->segments =
|
||||
array_merge(
|
||||
array_slice($this->segments, 0, $index),
|
||||
[$segment],
|
||||
array_slice($this->segments, $index)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the segment specified by $index.
|
||||
*
|
||||
* Note: Segment count within the message starts at 0.
|
||||
*
|
||||
* @param int $index Index where segment is inserted
|
||||
*/
|
||||
public function getSegmentByIndex(int $index): ?Segment
|
||||
{
|
||||
if ($index >= count($this->segments)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->segments[$index];
|
||||
}
|
||||
|
||||
public function getSegmentIndex(Segment $segment): ?int
|
||||
{
|
||||
foreach ($this->segments as $ii => $value) {
|
||||
if ($value === $segment) {
|
||||
return $ii;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of all segments with the given name
|
||||
*
|
||||
* @param string $name Segment name
|
||||
* @return array List of segments identified by name
|
||||
*/
|
||||
public function getSegmentsByName(string $name): array
|
||||
{
|
||||
$segmentsByName = [];
|
||||
|
||||
foreach ($this->segments as $segment) {
|
||||
if ($segment->getName() === $name) {
|
||||
$segmentsByName[] = $segment;
|
||||
}
|
||||
}
|
||||
|
||||
return $segmentsByName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of all segments with the given subclass of Segment
|
||||
*
|
||||
* @param string $name Segment class
|
||||
* @return array List of segments identified by class
|
||||
*/
|
||||
public function getSegmentsByClass(string $segmentClass): array
|
||||
{
|
||||
if (!is_subclass_of($segmentClass, Segment::class)) {
|
||||
throw new HL7Exception("$segmentClass is not a subclass of " . Segment::class);
|
||||
}
|
||||
$segmentsByClass = [];
|
||||
|
||||
foreach ($this->segments as $segment) {
|
||||
if ($segment instanceof $segmentClass) {
|
||||
$segmentsByClass[] = $segment;
|
||||
}
|
||||
}
|
||||
|
||||
return $segmentsByClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the segment indexed by $index.
|
||||
*
|
||||
* If it doesn't exist, nothing happens, if it does, all segments
|
||||
* after this one will be moved one index up.
|
||||
*
|
||||
* @param int $index Index where segment is removed
|
||||
*/
|
||||
public function removeSegmentByIndex(int $index): bool
|
||||
{
|
||||
if ($index < count($this->segments)) {
|
||||
array_splice($this->segments, $index, 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove given segment
|
||||
*
|
||||
* @return int Count of segments removed
|
||||
*/
|
||||
public function removeSegmentsByName(string $segmentName): int
|
||||
{
|
||||
$count = 0;
|
||||
foreach ($this->getSegmentsByName($segmentName) as $segment) {
|
||||
$this->removeSegmentByIndex($this->getSegmentIndex($segment));
|
||||
$count++;
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove given segment
|
||||
*
|
||||
* @return int Count of segments removed
|
||||
*/
|
||||
public function removeSegmentsByClass(string $segmentClass): int
|
||||
{
|
||||
if (!is_subclass_of($segmentClass, Segment::class)) {
|
||||
throw new HL7Exception("$segmentClass is not a subclass of " . Segment::class);
|
||||
}
|
||||
$count = 0;
|
||||
foreach ($this->getSegmentsByClass($segmentClass) as $segment) {
|
||||
$this->removeSegmentByIndex($this->getSegmentIndex($segment));
|
||||
$count++;
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the segment on index.
|
||||
*
|
||||
* If index is out of range, or not provided, do nothing. Setting MSH on index 0 will re-validate field separator,
|
||||
* control characters and hl7 version, based on MSH(1), MSH(2) and MSH(12).
|
||||
*
|
||||
* @param int $index Index where segment is set
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function setSegment(Segment $segment, int $index): bool
|
||||
{
|
||||
if ($index > count($this->segments)) {
|
||||
throw new InvalidArgumentException('Index out of range');
|
||||
}
|
||||
|
||||
if ($index === 0 && $segment->getName() === 'MSH') {
|
||||
$this->resetCtrl($segment);
|
||||
}
|
||||
|
||||
$this->segments[$index] = $segment;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* After change of MSH, reset control fields
|
||||
*/
|
||||
protected function resetCtrl(Segment $segment): bool
|
||||
{
|
||||
if ($segment->getField(1)) {
|
||||
$this->fieldSeparator = $segment->getField(1);
|
||||
}
|
||||
|
||||
if (preg_match('/(.)(.)(.)(.)/', (string) $segment->getField(2), $matches)) {
|
||||
$this->componentSeparator = $matches[1];
|
||||
$this->repetitionSeparator = $matches[2];
|
||||
$this->escapeChar = $matches[3];
|
||||
$this->subcomponentSeparator = $matches[4];
|
||||
}
|
||||
|
||||
if ($segment->getField(12)) {
|
||||
$this->hl7Version = $segment->getField(12);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array containing all segments in the right order.
|
||||
*
|
||||
* @return array List of all segments
|
||||
*/
|
||||
public function getSegments(): array
|
||||
{
|
||||
return $this->segments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string representation of this message.
|
||||
*
|
||||
* This can be used to send the message over a socket to an HL7 server. To print to other output, use the $pretty
|
||||
* argument as some true value. This will not use the default segment separator, but '\n' instead.
|
||||
*
|
||||
* @param boolean $pretty Whether to use \n as separator or default (\r).
|
||||
* @return mixed String representation of HL7 message
|
||||
* @access public
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function toString(bool $pretty = false)
|
||||
{
|
||||
if (empty($this->segments)) {
|
||||
throw new HL7Exception('Message contains no data. Can not convert to string');
|
||||
}
|
||||
|
||||
// Make sure MSH(1) and MSH(2) are ok, even if someone has changed these values
|
||||
$this->resetCtrl($this->segments[0]);
|
||||
|
||||
$message = '';
|
||||
foreach ($this->segments as $segment) {
|
||||
$segmentString = $this->segmentToString($segment);
|
||||
if (!$this->segmentEndingBar) {
|
||||
$segmentString = preg_replace('/\|$/', '', $segmentString);
|
||||
}
|
||||
$message .= $segmentString;
|
||||
$message .= $pretty
|
||||
? str_replace(['\r', '\n'], ["\r", "\n"], $this->segmentSeparator)
|
||||
: $this->segmentSeparator;
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Segment object to string
|
||||
*/
|
||||
public function segmentToString(Segment $segment): string
|
||||
{
|
||||
$segmentName = $segment->getName();
|
||||
$segmentString = $segmentName . $this->fieldSeparator;
|
||||
$fields = $segment->getFields(($segmentName === 'MSH' ? 2 : 1));
|
||||
|
||||
foreach ($fields as $field) {
|
||||
if (is_array($field)) {
|
||||
foreach ($field as $index => $value) {
|
||||
is_array($value)
|
||||
? ($segmentString .= implode($this->subcomponentSeparator, $value))
|
||||
: ($segmentString .= $value);
|
||||
|
||||
if ($index < (count($field) - 1)) {
|
||||
$segmentString .= $this->componentSeparator;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$segmentString .= $field;
|
||||
}
|
||||
|
||||
$segmentString .= $this->fieldSeparator;
|
||||
}
|
||||
|
||||
return $segmentString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index attribute of each given segment, so when those are added the indices start from 1
|
||||
*/
|
||||
public function resetSegmentIndices(): void
|
||||
{
|
||||
$reflector = new \ReflectionClass($this);
|
||||
$segments = glob(dirname($reflector->getFileName()) . '/Segments/*.php');
|
||||
|
||||
// Go through each available segment class and reset its ID
|
||||
foreach ($segments as $file) { // ['OBR', 'PID', 'OBX', 'IN1'...]
|
||||
$className = "Aranyasen\\HL7\\Segments\\" . pathinfo($file, PATHINFO_FILENAME);
|
||||
if (class_exists($className) && method_exists($className, 'resetIndex')) {
|
||||
$className::resetIndex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function extractComponentsFromField(string $field, bool $keepEmptySubFields): array|string
|
||||
{
|
||||
$pregFlags = $keepEmptySubFields
|
||||
? 0
|
||||
: PREG_SPLIT_NO_EMPTY;
|
||||
|
||||
if ((str_contains($field, $this->repetitionSeparator)) && (! $this->doNotSplitRepetition)) {
|
||||
$components = preg_split("/\\" . $this->repetitionSeparator . '/', $field, -1, $pregFlags);
|
||||
$fields = [];
|
||||
foreach ($components as $index => $component) {
|
||||
$fields[$index] = $this->extractComponentsFromField($component, $keepEmptySubFields);
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
$components = preg_split("/\\" . $this->componentSeparator . '/', $field, -1, $pregFlags);
|
||||
foreach ($components as $index => $component) {
|
||||
$subComps = preg_split("/\\" . $this->subcomponentSeparator . '/', $component);
|
||||
// Make it a ref or just the value
|
||||
$components[$index] = count($subComps) === 1
|
||||
? $subComps[0]
|
||||
: $subComps;
|
||||
}
|
||||
|
||||
return count($components) === 1
|
||||
? $components[0]
|
||||
: $components;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set various separators - segment, field etc.
|
||||
*
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
private function setSeparators(string $msh): void
|
||||
{
|
||||
if (!preg_match('/^([A-Z0-9]{3})(.)(.)(.)(.)(.)(.)/', $msh, $matches)) {
|
||||
throw new HL7Exception('Not a valid message: invalid control segment', E_USER_ERROR);
|
||||
}
|
||||
|
||||
[, , $fieldSep, $compSep, $repSep, $esc, $subCompSep, $fieldSepCtrl] = $matches;
|
||||
|
||||
// Check whether field separator is repeated after 4 control characters
|
||||
if ($fieldSep !== $fieldSepCtrl) {
|
||||
throw new HL7Exception('Not a valid message: field separator invalid', E_USER_ERROR);
|
||||
}
|
||||
|
||||
// Set field separator based on control segment
|
||||
$this->fieldSeparator = $fieldSep;
|
||||
|
||||
// Set other separators
|
||||
$this->componentSeparator = $compSep;
|
||||
$this->subcomponentSeparator = $subCompSep;
|
||||
$this->escapeChar = $esc;
|
||||
$this->repetitionSeparator = $repSep;
|
||||
}
|
||||
|
||||
private function getSegmentClass(string $segmentName, array $fields, bool $autoIncrementIndices): Segment
|
||||
{
|
||||
// If a class exists for the segment under segments/, (e.g., MSH)
|
||||
$className = "Aranyasen\\HL7\\Segments\\$segmentName";
|
||||
if (!class_exists($className)) {
|
||||
return new Segment($segmentName, $fields);
|
||||
}
|
||||
|
||||
if ($segmentName === 'MSH') {
|
||||
array_unshift($fields, $this->fieldSeparator); # First field for MSH is '|'
|
||||
return new $className($fields);
|
||||
}
|
||||
|
||||
return new $className($fields, $autoIncrementIndices);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7;
|
||||
|
||||
use Aranyasen\Exceptions\HL7Exception;
|
||||
use Aranyasen\HL7\Segments\MSH;
|
||||
|
||||
trait MessageHelpersTrait
|
||||
{
|
||||
/**
|
||||
* Get the segment identified by index as string, using the messages separators.
|
||||
*
|
||||
* @param int $index Index for segment to get
|
||||
* @return string|null String representation of segment
|
||||
*/
|
||||
public function getSegmentAsString(int $index): ?string
|
||||
{
|
||||
$segment = $this->getSegmentByIndex($index);
|
||||
|
||||
if ($segment === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->segmentToString($segment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field identified by $fieldIndex from segment $segmentIndex.
|
||||
*
|
||||
* Returns empty string if field is not set.
|
||||
*
|
||||
* @param int $segmentIndex Index for segment to get
|
||||
* @param int $fieldIndex Index for field to get
|
||||
* @return null|string String representation of field
|
||||
*/
|
||||
public function getSegmentFieldAsString(int $segmentIndex, int $fieldIndex): ?string
|
||||
{
|
||||
$segment = $this->getSegmentByIndex($segmentIndex);
|
||||
|
||||
if ($segment === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$field = $segment->getField($fieldIndex);
|
||||
|
||||
if (!$field) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$fieldString = null;
|
||||
|
||||
if (\is_array($field)) {
|
||||
foreach ($field as $i => $value) {
|
||||
\is_array($value)
|
||||
? ($fieldString .= implode($this->subcomponentSeparator, $value))
|
||||
: ($fieldString .= $value);
|
||||
|
||||
if ($i < (\count($field) - 1)) {
|
||||
$fieldString .= $this->componentSeparator;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$fieldString .= $field;
|
||||
}
|
||||
|
||||
return $fieldString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write HL7 to a file
|
||||
*
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function toFile(string $filename): void
|
||||
{
|
||||
file_put_contents($filename, $this->toString(true));
|
||||
if (!file_exists($filename)) {
|
||||
throw new HL7Exception("Failed to write HL7 to file '$filename'");
|
||||
}
|
||||
}
|
||||
|
||||
public function isOrm(): bool
|
||||
{
|
||||
/** @var MSH $msh */
|
||||
$msh = $this->getFirstSegmentInstance('MSH');
|
||||
return str_contains($msh->getMessageType(), 'ORM');
|
||||
}
|
||||
|
||||
public function isOru(): bool
|
||||
{
|
||||
/** @var MSH $msh */
|
||||
$msh = $this->getFirstSegmentInstance('MSH');
|
||||
return str_contains($msh->getMessageType(), 'ORU');
|
||||
}
|
||||
|
||||
public function isAdt(): bool
|
||||
{
|
||||
/** @var MSH $msh */
|
||||
$msh = $this->getFirstSegmentInstance('MSH');
|
||||
return str_contains($msh->getMessageType(), 'ADT');
|
||||
}
|
||||
|
||||
public function isSiu(): bool
|
||||
{
|
||||
/** @var MSH $msh */
|
||||
$msh = $this->getFirstSegmentInstance('MSH');
|
||||
return str_contains($msh->getMessageType(), 'SIU');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if given segment is present in the message object
|
||||
*/
|
||||
public function hasSegment(string $segment): bool
|
||||
{
|
||||
return count($this->getSegmentsByName(strtoupper($segment))) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if given segment is present in the message object by class name
|
||||
*/
|
||||
public function hasSegmentOfClass(string $segmentClass): bool
|
||||
{
|
||||
return count($this->getSegmentsByClass($segmentClass)) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if given segment is present in the message object by class name
|
||||
*/
|
||||
public function hasSegmentByClass(string $segmentClass): bool
|
||||
{
|
||||
return count($this->getSegmentsByClass($segmentClass)) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the first segment with given name in the message
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function getFirstSegmentInstance(string $segment)
|
||||
{
|
||||
if (!$this->hasSegment($segment)) {
|
||||
return null;
|
||||
}
|
||||
return $this->getSegmentsByName($segment)[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the first segment of the given class in the message
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function getFirstSegmentInstanceByClass(string $segmentClass)
|
||||
{
|
||||
if (!$this->hasSegmentOfClass($segmentClass)) {
|
||||
return null;
|
||||
}
|
||||
return $this->getSegmentsByClass($segmentClass)[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $reIndex After deleting, re-index remaining segments of same name
|
||||
*/
|
||||
public function removeSegment(Segment $segment, bool $reIndex = false): void
|
||||
{
|
||||
if (($key = array_search($segment, $this->segments, true)) !== false) {
|
||||
unset($this->segments[$key]);
|
||||
}
|
||||
|
||||
if (!$reIndex) {
|
||||
return;
|
||||
}
|
||||
|
||||
$segments = $this->getSegmentsByName($segment->getName());
|
||||
$index = 1;
|
||||
/** @var Segment $segment */
|
||||
foreach ($segments as $segment) {
|
||||
$segment->setField(1, $index++);
|
||||
}
|
||||
}
|
||||
|
||||
public function isEmpty(): bool
|
||||
{
|
||||
return empty($this->getSegments());
|
||||
}
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Messages;
|
||||
|
||||
use Aranyasen\HL7\Message;
|
||||
use Aranyasen\HL7\Segments\MSA;
|
||||
use Aranyasen\HL7\Segments\MSH;
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class ACK extends Message
|
||||
{
|
||||
protected string $ACK_TYPE;
|
||||
|
||||
/**
|
||||
* Usage:
|
||||
* ```php
|
||||
* $ack = new ACK($requestMessage);
|
||||
* ```
|
||||
*
|
||||
* Convenience module implementing an acknowledgement (ACK) message. This can be used in HL7 servers to create an
|
||||
* acknowledgement for an incoming message.
|
||||
*
|
||||
* @param Message|null $req
|
||||
* @param MSH|null $reqMsh
|
||||
* @param array|null $hl7Globals Set control characters or HL7 properties. e.g., ['HL7_VERSION' => '2.5']
|
||||
* @throws Exception
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(?Message $req = null, ?MSH $reqMsh = null, ?array $hl7Globals = null)
|
||||
{
|
||||
parent::__construct(null, $hl7Globals);
|
||||
|
||||
if ($req) {
|
||||
$msh = $req->getSegmentByIndex(0);
|
||||
|
||||
if ($msh) {
|
||||
$msh = new MSH($msh->getFields(1), $hl7Globals);
|
||||
} else {
|
||||
$msh = new MSH(null, $hl7Globals);
|
||||
}
|
||||
} else {
|
||||
$msh = new MSH(null, $hl7Globals);
|
||||
}
|
||||
|
||||
$msa = new MSA();
|
||||
|
||||
// Determine acknowledge mode: normal or enhanced
|
||||
//
|
||||
if ($req && ($msh->getField(15) || $msh->getField(16))) {
|
||||
$this->ACK_TYPE = 'E';
|
||||
$msa->setAcknowledgementCode('CA');
|
||||
} else {
|
||||
$this->ACK_TYPE = 'N';
|
||||
$msa->setAcknowledgementCode('AA');
|
||||
}
|
||||
|
||||
$this->addSegment($msh);
|
||||
$this->addSegment($msa);
|
||||
|
||||
$msh->setField(9, 'ACK');
|
||||
|
||||
// Construct an ACK based on the request
|
||||
if ($req && $reqMsh) {
|
||||
$msh->setField(3, $reqMsh->getReceivingApplication());
|
||||
$msh->setField(4, $reqMsh->getReceivingFacility());
|
||||
$msh->setField(5, $reqMsh->getSendingApplication());
|
||||
$msh->setField(6, $reqMsh->getSendingFacility());
|
||||
$msa->setMessageControlID($reqMsh->getMessageControlId());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the acknowledgement code for the acknowledgement.
|
||||
*
|
||||
* Code should be one of: A, E, R. Codes can be prepended with C or A, denoting enhanced or normal acknowledge mode.
|
||||
* This denotes: accept, general error and reject respectively. The ACK module will determine the right answer mode
|
||||
* (normal or enhanced) based upon the request, if not provided. The message provided in $msg will be set in MSA 3.
|
||||
*
|
||||
* @param string $code Code to use in acknowledgement
|
||||
* @param string|null $msg Acknowledgement message
|
||||
*/
|
||||
public function setAckCode(string $code, ?string $msg = null): bool
|
||||
{
|
||||
$mode = 'A';
|
||||
|
||||
// Determine acknowledge mode: normal or enhanced
|
||||
//
|
||||
if ($this->ACK_TYPE === 'E') {
|
||||
$mode = 'C';
|
||||
}
|
||||
|
||||
if (\strlen($code) === 1) {
|
||||
$code = "$mode$code";
|
||||
}
|
||||
|
||||
$seg1 = $this->getSegmentByIndex(1);
|
||||
if (!empty($seg1)) {
|
||||
$seg1->setField(1, $code);
|
||||
}
|
||||
if ($msg) {
|
||||
$seg1->setField(3, $msg);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the error message for acknowledgement.
|
||||
*
|
||||
* This will also set the error code to either AE or CE, depending on the mode of the incoming message.
|
||||
*
|
||||
* @param string $msg Error message
|
||||
*/
|
||||
public function setErrorMessage(string $msg): void
|
||||
{
|
||||
$this->setAckCode('E', $msg);
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Aranyasen\HL7;
|
||||
|
||||
class Request
|
||||
{
|
||||
//
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Aranyasen\HL7;
|
||||
|
||||
class Response
|
||||
{
|
||||
//
|
||||
}
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
class Segment
|
||||
{
|
||||
protected array $fields = [];
|
||||
|
||||
/**
|
||||
* 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);
|
||||
* ```
|
||||
*
|
||||
* @author Aranya Sen
|
||||
* @param string $name Name of the segment
|
||||
* @param array|null $fields Fields for segment
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function __construct(string $name, ?array $fields = null)
|
||||
{
|
||||
// Is the name 3 upper case characters?
|
||||
if ((!$name) || (strlen($name) !== 3) || (strtoupper($name) !== $name)) {
|
||||
throw new InvalidArgumentException("Segment name '$name' should be 3 characters and in uppercase");
|
||||
}
|
||||
|
||||
$this->fields[0] = $name;
|
||||
|
||||
if (is_array($fields)) {
|
||||
foreach ($fields as $i => $value) {
|
||||
$this->setField($i + 1, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param int $index Index to set
|
||||
*/
|
||||
public function setField(int $index, string|int|array|null $value = ''): bool
|
||||
{
|
||||
if ($index === 0) { // Do not allow changing 0th index, which is the name of the segment
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->isValueEmpty($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Fill in the blanks...
|
||||
for ($i = count($this->fields); $i < $index; $i++) {
|
||||
$this->fields[$i] = '';
|
||||
}
|
||||
|
||||
$this->fields[$index] = $value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function isValueEmpty($value): bool
|
||||
{
|
||||
if (is_array($value)) {
|
||||
return empty($value);
|
||||
}
|
||||
|
||||
if ((string) $value === '0') { // Allow 0
|
||||
return false;
|
||||
}
|
||||
|
||||
return ! $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove any existing value from the field
|
||||
*
|
||||
* @param int $index Field index
|
||||
*/
|
||||
public function clearField(int $index): void
|
||||
{
|
||||
$this->fields[$index] = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* ```
|
||||
*/
|
||||
public function getField(int $index): array|string|int|null
|
||||
{
|
||||
return $this->fields[$index] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of fields for this segment, not including the name
|
||||
*
|
||||
* @return int number of fields
|
||||
*/
|
||||
public function size(): int
|
||||
{
|
||||
return count($this->fields) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fields from a segment
|
||||
*
|
||||
* Get the fields in the specified range, or all if nothing specified. If only the 'from' value is provided, all
|
||||
* fields from this index till the end of the segment will be returned.
|
||||
*
|
||||
* @param int $from Start range at this index
|
||||
* @param int|null $to Stop range at this index
|
||||
* @return array List of fields
|
||||
*/
|
||||
public function getFields(int $from = 0, ?int $to = null): array
|
||||
{
|
||||
if (!$to) {
|
||||
$to = count($this->fields);
|
||||
}
|
||||
return array_slice($this->fields, $from, $to - $from + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the segment. This is basically the value at index 0
|
||||
*
|
||||
* @return string Name of segment
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->fields[0];
|
||||
}
|
||||
}
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* AIG segment class
|
||||
*
|
||||
* AIG: Appointment information - general resource segment
|
||||
* The AIG segment contains information about various kinds of resources (other than those with specifically defined
|
||||
* segments in this chapter) that can be scheduled. Resources included in a transaction using this segment are assumed
|
||||
* to be controlled by a schedule on a schedule filler application. Resources not controlled by a schedule are not
|
||||
* identified on a schedule request using this segment. Resources described by this segment are general kinds of
|
||||
* resources, such as equipment, that are identified with a simple identification code.
|
||||
|
||||
* Ref: http://hl7-definition.caristix.com:9010/Default.aspx?version=HL7+v2.3.1&segment=AIG
|
||||
*/
|
||||
class AIG extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
* @var int
|
||||
*/
|
||||
protected static $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('AIG', $fields);
|
||||
$this->setID($this::$setId++);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setID($this::$setId--);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setID(int $value, int $position = 1): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSegmentActionCode($value, int $position = 2): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setResourceID($value, int $position = 3): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setResourceType($value, int $position = 4): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setResourceGroup($value, int $position = 5): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setResourceQuantity($value, int $position = 6): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setResourceQuantityUnits($value, int $position = 7): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setStartDateTime($value, int $position = 8): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setStartDateTimeOffset($value, int $position = 9): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setStartDateTimeOffsetUnits($value, int $position = 10): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDuration($value, int $position = 11): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDurationUnits($value, int $position = 12): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAllowSubstitutionCode($value, int $position = 13): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFillerStatusCode($value, int $position = 14): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSegmentActionCode(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getResourceID(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getResourceType(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getResourceGroup(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getResourceQuantity(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getResourceQuantityUnits(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getStartDateTime(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getStartDateTimeOffset(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getStartDateTimeOffsetUnits(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDuration(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDurationUnits(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAllowSubstitutionCode(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFillerStatusCode(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* AIL segment class
|
||||
*
|
||||
* AIL: Appointment Information - Location Resource
|
||||
*
|
||||
* The AIL segment contains information about location resources (meeting rooms, operating rooms, examination rooms, or
|
||||
* other locations) that can be scheduled. Resources included in a transaction using this segment are assumed to be
|
||||
* controlled by a schedule on a schedule filler application. Resources not controlled by a schedule are not identified
|
||||
* on a schedule request using this segment. Location resources are identified with this specific segment because of the
|
||||
* specific encoding of locations used by the HL7 specification.
|
||||
|
||||
* Ref: http://hl7-definition.caristix.com:9010/Default.aspx?version=HL7+v2.5.1&segment=AIL
|
||||
*/
|
||||
class AIL extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
* @var int
|
||||
*/
|
||||
protected static $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('AIL', $fields);
|
||||
$this->setID($this::$setId++);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setID($this::$setId--);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setID(int $value, int $position = 1): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSegmentActionCode($value, int $position = 2): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setLocationResourceID($value, int $position = 3): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setLocationTypeAIL($value, int $position = 4): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setLocationGroup($value, int $position = 5): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setStartDateTime($value, int $position = 6): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setStartDateTimeOffset($value, int $position = 7): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setStartDateTimeOffsetUnits($value, int $position = 8): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDuration($value, int $position = 9): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDurationUnits($value, int $position = 10): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAllowSubstitutionCode($value, int $position = 11): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFillerStatusCode($value, int $position = 12): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSegmentActionCode(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLocationResourceID(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLocationTypeAIL(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLocationGroup(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getStartDateTime(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getStartDateTimeOffset(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getStartDateTimeOffsetUnits(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDuration(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDurationUnits(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAllowSubstitutionCode(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFillerStatusCode(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* AIP segment class
|
||||
*
|
||||
* AIP: Appointment Information - Personnel Resource
|
||||
* The AIP segment contains information about the personnel types that can be scheduled. Personnel included in a
|
||||
* transaction using this segment are assumed to be controlled by a schedule on a schedule filler application.
|
||||
* Personnel not controlled by a schedule are not identified on a schedule request using this segment. The kinds of
|
||||
* personnel described on this segment include any healthcare provider in the institution controlled by a schedule (for
|
||||
* example: technicians, physicians, nurses, surgeons, anesthesiologists, or CRNAs).
|
||||
|
||||
|
||||
* Ref: http://hl7-definition.caristix.com:9010/Default.aspx?version=HL7+v2.5.1&segment=AIP
|
||||
*/
|
||||
class AIP extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
* @var int
|
||||
*/
|
||||
protected static $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('AIP', $fields);
|
||||
$this->setID($this::$setId++);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setID($this::$setId--);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setID(int $value, int $position = 1): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSegmentActionCode($value, int $position = 2): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPersonnelResourceID($value, int $position = 3): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setResourceType($value, int $position = 4): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setResourceGroup($value, int $position = 5): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setStartDateTime($value, int $position = 6): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setStartDateTimeOffset($value, int $position = 7): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setStartDateTimeOffsetUnits($value, int $position = 8): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDuration($value, int $position = 9): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDurationUnits($value, int $position = 10): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAllowSubstitutionCode($value, int $position = 11): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFillerStatusCode($value, int $position = 12): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSegmentActionCode(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPersonnelResourceID(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getResourceType(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getResourceGroup(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getStartDateTime(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getStartDateTimeOffset(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getStartDateTimeOffsetUnits(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDuration(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDurationUnits(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAllowSubstitutionCode(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFillerStatusCode(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* DG1 segment class
|
||||
* Ref: http://hl7-definition.caristix.com:9010/HL7%20v2.3.1/segment/DG1
|
||||
*/
|
||||
class DG1 extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
*/
|
||||
protected static int $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null, bool $autoIncrementIndices = true)
|
||||
{
|
||||
parent::__construct('DG1', $fields);
|
||||
if ($autoIncrementIndices) {
|
||||
$this->setID($this::$setId++);
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setID($this::$setId--);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setID(int $value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDiagnosisCodingMethod($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDiagnosisCodeDG1($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDiagnosisDescription($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDiagnosisDateTime($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDiagnosisType($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setMajorDiagnosticCategory($value, int $position = 7)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDiagnosticRelatedGroup($value, int $position = 8)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDRGApprovalIndicator($value, int $position = 9)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDRGGrouperReviewCode($value, int $position = 10)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOutlierType($value, int $position = 11)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOutlierDays($value, int $position = 12)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOutlierCost($value, int $position = 13)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGrouperVersionAndType($value, int $position = 14)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDiagnosisPriority($value, int $position = 15)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDiagnosingClinician($value, int $position = 16)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDiagnosisClassification($value, int $position = 17)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setConfidentialIndicator($value, int $position = 18)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAttestationDateTime($value, int $position = 19)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDiagnosisCodingMethod(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDiagnosisCodeDG1(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDiagnosisDescription(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDiagnosisDateTime(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDiagnosisType(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getMajorDiagnosticCategory(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDiagnosticRelatedGroup(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDRGApprovalIndicator(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDRGGrouperReviewCode(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOutlierType(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOutlierDays(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOutlierCost(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGrouperVersionAndType(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDiagnosisPriority(int $position = 15)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDiagnosingClinician(int $position = 16)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDiagnosisClassification(int $position = 17)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getConfidentialIndicator(int $position = 18)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAttestationDateTime(int $position = 19)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* EQU segment class
|
||||
* Ref: https://www.interfaceware.com/hl7-standard/hl7-segment-EQU.html
|
||||
*/
|
||||
class EQU extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
* @var int
|
||||
*/
|
||||
protected static $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('EQU', $fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setEquipmentInstanceIdentifier(int $value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEventDateTime($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEquipmentState($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setLocalRemoteControlState($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAlertLevel($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getEquipmentInstanceIdentifier(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEventDateTime(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEquipmentState(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLocalRemoteControlState(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAlertLevel(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* EVN segment class
|
||||
* Ref: http://hl7-definition.caristix.com:9010/HL7%20v2.3.1/segment/EVN
|
||||
* https://corepointhealth.com/resource-center/hl7-resources/hl7-evn-event-type-segment
|
||||
*/
|
||||
class EVN extends Segment
|
||||
{
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('EVN', $fields);
|
||||
}
|
||||
|
||||
public function setEventTypeCode($value, int $position = 1): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setRecordedDateTime($value, int $position = 2): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDateTimePlannedEvent($value, int $position = 3): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEventReasonCode($value, int $position = 4): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOperatorID($value, int $position = 5): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEventOccurred($value, int $position = 6): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getEventTypeCode(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRecordedDateTime(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDateTimePlannedEvent(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEventReasonCode(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOperatorID(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEventOccurred(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* FHS: File Header Segment
|
||||
* Ref: https://hl7-definition.caristix.com/v2/HL7v2.3/Segments/FHS
|
||||
*/
|
||||
class FHS extends Segment
|
||||
{
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('FHS', $fields);
|
||||
}
|
||||
|
||||
public function setFileFieldSeparator($value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFileEncodingCharacters($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFileSendingApplication($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFileSendingFacility($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFileRecievingApplication($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFileRecievingFacility($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFileCreationDateTime($value, int $position = 7)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFileSecurity($value, int $position = 8)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFileNameId($value, int $position = 9)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFileHeaderComment($value, int $position = 10)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFileControlId($value, int $position = 11)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setReferenceFileControlId($value, int $position = 12)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
// -------------------- Getter Methods ------------------------------
|
||||
|
||||
public function getFileFieldSeparator(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFileEncodingCharacters(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFileSendingApplication(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFileSendingFacility(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFileRecievingApplication(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFileRecievingFacility(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFileCreationDateTime(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFileSecurity(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFileNameId(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFileHeaderComment(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFileControlId(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getReferenceFileControlId(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* FTS: File Trailer Segment
|
||||
* Ref: https://hl7-definition.caristix.com/v2/HL7v2.3/Segments/FTS
|
||||
*/
|
||||
class FTS extends Segment
|
||||
{
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('FTS', $fields);
|
||||
}
|
||||
|
||||
public function setFileBatchCount($value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFileTrailerComment($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
// -------------------- Getter Methods ------------------------------
|
||||
|
||||
public function getFileBatchCount(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFileTrailerComment(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+616
@@ -0,0 +1,616 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* GT1 segment class
|
||||
* Reference: https://hl7-definition.caristix.com/v2/HL7v2.5.1/Segments/GT1
|
||||
*/
|
||||
class GT1 extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected static $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null, bool $autoIncrementIndices = true)
|
||||
{
|
||||
parent::__construct('GT1', $fields);
|
||||
if ($autoIncrementIndices) {
|
||||
$this->setID($this::$setId++);
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setID($this::$setId--);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setID(int $value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorNumber($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorName($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorSpouseName($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorAddress($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorHomePhone($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorBusinessPhone($value, int $position = 7)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorDateOfBirth($value, int $position = 8)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorSex(string $value, int $position = 9)
|
||||
{
|
||||
// Ref: https://hl7-definition.caristix.com/v2/HL7v2.4/Tables/0001
|
||||
if (!in_array($value, ['A', 'F', 'M', 'N', 'O', 'U'], true)) {
|
||||
throw new InvalidArgumentException("Sex should one of 'A', 'F', 'M', 'N', 'O' or 'U'. Given: '$value'");
|
||||
}
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorType($value, int $position = 10)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorRelationship($value, int $position = 11)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorSSN($value, int $position = 12)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorBeginDate($value, int $position = 13)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorEndDate($value, int $position = 14)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorPriority($value, int $position = 15)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorEmployerName($value, int $position = 16)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorEmployerAddress($value, int $position = 17)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorEmployerPhone($value, int $position = 18)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorEmployeeID($value, int $position = 19)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorEmploymentStatus($value, int $position = 20)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorOrganizationName($value, int $position = 21)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorBillingHoldFlag($value, int $position = 22)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorCreditRatingCode($value, int $position = 23)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorDeathDateAndTime($value, int $position = 24)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorDeathFlag($value, int $position = 25)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorChargeAdjustmentCode($value, int $position = 26)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorAnnualIncome($value, int $position = 27)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorHouseholdSize($value, int $position = 28)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorEmployerID($value, int $position = 29)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorMaritalStatusCode($value, int $position = 30)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorHireEffectiveDate($value, int $position = 31)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEmploymentStopDate($value, int $position = 32)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setLivingDependency($value, int $position = 33)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAmbulatoryStatus($value, int $position = 34)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCitizenship($value, int $position = 35)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPrimaryLanguage($value, int $position = 36)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setLivingArrangement($value, int $position = 37)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPublicityCode($value, int $position = 38)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setProtectionIndicator($value, int $position = 39)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setStudentIndicator($value, int $position = 40)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setReligion($value, int $position = 41)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setMotherMaidenName($value, int $position = 42)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNationality($value, int $position = 43)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEthnicGroup($value, int $position = 44)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContactPersonsName($value, int $position = 45)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContactPersonsPhone($value, int $position = 46)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContactReason($value, int $position = 47)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContactRelationship($value, int $position = 48)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setJobTitle($value, int $position = 49)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setJobClass($value, int $position = 50)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorEmployersOrganizationName($value, int $position = 51)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setHandicap($value, int $position = 52)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setJobStatus($value, int $position = 53)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorFinancialClass($value, int $position = 54)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorRace($value, int $position = 55)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGuarantorBirthPlace($value, int $position = 56)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setVipIndicator($value, int $position = 57)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorNumber(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorName(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorSpouseName(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorAddress(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorHomePhone(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorBusinessPhone(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorDateOfBirth(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorSex(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorType(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorRelationship(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorSSN(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorBeginDate(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorEndDate(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorPriority(int $position = 15)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorEmployerName(int $position = 16)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorEmployerAddress(int $position = 17)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorEmployerPhone(int $position = 18)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorEmployeeID(int $position = 19)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorEmploymentStatus(int $position = 20)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorOrganizationName(int $position = 21)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorBillingHoldFlag(int $position = 22)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorCreditRatingCode(int $position = 23)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorDeathDateAndTime(int $position = 24)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorDeathFlag(int $position = 25)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorChargeAdjustmentCode(int $position = 26)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorAnnualIncome(int $position = 27)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorHouseholdSize(int $position = 28)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorEmployerID(int $position = 29)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorMaritalStatusCode(int $position = 30)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorHireEffectiveDate(int $position = 31)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEmploymentStopDate(int $position = 32)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLivingDependency(int $position = 33)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAmbulatoryStatus(int $position = 34)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCitizenship(int $position = 35)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPrimaryLanguage(int $position = 36)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLivingArrangement(int $position = 37)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPublicityCode(int $position = 38)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getProtectionIndicator(int $position = 39)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getStudentIndicator(int $position = 40)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getReligion(int $position = 41)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getMotherMaidenName(int $position = 42)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNationality(int $position = 43)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEthnicGroup(int $position = 44)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContactPersonsName(int $position = 45)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContactPersonsPhone(int $position = 46)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContactReason(int $position = 47)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContactRelationship(int $position = 48)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getJobTitle(int $position = 49)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getJobClass(int $position = 50)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorEmployersOrganizationName(int $position = 51)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getHandicap(int $position = 52)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getJobStatus(int $position = 53)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorFinancialClass(int $position = 54)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorRace(int $position = 55)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGuarantorBirthPlace(int $position = 56)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVipIndicator(int $position = 57)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+531
@@ -0,0 +1,531 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* IN1 segment class
|
||||
* Ref: https://corepointhealth.com/resource-center/hl7-resources/hl7-in1-insurance-segment
|
||||
*/
|
||||
class IN1 extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
* @var int
|
||||
*/
|
||||
protected static $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null, bool $autoIncrementIndices = true)
|
||||
{
|
||||
parent::__construct('IN1', $fields);
|
||||
if ($autoIncrementIndices) {
|
||||
$this->setID($this::$setId++);
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setID($this::$setId--);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setID(int $value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsurancePlanID($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsuranceCompanyID($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsuranceCompanyName($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsuranceCompanyAddress($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsuranceCoContactPerson($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsuranceCoPhoneNumber($value, int $position = 7)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGroupNumber($value, int $position = 8)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setGroupName($value, int $position = 9)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsuredsGroupEmpID($value, int $position = 10)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsuredsGroupEmpName($value, int $position = 11)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlanEffectiveDate($value, int $position = 12)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlanExpirationDate($value, int $position = 13)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAuthorizationInformation($value, int $position = 14)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlanType($value, int $position = 15)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNameOfInsured($value, int $position = 16)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsuredsRelationshipToPatient($value, int $position = 17)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsuredsDateOfBirth($value, int $position = 18)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsuredsAddress($value, int $position = 19)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAssignmentOfBenefits($value, int $position = 20)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCoordinationOfBenefits($value, int $position = 21)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCoordOfBenPriority($value, int $position = 22)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNoticeOfAdmissionFlag($value, int $position = 23)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNoticeOfAdmissionDate($value, int $position = 24)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setReportOfEligibilityFlag($value, int $position = 25)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setReportOfEligibilityDate($value, int $position = 26)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setReleaseInformationCode($value, int $position = 27)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPreAdmitCertPAC($value, int $position = 28)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setVerificationDateTime($value, int $position = 29)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setVerificationBy($value, int $position = 30)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setTypeOfAgreementCode($value, int $position = 31)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setBillingStatus($value, int $position = 32)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setLifetimeReserveDays($value, int $position = 33)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDelayBeforeLRDay($value, int $position = 34)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCompanyPlanCode($value, int $position = 35)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPolicyNumber($value, int $position = 36)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPolicyDeductible($value, int $position = 37)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPolicyLimitAmount($value, int $position = 38)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPolicyLimitDays($value, int $position = 39)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setRoomRateSemiPrivate($value, int $position = 40)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setRoomRatePrivate($value, int $position = 41)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsuredsEmploymentStatus($value, int $position = 42)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsuredsSex($value, int $position = 43)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsuredsEmployersAddress($value, int $position = 44)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setVerificationStatus($value, int $position = 45)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPriorInsurancePlanID($value, int $position = 46)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCoverageType($value, int $position = 47)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setHandicap($value, int $position = 48)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInsuredsIDNumber($value, int $position = 49)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsurancePlanID(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsuranceCompanyID(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsuranceCompanyName(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsuranceCompanyAddress(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsuranceCoContactPerson(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsuranceCoPhoneNumber(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGroupNumber(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getGroupName(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsuredsGroupEmpID(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsuredsGroupEmpName(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlanEffectiveDate(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlanExpirationDate(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAuthorizationInformation(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlanType(int $position = 15)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNameOfInsured(int $position = 16)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsuredsRelationshipToPatient(int $position = 17)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsuredsDateOfBirth(int $position = 18)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsuredsAddress(int $position = 19)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAssignmentOfBenefits(int $position = 20)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCoordinationOfBenefits(int $position = 21)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCoordOfBenPriority(int $position = 22)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNoticeOfAdmissionFlag(int $position = 23)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNoticeOfAdmissionDate(int $position = 24)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getReportOfEligibilityFlag(int $position = 25)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getReportOfEligibilityDate(int $position = 26)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getReleaseInformationCode(int $position = 27)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPreAdmitCertPAC(int $position = 28)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVerificationDateTime(int $position = 29)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVerificationBy(int $position = 30)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTypeOfAgreementCode(int $position = 31)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getBillingStatus(int $position = 32)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLifetimeReserveDays(int $position = 33)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDelayBeforeLRDay(int $position = 34)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCompanyPlanCode(int $position = 35)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPolicyNumber(int $position = 36)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPolicyDeductible(int $position = 37)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPolicyLimitAmount(int $position = 38)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPolicyLimitDays(int $position = 39)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRoomRateSemiPrivate(int $position = 40)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRoomRatePrivate(int $position = 41)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsuredsEmploymentStatus(int $position = 42)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsuredsSex(int $position = 43)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsuredsEmployersAddress(int $position = 44)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVerificationStatus(int $position = 45)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPriorInsurancePlanID(int $position = 46)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCoverageType(int $position = 47)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getHandicap(int $position = 48)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInsuredsIDNumber(int $position = 49)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+291
@@ -0,0 +1,291 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* IN3 segment class
|
||||
* Ref: http://hl7-definition.caristix.com:9010/Default.aspx?version=HL7+v2.5.1&segment=ORC
|
||||
*/
|
||||
class IN3 extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
* @var int
|
||||
*/
|
||||
protected static $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null, bool $autoIncrementIndices = true)
|
||||
{
|
||||
parent::__construct('IN3', $fields);
|
||||
if ($autoIncrementIndices) {
|
||||
$this->setID($this::$setId++);
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setID($this::$setId--);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setID(int $value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCertificationNumber($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCertifiedBy($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCertificationRequired($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPenalty($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCertificationDateTime($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCertificationModifyDateTime($value, int $position = 7)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOperator($value, int $position = 8)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCertificationBeginDate($value, int $position = 9)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCertificationEndDate($value, int $position = 10)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDays($value, int $position = 11)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNonConcurCodeDescription($value, int $position = 12)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNonConcurEffectiveDateTime($value, int $position = 13)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPhysicianReviewer($value, int $position = 14)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCertificationContact($value, int $position = 15)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCertificationContactPhoneNumber($value, int $position = 16)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAppealReason($value, int $position = 17)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCertificationAgency($value, int $position = 18)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCertificationAgencyPhoneNumber($value, int $position = 19)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPreCertificationRequirement($value, int $position = 20)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCaseManager($value, int $position = 21)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSecondOpinionDate($value, int $position = 22)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSecondOpinionStatus($value, int $position = 23)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSecondOpinionDocumentationReceived($value, int $position = 24)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSecondOpinionPhysician($value, int $position = 25)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCertificationNumber(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCertifiedBy(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCertificationRequired(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPenalty(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCertificationDateTime(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCertificationModifyDateTime(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOperator(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCertificationBeginDate(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCertificationEndDate(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDays(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNonConcurCodeDescription(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNonConcurEffectiveDateTime(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPhysicianReviewer(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCertificationContact(int $position = 15)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCertificationContactPhoneNumber(int $position = 16)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAppealReason(int $position = 17)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCertificationAgency(int $position = 18)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCertificationAgencyPhoneNumber(int $position = 19)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPreCertificationRequirement(int $position = 20)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCaseManager(int $position = 21)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSecondOpinionDate(int $position = 22)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSecondOpinionStatus(int $position = 23)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSecondOpinionDocumentationReceived(int $position = 24)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSecondOpinionPhysician(int $position = 25)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* MRG segment class
|
||||
* Ref: http://hl7-definition.caristix.com:9010/HL7%20v2.3.1/segment/MRG
|
||||
*/
|
||||
class MRG extends Segment
|
||||
{
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('MRG', $fields);
|
||||
}
|
||||
|
||||
public function setPriorPatientIdentifierList($value, int $position = 1): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPriorAlternatePatientID($value, int $position = 2): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPriorPatientAccountNumber($value, int $position = 3): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPriorPatientID($value, int $position = 4): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPriorVisitNumber($value, int $position = 5): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPriorAlternateVisitID($value, int $position = 6): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPriorPatientName($value, int $position = 7): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getPriorPatientIdentifierList(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPriorAlternatePatientID(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPriorPatientAccountNumber(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPriorPatientID(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPriorVisitNumber(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPriorAlternateVisitID(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPriorPatientName(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* MSA: Message acknowledgement segment
|
||||
* Ref: http://hl7-definition.caristix.com:9010/HL7%20v2.3/segment/MSA
|
||||
*/
|
||||
class MSA extends Segment
|
||||
{
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('MSA', $fields);
|
||||
}
|
||||
|
||||
public function setAcknowledgementCode($value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setMessageControlID($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setTextMessage($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setExpectedSequenceNumber($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDelayedAcknowledgementType($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setErrorCondition($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
// -------------------- Getter Methods ------------------------------
|
||||
|
||||
public function getAcknowledgementCode(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getMessageControlID(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTextMessage(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getExpectedSequenceNumber(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDelayedAcknowledgementType(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getErrorCondition(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+300
@@ -0,0 +1,300 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* MSH (message header) segment class
|
||||
*
|
||||
* Usage:
|
||||
* ```php
|
||||
* $seg = new MSH();
|
||||
*
|
||||
* $seg->setField(9, "ADT^A24");
|
||||
* echo $seg->getField(1);
|
||||
* ```
|
||||
*
|
||||
* The MSH is an implementation of the Segment class. The MSH segment is a bit different from other segments, in that
|
||||
* the first field is the field separator after the segment name. Other fields thus start counting from 2! The setting
|
||||
* for the field separator for a whole message can be changed by the setField method on index 1 of the MSH for that
|
||||
* message. The MSH segment also contains the default settings for field 2, COMPONENT_SEPARATOR, REPETITION_SEPARATOR,
|
||||
* ESCAPE_CHARACTER and SUBCOMPONENT_SEPARATOR. These fields default to ^, ~, \ and & respectively.
|
||||
*
|
||||
* Reference: https://corepointhealth.com/resource-center/hl7-resources/hl7-msh-message-header
|
||||
*/
|
||||
class MSH extends Segment
|
||||
{
|
||||
/**
|
||||
* Create an instance of the MSH segment.
|
||||
*
|
||||
* If an array argument is provided, 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. If the reference is not given, the MSH segment
|
||||
* will be created with the MSH 1,2,7,10 and 12 fields filled in for convenience.
|
||||
*
|
||||
* @param null|array $fields
|
||||
* @param null|array $hl7Globals
|
||||
* @throws InvalidArgumentException|Exception
|
||||
*/
|
||||
public function __construct(?array $fields = null, ?array $hl7Globals = null)
|
||||
{
|
||||
parent::__construct('MSH', $fields);
|
||||
|
||||
if (isset($fields)) { // We're done if MSH fields were provided
|
||||
return;
|
||||
}
|
||||
|
||||
// Fill mandatory fields if no fields array is given
|
||||
if (is_array($hl7Globals)) {
|
||||
$this->setField(1, $hl7Globals['FIELD_SEPARATOR']);
|
||||
$this->setField(
|
||||
2,
|
||||
$hl7Globals['COMPONENT_SEPARATOR'] .
|
||||
$hl7Globals['REPETITION_SEPARATOR'] .
|
||||
$hl7Globals['ESCAPE_CHARACTER'] .
|
||||
$hl7Globals['SUBCOMPONENT_SEPARATOR']
|
||||
);
|
||||
$this->setVersionId($hl7Globals['HL7_VERSION']);
|
||||
} else {
|
||||
$this->setField(1, '|');
|
||||
$this->setField(2, '^~\\&');
|
||||
$this->setVersionId('2.3');
|
||||
}
|
||||
$this->setDateTimeOfMessage(date('YmdHis'));
|
||||
$this->setMessageControlId($this->getDateTimeOfMessage() . random_int(10000, 99999));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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. Setting the
|
||||
* value on index 1, will effectively change the value of FIELD_SEPARATOR for the message containing this segment,
|
||||
* if the value has length 1; setting the field on index 2 will change the values of COMPONENT_SEPARATOR,
|
||||
* REPETITION_SEPARATOR, ESCAPE_CHARACTER and SUBCOMPONENT_SEPARATOR for the message, if the string is of length 4.
|
||||
*
|
||||
* @param int $index Index of field
|
||||
* @param string $value
|
||||
*/
|
||||
public function setField(int $index, $value = ''): bool
|
||||
{
|
||||
if (($index === 1) && strlen($value) !== 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (($index === 2) && strlen($value) !== 4) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return parent::setField($index, $value);
|
||||
}
|
||||
|
||||
// -------------------- Setter Methods ------------------------------
|
||||
|
||||
public function setSendingApplication($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSendingFacility($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setReceivingApplication($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setReceivingFacility($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDateTimeOfMessage($value, int $position = 7)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSecurity($value, int $position = 8)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Sets message type to MSH segment.
|
||||
*
|
||||
* If trigger event is already set, then it is preserved
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* If field value is ORU^R01 and you call
|
||||
*
|
||||
* ```
|
||||
* $msh->setMessageType('ORM');
|
||||
* ```
|
||||
*
|
||||
* Then the new field value will be ORM^R01.
|
||||
* If it was empty then the new value will be just ORM.
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setMessageType($value, int $position = 9): bool
|
||||
{
|
||||
$typeField = $this->getField($position);
|
||||
if (is_array($typeField) && !empty($typeField[1])) {
|
||||
$value = [$value, $typeField[1]];
|
||||
}
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Sets trigger event to MSH segment.
|
||||
*
|
||||
* If meessage type is already set, then it is preserved
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* If field value is ORU^R01 and you call
|
||||
*
|
||||
* ```
|
||||
* $msh->setTriggerEvent('R30');
|
||||
* ```
|
||||
*
|
||||
* Then the new field value will be ORU^R30.
|
||||
* If trigger event was not set then it will set the new value.
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setTriggerEvent($value, int $position = 9): bool
|
||||
{
|
||||
$typeField = $this->getField($position);
|
||||
if (is_array($typeField) && !empty($typeField[0])) {
|
||||
$value = [$typeField[0], $value];
|
||||
} else {
|
||||
$value = [$typeField, $value];
|
||||
}
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setMessageControlId($value, int $position = 10)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setProcessingId($value, int $position = 11)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setVersionId($value, int $position = 12)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSequenceNumber($value, int $position = 13)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContinuationPointer($value, int $position = 14)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAcceptAcknowledgementType($value, int $position = 15)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setApplicationAcknowledgementType($value, int $position = 16)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCountryCode($value, int $position = 17)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCharacterSet($value, int $position = 18)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPrincipalLanguage($value, int $position = 19)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
// -------------------- Getter Methods ------------------------------
|
||||
|
||||
public function getSendingApplication(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSendingFacility(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getReceivingApplication(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getReceivingFacility(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDateTimeOfMessage(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
/**
|
||||
* ORM / ORU etc.
|
||||
*/
|
||||
public function getMessageType(int $position = 9): string
|
||||
{
|
||||
$typeField = $this->getField($position);
|
||||
if (!empty($typeField) && is_array($typeField)) {
|
||||
return (string) $typeField[0];
|
||||
}
|
||||
return (string) $typeField;
|
||||
}
|
||||
|
||||
public function getTriggerEvent(int $position = 9): string|bool
|
||||
{
|
||||
$triggerField = $this->getField($position);
|
||||
if (!empty($triggerField[1]) && is_array($triggerField)) {
|
||||
return $triggerField[1];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getMessageControlId(int $position = 10): string
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getProcessingId(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HL7 version, e.g. 2.1, 2.3, 3.0 etc.
|
||||
*/
|
||||
public function getVersionId(int $position = 12): string|array
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+434
@@ -0,0 +1,434 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* NK1 segment class: Next of Kin / Associated Parties
|
||||
* The NK1 segment contains information about the patients other related parties. Any associated parties may be
|
||||
* identified. Utilizing NK1-1 - set ID, multiple NK1 segments can be sent to patient accounts.
|
||||
*
|
||||
* Ref: https://hl7-definition.caristix.com/v2/HL7v2.5/Segments/NK1
|
||||
*/
|
||||
class NK1 extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
* @var int
|
||||
*/
|
||||
protected static $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null, bool $autoIncrementIndices = true)
|
||||
{
|
||||
parent::__construct('NK1', $fields);
|
||||
if ($autoIncrementIndices) {
|
||||
$this->setID($this::$setId++);
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setID($this::$setId--);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setID(int $value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNKName($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setRelationship($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAddress($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPhoneNumber($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setBusinessPhoneNumber($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContactRole($value, int $position = 7)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setStartDate($value, int $position = 8)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEndDate($value, int $position = 9)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNextOfKinOrAssociatedPartiesJobTitle($value, int $position = 10)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNextOfKinOrAssociatedPartiesJobCodeOrClass($value, int $position = 11)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNextOfKinOrAssociatedPartiesEmployeeNumber($value, int $position = 12)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOrganizationName($value, int $position = 13)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setMaritalStatus($value, int $position = 14)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministrativeSex($value, int $position = 15)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDateTimeOfBirth($value, int $position = 16)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setLivingDependency($value, int $position = 17)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAmbulatoryStatus($value, int $position = 18)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCitizenship($value, int $position = 19)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPrimaryLanguage($value, int $position = 20)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setLivingArrangement($value, int $position = 21)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPublicityCode($value, int $position = 22)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setProtectionIndicator($value, int $position = 23)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setStudentIndicator($value, int $position = 24)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setReligion($value, int $position = 25)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setMothersMaidenName($value, int $position = 26)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNationality($value, int $position = 27)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEthnicGroup($value, int $position = 28)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContactReason($value, int $position = 29)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContactPersonsName($value, int $position = 30)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContactPersonsTelephoneNumber($value, int $position = 31)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContactPersonsAddress($value, int $position = 32)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNextOfKinOrAssociatedPartysIdentifiers($value, int $position = 33)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setJobStatus($value, int $position = 34)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setRace($value, int $position = 35)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setHandicap($value, int $position = 36)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContactPersonSocialSecurityNumber($value, int $position = 37)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNextOfKinBirthPlace($value, int $position = 38)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setVipIndicator($value, int $position = 39)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNKName(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRelationship(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAddress(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPhoneNumber(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getBusinessPhoneNumber(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContactRole(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getStartDate(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEndDate(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNextOfKinOrAssociatedPartiesJobTitle(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNextOfKinOrAssociatedPartiesJobCodeOrClass(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNextOfKinOrAssociatedPartiesEmployeeNumber(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrganizationName(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getMaritalStatus(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministrativeSex(int $position = 15)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDateTimeOfBirth(int $position = 16)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLivingDependency(int $position = 17)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAmbulatoryStatus(int $position = 18)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCitizenship(int $position = 19)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPrimaryLanguage(int $position = 20)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLivingArrangement(int $position = 21)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPublicityCode(int $position = 22)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getProtectionIndicator(int $position = 23)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getStudentIndicator(int $position = 24)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getReligion(int $position = 25)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getMothersMaidenName(int $position = 26)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNationality(int $position = 27)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEthnicGroup(int $position = 28)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContactReason(int $position = 29)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContactPersonsName(int $position = 30)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContactPersonsTelephoneNumber(int $position = 31)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContactPersonsAddress(int $position = 32)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNextOfKinOrAssociatedPartysIdentifiers(int $position = 33)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getJobStatus(int $position = 34)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRace(int $position = 35)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getHandicap(int $position = 36)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContactPersonSocialSecurityNumber(int $position = 37)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNextOfKinBirthPlace(int $position = 38)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVipIndicator(int $position = 39)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* NTE segment class
|
||||
* Ref: https://corepointhealth.com/resource-center/hl7-resources/hl7-nte-notes-comments
|
||||
*/
|
||||
class NTE extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
* @var int
|
||||
*/
|
||||
protected static $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null, bool $autoIncrementIndices = true)
|
||||
{
|
||||
parent::__construct('NTE', $fields);
|
||||
if ($autoIncrementIndices) {
|
||||
$this->setID($this::$setId++);
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setID($this::$setId--);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setID(int $value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSourceOfComment($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setComment($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCommentType($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSourceOfComment(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getComment(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCommentType(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+482
@@ -0,0 +1,482 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* OBR segment class
|
||||
* Ref: https://corepointhealth.com/resource-center/hl7-resources/hl7-obr-segment
|
||||
*/
|
||||
class OBR extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
* @var int
|
||||
*/
|
||||
protected static $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null, bool $autoIncrementIndices = true)
|
||||
{
|
||||
parent::__construct('OBR', $fields);
|
||||
if ($autoIncrementIndices) {
|
||||
$this->setID($this::$setId++);
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setID($this::$setId--);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setID(int $value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlacerOrderNumber($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFillerOrderNumber($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setUniversalServiceID($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPriority($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setRequestedDatetime($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setObservationDateTime($value, int $position = 7)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setObservationEndDateTime($value, int $position = 8)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCollectionVolume($value, int $position = 9)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCollectorIdentifier($value, int $position = 10)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSpecimenActionCode($value, int $position = 11)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDangerCode($value, int $position = 12)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setRelevantClinicalInfo($value, int $position = 13)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSpecimenReceivedDateTime($value, int $position = 14)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSpecimenSource($value, int $position = 15)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOrderingProvider($value, int $position = 16)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOrderCallbackPhoneNumber($value, int $position = 17)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlacerfield1($value, int $position = 18)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlacerfield2($value, int $position = 19)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFillerField1($value, int $position = 20)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFillerField2($value, int $position = 21)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* This field specifies the date/time when the results were reported or status changed. This field is used to
|
||||
* indicate the date and time that the results are composed into a report and released, or that a status, as
|
||||
* defined in ORC-5 order status, is entered or changed. (This is a results field only.) When other applications
|
||||
* (such as office or clinical database applications) query the laboratory application for untransmitted results,
|
||||
* the information in this field may be used to control processing on the communications link. Usually, the
|
||||
* ordering service would want only those results for which the reporting date/time is greater than the date/time
|
||||
* the inquiring application last received results.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setResultsRptStatusChngDateTime($value, int $position = 22)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setChargetoPractice($value, int $position = 23)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDiagnosticServSectID($value, int $position = 24)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setResultStatus($value, int $position = 25)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setParentResult($value, int $position = 26)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setQuantityTiming($value, int $position = 27)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setResultCopiesTo($value, int $position = 28)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setParent($value, int $position = 29)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setTransportationMode($value, int $position = 30)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setReasonforStudy($value, int $position = 31)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPrincipalResultInterpreter($value, int $position = 32)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAssistantResultInterpreter($value, int $position = 33)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setTechnician($value, int $position = 34)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setTranscriptionist($value, int $position = 35)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setScheduledDateTime($value, int $position = 36)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNumberofSampleContainers($value, int $position = 37)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setTransportLogisticsofCollectedSample($value, int $position = 38)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCollectorsComment($value, int $position = 39)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setTransportArrangementResponsibility($value, int $position = 40)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setTransportArranged($value, int $position = 41)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEscortRequired($value, int $position = 42)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlannedPatientTransportComment($value, int $position = 43)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlacerOrderNumber(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFillerOrderNumber(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getUniversalServiceID(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPriority(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRequestedDatetime(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getObservationDateTime(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getObservationEndDateTime(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCollectionVolume(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCollectorIdentifier(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSpecimenActionCode(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDangerCode(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRelevantClinicalInfo(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSpecimenReceivedDateTime(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSpecimenSource(int $position = 15)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrderingProvider(int $position = 16)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrderCallbackPhoneNumber(int $position = 17)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlacerfield1(int $position = 18)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlacerfield2(int $position = 19)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFillerField1(int $position = 20)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFillerField2(int $position = 21)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getResultsRptStatusChngDateTime(int $position = 22)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getChargetoPractice(int $position = 23)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDiagnosticServSectID(int $position = 24)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getResultStatus(int $position = 25)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getParentResult(int $position = 26)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getQuantityTiming(int $position = 27)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getResultCopiesTo(int $position = 28)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getParent(int $position = 29)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTransportationMode(int $position = 30)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getReasonforStudy(int $position = 31)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPrincipalResultInterpreter(int $position = 32)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAssistantResultInterpreter(int $position = 33)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTechnician(int $position = 34)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTranscriptionist(int $position = 35)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getScheduledDateTime(int $position = 36)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNumberofSampleContainers(int $position = 37)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTransportLogisticsofCollectedSample(int $position = 38)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCollectorsComment(int $position = 39)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTransportArrangementResponsibility(int $position = 40)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTransportArranged(int $position = 41)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEscortRequired(int $position = 42)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlannedPatientTransportComment(int $position = 43)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+230
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* OBX segment class
|
||||
* Ref: https://hl7-definition.caristix.com/v2/HL7v2.5.1/Segments/OBX
|
||||
*/
|
||||
class OBX extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
*/
|
||||
protected static int $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null, bool $autoIncrementIndices = true)
|
||||
{
|
||||
parent::__construct('OBX', $fields);
|
||||
if ($autoIncrementIndices) {
|
||||
$this->setID($this::$setId++);
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setID($this::$setId--);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setID(int $value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setValueType($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setObservationIdentifier($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setObservationSubId($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setObservationValue($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setUnits($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setReferenceRange($value, int $position = 7)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAbnormalFlags($value, int $position = 8)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setProbability($value, int $position = 9)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNatureOfAbnormalTest($value, int $position = 10)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setObserveResultStatus($value, int $position = 11)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDataLastObsNormalValues($value, int $position = 12)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setUserDefinedAccessChecks($value, int $position = 13)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDateTimeOfTheObservation($value, int $position = 14)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setProducersId($value, int $position = 15)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setResponsibleObserver($value, int $position = 16)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setObservationMethod($value, int $position = 17)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEquipmentInstanceIdentifier($value, int $position = 18)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDateTimeOfAnalysis($value, int $position = 19)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getValueType(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getObservationIdentifier(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getObservationSubId(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getObservationValue(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getUnits(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getReferenceRange(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAbnormalFlags(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getProbability(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNatureOfAbnormalTest(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getObserveResultStatus(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDataLastObsNormalValues(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getUserDefinedAccessChecks(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDateTimeOfTheObservation(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getProducersId(int $position = 15)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getResponsibleObserver(int $position = 16)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getObservationMethod(int $position = 17)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEquipmentInstanceIdentifier(int $position = 18)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDateTimeOfAnalysis(int $position = 19)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+329
@@ -0,0 +1,329 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* ORC segment class
|
||||
* Ref: http://hl7-definition.caristix.com:9010/Default.aspx?version=HL7%20v2.5.1&segment=ORC
|
||||
*/
|
||||
class ORC extends Segment
|
||||
{
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('ORC', $fields);
|
||||
}
|
||||
|
||||
public function setOrderControl($value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlacerOrderNumber($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFillerOrderNumber($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlacerGroupNumber($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOrderStatus($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setResponseFlag($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setQuantityTiming($value, int $position = 7)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setParentOrder($value, int $position = 8)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDateTimeofTransaction($value, int $position = 9)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEnteredBy($value, int $position = 10)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setVerifiedBy($value, int $position = 11)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOrderingProvider($value, int $position = 12)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEnterersLocation($value, int $position = 13)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCallBackPhoneNumber($value, int $position = 14)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOrderEffectiveDateTime($value, int $position = 15)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOrderControlCodeReason($value, int $position = 16)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEnteringOrganization($value, int $position = 17)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEnteringDevice($value, int $position = 18)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setActionBy($value, int $position = 19)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdvancedBeneficiaryNoticeCode($value, int $position = 20)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOrderingFacilityName($value, int $position = 21)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOrderingFacilityAddress($value, int $position = 22)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOrderingFacilityPhoneNumber($value, int $position = 23)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOrderingProviderAddress($value, int $position = 24)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOrderStatusModifier($value, int $position = 25)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdvancedBeneficiaryNoticeOverrideReason($value, int $position = 26)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFillersExpectedAvailabilityDateTime($value, int $position = 27)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setConfidentialityCode($value, int $position = 28)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOrderType($value, int $position = 29)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEntererAuthorizationMode($value, int $position = 30)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setParentUniversalServiceIdentifier($value, int $position = 31)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getOrderControl(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlacerOrderNumber(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFillerOrderNumber(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlacerGroupNumber(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrderStatus(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getResponseFlag(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getQuantityTiming(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getParentOrder(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDateTimeofTransaction(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEnteredBy(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVerifiedBy(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrderingProvider(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEnterersLocation(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCallBackPhoneNumber(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrderEffectiveDateTime(int $position = 15)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrderControlCodeReason(int $position = 16)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEnteringOrganization(int $position = 17)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEnteringDevice(int $position = 18)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getActionBy(int $position = 19)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdvancedBeneficiaryNoticeCode(int $position = 20)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrderingFacilityName(int $position = 21)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrderingFacilityAddress(int $position = 22)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrderingFacilityPhoneNumber(int $position = 23)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrderingProviderAddress(int $position = 24)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrderStatusModifier(int $position = 25)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdvancedBeneficiaryNoticeOverrideReason(int $position = 26)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFillersExpectedAvailabilityDateTime(int $position = 27)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getConfidentialityCode(int $position = 28)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrderType(int $position = 29)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEntererAuthorizationMode(int $position = 30)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getParentUniversalServiceIdentifier(int $position = 31)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+231
@@ -0,0 +1,231 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* The patient additional demographic segment contains demographic information that is likely
|
||||
* to change about the patient.
|
||||
*
|
||||
* @link https://hl7-definition.caristix.com/v2/HL7v2.5.1/Segments/PD1
|
||||
*/
|
||||
class PD1 extends Segment
|
||||
{
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('PD1', $fields);
|
||||
}
|
||||
|
||||
public function setLivingDependency(string|null $value, int $position = 1): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setLivingArrangement(string|null $value, int $position = 2): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPatientPrimaryFacility(array|null $value, int $position = 3): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPatientPrimaryCareProviderNameAndIDNo(array|null $value, int $position = 4): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setStudentIndicator(string|null $value, int $position = 5): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setHandicap(string|null $value, int $position = 6): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setLivingWillCode(string|null $value, int $position = 7): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOrganDonorCode(string|null $value, int $position = 8): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSeparateBill(string|null $value, int $position = 9): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDuplicatePatient(array|null $value, int $position = 10): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPublicityCode(array|null $value, int $position = 11): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setProtectionIndicator(string|null $value, int $position = 12): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setProtectionIndicatorEffectiveDate(string|null $value, int $position = 13): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlaceOfWorship(array|null $value, int $position = 14): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdvanceDirectiveCode(array|null $value, int $position = 15): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setImmunizationRegistryStatus(string|null $value, int $position = 16): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setImmunizationRegistryStatusEffectiveDate(string|null $value, int $position = 17): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPublicityCodeEffectiveDate(string|null $value, int $position = 18): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setMilitaryBranch(string|null $value, int $position = 19): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setMilitaryRankGrade(string|null $value, int $position = 20): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setMilitaryStatus(string|null $value, int $position = 21): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getLivingDependency(int $position = 1): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLivingArrangement(int $position = 2): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientPrimaryFacility(int $position = 3): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientPrimaryCareProviderNameAndIDNo(int $position = 4): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getStudentIndicator(int $position = 5): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getHandicap(int $position = 6): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLivingWillCode(int $position = 7): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrganDonorCode(int $position = 8): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSeparateBill(int $position = 9): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDuplicatePatient(int $position = 10): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPublicityCode(int $position = 11): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getProtectionIndicator(int $position = 12): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getProtectionIndicatorEffectiveDate(int $position = 13): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlaceOfWorship(int $position = 14): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdvanceDirectiveCode(int $position = 15): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getImmunizationRegistryStatus(int $position = 16): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getImmunizationRegistryStatusEffectiveDate(int $position = 17): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPublicityCodeEffectiveDate(int $position = 18): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getMilitaryBranch(int $position = 19): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getMilitaryRankGrade(int $position = 20): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getMilitaryStatus(int $position = 21): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+357
@@ -0,0 +1,357 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* PID segment class
|
||||
* Reference: https://corepointhealth.com/resource-center/hl7-resources/hl7-pid-segment
|
||||
*/
|
||||
class PID extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
*/
|
||||
protected static int $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null, bool $autoIncrementIndices = true)
|
||||
{
|
||||
parent::__construct('PID', $fields);
|
||||
if ($autoIncrementIndices) {
|
||||
$this->setID($this::$setId++);
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setID($this::$setId--);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setID(int $value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPatientID($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Patient ID (Internal ID)
|
||||
* @param string|array $value
|
||||
*/
|
||||
public function setPatientIdentifierList($value, int $position = 3): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAlternatePatientID($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPatientName($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setMothersMaidenName($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDateTimeOfBirth($value, int $position = 7)
|
||||
{
|
||||
// TODO: Validate if $value is of the form %Y%m%d%H%M%S
|
||||
//if ($value !== 'F' && $value !== 'M') {
|
||||
// throw new \InvalidArgumentException("Date should be of the form YYYYmmddHHMMSS. Given: '$value''");
|
||||
//}
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSex(string $value, int $position = 8)
|
||||
{
|
||||
// Ref: https://hl7-definition.caristix.com/v2/HL7v2.4/Tables/0001
|
||||
if (!in_array($value, ['A', 'F', 'M', 'N', 'O', 'U'], true)) {
|
||||
throw new InvalidArgumentException("Sex should one of 'A', 'F', 'M', 'N', 'O' or 'U'. Given: '$value'");
|
||||
}
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPatientAlias($value, int $position = 9)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setRace($value, int $position = 10)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPatientAddress($value, int $position = 11)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCountryCode($value, int $position = 12)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPhoneNumberHome($value, int $position = 13)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPhoneNumberBusiness($value, int $position = 14)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPrimaryLanguage($value, int $position = 15)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setMaritalStatus($value, int $position = 16)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setReligion($value, int $position = 17)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPatientAccountNumber($value, int $position = 18)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSSNNumber($value, int $position = 19)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDriversLicenseNumber($value, int $position = 20)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setMothersIdentifier($value, int $position = 21)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEthnicGroup($value, int $position = 22)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setBirthPlace($value, int $position = 23)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setMultipleBirthIndicator($value, int $position = 24)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setBirthOrder($value, int $position = 25)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCitizenship($value, int $position = 26)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setVeteransMilitaryStatus($value, int $position = 27)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setNationality($value, int $position = 28)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPatientDeathDateAndTime($value, int $position = 29)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPatientDeathIndicator($value, int $position = 30)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientID(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Patient ID (Internal ID)
|
||||
* @return array|null|string
|
||||
*/
|
||||
public function getPatientIdentifierList(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAlternatePatientID(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientName(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getMothersMaidenName(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDateTimeOfBirth(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSex(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientAlias(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRace(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientAddress(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCountryCode(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPhoneNumberHome(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPhoneNumberBusiness(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPrimaryLanguage(int $position = 15)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getMaritalStatus(int $position = 16)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getReligion(int $position = 17)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientAccountNumber(int $position = 18)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSSNNumber(int $position = 19)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDriversLicenseNumber(int $position = 20)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getMothersIdentifier(int $position = 21)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEthnicGroup(int $position = 22)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getBirthPlace(int $position = 23)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getMultipleBirthIndicator(int $position = 24)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getBirthOrder(int $position = 25)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCitizenship(int $position = 26)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVeteransMilitaryStatus(int $position = 27)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNationality(int $position = 28)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientDeathDateAndTime(int $position = 29)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientDeathIndicator(int $position = 30)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+708
@@ -0,0 +1,708 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* PV1 segment class
|
||||
* Ref: https://corepointhealth.com/resource-center/hl7-resources/hl7-pv1-patient-visit-information-segment
|
||||
*/
|
||||
class PV1 extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
* @var int
|
||||
*/
|
||||
protected static $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null, bool $autoIncrementIndices = true)
|
||||
{
|
||||
parent::__construct('PV1', $fields);
|
||||
if ($autoIncrementIndices) {
|
||||
$this->setID($this::$setId++);
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setID($this::$setId--);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setID(int $value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPatientClass($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAssignedPatientLocation($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setAdmissionType($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPreAdmitNumber($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPriorPatientLocation($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setAttendingDoctor($value, int $position = 7)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setReferringDoctor($value, int $position = 8)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setConsultingDoctor($value, int $position = 9)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setHospitalService($value, int $position = 10)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setTemporaryLocation($value, int $position = 11)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPreAdmitTestIndicator($value, int $position = 12)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setReAdmissionIndicator($value, int $position = 13)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setAdmitSource($value, int $position = 14)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setAmbulatoryStatus($value, int $position = 15)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setVipIndicator($value, int $position = 16)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setAdmittingDoctor($value, int $position = 17)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPatientType($value, int $position = 18)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setVisitNumber($value, int $position = 19)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setFinancialClass($value, int $position = 20)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setChargePriceIndicator($value, int $position = 21)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setCourtesyCode($value, int $position = 22)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setCreditRating($value, int $position = 23)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setContractCode($value, int $position = 24)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setContractEffectiveDate($value, int $position = 25)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setContractAmount($value, int $position = 26)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setContractPeriod($value, int $position = 27)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setInterestCode($value, int $position = 28)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setTransferToBadDebtCode($value, int $position = 29)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setTransferToBadDebtDate($value, int $position = 30)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setBadDebtAgencyCode($value, int $position = 31)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setBadDebtTransferAmount($value, int $position = 32)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setBadDebtRecoveryAmount($value, int $position = 33)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setDeleteAccountIndicator($value, int $position = 34)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setDeleteAccountDate($value, int $position = 35)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setDischargeDisposition($value, int $position = 36)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setDischargedToLocation($value, int $position = 37)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setDietType($value, int $position = 38)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setServicingFacility($value, int $position = 39)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setBedStatus($value, int $position = 40)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setAccountStatus($value, int $position = 41)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPendingLocation($value, int $position = 42)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPriorTemporaryLocation($value, int $position = 43)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setAdmitDateTime($value, int $position = 44)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setDischargeDateTime($value, int $position = 45)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setCurrentPatientBalance($value, int $position = 46)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setTotalCharges($value, int $position = 47)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setTotalAdjustments($value, int $position = 48)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setTotalPayments($value, int $position = 49)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setAlternateVisitID($value, int $position = 50)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setVisitIndicator($value, int $position = 51)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setOtherHealthcareProvider($value, int $position = 52)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientClass(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAssignedPatientLocation(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdmissionType(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPreAdmitNumber(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPriorPatientLocation(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAttendingDoctor(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getReferringDoctor(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getConsultingDoctor(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getHospitalService(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTemporaryLocation(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPreAdmitTestIndicator(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getReAdmissionIndicator(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdmitSource(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAmbulatoryStatus(int $position = 15)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVipIndicator(int $position = 16)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdmittingDoctor(int $position = 17)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientType(int $position = 18)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVisitNumber(int $position = 19)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFinancialClass(int $position = 20)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getChargePriceIndicator(int $position = 21)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCourtesyCode(int $position = 22)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCreditRating(int $position = 23)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContractCode(int $position = 24)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContractEffectiveDate(int $position = 25)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContractAmount(int $position = 26)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContractPeriod(int $position = 27)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInterestCode(int $position = 28)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTransferToBadDebtCode(int $position = 29)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTransferToBadDebtDate(int $position = 30)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getBadDebtAgencyCode(int $position = 31)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getBadDebtTransferAmount(int $position = 32)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getBadDebtRecoveryAmount(int $position = 33)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDeleteAccountIndicator(int $position = 34)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDeleteAccountDate(int $position = 35)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDischargeDisposition(int $position = 36)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDischargedToLocation(int $position = 37)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDietType(int $position = 38)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getServicingFacility(int $position = 39)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getBedStatus(int $position = 40)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAccountStatus(int $position = 41)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPendingLocation(int $position = 42)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPriorTemporaryLocation(int $position = 43)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdmitDateTime(int $position = 44)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDischargeDateTime(int $position = 45)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCurrentPatientBalance(int $position = 46)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTotalCharges(int $position = 47)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTotalAdjustments(int $position = 48)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTotalPayments(int $position = 49)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAlternateVisitID(int $position = 50)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVisitIndicator(int $position = 51)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOtherHealthcareProvider(int $position = 52)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+630
@@ -0,0 +1,630 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* PV2 segment class
|
||||
* Ref: https://hl7-definition.caristix.com/v2/HL7v2.4/Segments/PV2
|
||||
*/
|
||||
class PV2 extends Segment
|
||||
{
|
||||
/**
|
||||
* @param ?array $fields
|
||||
*/
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('PV2', $fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPriorPendingLocation($value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setAccommodationCode($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setAdmitReason($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setTransferReason($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPatientValuables($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPatientValuablesLocation($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setVisitUserCode($value, int $position = 7)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setExpectedAdmitDateTime($value, int $position = 8)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setExpectedDischargeDateTime($value, int $position = 9)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setEstimatedLengthofInpatientStay($value, int $position = 10)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setActualLengthOfInpatientStay($value, int $position = 11)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setVisitDescription($value, int $position = 12)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setReferralSourceCode($value, int $position = 13)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPreviousServiceDate($value, int $position = 14)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setEmploymentIllnessRelatedIndicator($value, int $position = 15)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPurgeStatusCode($value, int $position = 16)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPurgeStatusDate($value, int $position = 17)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setSpecialProgramCode($value, int $position = 18)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setRetentionIndicator($value, int $position = 19)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setExpectedNumberOfInsurancePlans($value, int $position = 20)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setVisitPublicityCode($value, int $position = 21)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setVisitProtectionIndicator($value, int $position = 22)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setClinicOrganizationName($value, int $position = 23)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPatientStatusCode($value, int $position = 24)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setVisitPriorityCode($value, int $position = 25)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPreviousTreatmentDate($value, int $position = 26)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setExpectedDischargeDisposition($value, int $position = 27)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setSignatureOnFileDate($value, int $position = 28)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setFirstSimilarIllnessDate($value, int $position = 29)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPatientChargeAdjustmentCode($value, int $position = 30)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setRecurringServiceCode($value, int $position = 31)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setBillingMediaCode($value, int $position = 32)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setExpectedSurgeryDateAndTime($value, int $position = 33)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setMilitaryPartnershipCode($value, int $position = 34)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setMilitaryNonAvailabilityCode($value, int $position = 35)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setNewbornBabyIndicator($value, int $position = 36)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setBabyDetainedIndicator($value, int $position = 37)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setModeOfArrivalCode($value, int $position = 38)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setRecreationalDrugUseCode($value, int $position = 39)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setAdmissionLevelOfCareCode($value, int $position = 40)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPrecautionCode($value, int $position = 41)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPatientConditionCode($value, int $position = 42)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setLivingWillCode($value, int $position = 43)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setOrganDonorCode($value, int $position = 44)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setAdvanceDirectiveCode($value, int $position = 45)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setPatientStatusEffectiveDate($value, int $position = 46)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function setExpectedLOAReturnDateTime($value, int $position = 47)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
// -------------------- Getter Methods ------------------------------
|
||||
|
||||
public function getAccommodationCode(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdmitReason(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTransferReason(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientValuables(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientValuablesLocation(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVisitUserCode(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getExpectedAdmitDateTime(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getExpectedDischargeDateTime(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEstimatedLengthofInpatientStay(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getActualLengthOfInpatientStay(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVisitDescription(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getReferralSourceCode(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPreviousServiceDate(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEmploymentIllnessRelatedIndicator(int $position = 15)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPurgeStatusCode(int $position = 16)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPurgeStatusDate(int $position = 17)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSpecialProgramCode(int $position = 18)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRetentionIndicator(int $position = 19)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getExpectedNumberOfInsurancePlans(int $position = 20)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVisitPublicityCode(int $position = 21)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVisitProtectionIndicator(int $position = 22)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getClinicOrganizationName(int $position = 23)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientStatusCode(int $position = 24)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVisitPriorityCode(int $position = 25)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPreviousTreatmentDate(int $position = 26)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getExpectedDischargeDisposition(int $position = 27)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSignatureOnFileDate(int $position = 28)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFirstSimilarIllnessDate(int $position = 29)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientChargeAdjustmentCode(int $position = 30)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRecurringServiceCode(int $position = 31)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getBillingMediaCode(int $position = 32)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getExpectedSurgeryDateAndTime(int $position = 33)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getMilitaryPartnershipCode(int $position = 34)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getMilitaryNonAvailabilityCode(int $position = 35)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getNewbornBabyIndicator(int $position = 36)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getBabyDetainedIndicator(int $position = 37)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getModeOfArrivalCode(int $position = 38)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRecreationalDrugUseCode(int $position = 39)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdmissionLevelOfCareCode(int $position = 40)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPrecautionCode(int $position = 41)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientConditionCode(int $position = 42)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLivingWillCode(int $position = 43)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOrganDonorCode(int $position = 44)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdvanceDirectiveCode(int $position = 45)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPatientStatusEffectiveDate(int $position = 46)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getExpectedLOAReturnDateTime(int $position = 47)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* RGS segment class
|
||||
* Ref: http://hl7-definition.caristix.com:9010/Default.aspx?version=HL7+v2.5.1&segment=RGS
|
||||
*/
|
||||
class RGS extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
*/
|
||||
protected static int $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null, bool $autoIncrementIndices = true)
|
||||
{
|
||||
parent::__construct('RGS', $fields);
|
||||
if ($autoIncrementIndices) {
|
||||
$this->setID($this::$setId++);
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->setID($this::$setId--);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setID(int $value, int $position = 1): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSegmentActionCode($value, int $position = 2): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setResourceGroupID($value, int $position = 3): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSegmentActionCode(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getResourceGroupID(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+282
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* The ORC must have the filler order number and the order control code RE. As a site-specific variant,
|
||||
* the RXO and associated RXCs and/or the RXE (and associated RXCs) may be present if the receiving
|
||||
* application needs any of their data. The RXA carries the administration data.
|
||||
*
|
||||
* @link https://hl7-definition.caristix.com/v2/HL7v2.5.1/Segments/RXA
|
||||
*/
|
||||
class RXA extends Segment
|
||||
{
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('RXA', $fields);
|
||||
}
|
||||
|
||||
public function setGiveSubIdCounter(int $value, int $position = 1): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministrationSubIdCounter(int $value, int $position = 2): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDateTimeStartAdministration(string|array $value, int $position = 3): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDateTimeEndAdministration(string|array $value, int $position = 4): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministeredCode(array $value, int $position = 5): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministeredAmount(string $value, int $position = 6): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministeredUnits(array|null $value, int $position = 7): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministeredDosageForm(array|null $value, int $position = 8): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministrationNotes(array|null $value, int $position = 9): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministeringProvider(array|null $value, int $position = 10): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministeredAtLocation(array|null $value, int $position = 11): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministeredPerTimeUnit(string|null $value, int $position = 12): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministeredStrength(string|null $value, int $position = 13): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministeredStrengthUnits(array|null $value, int $position = 14): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSubstanceLotNumber(string|null $value, int $position = 15): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSubstanceExpirationDate(string|array|null $value, int $position = 16): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSubstanceManufacturerName(array|null $value, int $position = 17): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSubstanceTreatmentRefusalReason(array|null $value, int $position = 18): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setIndication(array|null $value, int $position = 19): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCompletionStatus(string|null $value, int $position = 20): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setActionCode(string|null $value, int $position = 21): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSystemEntryDateTime(string|array|null $value, int $position = 22): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministeredDrugStrengthVolume(string|null $value, int $position = 23): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministeredDrugStrengthVolumeUnits(array|null $value, int $position = 24): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministeredBarcodeIdentifier(array|null $value, int $position = 25): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPharmacyOrderType(string|null $value, int $position = 26): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getGiveSubIdCounter(int $position = 1): int
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministrationSubIdCounter(int $position = 2): int
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDateTimeStartAdministration(int $position = 3): string|array
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDateTimeEndAdministration(int $position = 4): string|array
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministeredCode(int $position = 5): array
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministeredAmount(int $position = 6): string
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministeredUnits(int $position = 7): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministeredDosageForm(int $position = 8): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministrationNotes(int $position = 9): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministeringProvider(int $position = 10): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministeredAtLocation(int $position = 11): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministeredPerTimeUnit(int $position = 12): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministeredStrength(int $position = 13): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministeredStrengthUnits(int $position = 14): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSubstanceLotNumber(int $position = 15): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSubstanceExpirationDate(int $position = 16): string|array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSubstanceManufacturerName(int $position = 17): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSubstanceTreatmentRefusalReason(int $position = 18): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getIndication(int $position = 19): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCompletionStatus(int $position = 20): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getActionCode(int $position = 21): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSystemEntryDateTime(int $position = 22): string|array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministeredDrugStrengthVolume(int $position = 23): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministeredDrugStrengthVolumeUnits(int $position = 24): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministeredBarcodeIdentifier(int $position = 25): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPharmacyOrderType(int $position = 26): string|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* The Pharmacy/Treatment Route segment contains the alternative combination of route, site, administration device,
|
||||
* and administration method that are prescribed as they apply to a particular order. The pharmacy, treatment
|
||||
* staff and/or nursing staff has a choice between the routes based on either their professional judgment
|
||||
* or administration instructions provided by the physician.
|
||||
*
|
||||
* @link https://hl7-definition.caristix.com/v2/HL7v2.8/Segments/RXR
|
||||
*/
|
||||
class RXR extends Segment
|
||||
{
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('RXR', $fields);
|
||||
}
|
||||
|
||||
public function setRoute(array $value, int $position = 1): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministrationSite(array $value, int $position = 2): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministrationDevice(array $value, int $position = 3): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministrationMethod(array $value, int $position = 4): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setRoutingInstruction(array $value, int $position = 5): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdministrationSiteModifier(array $value, int $position = 6): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getRoute(int $position = 1): array
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministrationSite(int $position = 2): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministrationDevice(int $position = 3): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministrationMethod(int $position = 4): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRoutingInstruction(int $position = 5): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdministrationSiteModifier(int $position = 6): array|null
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+486
@@ -0,0 +1,486 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* SAC segment class
|
||||
* Ref: https://www.interfaceware.com/hl7-standard/hl7-segment-SAC.html
|
||||
*/
|
||||
class SAC extends Segment
|
||||
{
|
||||
/**
|
||||
* Index of this segment. Incremented for every new segment of this class created
|
||||
* @var int
|
||||
*/
|
||||
protected static $setId = 1;
|
||||
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('SAC', $fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset index of this segment
|
||||
*/
|
||||
public static function resetIndex(int $index = 1): void
|
||||
{
|
||||
self::$setId = $index;
|
||||
}
|
||||
|
||||
public function setExternalAccessionIdentifier(int $value, int $position = 1)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAccessionIdentifier($value, int $position = 2)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContainerIdentifier($value, int $position = 3)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPrimaryContainerIdentifier($value, int $position = 4)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEquipmentContainerIdentifier($value, int $position = 5)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSpecimenSource($value, int $position = 6)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setRegistrationDateTime($value, int $position = 7)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*
|
||||
* value:
|
||||
* I : Identified
|
||||
* P : In Position
|
||||
* O : In Process
|
||||
* R : Process Completed
|
||||
* L : Left Equipment
|
||||
* M : Missing
|
||||
* X : Container Unavailable
|
||||
* U : Unknown
|
||||
*/
|
||||
public function setContainerStatus($value, int $position = 8)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCarrierType($value, int $position = 9)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCarrierIdentifier($value, int $position = 10)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPositionInCarrier($value, int $position = 11)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setTrayTypeSAC($value, int $position = 12)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setTrayIdentifier($value, int $position = 13)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPositionInTray($value, int $position = 14)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setLocation($value, int $position = 15)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContainerHeight($value, int $position = 16)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContainerDiameter($value, int $position = 17)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setBarrierDelta($value, int $position = 18)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setBottomDelta($value, int $position = 19)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContainerSizeUnits($value, int $position = 20)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setContainerVolume($value, int $position = 21)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAvailableSpecimenVolume($value, int $position = 22)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setInitialSpecimenVolume($value, int $position = 23)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setVolumeUnits($value, int $position = 24)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSeparatorType($value, int $position = 25)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setCapType($value, int $position = 26)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAdditive($value, int $position = 27)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSpecimenComponent($value, int $position = 28)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDilutionFactor($value, int $position = 29)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setTreatment($value, int $position = 30)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setTemperature($value, int $position = 31)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setHemolysisIndex($value, int $position = 32)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setHemolysisIndexUnits($value, int $position = 33)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setLepemiaIndex($value, int $position = 34)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setLepemiaIndexUnits($value, int $position = 35)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setIcterusIndex($value, int $position = 36)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setIcterusIndexUnits($value, int $position = 37)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFibrinIndex($value, int $position = 38)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFibrinIndexUnits($value, int $position = 39)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSystemInducedContaminants($value, int $position = 40)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setDrugInterference($value, int $position = 41)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setArtificialBlood($value, int $position = 42)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setSpecialHandlingCode($value, int $position = 43)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOtherEnvironmentalFactors($value, int $position = 44)
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getExternalAccessionIdentifier(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAccessionIdentifier(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContainerIdentifier(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPrimaryContainerIdentifier(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEquipmentContainerIdentifier(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSpecimenSource(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRegistrationDateTime(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContainerStatus(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCarrierType(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCarrierIdentifier(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPositionInCarrier(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTrayTypeSAC(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTrayIdentifier(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPositionInTray(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLocation(int $position = 15)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContainerHeight(int $position = 16)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContainerDiameter(int $position = 17)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getBarrierDelta(int $position = 18)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getBottomDelta(int $position = 19)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContainerSizeUnits(int $position = 20)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getContainerVolume(int $position = 21)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAvailableSpecimenVolume(int $position = 22)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getInitialSpecimenVolume(int $position = 23)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getVolumeUnits(int $position = 24)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSeparatorType(int $position = 25)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getCapType(int $position = 26)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAdditive(int $position = 27)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSpecimenComponent(int $position = 28)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDilutionFactor(int $position = 29)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTreatment(int $position = 30)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTemperature(int $position = 31)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getHemolysisIndex(int $position = 32)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getHemolysisIndexUnits(int $position = 33)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLepemiaIndex(int $position = 34)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getLepemiaIndexUnits(int $position = 35)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getIcterusIndex(int $position = 36)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getIcterusIndexUnits(int $position = 37)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFibrinIndex(int $position = 38)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFibrinIndexUnits(int $position = 39)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSystemInducedContaminants(int $position = 40)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getDrugInterference(int $position = 41)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getArtificialBlood(int $position = 42)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getSpecialHandlingCode(int $position = 43)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOtherEnvironmentalFactors(int $position = 44)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+270
@@ -0,0 +1,270 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* SCH segment class
|
||||
* Ref: https://corepointhealth.com/resource-center/hl7-resources/hl7-siu-message
|
||||
* http://hl7-definition.caristix.com:9010/HL7%20v2.3.1/segment/SCH
|
||||
*/
|
||||
class SCH extends Segment
|
||||
{
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('SCH', $fields);
|
||||
}
|
||||
|
||||
public function setPlacerAppointmentID($value, int $position = 1): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFillerAppointmentID($value, int $position = 2): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOccurrenceNumber($value, int $position = 3): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlacerGroupNumber($value, int $position = 4): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setScheduleID($value, int $position = 5): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEventReason($value, int $position = 6): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAppointmentReason($value, int $position = 7): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAppointmentType($value, int $position = 8): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAppointmentDuration($value, int $position = 9): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAppointmentDurationUnits($value, int $position = 10): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setAppointmentTimingQuantity($value, int $position = 11): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlacerContactPerson($value, int $position = 12): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlacerContactPhoneNumber($value, int $position = 13): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlacerContactAddress($value, int $position = 14): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPlacerContactLocation($value, int $position = 15): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFillerContactPerson($value, int $position = 16): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFillerContactPhoneNumber($value, int $position = 17): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFillerContactAddress($value, int $position = 18): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFillerContactLocation($value, int $position = 19): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEnteredbyPerson($value, int $position = 20): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEnteredbyPhoneNumber($value, int $position = 21): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEnteredbyLocation($value, int $position = 22): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setParentPlacerAppointmentID($value, int $position = 23): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setParentFillerAppointmentID($value, int $position = 24): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setFillerStatusCode($value, int $position = 25): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getPlacerAppointmentID(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFillerAppointmentID(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOccurrenceNumber(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlacerGroupNumber(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getScheduleID(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEventReason(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAppointmentReason(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAppointmentType(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAppointmentDuration(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAppointmentDurationUnits(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getAppointmentTimingQuantity(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlacerContactPerson(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlacerContactPhoneNumber(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlacerContactAddress(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPlacerContactLocation(int $position = 15)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFillerContactPerson(int $position = 16)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFillerContactPhoneNumber(int $position = 17)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFillerContactAddress(int $position = 18)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFillerContactLocation(int $position = 19)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEnteredbyPerson(int $position = 20)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEnteredbyPhoneNumber(int $position = 21)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEnteredbyLocation(int $position = 22)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getParentPlacerAppointmentID(int $position = 23)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getParentFillerAppointmentID(int $position = 24)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getFillerStatusCode(int $position = 25)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
|
||||
/**
|
||||
* TQ1 segment class
|
||||
* Ref: http://hl7-definition.caristix.com:9010/HL7%20v2.5.1/dataType/Default.aspx?version=HL7+v2.5.1&dataType=TQ1
|
||||
*/
|
||||
class TQ1 extends Segment
|
||||
{
|
||||
public function __construct(?array $fields = null)
|
||||
{
|
||||
parent::__construct('TQ1', $fields);
|
||||
}
|
||||
|
||||
public function setSetIdTQ1($value, int $position = 1): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setQuantity($value, int $position = 2): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setRepeatPattern($value, int $position = 3): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setExplicitTime($value, int $position = 4): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setRelativeTimeAndUnits($value, int $position = 5): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setServiceDuration($value, int $position = 6): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setStartDateTime($value, int $position = 7): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setEndDateTime($value, int $position = 8): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setPriority($value, int $position = 9): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setConditionText($value, int $position = 10): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setTextInstruction($value, int $position = 11): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setConjunction($value, int $position = 12): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setOccurrenceDuration($value, int $position = 13): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function setTotalOccurrences($value, int $position = 14): bool
|
||||
{
|
||||
return $this->setField($position, $value);
|
||||
}
|
||||
|
||||
public function getSetIdTQ1(int $position = 1)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getQuantity(int $position = 2)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRepeatPattern(int $position = 3)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getExplicitTime(int $position = 4)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getRelativeTimeAndUnits(int $position = 5)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getServiceDuration(int $position = 6)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getStartDateTime(int $position = 7)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getEndDateTime(int $position = 8)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getPriority(int $position = 9)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getConditionText(int $position = 10)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTextInstruction(int $position = 11)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getConjunction(int $position = 12)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getOccurrenceDuration(int $position = 13)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
|
||||
public function getTotalOccurrences(int $position = 14)
|
||||
{
|
||||
return $this->getField($position);
|
||||
}
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Tests;
|
||||
|
||||
use Aranyasen\HL7\Message;
|
||||
use Aranyasen\HL7\Messages\ACK;
|
||||
use Aranyasen\HL7\Segments\MSH;
|
||||
use Exception;
|
||||
|
||||
class AckTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function test()
|
||||
{
|
||||
$msg = new Message();
|
||||
$msg->addSegment(new MSH());
|
||||
|
||||
$msh = $msg->getSegmentByIndex(0);
|
||||
$msh->setField(15, 'AL');
|
||||
$msh->setField(16, 'NE');
|
||||
|
||||
$ack = new ACK($msg);
|
||||
|
||||
$seg1 = $ack->getSegmentByIndex(1);
|
||||
|
||||
self::assertSame('CA', $seg1->getField(1), 'Error code is CA');
|
||||
|
||||
$msg = new Message();
|
||||
$msh = new MSH();
|
||||
$msh->setField(15);
|
||||
$msh->setField(16, 'NE');
|
||||
$msg->addSegment($msh);
|
||||
$ack = new ACK($msg);
|
||||
|
||||
$seg1 = $ack->getSegmentByIndex(1);
|
||||
|
||||
self::assertSame('CA', $seg1->getField(1), 'Error code is CA');
|
||||
|
||||
$msg = new Message();
|
||||
$msh = new MSH();
|
||||
$msh->setField(16);
|
||||
$msh->setField(15);
|
||||
$msg->addSegment($msh);
|
||||
$ack = new ACK($msg);
|
||||
|
||||
$seg1 = $ack->getSegmentByIndex(1);
|
||||
|
||||
self::assertSame('AA', $seg1->getField(1), 'Error code is AA');
|
||||
|
||||
$ack->setAckCode('E');
|
||||
self::assertSame('AE', $seg1->getField(1), 'Error code is AE');
|
||||
|
||||
$ack->setAckCode('CR');
|
||||
self::assertSame('CR', $seg1->getField(1), 'Error code is CR');
|
||||
|
||||
$ack->setAckCode('CR', 'XX');
|
||||
self::assertSame('XX', $seg1->getField(3), 'Set message and code');
|
||||
|
||||
$msg = new Message();
|
||||
$msg->addSegment(new MSH());
|
||||
$msh = $msg->getSegmentByIndex(0);
|
||||
$msh->setField(16, 'NE');
|
||||
$msh->setField(11, 'P');
|
||||
$msh->setField(12, '2.4');
|
||||
$msh->setField(15, 'NE');
|
||||
|
||||
$ack = new ACK($msg);
|
||||
$seg0 = $ack->getSegmentByIndex(0);
|
||||
self::assertSame('P', $seg0->getField(11), 'Field 11 is P');
|
||||
self::assertSame('2.4', $seg0->getField(12), 'Field 12 is 2.4');
|
||||
self::assertSame('NE', $seg0->getField(15), 'Field 15 is NE');
|
||||
self::assertSame('NE', $seg0->getField(16), 'Field 16 is NE');
|
||||
|
||||
$ack = new ACK($msg);
|
||||
$ack->setErrorMessage('Some error');
|
||||
$seg1 = $ack->getSegmentByIndex(1);
|
||||
self::assertSame('Some error', $seg1->getField(3), 'Setting error message');
|
||||
self::assertSame('CE', $seg1->getField(1), 'Code CE after setting message');
|
||||
}
|
||||
|
||||
/** @test
|
||||
* @throws Exception
|
||||
*/
|
||||
public function a_MSH_can_be_provided_to_get_the_fields_from(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\rPV1|1|O|^AAAA1^^^BB|");
|
||||
$msh = new MSH(
|
||||
[
|
||||
'MSH', '^~\&', 'HL7 Corp', 'HL7 HQ', 'VISION', 'MISYS', '200404061744', '', ['DFT', 'P03'], 'TC-22222',
|
||||
'T', '2.3',
|
||||
]
|
||||
);
|
||||
$ack = new ACK($msg, $msh);
|
||||
self::assertSame("MSH|^~\&|VISION|MISYS|HL7 Corp|HL7 HQ|||ACK|\nMSA|AA|TC-22222|\n", $ack->toString(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @throws Exception
|
||||
*/
|
||||
public function globals_can_be_passed_to_constructor(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\rPV1|1|O|^AAAA1^^^BB|");
|
||||
$ack = new ACK($msg, null, ['SEGMENT_SEPARATOR' => '\r\n']);
|
||||
self::assertSame("MSH|^~\&|1||||||ACK|\r\nMSA|AA|\r\n", $ack->toString(true));
|
||||
}
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Tests;
|
||||
|
||||
use Aranyasen\Exceptions\HL7ConnectionException;
|
||||
use Aranyasen\Exceptions\HL7Exception;
|
||||
use Aranyasen\HL7\Message;
|
||||
use Aranyasen\HL7\Connection;
|
||||
use RuntimeException;
|
||||
|
||||
class ConnectionTest extends TestCase
|
||||
{
|
||||
use Hl7ListenerTrait;
|
||||
|
||||
protected int $port = 12011;
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
$this->deletePipe();
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @throws HL7ConnectionException
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function a_message_can_be_sent_to_a_hl7_server(): void
|
||||
{
|
||||
if (!extension_loaded('pcntl')) {
|
||||
self::markTestSkipped("Extension pcntl_fork is not loaded");
|
||||
}
|
||||
$pid = pcntl_fork();
|
||||
if ($pid === -1) {
|
||||
throw new RuntimeException('Could not fork');
|
||||
}
|
||||
if (!$pid) { // In child process
|
||||
$this->createTcpServer($this->port, 1);
|
||||
}
|
||||
if ($pid) { // in Parent process...
|
||||
sleep(2); // Give a second to server (child) to start up. TODO: Speed up by polling
|
||||
|
||||
$connection = new Connection('localhost', $this->port);
|
||||
$msg = new Message("MSH|^~\\&|1|\rPV1|1|O|^AAAA1^^^BB|", null, true, true);
|
||||
$ack = $connection->send($msg);
|
||||
self::assertInstanceOf(Message::class, $ack);
|
||||
self::assertSame('MSH|^~\&|1||||||ACK|\nMSA|AA|\n|\n', $ack->toString());
|
||||
|
||||
self::assertStringContainsString("MSH|^~\\&|1|\nPV1|1|O|^AAAA1^^^BB|", $this->getWhatServerGot());
|
||||
|
||||
$this->closeTcpSocket($connection->getSocket()); // Clean up listener
|
||||
pcntl_wait($status); // Wait till child is closed
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @throws HL7ConnectionException
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function do_not_wait_for_ack_after_sending_if_corresponding_parameter_is_set(): void
|
||||
{
|
||||
if (!extension_loaded('pcntl')) {
|
||||
self::markTestSkipped("Extension pcntl_fork is not loaded");
|
||||
}
|
||||
$pid = pcntl_fork();
|
||||
if ($pid === -1) {
|
||||
throw new RuntimeException('Could not fork');
|
||||
}
|
||||
if (!$pid) { // In child process
|
||||
$this->createTcpServer($this->port, 1);
|
||||
}
|
||||
if ($pid) { // in Parent process...
|
||||
sleep(2); // Give a second to server (child) to start up
|
||||
|
||||
$connection = new Connection('localhost', $this->port);
|
||||
$msg = new Message("MSH|^~\\&|1|\rPV1|1|O|^AAAA1^^^BB|", null, true, true);
|
||||
self::assertNull($connection->send($msg, ' UTF-8', true));
|
||||
|
||||
$this->closeTcpSocket($connection->getSocket()); // Clean up listener
|
||||
pcntl_wait($status); // Wait till child is closed
|
||||
}
|
||||
}
|
||||
}
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Tests;
|
||||
|
||||
use Aranyasen\Exceptions\HL7Exception;
|
||||
use Aranyasen\HL7;
|
||||
use Aranyasen\HL7\Segments\PID;
|
||||
use DMS\PHPUnitExtensions\ArraySubset\Assert;
|
||||
|
||||
class HL7Test extends TestCase
|
||||
{
|
||||
/** @test
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function hl7_message_can_be_created_using_factory_class(): void
|
||||
{
|
||||
$msg = HL7::build()->createMessage();
|
||||
self::assertIsObject($msg);
|
||||
self::assertSame(HL7\Message::class, $msg::class);
|
||||
}
|
||||
|
||||
/** @test
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function factory_creates_a_msh_segment_with_defaults_when_no_message_string_provided(): void
|
||||
{
|
||||
$msg = HL7::build()->createMessage();
|
||||
self::assertStringContainsString('MSH|^~\&|||||', $msg->toString(true));
|
||||
}
|
||||
|
||||
/** @test
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function a_message_can_be_built_from_a_provided_hl7_string(): void
|
||||
{
|
||||
$msg = HL7::from("MSH|^~\\&|1|\rABC|||xxx|\r")->createMessage();
|
||||
self::assertSame("MSH|^~\\&|1|\nABC|||xxx|\n", $msg->toString(true));
|
||||
}
|
||||
|
||||
/** @test
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function hl7_property_in_a_given_hl7_string_can_be_overridden(): void
|
||||
{
|
||||
self::markTestSkipped('property cannot be overridden yet in Message() constructor');
|
||||
$msg = HL7::from("MSH|^~\\&|1|\rABC|||xxx|\r")
|
||||
->withEscapeCharacter('=')
|
||||
->createMessage();
|
||||
self::assertSame("MSH|^~=&|1|\nABC|||xxx|\n", $msg->toString(true));
|
||||
}
|
||||
/**
|
||||
* @test
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function hl7_properties_can_be_set_using_chained_methods(): void
|
||||
{
|
||||
$msg = HL7::build()
|
||||
->withSegmentSeparator('[')
|
||||
->withFieldSeparator('#')
|
||||
->withComponentSeparator('*')
|
||||
->withSubcomponentSeparator('}')
|
||||
->withRepetitionSeparator('`')
|
||||
->withEscapeCharacter('=')
|
||||
->withHL7Version('555.666')
|
||||
->createMessage();
|
||||
self::assertStringContainsString('MSH#*`=}#', $msg->toString(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @throws Exception
|
||||
*/
|
||||
public function empty_subfields_can_be_retained_if_needed(): void
|
||||
{
|
||||
$msg = HL7::from("MSH|^~\\&|1|\rPV1|1|O|^AAAA1^^^BB|")->keepEmptySubfields()->createMessage();
|
||||
Assert::assertArraySubset(['', 'AAAA1', '', '', 'BB'], $msg->getSegmentByIndex(1)->getField(3));
|
||||
}
|
||||
|
||||
/** @test
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function indices_of_each_segment_can_be_reset_when_message_is_composed(): void
|
||||
{
|
||||
// Create a message with a PID segment
|
||||
$msg1 = HL7::from("MSH|^~\&|||||||ORM^O01||P|2.3.1|")->createMessage();
|
||||
$msg1->addSegment(new PID());
|
||||
self::assertSame(
|
||||
"MSH|^~\&|||||||ORM^O01||P|2.3.1|\nPID|1|\n",
|
||||
$msg1->toString(true),
|
||||
'PID index in first message is 1'
|
||||
);
|
||||
|
||||
// Create another message with a PID segment
|
||||
$msg2 = Hl7::from("MSH|^~\&|||||||ORM^O01||P|2.3.1|")->createMessage();
|
||||
$msg2->addSegment(new PID());
|
||||
self::assertSame(
|
||||
"MSH|^~\&|||||||ORM^O01||P|2.3.1|\nPID|2|\n",
|
||||
$msg2->toString(true),
|
||||
'PID index gets incremented'
|
||||
);
|
||||
|
||||
// Create another message with a PID segment, this time with resetIndices()
|
||||
$msg3 = Hl7::from("MSH|^~\&|||||||ORM^O01||P|2.3.1|")
|
||||
->resetIndices()
|
||||
->createMessage();
|
||||
$msg3->addSegment(new PID());
|
||||
self::assertSame("MSH|^~\&|||||||ORM^O01||P|2.3.1|\nPID|1|\n", $msg3->toString(true), 'PID index resets to 1');
|
||||
|
||||
// Create a message with a PID segment
|
||||
$msg4 = Hl7::from("MSH|^~\&|||||||ORM^O01||P|2.3.1|")->createMessage();
|
||||
$msg4->addSegment(new PID());
|
||||
self::assertSame(
|
||||
"MSH|^~\&|||||||ORM^O01||P|2.3.1|\nPID|2|\n",
|
||||
$msg4->toString(true),
|
||||
'PID index gets incremented'
|
||||
);
|
||||
|
||||
$msg5 = Hl7::from("MSH|^~\&|||||||ORM^O01||P|2.3.1|")->createMessage();
|
||||
$msg5->resetSegmentIndices();
|
||||
$msg5->addSegment(new PID());
|
||||
self::assertSame("MSH|^~\&|||||||ORM^O01||P|2.3.1|\nPID|1|\n", $msg5->toString(true), 'PID index resets to 1');
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function auto_increment_of_segment_indices_can_be_avoided(): void
|
||||
{
|
||||
$hl7String = "MSH|^~\&|||||||ORU^R01|00001|P|2.3.1|\n" . "OBX|1||11^AA|\n" . "OBX|1||22^BB|\n";
|
||||
|
||||
$msg = Hl7::from($hl7String)
|
||||
->createMessage();
|
||||
self::assertSame(
|
||||
"MSH|^~\&|||||||ORU^R01|00001|P|2.3.1|\n" . "OBX|1||11^AA|\n" . "OBX|2||22^BB|\n",
|
||||
$msg->toString(true),
|
||||
'without autoIncrementIndices(false), each instance is auto-incremented'
|
||||
);
|
||||
|
||||
$msg = Hl7::from($hl7String)
|
||||
->autoIncrementIndices(false)
|
||||
->createMessage();
|
||||
self::assertSame(
|
||||
"MSH|^~\&|||||||ORU^R01|00001|P|2.3.1|\n" . "OBX|1||11^AA|\n" . "OBX|1||22^BB|\n",
|
||||
$msg->toString(true)
|
||||
);
|
||||
|
||||
$msg = Hl7::from("MSH|^~\&|||||||ORU^R01|00001|P|2.3.1|\n" . "PID|||3^0\n")
|
||||
->autoIncrementIndices(false)
|
||||
->createMessage();
|
||||
self::assertSame(
|
||||
"MSH|^~\&|||||||ORU^R01|00001|P|2.3.1|\n" . "PID|||3^0|\n",
|
||||
$msg->toString(true),
|
||||
"With auto-incrementing off, a segment index shouldn't be inserted if not present"
|
||||
);
|
||||
}
|
||||
|
||||
/** @test
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function repetition_separation_character_can_be_ignored(): void
|
||||
{
|
||||
$message = Hl7::from("MSH|^~\&|||||||ADT^A01||P|2.3.1|\nPID|||3^0~4^1")
|
||||
->createMessage();
|
||||
self::assertIsArray(
|
||||
$message->getSegmentByIndex(1)->getField(3),
|
||||
'By default repetition should be split into array'
|
||||
);
|
||||
|
||||
$message = Hl7::from("MSH|^~\&|||||||ADT^A01||P|2.3.1|\nPID|||3^0~4^1")
|
||||
->doNotSplitRepetition() // Ignore repetition separator character
|
||||
->createMessage();
|
||||
$patientIdentifierList = $message->getSegmentByIndex(1)->getField(3);
|
||||
self::assertIsArray($patientIdentifierList);
|
||||
self::assertSame(['3', '0~4', '1'], $patientIdentifierList);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_throws_exception_when_multiple_character_property_is_provided(): void
|
||||
{
|
||||
$this->expectException(HL7Exception::class);
|
||||
$this->expectExceptionMessage("Parameter should be a single character. Received: 'aa'");
|
||||
HL7::build()->withSegmentSeparator('aa');
|
||||
}
|
||||
}
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Tests;
|
||||
|
||||
use Aranyasen\Exceptions\HL7Exception;
|
||||
use Aranyasen\HL7\Message;
|
||||
use Aranyasen\HL7\Messages\ACK;
|
||||
use Exception;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Trait Hl7ListenerTrait
|
||||
*
|
||||
* Create a TCP socket server to receive HL7 messages. It responds to HL7 messages with an ACK
|
||||
* It also creates a pipe so client can get back exactly what it sent. Useful for testing...
|
||||
* To close the server, send "\n" or "shutdown\n"
|
||||
* @package Aranyasen\HL7\Tests
|
||||
*/
|
||||
trait Hl7ListenerTrait
|
||||
{
|
||||
private string $pipeName = "pipe1";
|
||||
|
||||
// As per MLLP protocol, the sender prefixes and suffixes the HL7 message with certain codes. If these need to be
|
||||
// overwritten, simply declare these after the 'use Hl7ListenerTrait' statement in the calling class
|
||||
protected string $MESSAGE_PREFIX = "\013";
|
||||
protected string $MESSAGE_SUFFIX = "\034\015";
|
||||
|
||||
public function writeToPipe(string $value): void
|
||||
{
|
||||
$pipe = fopen($this->pipeName, 'wb');
|
||||
fwrite($pipe, $value);
|
||||
}
|
||||
|
||||
public function readFromPipe(): string
|
||||
{
|
||||
$pipe = fopen($this->pipeName, 'rb');
|
||||
return fread($pipe, 1024);
|
||||
}
|
||||
|
||||
public function getWhatServerGot(): string
|
||||
{
|
||||
return $this->readFromPipe();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $port
|
||||
* @param int $totalClientsToConnect How many clients are expected to connect to this server, once it's up
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function createTcpServer(int $port, int $totalClientsToConnect): void
|
||||
{
|
||||
if (!extension_loaded('sockets')) {
|
||||
throw new RuntimeException("need ext-sockets to run this");
|
||||
}
|
||||
if (($socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) {
|
||||
throw new RuntimeException(
|
||||
'socket_create() failed: reason: ' . socket_strerror(socket_last_error()) . "\n"
|
||||
);
|
||||
}
|
||||
|
||||
// This is to avoid "address already in use" error while doing ->bind()
|
||||
if (!socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1)) {
|
||||
echo socket_strerror(socket_last_error($socket));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (($ret = socket_bind($socket, "localhost", $port)) === false) {
|
||||
throw new RuntimeException('socket_bind() failed: reason: ' . socket_strerror($ret) . "\n");
|
||||
}
|
||||
if (($ret = socket_listen($socket, 5)) === false) {
|
||||
throw new RuntimeException('socket_listen() failed: reason: ' . socket_strerror($ret) . "\n");
|
||||
}
|
||||
|
||||
$clientCount = 0;
|
||||
while (true) { // Loop over each client
|
||||
if (($clientSocket = socket_accept($socket)) === false) {
|
||||
echo 'socket_accept() failed: reason: ' . socket_strerror(socket_last_error()) . "\n";
|
||||
socket_close($clientSocket);
|
||||
exit();
|
||||
}
|
||||
if ($clientSocket === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$clientCount++;
|
||||
$clientName = 'Unknown';
|
||||
socket_getpeername($clientSocket, $clientName);
|
||||
// echo "Client {$clientCount} ({$clientName}) connected\n"; // Uncomment to debug
|
||||
|
||||
while (true) { // Keep reading a given client until they send "shutdown" or an empty string
|
||||
$buffer = socket_read($clientSocket, 1024); // Keeps reading until bytes exhaust, /n or /r
|
||||
if (false === $buffer) {
|
||||
break;
|
||||
}
|
||||
// echo "\n--- From client: '$buffer' ---\n\n"; // Uncomment to debug
|
||||
if (!$buffer || empty(trim($buffer)) || false !== stripos($buffer, 'shutdown')) {
|
||||
break;
|
||||
}
|
||||
|
||||
$ackString = $this->getAckString($buffer);
|
||||
$message = $this->MESSAGE_PREFIX . $ackString . $this->MESSAGE_SUFFIX;
|
||||
socket_write($clientSocket, $message, strlen($message));
|
||||
|
||||
// Also write to a pipe/msg queue for client to get the actual message
|
||||
$this->writeToPipe($buffer);
|
||||
}
|
||||
|
||||
socket_shutdown($clientSocket);
|
||||
socket_close($clientSocket);
|
||||
|
||||
if ($totalClientsToConnect > 0 && $clientCount >= $totalClientsToConnect) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
socket_close($socket);
|
||||
exit(0); // Child process needs it
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $socket
|
||||
*/
|
||||
public function closeTcpSocket($socket): void
|
||||
{
|
||||
$msg = "\n"; // Or send "shutdown\n"
|
||||
socket_write($socket, $msg, strlen($msg)); // Tell the client to shutdown
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string ACK string
|
||||
* @throws HL7Exception
|
||||
* @throws Exception
|
||||
*/
|
||||
private function getAckString(string $hl7): string
|
||||
{
|
||||
// Remove message prefix and suffix
|
||||
$hl7 = preg_replace('/^' . $this->MESSAGE_PREFIX . '/', '', $hl7);
|
||||
$hl7 = preg_replace('/' . $this->MESSAGE_SUFFIX . '$/', '', $hl7);
|
||||
|
||||
$msg = new Message(trim($hl7), null, true, true);
|
||||
return (new ACK($msg))->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up temporary pipe file generated for testing
|
||||
*/
|
||||
private function deletePipe(): void
|
||||
{
|
||||
if (file_exists($this->pipeName)) {
|
||||
unlink($this->pipeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
+638
@@ -0,0 +1,638 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Tests;
|
||||
|
||||
use Aranyasen\Exceptions\HL7Exception;
|
||||
use Aranyasen\HL7\Message;
|
||||
use Aranyasen\HL7\Segment;
|
||||
use Aranyasen\HL7\Segments\MSH;
|
||||
use Aranyasen\HL7\Segments\OBR;
|
||||
use Aranyasen\HL7\Segments\OBX;
|
||||
use Aranyasen\HL7\Segments\PID;
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
use DMS\PHPUnitExtensions\ArraySubset\Assert;
|
||||
|
||||
class MessageTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
public function segments_can_be_retrieved_using_index(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\rABC|\r");
|
||||
self::assertSame('ABC', $msg->getSegmentByIndex(1)->getName());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function segmentByIndex_returns_null_when_target_index_is_beyond_the_total_number_of_segments(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\rABC|\r");
|
||||
self::assertNull($msg->getSegmentByIndex(2));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_throws_error_when_field_separator_control_char_doesnt_match_the_actual_field_separators(): void
|
||||
{
|
||||
$this->expectException(HL7Exception::class);
|
||||
$msg = new Message("MSH|^~\\&#\r");
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @throws Exception
|
||||
*/
|
||||
public function subfields_can_be_retained_when_required(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\rPV1|1|O|^AAAA1^^^BB|", null, true);
|
||||
$pv1 = $msg->getSegmentByIndex(1);
|
||||
$fields = $pv1->getField(3);
|
||||
Assert::assertArraySubset(['', 'AAAA1', '', '', 'BB'], $fields);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function segments_can_be_added_to_existing_message(): void
|
||||
{
|
||||
$msg = new Message();
|
||||
$msg->addSegment(new MSH());
|
||||
$msg->addSegment(new Segment('PID'));
|
||||
|
||||
$seg0 = $msg->getSegmentByIndex(0);
|
||||
$seg1 = $msg->getSegmentByIndex(1);
|
||||
|
||||
self::assertSame('MSH', $seg0->getName(), 'Segment 0 name MSH');
|
||||
self::assertSame('PID', $seg1->getName(), 'Segment 1 name PID');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function fields_can_be_added_to_existing_segments(): void
|
||||
{
|
||||
$msg = new Message();
|
||||
$msg->addSegment(new MSH());
|
||||
$msg->addSegment(new Segment('ABC'));
|
||||
$seg0 = $msg->getSegmentByIndex(0);
|
||||
$seg1 = $msg->getSegmentByIndex(1);
|
||||
|
||||
$seg0->setField(3, 'XXX');
|
||||
$seg1->setField(2, 'Foo');
|
||||
|
||||
self::assertSame('XXX', $seg0->getField(3), '3d field of MSH');
|
||||
self::assertSame('Foo', $seg1->getField(2), '2nd field of ABC');
|
||||
self::assertSame('XXX', $msg->getSegmentByIndex(0)->getField(3), '3d field of MSH');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function control_characters_are_properly_set_from_MSH_Segment(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\rABC|||xxx|\r");
|
||||
self::assertSame("^~\\&", $msg->getSegmentByIndex(0)->getField(2), 'Encoding characters');
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @throws Exception
|
||||
*/
|
||||
public function control_characters_can_be_customized_using_second_argument(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\nABC|||xxx|\n", ['SEGMENT_SEPARATOR' => '\r\n']);
|
||||
self::assertSame('MSH|^~\\&|1|\r\nABC|||xxx|\r\n', $msg->toString(), 'Custom line-endings');
|
||||
self::assertSame(
|
||||
"MSH|^~\\&|1|\r\nABC|||xxx|\r\n",
|
||||
$msg->toString(true),
|
||||
'toString() respects custom line-endings'
|
||||
);
|
||||
}
|
||||
|
||||
/** @test
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function message_can_be_converted_to_string(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\rABC|||xxx|\r");
|
||||
self::assertSame('MSH|^~\\&|1|\nABC|||xxx|\n', $msg->toString(), 'String representation of message');
|
||||
self::assertSame(
|
||||
"MSH|^~\\&|1|\nABC|||xxx|\n",
|
||||
$msg->toString(true),
|
||||
'Pretty print representation of message'
|
||||
);
|
||||
}
|
||||
|
||||
/** @test
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function toString_method_throws_exception_when_message_empty(): void
|
||||
{
|
||||
$msg = new Message();
|
||||
$this->expectException(HL7Exception::class);
|
||||
$msg->toString();
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function fields_and_subfields_can_be_set_properly(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\rABC|||xx^x&y&z^yy^zz|\r");
|
||||
$segment1 = $msg->getSegmentByIndex(1);
|
||||
$fields = $segment1->getField(3);
|
||||
|
||||
self::assertSame($fields[0], 'xx', 'Composed field');
|
||||
self::assertSame($fields[1][1], 'y', 'Subcomposed field');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function fields_can_be_separated_by_custom_character(): void
|
||||
{
|
||||
$msg = new Message("MSH*^~\\&*1\rABC***xxx\r"); // Use * as a field separator
|
||||
|
||||
self::assertSame(
|
||||
'MSH*^~\&*1*\nABC***xxx*\n',
|
||||
$msg->toString(),
|
||||
'String representation of message with * as field separator'
|
||||
);
|
||||
self::assertSame('1', $msg->getSegmentByIndex(0)->getField(3), '3d field of MSH');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function components_of_a_field_can_be_separated_by_custom_character(): void
|
||||
{
|
||||
$msg = new Message("MSH|*~\\&|1\rABC|||x*y*z\r");
|
||||
$field = $msg->getSegmentByIndex(1)->getField(3);
|
||||
self::assertSame('x', $field[0], 'Composed field with * as separator between subfields');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function subcomponents_can_be_separated_by_custom_character(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\@|1\rABC|||a^x@y@z^b\r");
|
||||
$field = $msg->getSegmentByIndex(1)->getField(3);
|
||||
self::assertSame('y', $field[1][1], 'Subcomposed field with @ as separator');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function segments_can_be_added_from_message(): void
|
||||
{
|
||||
$msg = new Message();
|
||||
$msg->addSegment(new Segment('XXX'));
|
||||
self::assertSame('XXX', $msg->getSegmentByIndex(0)->getName(), 'Add segment');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function segment_can_be_removed_from_message(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\nAAA|1||xxx|\nBBB|1|\nBBB|2|");
|
||||
$segment = $msg->getFirstSegmentInstance('BBB');
|
||||
$msg->removeSegment($segment);
|
||||
self::assertSame("MSH|^~\\&|1|\nAAA|1||xxx|\nBBB|2|\n", $msg->toString(true));
|
||||
|
||||
$msg = new Message("MSH|^~\\&|1|\nAAA|1||xxx|\nBBB|1|a|\nBBB|2|b|\nBBB|3|c|");
|
||||
$segment = $msg->getSegmentsByName('BBB')[1];
|
||||
$msg->removeSegment($segment, true);
|
||||
self::assertSame(
|
||||
"MSH|^~\\&|1|\nAAA|1||xxx|\nBBB|1|a|\nBBB|2|c|\n",
|
||||
$msg->toString(true),
|
||||
'Should reset index of subsequent segments'
|
||||
);
|
||||
|
||||
$msg = new Message("MSH|^~\\&|1|\nAAA|1||xxx|\nPID|1|\nBBB|2|");
|
||||
$segment = $msg->getFirstSegmentInstanceByClass(PID::class);
|
||||
$msg->removeSegment($segment);
|
||||
self::assertSame("MSH|^~\\&|1|\nAAA|1||xxx|\nBBB|2|\n", $msg->toString(true));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function segments_can_be_removed_from_message_using_index(): void
|
||||
{
|
||||
$msg = new Message();
|
||||
$msg->addSegment(new Segment('XXX'));
|
||||
$msg->addSegment(new Segment('YYY'));
|
||||
$msg->removeSegmentByIndex(0);
|
||||
self::assertSame('YYY', $msg->getSegmentByIndex(0)->getName(), 'Remove segment');
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @throws Exception
|
||||
*/
|
||||
public function segments_can_be_removed_by_name(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\nAAA|1||xxx|\nAAA|2||\nBBB|1|\n");
|
||||
$count = $msg->removeSegmentsByName('AAA');
|
||||
self::assertSame("MSH|^~\\&|1|\nBBB|1|\n", $msg->toString(true), 'Removes consecutive segments');
|
||||
self::assertSame(2, $count);
|
||||
|
||||
$msg = new Message("MSH|^~\\&|1|\nAAA|1||xxx|\nBBB|1|\nAAA|2|\n");
|
||||
$count = $msg->removeSegmentsByName('AAA');
|
||||
self::assertSame("MSH|^~\\&|1|\nBBB|1|\n", $msg->toString(true), 'removes non-consecutive segments');
|
||||
self::assertSame(2, $count);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function a_new_segment_can_be_inserted_between_two_existing_segments(): void
|
||||
{
|
||||
$msg = new Message();
|
||||
$msg->addSegment(new Segment('AAA'));
|
||||
$msg->addSegment(new Segment('BBB'));
|
||||
$msg->insertSegment(new Segment('XXX'), 1);
|
||||
|
||||
self::assertSame('XXX', $msg->getSegmentByIndex(1)->getName(), 'Inserted segment');
|
||||
self::assertSame('BBB', $msg->getSegmentByIndex(2)->getName(), 'Existing segment should shift');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function MSH_segment_can_be_inserted_with_new_control_characters(): void
|
||||
{
|
||||
$msg = new Message();
|
||||
$msh = new MSH(['MSH', '#~\&', '', '', '', '', '', '', ['AAA', 'BBB'], '', '', '555']);
|
||||
$msg->insertSegment($msh, 0);
|
||||
self::assertSame('MSH', $msg->getSegmentByIndex(0)->getName(), 'Inserted MSH');
|
||||
self::assertSame(
|
||||
'MSH|#~\&|||||||AAA#BBB|||555|\n',
|
||||
$msg->toString(),
|
||||
'Component separator should be # and version should be 555'
|
||||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function insertSegment_appends_when_the_target_index_is_same_as_the_count_of_total_segments(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\rAAA|1", null, true);
|
||||
$msg->insertSegment(new Segment('XXX'), 2);
|
||||
self::assertSame('MSH|^~\&|1|\nAAA|1|\nXXX|\n', $msg->toString());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_should_not_be_possible_to_insert_segment_beyond_last_index(): void
|
||||
{
|
||||
$msg = new Message();
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$msg->insertSegment(new Segment('ZZ1'), 3);
|
||||
self::assertEmpty($msg->getSegmentByIndex(3), 'Erroneous insert');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function a_segment_can_be_overwritten(): void
|
||||
{
|
||||
$msg = new Message();
|
||||
$msg->addSegment(new Segment('AAA'));
|
||||
$msg->setSegment(new Segment('BBB'), 0);
|
||||
self::assertCount(0, $msg->getSegmentsByName('AAA'), 'No AAA segment anymore');
|
||||
self::assertSame('BBB', $msg->getSegmentByIndex(0)->getName(), 'BBB should have replaced AAA');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function setSegment_throws_exception_when_the_target_index_is_beyond_total_count_of_segments(): void
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$msg = new Message("MSH|^~\\&|1|\nAAA|1|\n");
|
||||
$msg->setSegment(new Segment('BBB'), 3);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function setSegment_resets_control_characters_when_adding_MSH_segment_at_0th_index(): void
|
||||
{
|
||||
$msg = new Message();
|
||||
$msh = new MSH(['MSH', '#~\&', '', '', '', '', '', '', ['AAA', 'BBB'], '', '', '555']);
|
||||
$msg->setSegment($msh, 0);
|
||||
self::assertSame(
|
||||
'MSH|#~\&|||||||AAA#BBB|||555|\n',
|
||||
$msg->toString(),
|
||||
'Component separator should be # and version should be 555'
|
||||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function same_segment_type_can_be_added_multiple_times(): void
|
||||
{
|
||||
$msg = new Message();
|
||||
$msg->addSegment(new Segment('AAA'));
|
||||
$msg->addSegment(new Segment('AAA'));
|
||||
self::assertCount(2, $msg->getSegmentsByName('AAA'), 'Message should have 2 AAAs');
|
||||
}
|
||||
|
||||
/** @test
|
||||
* @throws Exception
|
||||
*/
|
||||
public function field_separator_can_be_changed_after_message_creation(): void
|
||||
{
|
||||
$msg = new Message();
|
||||
$msh = new MSH([]);
|
||||
|
||||
$msh->setField(1, '*');
|
||||
$msh->setField(2, 'abcd');
|
||||
$msg->addSegment($msh);
|
||||
self::assertSame('MSH*abcd*\n', $msg->toString(), '* should be used as field separator');
|
||||
|
||||
$msh->setField(1, '|');
|
||||
self::assertSame('MSH|abcd|\n', $msg->toString(), 'Field separator should be changed to |');
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @throws Exception
|
||||
*/
|
||||
public function a_message_can_be_constructed_from_a_string(): void
|
||||
{
|
||||
$str = 'MSH|^~\&|Aranya HL7|Aranya HQ|VISION|MISYS|200404061744||DFT^P03|TC-2743|P^T|2.3|||AL|NE||ASCII||| |';
|
||||
$msg = new Message($str);
|
||||
self::assertCount(1, $msg->getSegments(), 'Message from string');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function a_message_can_be_converted_to_a_string(): void
|
||||
{
|
||||
$str = 'MSH|^~\&|Aranya HL7|Aranya HQ|VISION|MISYS|200404061744||DFT^P03|TC-2743|P^T|2.3|||AL|NE||ASCII||| |';
|
||||
$msg = new Message($str);
|
||||
self::assertSame("$str\n", $msg->toString(true), 'Message to string with subcomponents');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function a_segment_can_be_retrieved_as_a_string(): void
|
||||
{
|
||||
$msg = new Message("MSH*^~\\&*1\rXXX*a^b^c*a^b1&b2^c*xxx\r");
|
||||
self::assertSame("MSH*^~\\&*1*", $msg->getSegmentAsString(0), 'MSH segment as string');
|
||||
|
||||
$xxx = new Segment('XXX');
|
||||
$xxx->setField(2, ['a', ['b1', 'b2'], 'c']);
|
||||
$msg->addSegment($xxx);
|
||||
|
||||
self::assertSame('XXX*a^b^c*a^b1&b2^c*xxx*', $msg->getSegmentAsString(1), 'XXX segment as string');
|
||||
self::assertSame('XXX**a^b1&b2^c*', $msg->getSegmentAsString(2), 'XXX segment as string');
|
||||
|
||||
// Get segment field as string
|
||||
self::assertSame('1', $msg->getSegmentFieldAsString(0, 3), 'MSH(3) as string');
|
||||
self::assertSame('a^b1&b2^c', $msg->getSegmentFieldAsString(1, 2), 'XXX(2) as string');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function getSegmentAsString_returns_null_if_the_target_segment_doesnt_exist(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\nABC|");
|
||||
self::assertNull($msg->getSegmentAsString(5));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function getSegmentFieldAsString_returns_null_if_the_target_segment_doesnt_exist(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\nABC|");
|
||||
self::assertNull($msg->getSegmentFieldAsString(5, 1));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function getSegmentFieldAsString_returns_null_if_the_target_field_doesnt_exist(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\nABC|");
|
||||
self::assertNull($msg->getSegmentFieldAsString(1, 5));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function an_exception_will_be_throw_in_invalid_string(): void
|
||||
{
|
||||
$this->expectException(HL7Exception::class);
|
||||
$this->expectExceptionMessage('Not a valid message: invalid control segment');
|
||||
new Message("I'm an invalid message");
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function segment_ending_bar_can_be_omitted(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\nABC|||xxx|\n", ['SEGMENT_ENDING_BAR' => false]);
|
||||
self::assertSame("MSH|^~\\&|1\nABC|||xxx\n", $msg->toString(true), 'No ending bar on each segment');
|
||||
|
||||
$msg = new Message("MSH|^~\\&|1|\nABC|||xxx|\n");
|
||||
self::assertSame("MSH|^~\\&|1|\nABC|||xxx|\n", $msg->toString(true), 'Ending bar retains by default');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function segment_index_can_be_retrieved_from_a_message(): void
|
||||
{
|
||||
$message = new Message("MSH|^~\\&|1|\n");
|
||||
$pid = new PID();
|
||||
$message->addSegment($pid);
|
||||
self::assertSame(1, $message->getSegmentIndex($pid));
|
||||
|
||||
$message = new Message("MSH|^~\\&|1|\nABC|||xxx|\n");
|
||||
$pid = new PID();
|
||||
$message->addSegment($pid);
|
||||
self::assertSame(2, $message->getSegmentIndex($pid));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function segmentIndex_returns_null_if_the_target_segment_is_not_found(): void
|
||||
{
|
||||
$message = new Message("MSH|^~\\&|1|\nABC|\n");
|
||||
self::assertNull($message->getSegmentIndex(new Segment('XXX')));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function message_type_can_be_checked(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\&|||||||ORM^O01||P|2.3.1|");
|
||||
self::assertTrue($msg->isOrm());
|
||||
self::assertFalse($msg->isOru());
|
||||
self::assertFalse($msg->isSiu());
|
||||
|
||||
$msg = new Message("MSH|^~\&|||||||ORU^O01||P|2.3.1|");
|
||||
self::assertTrue($msg->isOru());
|
||||
self::assertFalse($msg->isOrm());
|
||||
self::assertFalse($msg->isSiu());
|
||||
|
||||
$msg = new Message("MSH|^~\&|||||||SIU^S12||P|2.3.1|");
|
||||
self::assertTrue($msg->isSiu());
|
||||
self::assertFalse($msg->isOrm());
|
||||
self::assertFalse($msg->isOru());
|
||||
|
||||
$msg = new Message("MSH|^~\&|||||||ADT^A01|");
|
||||
self::assertTrue($msg->isAdt());
|
||||
self::assertFalse($msg->isOrm());
|
||||
self::assertFalse($msg->isOru());
|
||||
}
|
||||
|
||||
/**
|
||||
* The segment classes use static properties to maintain segment-index. This is required as one can add new segments
|
||||
* to a given message object and expect the index to auto-increment. The side effect to this is, if you create a
|
||||
* second message, adding the same segments will now start indexing from their index in the last message instead of
|
||||
* 1! This happens because static properties are class properties, not object ones, and thus shared across all
|
||||
* objects.
|
||||
*
|
||||
* To counter this, use 'true' in the 4th argument while creating a message, or call resetSegmentIndices()
|
||||
* explicitly.
|
||||
*
|
||||
* This test verifies both.
|
||||
*
|
||||
* @test
|
||||
* @throws Exception
|
||||
*/
|
||||
public function segment_id_can_be_reset_on_demand(): void
|
||||
{
|
||||
PID::resetIndex(); // Start with a clean slate
|
||||
|
||||
// Create a message with a PID segment
|
||||
$msg1 = new Message("MSH|^~\&|||||||ORM^O01||P|2.3.1|");
|
||||
$msg1->addSegment(new PID());
|
||||
self::assertSame(
|
||||
"MSH|^~\&|||||||ORM^O01||P|2.3.1|\nPID|1|\n",
|
||||
$msg1->toString(true),
|
||||
'PID index in first message is 1'
|
||||
);
|
||||
|
||||
// Create another message with a PID segment
|
||||
$msg2 = new Message("MSH|^~\&|||||||ORM^O01||P|2.3.1|");
|
||||
$msg2->addSegment(new PID());
|
||||
self::assertSame(
|
||||
"MSH|^~\&|||||||ORM^O01||P|2.3.1|\nPID|2|\n",
|
||||
$msg2->toString(true),
|
||||
'PID index gets incremented'
|
||||
);
|
||||
|
||||
// Create another message with a PID segment, this time 4th argument to message as true
|
||||
$msg3 = new Message("MSH|^~\&|||||||ORM^O01||P|2.3.1|", resetIndices: true);
|
||||
$msg3->addSegment(new PID());
|
||||
self::assertSame("MSH|^~\&|||||||ORM^O01||P|2.3.1|\nPID|1|\n", $msg3->toString(true), 'PID index resets to 1');
|
||||
|
||||
// Create a message with a PID segment
|
||||
$msg4 = new Message("MSH|^~\&|||||||ORM^O01||P|2.3.1|");
|
||||
$msg4->addSegment(new PID());
|
||||
self::assertSame(
|
||||
"MSH|^~\&|||||||ORM^O01||P|2.3.1|\nPID|2|\n",
|
||||
$msg4->toString(true),
|
||||
'PID index gets incremented'
|
||||
);
|
||||
|
||||
$msg5 = new Message("MSH|^~\&|||||||ORM^O01||P|2.3.1|");
|
||||
$msg5->resetSegmentIndices();
|
||||
$msg5->addSegment(new PID());
|
||||
self::assertSame("MSH|^~\&|||||||ORM^O01||P|2.3.1|\nPID|1|\n", $msg5->toString(true), 'PID index resets to 1');
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @throws Exception
|
||||
*/
|
||||
public function segment_index_autoincrement_can_be_avoided(): void
|
||||
{
|
||||
$hl7String = "MSH|^~\&|||||||ORU^R01|00001|P|2.3.1|\n" . "OBX|1||11^AA|\n" . "OBX|1||22^BB|\n";
|
||||
|
||||
$msg = new Message($hl7String, resetIndices: true);
|
||||
self::assertSame(
|
||||
"MSH|^~\&|||||||ORU^R01|00001|P|2.3.1|\n" . "OBX|1||11^AA|\n" . "OBX|2||22^BB|\n",
|
||||
$msg->toString(true),
|
||||
'without 5th argument as false, each instance is auto-incremented'
|
||||
);
|
||||
|
||||
$msg = new Message($hl7String, null, true, true, false);
|
||||
self::assertSame(
|
||||
"MSH|^~\&|||||||ORU^R01|00001|P|2.3.1|\n" . "OBX|1||11^AA|\n" . "OBX|1||22^BB|\n",
|
||||
$msg->toString(true)
|
||||
);
|
||||
|
||||
$msg = new Message("MSH|^~\&|||||||ORU^R01|00001|P|2.3.1|\n" . "PID|||3^0\n", null, true, false, false);
|
||||
self::assertSame(
|
||||
"MSH|^~\&|||||||ORU^R01|00001|P|2.3.1|\n" . "PID|||3^0|\n",
|
||||
$msg->toString(true),
|
||||
"With auto-incrementing off, a segment index shouldn't be inserted if not present"
|
||||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function a_segments_presence_can_be_checked(): void
|
||||
{
|
||||
$message = new Message("MSH|^~\&|||||||ORM^O01||P|2.3.1|");
|
||||
self::assertFalse($message->hasSegment('PID'));
|
||||
|
||||
$message->addSegment(new PID());
|
||||
self::assertTrue($message->hasSegment('PID'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function first_of_the_given_segment_name_can_be_easily_obtained_using_a_helper_method(): void
|
||||
{
|
||||
$message = new Message("MSH|^~\&|||||||ORM^O01||P|2.3.1|");
|
||||
$message->addSegment(new PID());
|
||||
$firstPidSegment = $message->getFirstSegmentInstance('PID');
|
||||
self::assertNotNull($firstPidSegment);
|
||||
self::assertIsObject($firstPidSegment);
|
||||
self::assertInstanceOf(PID::class, $firstPidSegment);
|
||||
|
||||
$firstPidSegment = $message->getFirstSegmentInstanceByClass(PID::class);
|
||||
self::assertNotNull($firstPidSegment);
|
||||
self::assertIsObject($firstPidSegment);
|
||||
self::assertInstanceOf(PID::class, $firstPidSegment);
|
||||
|
||||
self::assertNull($message->getFirstSegmentInstance('XXX'), 'Non existing segment should return null');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function message_can_be_verified_as_empty(): void
|
||||
{
|
||||
self::assertTrue((new Message())->isEmpty());
|
||||
self::assertFalse((new Message("MSH|^~\&|||||||ORM^O01||P|2.3.1|"))->isEmpty());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function field_with_repetition_separator_splits_into_array_by_default(): void
|
||||
{
|
||||
$message = new Message("MSH|^~\&|||||||ADT^A01||P|2.3.1|\nPID|||3^0~4^1"); // Repetition separator is ~
|
||||
$patientIdentifierList = $message->getSegmentByIndex(1)->getField(3);
|
||||
self::assertIsArray($patientIdentifierList);
|
||||
self::assertSame('3', $patientIdentifierList[0][0]);
|
||||
self::assertSame('0', $patientIdentifierList[0][1]);
|
||||
self::assertSame('4', $patientIdentifierList[1][0]);
|
||||
self::assertSame('1', $patientIdentifierList[1][1]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function field_with_repetition_separator_can_be_split_into_array(): void
|
||||
{
|
||||
$message = new Message("MSH|^~\&|||||||ADT^A01||P|2.3.1|\nPID|||3^0~4^1", doNotSplitRepetition: false);
|
||||
$patientIdentifierList = $message->getSegmentByIndex(1)->getField(3);
|
||||
self::assertIsArray($patientIdentifierList);
|
||||
self::assertSame('3', $patientIdentifierList[0][0]);
|
||||
self::assertSame('0', $patientIdentifierList[0][1]);
|
||||
self::assertSame('4', $patientIdentifierList[1][0]);
|
||||
self::assertSame('1', $patientIdentifierList[1][1]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function repetition_separation_character_can_be_ignored(): void
|
||||
{
|
||||
$message = new Message("MSH|^~\&|||||||ADT^A01||P|2.3.1|\nPID|||3^0~4^1", doNotSplitRepetition: true);
|
||||
$pid = $message->getSegmentByIndex(1);
|
||||
$patientIdentifierList = $pid->getField(3);
|
||||
self::assertIsArray($patientIdentifierList);
|
||||
self::assertSame(['3', '0~4', '1'], $patientIdentifierList);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function a_message_can_be_saved_in_a_file(): void
|
||||
{
|
||||
$hl7File = __DIR__ . DIRECTORY_SEPARATOR . 'hl7_test_' . random_int(100, 1000) . '.hl7';
|
||||
$message = new Message("MSH|^~\&|");
|
||||
$message->toFile($hl7File);
|
||||
self::assertFileExists($hl7File);
|
||||
self::assertSame($message->toString(true), file_get_contents($hl7File));
|
||||
if (file_exists($hl7File)) {
|
||||
unlink($hl7File);
|
||||
}
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function segments_can_be_retrieved_by_class(): void
|
||||
{
|
||||
$message = new Message(
|
||||
"MSH|^~\&|||||||ADT^A01||P|2.3.1|\nPID|||3^0~4^1\nOBX|1|||\nOBX|2|||",
|
||||
doNotSplitRepetition: true
|
||||
);
|
||||
$MSHs = $message->getSegmentsByClass(MSH::class);
|
||||
self::assertCount(1, $MSHs);
|
||||
self::assertInstanceOf(MSH::class, $MSHs[0]);
|
||||
$PIDs = $message->getSegmentsByClass(PID::class);
|
||||
self::assertCount(1, $PIDs);
|
||||
self::assertInstanceOf(PID::class, $PIDs[0]);
|
||||
$OBXs = $message->getSegmentsByClass(OBX::class);
|
||||
self::assertCount(2, $OBXs);
|
||||
self::assertInstanceOf(OBX::class, $OBXs[0]);
|
||||
$OBRs = $message->getSegmentsByClass(OBR::class);
|
||||
self::assertCount(0, $OBRs);
|
||||
}
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Tests;
|
||||
|
||||
use Aranyasen\HL7\Segment;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class SegmentTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
public function it_throws_error_when_segment_name_has_less_than_3_characters(): void
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
new Segment('XX');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_throws_exception_when_a_blank_string_is_passed_as_segment_name(): void
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
new Segment('');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_throws_exception_when_segment_name_is_not_in_upper_case(): void
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
new Segment('xxx');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function field_at_a_given_nonzero_index_can_be_set(): void
|
||||
{
|
||||
$seg = new Segment('XXX');
|
||||
$seg->setField(1, 'YYY');
|
||||
self::assertSame('YYY', $seg->getField(1), 'Field 1 is YYY');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function field_at_index_0_can_not_be_changed(): void
|
||||
{
|
||||
$seg = new Segment('XXX');
|
||||
$seg->setField(0, 'YYY');
|
||||
self::assertNotSame('YYY', $seg->getField(0), 'Field 0 has not been changed');
|
||||
self::assertSame('XXX', $seg->getField(0), 'Field 0 is still the same');
|
||||
self::assertSame('XXX', $seg->getName(), 'Segment name is still the same');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function a_segment_can_be_constructed_from_an_array(): void
|
||||
{
|
||||
$seg = new Segment('XXX', ['a', 'b', 'c', ['p', 'q', 'r'], 'd']);
|
||||
self::assertSame('c', $seg->getField(3), 'Constructor with array');
|
||||
self::assertSame('r', $seg->getField(4)[2], 'Constructor with array for composed fields');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function field_can_be_cleared(): void
|
||||
{
|
||||
$segment = new Segment('XXX', ['a']);
|
||||
self::assertSame('a', $segment->getField(1));
|
||||
$segment->clearField(1);
|
||||
self::assertNull($segment->getField(1), 'Field 1 should be NULL');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function field_can_be_set_using_array(): void
|
||||
{
|
||||
$seg = new Segment('XXX');
|
||||
$seg->setField(3, ['1', '2', '3']);
|
||||
self::assertIsArray($seg->getField(3), 'Composed field 1^2^3');
|
||||
self::assertCount(3, $seg->getField(3), 'Getting composed fields as array');
|
||||
self::assertSame('2', $seg->getField(3)[1], 'Getting single value from composed field');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function fields_from_a_given_position_to_end_can_be_retrieved_in_an_array(): void
|
||||
{
|
||||
$seg = new Segment('XXX');
|
||||
$seg->setField(8, 'aaa');
|
||||
self::assertCount(7, $seg->getFields(2), 'Getting all fields from 2nd index');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function a_chunk_of_fields_can_be_retrieved_from_a_segment(): void
|
||||
{
|
||||
$seg = new Segment('XXX');
|
||||
$seg->setField(8, 'aaa');
|
||||
self::assertCount(3, $seg->getFields(2, 4), 'Getting fields from 2 till 4');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function setting_field_beyond_last_index_creates_empty_fields_in_between(): void
|
||||
{
|
||||
$seg = new Segment('XXX');
|
||||
$seg->setField(8, 'aaa');
|
||||
self::assertCount(9, $seg->getFields(), 'Number of fields in segment');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function total_size_of_a_segment_can_be_obtained(): void
|
||||
{
|
||||
$seg = new Segment('XXX');
|
||||
$seg->setField(8, ['']);
|
||||
self::assertSame(8, $seg->size(), 'Size operator');
|
||||
$seg->setField(12, 'x');
|
||||
self::assertSame(12, $seg->size(), 'Size operator');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function a_field_can_have_0_as_a_value(): void
|
||||
{
|
||||
$segment = new Segment('XXX');
|
||||
|
||||
$segment->setField(1, 0);
|
||||
self::assertSame(0, $segment->getField(1));
|
||||
|
||||
$segment->setField(1, '0');
|
||||
self::assertSame('0', $segment->getField(1));
|
||||
}
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Tests\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segments\MSH;
|
||||
use Aranyasen\HL7\Tests\TestCase;
|
||||
use Exception;
|
||||
|
||||
class MSHTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
public function MSH_formed_without_any_arguments_should_have_mandatory_fields_set_automatically(): void
|
||||
{
|
||||
$msh = new MSH();
|
||||
self::assertSame('|', $msh->getField(1));
|
||||
self::assertSame('^~\\&', $msh->getField(2));
|
||||
self::assertSame('2.3', $msh->getVersionId());
|
||||
self::assertNotEmpty($msh->getDateTimeOfMessage());
|
||||
self::assertMatchesRegularExpression('/\d{14}/', $msh->getDateTimeOfMessage());
|
||||
self::assertNotEmpty($msh->getMessageControlId());
|
||||
}
|
||||
|
||||
/** @test
|
||||
* @throws Exception
|
||||
*/
|
||||
public function an_array_of_fields_can_be_passed_to_constructor_to_construct_MSH(): void
|
||||
{
|
||||
$msh = new MSH(
|
||||
[
|
||||
'MSH', '^~\&', 'HL7 Corp', 'HL7 HQ', 'VISION', 'MISYS', '200404061744', '', ['DFT', 'P03'], 'TC-22222',
|
||||
'T', '2.3',
|
||||
]
|
||||
);
|
||||
self::assertSame(
|
||||
[
|
||||
'MSH', '', '^~\&', 'HL7 Corp', 'HL7 HQ', 'VISION', 'MISYS', '200404061744', '', ['DFT', 'P03'],
|
||||
'TC-22222', 'T', '2.3',
|
||||
],
|
||||
$msh->getFields()
|
||||
);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function field_separator_can_be_set(): void
|
||||
{
|
||||
$msh = new MSH();
|
||||
$msh->setField(1, '*');
|
||||
self::assertSame('*', $msh->getField(1), 'MSH Field sep field (MSH(1))');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function more_than_one_character_as_field_separator_is_not_accepted(): void
|
||||
{
|
||||
$msh = new MSH();
|
||||
$msh->setField(1, 'xx');
|
||||
self::assertSame('|', $msh->getField(1), 'MSH Field sep field (MSH(1))');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function version_id_can_be_string_or_array_for_v2_7_onwards(): void
|
||||
{
|
||||
$msh = new MSH();
|
||||
$msh->setVersionId('2.3');
|
||||
self::assertSame('2.3', $msh->getVersionId());
|
||||
|
||||
$msh->setVersionId(['2.7', 'NZL', '1.0']);
|
||||
self::assertSame(['2.7', 'NZL', '1.0'], $msh->getVersionId());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function index_2_in_MSH_accepts_only_4_character_strings(): void
|
||||
{
|
||||
$msh = new MSH();
|
||||
$msh->setField(2, 'xxxx');
|
||||
self::assertSame('xxxx', $msh->getField(2), 'Special fields not changed');
|
||||
|
||||
$msh->setField(2, 'yyyyy');
|
||||
self::assertSame('xxxx', $msh->getField(2), 'Special fields not changed');
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Tests\Segments;
|
||||
|
||||
use Aranyasen\HL7\Message;
|
||||
use Aranyasen\HL7\Segments\NK1;
|
||||
use Aranyasen\HL7\Tests\TestCase;
|
||||
|
||||
class NK1Test extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
public function NK1_segment_can_be_parsed_from_a_HL7_message(): void
|
||||
{
|
||||
$msg = new Message("MSH|^~\\&|1|\nNK1|1|John^Doe|\n");
|
||||
$nk1Segments = $msg->getSegmentsByName('NK1');
|
||||
self::assertIsArray($nk1Segments);
|
||||
self::assertCount(1, $nk1Segments);
|
||||
self::assertSame(['John', 'Doe'], $nk1Segments[0]->getNKName());
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function next_of_kin_name_can_be_set_and_get(): void
|
||||
{
|
||||
$nk1Segment = new NK1();
|
||||
$nk1Segment->setNKName("John Doe");
|
||||
self::assertSame("John Doe", $nk1Segment->getNKName());
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Tests\Segments;
|
||||
|
||||
use Aranyasen\HL7\Segments\OBX;
|
||||
use Aranyasen\HL7\Tests\TestCase;
|
||||
|
||||
class OBXTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
public function segment_id_automatically_increments_when_a_new_instance_is_created(): void
|
||||
{
|
||||
OBX::resetIndex(); // Previous tests would have incremented the static $index variable
|
||||
|
||||
$obx = new OBX();
|
||||
$this->assertSame(1, $obx->getID());
|
||||
$obx = new OBX();
|
||||
$this->assertSame(2, $obx->getID());
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Aranyasen\HL7\Tests\Segments;
|
||||
|
||||
use Aranyasen\Exceptions\HL7Exception;
|
||||
use Aranyasen\HL7\Message;
|
||||
use Aranyasen\HL7\Segments\PID;
|
||||
use Aranyasen\HL7\Tests\TestCase;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class PIDTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider validSexValues
|
||||
* @test
|
||||
*/
|
||||
public function PID_8_should_accept_value_for_sex_as_per_hl7_standard(string $validSexValue): void
|
||||
{
|
||||
$pidSegment = (new PID());
|
||||
$pidSegment->setSex($validSexValue);
|
||||
self::assertSame($validSexValue, $pidSegment->getSex(), "Sex should have been set with '$validSexValue'");
|
||||
self::assertSame($validSexValue, $pidSegment->getField(8), "Sex should have been set with '$validSexValue'");
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider invalidSexValues
|
||||
* @test
|
||||
* @param string $invalidSexValue
|
||||
*/
|
||||
public function PID_8_should_not_accept_non_standard_values_for_sex(string $invalidSexValue): void
|
||||
{
|
||||
$pidSegment = (new PID());
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage("Sex should one of 'A', 'F', 'M', 'N', 'O' or 'U'. Given: '$invalidSexValue'");
|
||||
$pidSegment->setSex($invalidSexValue);
|
||||
self::assertEmpty($pidSegment->getSex(), "Sex should not have been set with value: $invalidSexValue");
|
||||
self::assertEmpty($pidSegment->getField(8), "Sex should not have been set with value: $invalidSexValue");
|
||||
}
|
||||
|
||||
/** @test
|
||||
* @throws HL7Exception
|
||||
*/
|
||||
public function PID_5_should_parse_properly(): void
|
||||
{
|
||||
$messageString = "MSH|^~\\&|1|\r" .
|
||||
'PID|||||' .
|
||||
'Test &""&firstname &""&""^F^N N^^^^F^^^^""~Test &""&Test^Test^""^^^^B~""&""&""^^^^^^P~^Lastname^^^^^N|' .
|
||||
"\r";
|
||||
$msg = new Message($messageString, null, false, true, true, true);
|
||||
|
||||
self::assertSame(
|
||||
'MSH|^~\&|1|\nPID|1||||Test &""&firstname &""&""^F^N N^F^""~Test &""&Test^Test^""^B~""&""&""^P~^' .
|
||||
'Lastname^N|\n',
|
||||
$msg->toString()
|
||||
);
|
||||
}
|
||||
|
||||
public function validSexValues(): array
|
||||
{
|
||||
return [
|
||||
['A'], ['F'], ['M'], ['N'], ['O'], ['U']
|
||||
];
|
||||
}
|
||||
|
||||
public function invalidSexValues(): array
|
||||
{
|
||||
return [
|
||||
['B'], ['Z'], ['z'], ['a']
|
||||
];
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Aranyasen\HL7\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase as TC;
|
||||
|
||||
abstract class TestCase extends TC
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
//
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
// Any tearDown should appear before parent::tearDown()
|
||||
parent::tearDown();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user