-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* register fetcher * add aplicares module * fix aplicares base urls * extending metadata response props * add ref kamar * update readme * add update bed method * requiredConfig validation helper * add doc comments * add create ruang method * add read bed method * fix bed create and update method * add create and update test * tidy up read test * add delete bed method * don't run test concurrently * add changeset
- Loading branch information
1 parent
50eedd6
commit 69f1475
Showing
9 changed files
with
263 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@ssecd/jkn': minor | ||
--- | ||
|
||
Implement Aplicares services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
import { BaseApi } from './base.js'; | ||
|
||
export class Aplicares extends BaseApi<'aplicares'> { | ||
protected type = 'aplicares' as const; | ||
|
||
/** | ||
* Referensi Kamar | ||
*/ | ||
async refKamar() { | ||
return this.send< | ||
{ | ||
list: { | ||
kodekelas: string; | ||
namakelas: string; | ||
}[]; | ||
}, | ||
{ totalitems: number } | ||
>({ | ||
path: `/rest/ref/kelas`, | ||
method: 'GET', | ||
skipDecrypt: true | ||
}); | ||
} | ||
|
||
/** | ||
* Update Ketersediaan Tempat Tidur | ||
* | ||
* Property `tersediapria`, `tersediawanita`, dan `tersediapriawanita` | ||
* digunakan untuk faskes yang ingin mencantumkan informasi ketersediaan | ||
* tempat tidur untuk pasien laki-laki, perempuan, dan laki–laki atau | ||
* perempuan. | ||
*/ | ||
async update(data: AplicaresBedData) { | ||
const { ppkCode } = await this.requiredConfig('ppkCode'); | ||
return this.send({ | ||
path: `/rest/bed/update/${ppkCode}`, | ||
method: 'POST', | ||
skipContentTypeHack: true, | ||
headers: { 'Content-Type': 'application/json' }, | ||
data | ||
}); | ||
} | ||
|
||
/** | ||
* Buat Ruangan Baru | ||
* | ||
* Property `tersediapria`, `tersediawanita`, dan `tersediapriawanita` | ||
* digunakan untuk faskes yang ingin mencantumkan informasi ketersediaan | ||
* tempat tidur untuk pasien laki-laki, perempuan, dan laki–laki atau | ||
* perempuan. | ||
*/ | ||
async create(data: AplicaresBedData) { | ||
const { ppkCode } = await this.requiredConfig('ppkCode'); | ||
return this.send<undefined>({ | ||
path: `/rest/bed/create/${ppkCode}`, | ||
method: 'POST', | ||
skipContentTypeHack: true, | ||
headers: { 'Content-Type': 'application/json' }, | ||
data | ||
}); | ||
} | ||
|
||
/** | ||
* Melihat Data Ketersediaan Kamar Faskes | ||
* | ||
* Property `start` dan `limit` berfungsi untuk paging, jika faskes | ||
* ingin menampilkan data dari baris pertama sampai baris kesepuluh | ||
* maka `start` = `1` dan `limit` = `1`, nilai `start` dimulai dari `1`. | ||
*/ | ||
async read(params: { | ||
/** paging start */ | ||
start: number; | ||
|
||
/** paging limit */ | ||
limit: number; | ||
}) { | ||
const { ppkCode } = await this.requiredConfig('ppkCode'); | ||
return this.send< | ||
{ | ||
list: (AplicaresBedData & { | ||
kodeppk: string; | ||
rownumber: number; | ||
lastupdate: string; | ||
})[]; | ||
}, | ||
{ totalitems: number } | ||
>({ | ||
path: `/rest/bed/read/${ppkCode}/${params.start}/${params.limit}`, | ||
method: 'GET', | ||
skipDecrypt: true | ||
}); | ||
} | ||
|
||
/** | ||
* Hapus Ruangan | ||
*/ | ||
async delete(data: { | ||
/** kode kelas ruang rawat sesuai dengan mapping BPJS Kesehatan */ | ||
kodekelas: string; | ||
|
||
/** kode ruangan faskes */ | ||
koderuang: string; | ||
}) { | ||
const { ppkCode } = await this.requiredConfig('ppkCode'); | ||
return this.send<undefined>({ | ||
path: `/rest/bed/delete/${ppkCode}`, | ||
method: 'POST', | ||
skipContentTypeHack: true, | ||
headers: { 'Content-Type': 'application/json' }, | ||
data | ||
}); | ||
} | ||
} | ||
|
||
interface AplicaresBedData { | ||
/** kode kelas ruang rawat sesuai dengan mapping BPJS Kesehatan */ | ||
kodekelas: string; | ||
|
||
/** kode ruangan faskes */ | ||
koderuang: string; | ||
|
||
/** nama ruang rawat faskes */ | ||
namaruang: string; | ||
|
||
/** kapasitas ruang faskes */ | ||
kapasitas: number; | ||
|
||
/** jumlah tempat tidur yang kosong atau dapat ditempati pasien baru */ | ||
tersedia: number; | ||
|
||
/** jumlah tempat tidur yang kosong atau dapat ditempati pasien baru laki – laki */ | ||
tersediapria?: number; | ||
|
||
/** jumlah tempat tidur yang kosong atau dapat ditempati pasien baru perempuan */ | ||
tersediawanita?: number; | ||
|
||
/** jumlah tempat tidur yang kosong atau dapat ditempati pasien baru laki – laki atau perempuan */ | ||
tersediapriawanita?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.