✨ feat (soapi): parse and display main complaint and diagnoses from json data
This commit is contained in:
No files matched your search
@@ -20,14 +20,44 @@ export const config: Config = {
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
keys: ['time', 'employee_id', 'main_complaint', 'examination', 'diagnose', 'status', 'action'],
|
keys: ['time', 'employee_id', 'main_complaint', 'encounter_id', 'diagnose', 'status', 'action'],
|
||||||
|
|
||||||
delKeyNames: [
|
delKeyNames: [
|
||||||
{ key: 'code', label: 'Kode' },
|
{ key: 'code', label: 'Kode' },
|
||||||
{ key: 'name', label: 'Nama' },
|
{ key: 'name', label: 'Nama' },
|
||||||
],
|
],
|
||||||
|
|
||||||
parses: {},
|
parses: {
|
||||||
|
time(rec: any) {
|
||||||
|
return rec.time ? new Date(rec.time).toLocaleDateString() : ''
|
||||||
|
},
|
||||||
|
main_complaint(rec: any) {
|
||||||
|
const { value } = rec ?? {}
|
||||||
|
|
||||||
|
if (typeof value !== 'string') return '-'
|
||||||
|
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(value)
|
||||||
|
console.log('parsed', parsed)
|
||||||
|
return parsed?.['prim-compl'] || '-'
|
||||||
|
} catch {
|
||||||
|
return '-'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
diagnose(rec: any) {
|
||||||
|
const { value } = rec ?? {}
|
||||||
|
|
||||||
|
if (typeof value !== 'string') return '-'
|
||||||
|
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(value)
|
||||||
|
const diagnose = parsed?.diagnose || []
|
||||||
|
return diagnose.map((d: any) => d.name).join(', ')
|
||||||
|
} catch {
|
||||||
|
return '-'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
action(rec, idx) {
|
action(rec, idx) {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ onMounted(async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
async function getMyList() {
|
async function getMyList() {
|
||||||
const url = `/api/v1/soapi?type-code=${typeCode.value}`
|
const url = `/api/v1/soapi?type-code=${typeCode.value}?includes=encounter`
|
||||||
const resp = await xfetch(url)
|
const resp = await xfetch(url)
|
||||||
if (resp.success) {
|
if (resp.success) {
|
||||||
data.value = (resp.body as Record<string, any>).data
|
data.value = (resp.body as Record<string, any>).data
|
||||||
|
|||||||
Reference in New Issue
Block a user