Skip to content

Commit

Permalink
fixed codableconcept
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanwilliammd committed Dec 2, 2024
1 parent 49d90d5 commit ef3c58b
Showing 1 changed file with 28 additions and 18 deletions.
46 changes: 28 additions & 18 deletions src/FHIR/Medication.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ public function addIdentifier($medication_id)

public function setCode($code = null, $display = null)
{
$coding['system'] = 'http://sys-ids.kemkes.go.id/kfa';
$coding['code'] = $code;

if ($display) {
$coding['display'] = $display;
}

$this->medication['code']['coding'][] = $coding;
$this->medication['code'][] = [
'coding' => [
[
'system' => 'http://sys-ids.kemkes.go.id/kfa',
'code' => $code,
'display' => $display,
],
],
];
}

public function setStatus($status = 'active')
Expand All @@ -74,11 +75,16 @@ public function setForm($code = null)
throw new FHIRException("Medication form code not found");
}

$this->medication['form']['coding'][] = [
'system' => 'http://terminology.kemkes.go.id/CodeSystem/medication-form',
'code' => $code,
'display' => $this->medication_form[$code],
$this->medication['form'][] = [
'coding' => [
[
'system' => 'http://terminology.kemkes.go.id/CodeSystem/medication-form',
'code' => $code,
'display' => $this->medication_form[$code],
],
],
];

}

public function setAmount($numerator = null, $numerator_unit = null, $denominator = 1, $denominator_unit = null)
Expand Down Expand Up @@ -120,8 +126,8 @@ public function addIngredient($itemCode = null, $itemDisplay = null, $numerator
'coding' => [
[
'system' => 'http://sys-ids.kemkes.go.id/kfa',
'code' => $itemCode,
'display' => $itemDisplay,
'code' => $itemCode,
'display' => $itemDisplay,
],
],
];
Expand Down Expand Up @@ -165,10 +171,14 @@ public function setMedicationType($code = 'NC')
);

$medicationType['url'] = 'https://fhir.kemkes.go.id/r4/StructureDefinition/MedicationType';
$medicationType['valueCodeableConcept']['coding'][] = [
'system' => 'http://terminology.kemkes.go.id/CodeSystem/medication-type',
'code' => $code,
'display' => $medicationTypeOption[$code],
$medicationType['valueCodeableConcept'][] = [
'coding' => [
[
'system' => 'http://terminology.kemkes.go.id/CodeSystem/medication-type',
'code' => $code,
'display' => $medicationTypeOption[$code],
],
],
];

$this->medication['extension'][] = $medicationType;
Expand Down

0 comments on commit ef3c58b

Please sign in to comment.