Skip to content

Commit

Permalink
updated MedicationRequest & Medication
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanwilliammd committed Dec 2, 2024
1 parent 2212db1 commit 49d90d5
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 31 deletions.
8 changes: 6 additions & 2 deletions src/FHIR/Medication.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,14 @@ public function addIngredient($itemCode = null, $itemDisplay = null, $numerator
throw new FHIRException("Item display is required");
}

$ingredient['item']['coding'][] = [
'system' => 'http://sys-ids.kemkes.go.id/kfa',
$ingredient['itemCodableConcept'] = [
'coding' => [
[
'system' => 'http://sys-ids.kemkes.go.id/kfa',
'code' => $itemCode,
'display' => $itemDisplay,
],
],
];

$ingredient['isActive'] = true;
Expand Down
76 changes: 47 additions & 29 deletions src/FHIR/MedicationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,15 @@ public function setIntent($intent = 'order')

public function addCategory($category = 'outpatient')
{
$medicationrequest_category['coding'][] = [
'system' => 'http://terminology.hl7.org/CodeSystem/medicationrequest-category',
'code' => $category,
'display' => $this->medicationrequest_category[$category],
];
$this->medication_request['category'][] = $medicationrequest_category;
$this->medication_request['category'][] = [
'coding' => [
[
'system' => 'http://terminology.hl7.org/CodeSystem/medicationrequest-category',
'code' => $category,
'display' => $this->medicationrequest_category[$category],
],
],
];;
}

public function setPriority($priority = 'routine')
Expand Down Expand Up @@ -165,12 +168,15 @@ public function setPerformer($performerId, $name)

public function setPerformerType($performer_type)
{
$medicationrequest_performer_type['coding'][] = [
'system' => 'http://terminology.hl7.org/CodeSystem/medicationrequest-performer-type',
'code' => $performer_type,
'display' => $this->performer_role[$performer_type],
];
$this->medication_request['performerType'][] = $medicationrequest_performer_type;
$this->medication_request['performerType'][] = [
'coding' => [
[
'system' => 'http://terminology.hl7.org/CodeSystem/medicationrequest-performer-type',
'code' => $performer_type,
'display' => $this->performer_role[$performer_type],
],
],
];;
}

public function setRecorder($recorderId, $name)
Expand All @@ -191,18 +197,22 @@ public function addReasonCode($code, $display = null)

$display = $display ? $display : $code_check->icd10_en;

$medicationrequest_reasonCode['coding'][] = [
'system' => 'http://hl7.org/fhir/sid/icd-10',
'code' => strtoupper($code),
'display' => $display,
$this->medication_request['reasonCode'][] = [
'coding' => [
[
'system' => 'http://hl7.org/fhir/sid/icd-10',
'code' => strtoupper($code),
'display' => $display,
],
],
];

$this->medication_request['reasonCode'][] = $medicationrequest_reasonCode;
}

public function addReasonReference($reference)
{
$this->medication_request['reasonReference'][]['reference'] = 'Condition/'.$reference;
$this->medication_request['reasonReference'][] = [
'reference' => 'Condition/'.$reference,
];
}

public function addBasedOn($reference)
Expand Down Expand Up @@ -257,17 +267,25 @@ public function addDosageInstruction($sequence = 1, $route_code, $timing_code, $

$dosage_instruction['doseAndRate'][] = $doseAndRate_singular;

$route_coding['system'] = 'http://snomed.info/sct';
$route_coding['code'] = $route_code;
$route_coding['display'] = $this->route[$route_code];

$dosage_instruction['route']['coding'][] = $route_coding;

$timing_coding['system'] = 'http://terminology.hl7.org/CodeSystem/v3-GTSAbbreviation';
$timing_coding['code'] = $timing_code;
$timing_coding['display'] = $this->timing[$timing_code];
$dosage_instruction['route'][] = [
'coding' => [
[
'system' => 'http://snomed.info/sct',
'code' => $route_code,
'display' => $this->route[$route_code],
],
],
];

$dosage_instruction['timing']['coding'][] = $timing_coding;
$dosage_instruction['timing']['code'][] = [
'coding' => [
[
'system' => 'http://terminology.hl7.org/CodeSystem/v3-GTSAbbreviation',
'code' => $timing_code,
'display' => $this->timing[$timing_code],
],
],
];;

$this->medication_request['dosageInstruction'][] = $dosage_instruction;
}
Expand Down

0 comments on commit 49d90d5

Please sign in to comment.