Resource untuk catat riwayat alergi pasien (obat, makanan, lingkungan).
- Pasien punya riwayat alergi yang harus di-track lintas kunjungan
- Penting untuk safety check sebelum prescribe obat
- Update saat ada alergi baru ditemukan atau status berubah (active → resolved)
use Satusehat\Integration\FHIR\AllergyIntolerance;
$allergy = new AllergyIntolerance();
$allergy->setIdentifier('ALG-001');
$allergy->setPatient('P02478375538', 'Budi Setiawan');
$allergy->setEncounter('E12345');
$allergy->setStatus('active');
$allergy->setCategory(['medication']);
$allergy->setCoding(
'http://www.whocc.no/atc',
'J01CA04',
'Amoxicillin',
'Alergi Amoxicillin (gatal-gatal seluruh badan)'
);
$allergy->setRecorder('10009880728', 'dr. Ahmad');
[$statusCode, $response] = $allergy->post();| Method | Deskripsi |
|---|---|
setPatient($patientId, $name) |
Pasien (catatan: pake setPatient, bukan setSubject) |
setCoding($system, $code, $display, $text) |
Kode alergi (ATC untuk obat, SNOMED untuk lainnya) |
| Method | Default | Deskripsi |
|---|---|---|
setIdentifier($id) |
— | ID internal di sistem kamu |
setEncounter($encounterId) |
— | Kunjungan saat alergi dicatat |
setCategory(array $categories) |
— | Array of food / medication / environment / biologic |
setStatus($status) |
active (default tidak auto-set) |
active / inactive / resolved |
setRecorder($practId, $name) |
— | Nakes yang catat. Auto-set recordedDate ke now (UTC). |
json()/post()/put($id)/patch($id, $payload)
- Method-nya
setPatient, bukansetSubject— beda dari resource lain. FHIR spec untuk AllergyIntolerance pake fieldpatient, bukansubject. setStatuspake PHPmatch— kalau pass value di luaractive/inactive/resolvedakan throwUnhandledMatchError(PHP 8.0+).verificationStatus=confirmeddefault sudah di-set di constructor, nggak bisa diubah via method. Edit payload manual kalau butuh.- Kategori multiple —
setCategory(['medication', 'food'])valid untuk pasien yang alergi obat + makanan. setRecorderset 2 field —recorder(reference ke practitioner) +recordedDate(timestamp now UTC).json()nggak validate field wajib — pastikan minimalsetPatient+setCodingsebelum post.
- Patient — pasien parent
- Practitioner — recorder
- MedicationRequest — cross-check alergi sebelum resep