Merge branch 'dev' of https://github.com/dikstub-rssa/simrs-fe into feat/rm-rajal-183

This commit is contained in:
Abizrh
2025-12-06 09:31:18 +07:00
226 changed files with 9442 additions and 1162 deletions
+21
View File
@@ -5,6 +5,9 @@ export async function create(path: string, data: any, name: string = 'item') {
const resp = await xfetch(path, 'POST', data)
const result: any = {}
result.success = resp.success
if (resp.status_code !== 200) {
result.error = { ...resp.error }
}
result.body = (resp.body as Record<string, any>) || {}
return result
} catch (error) {
@@ -29,6 +32,9 @@ export async function getList(path: string, params: any = null, name: string = '
const resp = await xfetch(url, 'GET')
const result: any = {}
result.success = resp.success
if (resp.status_code !== 200) {
result.error = { ...resp.error }
}
result.body = (resp.body as Record<string, any>) || {}
return result
} catch (error) {
@@ -53,6 +59,9 @@ export async function getDetail(path: string, id: number | string, name: string
const resp = await xfetch(`${path}/${id}${paramStr}`, 'GET')
const result: any = {}
result.success = resp.success
if (resp.status_code !== 200) {
result.error = { ...resp.error }
}
result.body = (resp.body as Record<string, any>) || {}
return result
} catch (error) {
@@ -66,6 +75,9 @@ export async function update(path: string, id: number | string, data: any, name:
const resp = await xfetch(`${path}/${id}`, 'PATCH', data)
const result: any = {}
result.success = resp.success
if (resp.status_code !== 200) {
result.error = { ...resp.error }
}
result.body = (resp.body as Record<string, any>) || {}
return result
} catch (error) {
@@ -79,6 +91,9 @@ export async function updateCustom(path: string, data: any, name: string = 'item
const resp = await xfetch(`${path}`, 'PATCH', data)
const result: any = {}
result.success = resp.success
if (resp.status_code !== 200) {
result.error = { ...resp.error }
}
result.body = (resp.body as Record<string, any>) || {}
return result
} catch (error) {
@@ -92,6 +107,9 @@ export async function remove(path: string, id: number | string, name: string = '
const resp = await xfetch(`${path}/${id}`, 'DELETE')
const result: any = {}
result.success = resp.success
if (resp.status_code !== 200) {
result.error = { ...resp.error }
}
result.body = (resp.body as Record<string, any>) || {}
return result
} catch (error) {
@@ -105,6 +123,9 @@ export async function removeCustom(path: string, data: any, name: string = 'item
const resp = await xfetch(`${path}`, 'DELETE', data)
const result: any = {}
result.success = resp.success
if (resp.status_code !== 200) {
result.error = { ...resp.error }
}
result.body = (resp.body as Record<string, any>) || {}
return result
} catch (error) {
+25
View File
@@ -0,0 +1,25 @@
// Base
import * as base from './_crud-base'
const name = 'antibiotic-in-use'
const path = '/api/v1/' + name
export function create(data: any) {
return base.create(path, data, name)
}
export function getList(params: any = null) {
return base.getList(path, params, name)
}
export function getDetail(id: number | string) {
return base.getDetail(path, id, name)
}
export function update(id: number | string, data: any) {
return base.update(path, id, data, name)
}
export function remove(id: number | string) {
return base.remove(path, id, name)
}
+25
View File
@@ -0,0 +1,25 @@
// Base
import * as base from './_crud-base'
const name = 'antibiotic-src-category'
const path = '/api/v1/' + name
export function create(data: any) {
return base.create(path, data, name)
}
export function getList(params: any = null) {
return base.getList(path, params, name)
}
export function getDetail(id: number | string) {
return base.getDetail(path, id, name)
}
export function update(id: number | string, data: any) {
return base.update(path, id, data, name)
}
export function remove(id: number | string) {
return base.remove(path, id, name)
}
+25
View File
@@ -0,0 +1,25 @@
// Base
import * as base from './_crud-base'
const name = 'antibiotic-src'
const path = '/api/v1/' + name
export function create(data: any) {
return base.create(path, data, name)
}
export function getList(params: any = null) {
return base.getList(path, params, name)
}
export function getDetail(id: number | string) {
return base.getDetail(path, id, name)
}
export function update(id: number | string, data: any) {
return base.update(path, id, data, name)
}
export function remove(id: number | string) {
return base.remove(path, id, name)
}
+19 -11
View File
@@ -1,14 +1,11 @@
// Base
import * as base from './_crud-base'
// Types
import type { Infra } from '~/models/infra'
const path = '/api/v1/infra'
const name = 'infra'
const path = `/api/v1/${name}`
export function create(data: any) {
export function create(data: Infra) {
return base.create(path, data, name)
}
@@ -20,7 +17,7 @@ export function getDetail(id: number | string) {
return base.getDetail(path, id, name)
}
export function update(id: number | string, data: any) {
export function update(id: number | string, data: Infra) {
return base.update(path, id, data, name)
}
@@ -28,15 +25,26 @@ export function remove(id: number | string) {
return base.remove(path, id, name)
}
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
export async function getValueLabelList(params: any = null, useId = false): Promise<{ value: string; label: string }[]> {
let data: { value: string; label: string }[] = []
const result = await getList(params)
if (result.success) {
const resultData = result.body?.data || []
data = resultData.map((item: Infra) => ({
value: item.id ? Number(item.id) : item.code,
label: item.name,
}))
data = !useId ?
resultData.map((item: Infra) => ({ value: item.code, label: item.name })) :
resultData.map((item: Infra) => ({ value: item.id, label: item.name }))
}
return data
}
// export async function getProcedureRoomValueLabelList(params: any = null, useId = false): Promise<{ value: string; label: string }[]> {
// let data: { value: string; label: string }[] = []
// const result = await getList({ 'infraGroup_code': 'procedure-room' ,...params})
// if (result.success) {
// const resultData = result.body?.data || []
// data = !useId ?
// resultData.map((item: Infra) => ({ value: item.code, label: item.name })) :
// resultData.map((item: Infra) => ({ value: item.id, label: item.name }))
// }
// return data
// }
@@ -0,0 +1,25 @@
// Base
import * as base from './_crud-base'
const name = 'material-package-item'
const path = `/api/v1/${name}`
export function create(data: any) {
return base.create(path, data, name)
}
export function getList(params: any = null) {
return base.getList(path, params, name)
}
export function getDetail(id: number | string) {
return base.getDetail(path, id, name)
}
export function update(id: number | string, data: any) {
return base.update(path, id, data, name)
}
export function remove(id: number | string) {
return base.remove(path, id, name)
}
+38
View File
@@ -0,0 +1,38 @@
// Base
import type { MaterialPackage } from '~/models/material-package'
import * as base from './_crud-base'
const name = 'material-package'
const path = `/api/v1/${name}`
export function create(data: any) {
return base.create(path, data, name)
}
export function getList(params: any = null) {
return base.getList(path, params, name)
}
export function getDetail(id: number | string) {
return base.getDetail(path, id, name)
}
export function update(id: number | string, data: any) {
return base.update(path, id, data, name)
}
export function remove(id: number | string) {
return base.remove(path, id, name)
}
export async function getValueLabelList(params: any = null, useId = false): Promise<{ value: string; label: string }[]> {
let data: { value: string; label: string }[] = []
const result = await getList(params)
if (result.success) {
const resultData = result.body?.data || []
data = !useId ?
resultData.map((item: MaterialPackage) => ({ value: item.code, label: item.name })) :
resultData.map((item: MaterialPackage) => ({ value: item.id, label: item.name }))
}
return data
}
+4 -3
View File
@@ -1,13 +1,14 @@
import * as base from './_crud-base'
import * as model from '~/models/mcu-order-item'
const path = '/api/v1/mcu-order-item'
const name = 'mcu-order-item'
export function create(data: any) {
export function create(data: model.CreateDto) {
return base.create(path, data)
}
export function getList(params: any = null) {
export function getList(params: model.ReadList | null = null) {
return base.getList(path, params)
}
@@ -15,7 +16,7 @@ export function getDetail(id: number | string, params?: any) {
return base.getDetail(path, id, name, params)
}
export function update(id: number | string, data: any) {
export function update(id: number | string, data: model.UpdateDto) {
return base.update(path, id, data)
}
+13
View File
@@ -22,3 +22,16 @@ export function update(id: number | string, data: any) {
export function remove(id: number | string) {
return base.remove(path, id)
}
export async function submit(id: number) {
try {
const resp = await xfetch(`${path}/${id}/submit`, 'PATCH')
const result: any = {}
result.success = resp.success
result.body = (resp.body as Record<string, any>) || {}
return result
} catch (error) {
console.error(`Error submitting ${name}:`, error)
throw new Error(`Failed to submit ${name}`)
}
}
+14
View File
@@ -1,4 +1,5 @@
// Base
import type { Medicine } from '~/models/medicine'
import * as base from './_crud-base'
const path = '/api/v1/medicine'
@@ -23,3 +24,16 @@ export function update(id: number | string, data: any) {
export function remove(id: number | string) {
return base.remove(path, id, name)
}
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
let data: { value: string; label: string }[] = []
const result = await getList(params)
if (result.success) {
const resultData = result.body?.data || []
data = resultData.map((item: Medicine) => ({
value: item.code,
label: item.name,
}))
}
return data
}
+28
View File
@@ -0,0 +1,28 @@
// Base
import * as base from './_crud-base'
// Constants
import { encounterClassCodes } from '~/lib/constants'
const path = '/api/v1/prb'
const name = 'prb'
export function create(data: any) {
return base.create(path, data, name)
}
export function getList(params: any = null) {
return base.getList(path, params, name)
}
export function getDetail(id: number | string, params?: any) {
return base.getDetail(path, id, name, params)
}
export function update(id: number | string, data: any) {
return base.update(path, id, data, name)
}
export function remove(id: number | string) {
return base.remove(path, id, name)
}
@@ -0,0 +1,26 @@
// Base
import type { CreateDto, UpdateDto } from '~/models/procedure-room-order-item'
import * as base from './_crud-base'
const name = 'procedure-room-order-item'
const path = `/api/v1/${name}`
export function create(data: CreateDto) {
return base.create(path, data, name)
}
export function getList(params: any = null) {
return base.getList(path, params, name)
}
export function getDetail(id: number | string) {
return base.getDetail(path, id, name)
}
export function update(id: number | string, data: UpdateDto) {
return base.update(path, id, data, name)
}
export function remove(id: number | string) {
return base.remove(path, id, name)
}
@@ -0,0 +1,42 @@
// Base
import type { ProcedureRoomOrder, CreateDto } from '~/models/procedure-room-order'
import * as base from './_crud-base'
const name = 'procedure-room-order'
const path = `/api/v1/${name}`
export function create(data: CreateDto) {
return base.create(path, data, name)
}
export function getList(params: any = null) {
return base.getList(path, params, name)
}
export function getDetail(id: number | string, params: any = null) {
return base.getDetail(path, id, name, params)
}
export function update(id: number | string, data: ProcedureRoomOrder) {
return base.update(path, id, data, name)
}
export function remove(id: number | string) {
return base.remove(path, id, name)
}
export async function submit(id: number) {
try {
const resp = await xfetch(`${path}/${id}/submit`, 'PATCH')
const result: any = {}
if (resp.success) {
result.success = resp.success
result.body = (resp.body as Record<string, any>) || {}
return result
}
} catch (error) {
console.error(`Error submitting ${name}:`, error)
throw new Error(`Failed to submit ${name}`)
}
}
+26
View File
@@ -0,0 +1,26 @@
// Base
import type { ProcedureRoom } from '~/models/procedure-room'
import * as base from './_crud-base'
const name = 'procedure-room'
const path = `/api/v1/${name}`
export function create(data: ProcedureRoom) {
return base.create(path, data, name)
}
export function getList(params: any = null) {
return base.getList(path, params, name)
}
export function getDetail(id: number | string) {
return base.getDetail(path, id, name)
}
export function update(id: number | string, data: ProcedureRoom) {
return base.update(path, id, data, name)
}
export function remove(id: number | string) {
return base.remove(path, id, name)
}
+28
View File
@@ -0,0 +1,28 @@
// Base
import * as base from './_crud-base'
// Constants
import { encounterClassCodes } from '~/lib/constants'
const path = '/api/v1/vaccine-data'
const name = 'vaccine-data'
export function create(data: any) {
return base.create(path, data, name)
}
export function getList(params: any = null) {
return base.getList(path, params, name)
}
export function getDetail(id: number | string, params?: any) {
return base.getDetail(path, id, name, params)
}
export function update(id: number | string, data: any) {
return base.update(path, id, data, name)
}
export function remove(id: number | string) {
return base.remove(path, id, name)
}
+21 -5
View File
@@ -1,11 +1,12 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim-swagger/RencanaKontrol'
const name = 'rencana-kontrol'
const path = '/api/v1/control-plan'
const pathOld = '/api/v1/rencana-kontrol'
const name = 'control-plan' // 'rencana-kontrol'
export function getList(params: any = null) {
let url = path
export function getListOld(params: any = null) {
let url = pathOld
if (params?.letterNumber && params.mode === 'by-control') {
url += `/noSuratKontrol/${params.letterNumber}`
}
@@ -26,4 +27,19 @@ export function getList(params: any = null) {
delete params.mode
}
return base.getList(url, params, name)
}
}
export function getList(params: any = null) {
let url = path
if (params?.controlDate && params.mode === 'by-schedule') {
url += `/${params.controlType}/${params.polyCode}/${params.controlDate}`
delete params.controlType
delete params.controlDate
delete params.polyCode
}
if (params) {
delete params.letterNumber
delete params.mode
}
return base.getList(url, params, name)
}
@@ -1,9 +1,10 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/diagnose-prb'
const path = '/api/v1/reference/diagnose-prb'
const name = 'diagnose-referral'
export function getList(params: any = null) {
return base.getList(path, params, name)
const url = path
return base.getList(url, params, name)
}
+1 -1
View File
@@ -1,7 +1,7 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/diagnose'
const path = '/api/v1/reference/diagnose'
const name = 'diagnose'
export function getList(params: any = null) {
+1 -1
View File
@@ -1,7 +1,7 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/responsible-doctor'
const path = '/api/v1/reference/responsible-doctor'
const name = 'responsible-doctor'
export function getList(params: any = null) {
+1 -1
View File
@@ -1,7 +1,7 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/healthcare'
const path = '/api/v1/reference/healthcare'
const name = 'healthcare'
export function getList(params: any = null) {
+3 -2
View File
@@ -1,11 +1,12 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/medicine'
const path = '/api/v1/reference/medicine'
const name = 'medicine'
export function getList(params: any = null) {
return base.getList(path, params, name)
const url = path
return base.getList(url, params, name)
}
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
+1 -1
View File
@@ -1,7 +1,7 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/member'
const path = '/api/v1/member'
const name = 'member'
export function getList(params: any = null) {
@@ -1,7 +1,7 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/monitoring/hist'
const path = '/api/v1/monitoring/hist'
const name = 'monitoring-history'
export function getList(params: any = null) {
@@ -1,7 +1,7 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/monitoring/visit'
const path = '/api/v1/monitoring/visit'
const name = 'monitoring-visit'
export async function getList(params: any = null) {
@@ -1,8 +1,8 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim-swagger/Rujukan/RS'
const name = 'rujukan-rumah-sakit'
const path = '/api/v1/referral'
const name = 'reference-hospital-letter' // 'rujukan-rumah-sakit'
export function getList(params: any = null) {
let url = path
@@ -13,4 +13,4 @@ export function getList(params: any = null) {
delete params.letterNumber
}
return base.getList(url, params, name)
}
}
@@ -13,4 +13,4 @@ export function getList(params: any = null) {
delete params.letterNumber
}
return base.getList(url, params, name)
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/regency'
const path = '/api/v1/reference/regency'
const name = 'cities'
export function getList(params: any = null) {
@@ -1,7 +1,7 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/district'
const path = '/api/v1/reference/district'
const name = 'districts'
export function getList(params: any = null) {
@@ -1,11 +1,12 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/province'
const path = '/api/v1/reference/province'
const name = 'provinces'
export function getList(params: any = null) {
return base.getList(path, params, name)
const url = path
return base.getList(url, params, name)
}
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
+27 -7
View File
@@ -4,18 +4,32 @@ import * as base from './_crud-base'
// Types
import type { IntegrationBpjsFormData } from '~/schemas/integration-bpjs.schema'
const path = '/api/vclaim-swagger/sep'
const path = '/api/v1/vclaim-sep'
const pathOld = '/api/vclaim-swagger/sep'
const name = 'sep'
// TODO: temporary destinationClinic
const destinationClinic = '1323R001'
export function create(data: any) {
return base.create(path, data, name)
const isNew = true
let url = !isNew ? pathOld : path
let payload: any = data
if (isNew && data?.encounterId) {
payload = {
encounter_id: Number(data.encounterId) || 0,
requestPayload: data?.request ? JSON.stringify({ request: data.request }) : null,
}
} else {
url = pathOld
delete payload.encounterId
}
return base.create(url, payload, name)
}
export function getList(params: any = null) {
let url = path
const isNew = true
let url = !isNew ? pathOld : path
if (params?.number) {
url += `/${params.number}`
delete params.number
@@ -24,12 +38,18 @@ export function getList(params: any = null) {
}
export function getDetail(id: number | string) {
return base.getDetail(path, id, name)
const isNew = true
const url = !isNew ? pathOld : path
return base.getDetail(url, id, name)
}
export function remove(payload: any) {
const url = `${path}`
return base.removeCustom(url, payload, name)
export function remove(id: string) {
const url = `${path}/${id}`
return base.removeCustom(url, {}, name)
}
export function removeOld(payload: any) {
return base.removeCustom(pathOld, payload, name)
}
export function makeSepData(
+1 -1
View File
@@ -1,7 +1,7 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/v1/reference/unit'
const path = '/api/v1/reference/unit'
const name = 'unit'
export function getList(params: any = null) {