Skip to content

Commit

Permalink
troubleshooting addDosageInstruction
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanwilliammd committed Nov 30, 2024
1 parent 889e511 commit bd94ed7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
38 changes: 38 additions & 0 deletions src/FHIR/MedicationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class MedicationRequest extends OAuth2Client
public $drug_form;
public $medicationrequest_status_reason;
public $medicationrequest_category;
public $course_of_therapy_type;

# Declare general terminology
public $performer_role;
Expand All @@ -31,6 +32,7 @@ public function __construct()
$this->drug_form = $medication_terminology->drug_form;
$this->medicationrequest_status_reason = $medication_terminology->medicationrequest_status_reason;
$this->medicationrequest_category = $medication_terminology->medicationrequest_category;
$this->course_of_therapy_type = $medication_terminology->course_of_therapy_type;

$this->performer_role = $occupation->performer_role;
}
Expand Down Expand Up @@ -194,6 +196,42 @@ public function addBasedOn($reference)
$this->medication_request['basedOn']['reference'] = $reference;
}

public function setCourseOfTherapyType($course)
{
$this->medication_request['courseOfTherapyType']['coding'][] = [
'system' => 'http://terminology.hl7.org/CodeSystem/medicationrequest-course-of-therapy',
'code' => $course,
'display' => $this->course_of_therapy_type[$course],
];
}

public function addInsurance($insurance)
{
$this->medication_request['insurance']['reference'] = $insurance;
}

public function addNote($note)
{
$this->medication_request['note'][] = [
'text' => $note,
];
}

public function addDosageInstruction($sequence = 1, $route, $timing_code, $patientInstruction, $as_needed = false, $dose_value, $dose_unit)
{

$dosage_instruction = [
'sequence' => $sequence,
'patientInstruction' => $patientInstruction,
'asNeededBoolean' => $as_needed,
'timing' => $timing, # perlu di cherry pick yang umum
'route' => $route, # ATC
'doseAndRate' => $doseAndRate,
];

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

public function addContained(Medication $medication)
{
$this->medication_request['contained'][] = $medication;
Expand Down
7 changes: 6 additions & 1 deletion src/Terminology/MedicationTerminology.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,19 @@ class MedicationTerminology
"discharge" => "Discharge"
);


public array $course_of_therapy_type = array(
"continuous" => "Continuous long term therapy",
"acute" => "Short course (acute) therapy",
"seasonal" => "Seasonal",
);

public function __construct()
{
$this->medication_form = $this->medication_form;
$this->drug_form = $this->drug_form;
$this->medicationrequest_status_reason = $this->medicationrequest_status_reason;
$this->medicationrequest_category = $this->medicationrequest_category;
$this->course_of_therapy_type = $this->course_of_therapy_type;
}

}

0 comments on commit bd94ed7

Please sign in to comment.