fix: debug encounter

This commit is contained in:
riefive
2025-10-24 17:04:46 +07:00
parent 3108297d8f
commit 26e9ea96ea
5 changed files with 91 additions and 27 deletions
+16
View File
@@ -40,6 +40,22 @@ export async function getPatientDetail(id: number) {
}
}
export async function getPatientByIdentifier(search: string) {
try {
const urlPath = search.length === 16 ? `by-resident-identity/search=${encodeURIComponent(search)}` : `/search/${search}`
const url = `${mainUrl}/${urlPath}`
const resp = await xfetch(url, 'GET')
const result: any = {}
result.success = resp.success
result.body = (resp.body as Record<string, any>) || {}
result.type = urlPath.includes('by-resident-identity') ? 'resident-identity' : 'identity'
return result
} catch (error) {
console.error('Error fetching patient by identifier:', error)
throw new Error('Failed to get patient by identifier')
}
}
export async function postPatient(record: any) {
try {
const resp = await xfetch(mainUrl, 'POST', record)