Merge branch 'dev' into feat/micro-lab-order-50
This commit is contained in:
@@ -74,6 +74,19 @@ export async function update(path: string, id: number | string, data: any, name:
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateCustom(path: string, data: any, name: string = 'item') {
|
||||
try {
|
||||
const resp = await xfetch(`${path}`, 'PATCH', data)
|
||||
const result: any = {}
|
||||
result.success = resp.success
|
||||
result.body = (resp.body as Record<string, any>) || {}
|
||||
return result
|
||||
} catch (error) {
|
||||
console.error(`Error putting ${name}:`, error)
|
||||
throw new Error(`Failed to put ${name}`)
|
||||
}
|
||||
}
|
||||
|
||||
export async function remove(path: string, id: number | string, name: string = 'item') {
|
||||
try {
|
||||
const resp = await xfetch(`${path}/${id}`, 'DELETE')
|
||||
@@ -86,3 +99,16 @@ export async function remove(path: string, id: number | string, name: string = '
|
||||
throw new Error(`Failed to delete ${name}`)
|
||||
}
|
||||
}
|
||||
|
||||
export async function removeCustom(path: string, data: any, name: string = 'item') {
|
||||
try {
|
||||
const resp = await xfetch(`${path}`, 'DELETE', data)
|
||||
const result: any = {}
|
||||
result.success = resp.success
|
||||
result.body = (resp.body as Record<string, any>) || {}
|
||||
return result
|
||||
} catch (error) {
|
||||
console.error(`Error deleting ${name}:`, error)
|
||||
throw new Error(`Failed to delete ${name}`)
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ const path = '/api/v1/device-order-item'
|
||||
const name = 'device-order-item'
|
||||
|
||||
export function create(data: any) {
|
||||
console.log('service create', data)
|
||||
return base.create(path, data, name)
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ 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 getDetail(id: number | string, params?: any) {
|
||||
return base.getDetail(path, id, name, params)
|
||||
}
|
||||
|
||||
export function update(id: number | string, data: any) {
|
||||
@@ -24,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 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 putting ${name}:`, error)
|
||||
throw new Error(`Failed to put ${name}`)
|
||||
}
|
||||
}
|
||||
@@ -28,13 +28,15 @@ 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, useCodeAsValue = 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: Division) => ({
|
||||
value: item.id ? Number(item.id) : item.code,
|
||||
value: useCodeAsValue ? item.code
|
||||
: item.id ? Number(item.id)
|
||||
: item.code,
|
||||
label: item.name,
|
||||
}))
|
||||
}
|
||||
@@ -46,10 +48,12 @@ export async function getValueLabelList(params: any = null): Promise<{ value: st
|
||||
* @param divisions Array of division objects from API
|
||||
* @returns TreeItem[]
|
||||
*/
|
||||
export function getValueTreeItems(divisions: any[]): TreeItem[] {
|
||||
export function getValueTreeItems(divisions: any[], byCode = true): TreeItem[] {
|
||||
return divisions
|
||||
.map((division: Division) => ({
|
||||
value: division.id ? String(division.id) : division.code,
|
||||
value: byCode ? String(division.code)
|
||||
: String(division.id) ? String(division.id)
|
||||
: division.code,
|
||||
label: division.name,
|
||||
hasChildren: Array.isArray(division.childrens) && division.childrens.length > 0,
|
||||
children:
|
||||
|
||||
@@ -28,6 +28,11 @@ export function remove(id: number | string) {
|
||||
return base.remove(path, id, name)
|
||||
}
|
||||
|
||||
export function cancel(id: number | string) {
|
||||
let url = `${path}/${id}/cancel`
|
||||
return base.updateCustom(url, null, name)
|
||||
}
|
||||
|
||||
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
|
||||
let data: { value: string; label: string }[] = []
|
||||
const result = await getList(params)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import * as base from './_crud-base'
|
||||
|
||||
const path = '/api/v1/general-consent'
|
||||
|
||||
export function create(data: any) {
|
||||
return base.create(path, data)
|
||||
}
|
||||
|
||||
export function getList(params: any = null) {
|
||||
return base.getList(path, params)
|
||||
}
|
||||
|
||||
export function getDetail(id: number | string) {
|
||||
return base.getDetail(path, id)
|
||||
}
|
||||
|
||||
export function update(id: number | string, data: any) {
|
||||
return base.update(path, id, data)
|
||||
}
|
||||
|
||||
export function remove(id: number | string) {
|
||||
return base.remove(path, id)
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import * as base from './_crud-base'
|
||||
|
||||
const path = '/api/v1/generate-file'
|
||||
|
||||
export function create(data: any) {
|
||||
return base.create(path, data)
|
||||
}
|
||||
|
||||
export function getList(params: any = null) {
|
||||
return base.getList(path, params)
|
||||
}
|
||||
|
||||
export function getDetail(id: number | string) {
|
||||
return base.getDetail(path, id)
|
||||
}
|
||||
@@ -27,13 +27,15 @@ 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, useCodeAsValue = 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: Installation) => ({
|
||||
value: item.id ? Number(item.id) : item.code,
|
||||
value: useCodeAsValue ? item.code
|
||||
: item.id ? Number(item.id)
|
||||
: item.code,
|
||||
label: item.name,
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// Base
|
||||
import * as base from './_crud-base'
|
||||
|
||||
// Types
|
||||
import type { MedicineForm } from '~/models/medicine-form'
|
||||
|
||||
const path = '/api/v1/medicine-form'
|
||||
const name = 'medicine-form'
|
||||
|
||||
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): 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: MedicineForm) => ({
|
||||
value: item.code,
|
||||
label: item.name,
|
||||
}))
|
||||
}
|
||||
return data
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as base from './_crud-base'
|
||||
import { xfetch } from '~/composables/useXfetch'
|
||||
|
||||
const path = '/api/v1/prescription'
|
||||
const name = 'prescription'
|
||||
@@ -22,3 +23,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}`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export async function getValueLabelList(params: any = null, useCodeAsValue = fal
|
||||
data = resultData.map((item: Specialist) => ({
|
||||
value: useCodeAsValue ? item.code
|
||||
: item.id ? Number(item.id)
|
||||
: item.id,
|
||||
: item.code,
|
||||
label: item.name,
|
||||
parent: item.unit_id ? Number(item.unit_id) : null,
|
||||
}))
|
||||
|
||||
@@ -33,9 +33,9 @@ export async function getValueLabelList(params: any = null, useCodeAsValue = fal
|
||||
if (result.success) {
|
||||
const resultData = result.body?.data || []
|
||||
data = resultData.map((item: Subspecialist) => ({
|
||||
value: useCodeAsValue ? item.code
|
||||
value: useCodeAsValue ? item.code
|
||||
: item.id ? Number(item.id)
|
||||
: item.id,
|
||||
: item.code,
|
||||
label: item.name,
|
||||
parent: item.specialist_id ? Number(item.specialist_id) : null,
|
||||
}))
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
// Base
|
||||
import * as base from './_crud-base'
|
||||
|
||||
// Constants
|
||||
import { uploadCode, type UploadCodeKey } from '~/lib/constants'
|
||||
|
||||
const path = '/api/v1/encounter-document'
|
||||
const create_path = '/api/v1/upload-file'
|
||||
const name = 'encounter-document'
|
||||
|
||||
export function create(data: any) {
|
||||
return base.create(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)
|
||||
}
|
||||
|
||||
export async function uploadAttachment(file: File, userId: number, key: UploadCodeKey) {
|
||||
try {
|
||||
const resolvedKey = uploadCode[key]
|
||||
if (!resolvedKey) {
|
||||
throw new Error(`Invalid upload code key: ${key}`)
|
||||
}
|
||||
|
||||
// siapkan form-data body
|
||||
const formData = new FormData()
|
||||
formData.append('code', resolvedKey)
|
||||
formData.append('content', file)
|
||||
|
||||
// kirim via xfetch
|
||||
const resp = await xfetch(`${path}/${userId}/upload`, 'POST', formData)
|
||||
|
||||
// struktur hasil sama seperti patchPatient
|
||||
const result: any = {}
|
||||
result.success = resp.success
|
||||
result.body = (resp.body as Record<string, any>) || {}
|
||||
|
||||
return result
|
||||
} catch (error) {
|
||||
console.error('Error uploading attachment:', error)
|
||||
throw new Error('Failed to upload attachment')
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ export async function getValueLabelList(params: any = null, useCodeAsValue = fal
|
||||
data = resultData.map((item: Unit) => ({
|
||||
value: useCodeAsValue ? item.code
|
||||
: item.id ? Number(item.id)
|
||||
: item.id,
|
||||
: item.code,
|
||||
label: item.name,
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -15,11 +15,11 @@ export function getList(params: any = null) {
|
||||
if (params?.letterNumber && params.mode === 'by-sep') {
|
||||
url += `/${params.letterNumber}`
|
||||
}
|
||||
if (params?.letterNumber && params.mode === 'by-schedule') {
|
||||
url += `/jadwalDokter?jeniskontrol=${params.controlType}&kodepoli=${params.poliCode}&tanggalkontrol=${params.controlDate}`
|
||||
if (params?.controlDate && params.mode === 'by-schedule') {
|
||||
url += `/jadwalDokter?jeniskontrol=${params.controlType}&kodepoli=${params.polyCode}&tanggalkontrol=${params.controlDate}`
|
||||
delete params.controlType
|
||||
delete params.poliCode
|
||||
delete params.controlDate
|
||||
delete params.polyCode
|
||||
}
|
||||
if (params) {
|
||||
delete params.letterNumber
|
||||
|
||||
@@ -4,68 +4,16 @@ import * as base from './_crud-base'
|
||||
const path = '/api/vclaim/v1/monitoring/visit'
|
||||
const name = 'monitoring-visit'
|
||||
|
||||
const dummyResponse = {
|
||||
metaData: {
|
||||
code: '200',
|
||||
message: 'Sukses',
|
||||
},
|
||||
response: {
|
||||
sep: [
|
||||
{
|
||||
diagnosa: 'K65.0',
|
||||
jnsPelayanan: 'R.Inap',
|
||||
kelasRawat: '2',
|
||||
nama: 'HANIF ABDURRAHMAN',
|
||||
noKartu: '0001819122189',
|
||||
noSep: '0301R00110170000004',
|
||||
noRujukan: '0301U01108180200084',
|
||||
poli: null,
|
||||
tglPlgSep: '2017-10-03',
|
||||
tglSep: '2017-10-01',
|
||||
},
|
||||
{
|
||||
diagnosa: 'I50.0',
|
||||
jnsPelayanan: 'R.Inap',
|
||||
kelasRawat: '3',
|
||||
nama: 'ASRIZAL',
|
||||
noKartu: '0002283324674',
|
||||
noSep: '0301R00110170000005',
|
||||
noRujukan: '0301U01108180200184',
|
||||
poli: null,
|
||||
tglPlgSep: '2017-10-10',
|
||||
tglSep: '2017-10-01',
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
export async function getList(params: any = null) {
|
||||
try {
|
||||
let url = path
|
||||
if (params?.date && params.serviceType) {
|
||||
url += `/${params.date}/${params.serviceType}`
|
||||
}
|
||||
if (params) {
|
||||
delete params.date
|
||||
delete params.serviceType
|
||||
}
|
||||
const resp = await base.getList(url, params, name)
|
||||
|
||||
// Jika success false, return dummy response
|
||||
if (!resp.success || !resp.body?.response) {
|
||||
return {
|
||||
success: true,
|
||||
body: dummyResponse,
|
||||
}
|
||||
}
|
||||
|
||||
return resp
|
||||
} catch (error) {
|
||||
// Jika terjadi error, return dummy response
|
||||
console.error(`Error fetching ${name}s:`, error)
|
||||
return {
|
||||
success: true,
|
||||
body: dummyResponse,
|
||||
}
|
||||
let url = path
|
||||
if (params?.date && params.serviceType) {
|
||||
url += `/${params.date}/${params.serviceType}`
|
||||
}
|
||||
if (params) {
|
||||
delete params.date
|
||||
delete params.serviceType
|
||||
}
|
||||
const resp = await base.getList(url, params, name)
|
||||
|
||||
return resp
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ import type { IntegrationBpjsFormData } from '~/schemas/integration-bpjs.schema'
|
||||
const path = '/api/vclaim-swagger/sep'
|
||||
const name = 'sep'
|
||||
|
||||
// TODO: temporary destinationClinic
|
||||
const destinationClinic = '1323R001'
|
||||
|
||||
export function create(data: any) {
|
||||
return base.create(path, data, name)
|
||||
}
|
||||
@@ -20,8 +23,19 @@ export function getList(params: any = null) {
|
||||
return base.getList(url, params, name)
|
||||
}
|
||||
|
||||
export function getDetail(id: number | string) {
|
||||
return base.getDetail(path, id, name)
|
||||
}
|
||||
|
||||
export function remove(payload: any) {
|
||||
const url = `${path}`
|
||||
return base.removeCustom(url, payload, name)
|
||||
}
|
||||
|
||||
export function makeSepData(
|
||||
data: IntegrationBpjsFormData & {
|
||||
userName: string
|
||||
polyCode?: string
|
||||
referralFrom?: string
|
||||
referralTo?: string
|
||||
referralLetterDate?: string
|
||||
@@ -31,13 +45,13 @@ export function makeSepData(
|
||||
const content = {
|
||||
noKartu: data.cardNumber || '',
|
||||
tglSep: data.sepDate,
|
||||
ppkPelayanan: data.fromClinic || '',
|
||||
jnsPelayanan: data.admissionType ? String(data.admissionType) : '1',
|
||||
ppkPelayanan: destinationClinic || data.fromClinic || '',
|
||||
jnsPelayanan: data.serviceType ? String(data.serviceType) : '2',
|
||||
noMR: data.medicalRecordNumber || '',
|
||||
catatan: data.note || '',
|
||||
diagAwal: data.initialDiagnosis || '',
|
||||
poli: {
|
||||
tujuan: data.destinationClinic || '',
|
||||
tujuan: data.polyCode || '',
|
||||
eksekutif: data.clinicExcecutive === 'yes' ? '1' : '0',
|
||||
},
|
||||
cob: {
|
||||
@@ -46,19 +60,21 @@ export function makeSepData(
|
||||
katarak: {
|
||||
katarak: data.cataract === 'yes' ? '1' : '0',
|
||||
},
|
||||
tujuanKunj: data.purposeOfVisit || '',
|
||||
tujuanKunj: data.purposeOfVisit || '0',
|
||||
flagProcedure: data.procedureType || '',
|
||||
kdPenunjang: data.supportCode || '',
|
||||
assesmentPel: data.serviceAssessment || '',
|
||||
skdp: {
|
||||
noSurat: ['3'].includes(data.admissionType) ? data.referralLetterNumber : '',
|
||||
kodeDPJP: ['3'].includes(data.admissionType)? data.attendingDoctor : '',
|
||||
kodeDPJP: ['3'].includes(data.admissionType) ? data.attendingDoctor : '',
|
||||
},
|
||||
rujukan: {
|
||||
asalRujukan: ['2'].includes(data.admissionType) ? data?.referralFrom || '' : '',
|
||||
tglRujukan: ['2'].includes(data.admissionType) ? data?.referralLetterDate || '' : '',
|
||||
noRujukan: ['2'].includes(data.admissionType) ? data?.referralLetterNumber || '' : '',
|
||||
ppkRujukan: ['2'].includes(data.admissionType) ? data?.referralTo || '' : '',
|
||||
// Handle referral data for admissionType !== '3'
|
||||
// asalRujukan: 1 = Faskes 1, 2 = Faskes RS
|
||||
asalRujukan: !['3'].includes(data.admissionType) ? data?.referralFrom || '' : '',
|
||||
tglRujukan: !['3'].includes(data.admissionType) ? data?.referralLetterDate || '' : '',
|
||||
noRujukan: !['3'].includes(data.admissionType) ? data?.referralLetterNumber || '' : '',
|
||||
ppkRujukan: !['3'].includes(data.admissionType) ? data?.referralTo || '' : '',
|
||||
},
|
||||
klsRawat: {
|
||||
klsRawatHak: data.classLevel || '',
|
||||
@@ -68,7 +84,7 @@ export function makeSepData(
|
||||
},
|
||||
dpjpLayan: data.attendingDoctor || '',
|
||||
noTelp: data.phoneNumber || '',
|
||||
user: data.patientName || '',
|
||||
user: data.userName || '',
|
||||
jaminan: {
|
||||
lakaLantas: data.trafficAccident || '0',
|
||||
noLP: data.lpNumber || '',
|
||||
@@ -93,3 +109,14 @@ export function makeSepData(
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export function makeSepDataForRemove(data: any) {
|
||||
return {
|
||||
request: {
|
||||
t_sep: {
|
||||
noSep: data.sepNumber,
|
||||
user: data.userName,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user