feat(sep): testing vclaim monitoring

This commit is contained in:
riefive
2025-10-17 14:34:21 +07:00
parent b25b463725
commit 90ab600755
7 changed files with 73 additions and 8 deletions
+15 -3
View File
@@ -1,6 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { id } from 'date-fns/locale' import { ref, onMounted } from 'vue'
import { ref } from 'vue'
// Types // Types
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
@@ -8,6 +7,8 @@ import type { PatientEntity } from '~/models/patient'
// Services // Services
import { getPatientDetail, getPatients } from '~/services/patient.service' import { getPatientDetail, getPatients } from '~/services/patient.service'
import { getList as getVclaimMonitoringVisitList } from '~/services/vclaim-monitoring-visit.service'
import { getList as getVclaimMonitoringHistoryList } from '~/services/vclaim-monitoring-history.service'
const openPatient = ref(false) const openPatient = ref(false)
const openLetter = ref(false) const openLetter = ref(false)
@@ -155,6 +156,14 @@ function handleEvent(value: string) {
navigateTo('/bpjs/sep') navigateTo('/bpjs/sep')
} }
} }
onMounted(() => {
getVclaimMonitoringHistoryList({ nop: '0002078925513', tglawal: '2025-07-20', tglakhir: '2025-10-10' }).then(
(value) => {
console.log('value:', value)
},
)
})
</script> </script>
<template> <template>
@@ -166,7 +175,10 @@ function handleEvent(value: string) {
<span class="font-semibold">Tambah</span> <span class="font-semibold">Tambah</span>
SEP SEP
</div> </div>
<AppSepEntryForm :patient="selectedPatientObject" @event="handleEvent" /> <AppSepEntryForm
:patient="selectedPatientObject"
@event="handleEvent"
/>
<AppSepTableSearchPatient <AppSepTableSearchPatient
v-model:open="openPatient" v-model:open="openPatient"
v-model:selected="selectedPatient" v-model:selected="selectedPatient"
@@ -0,0 +1,9 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/diagnosaprb'
const name = 'diagnose-referral'
export function getList(params: any = null) {
return base.getList(path, params, name)
}
+9
View File
@@ -0,0 +1,9 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/diagnosa'
const name = 'diagnose'
export function getList(params: any = null) {
return base.getList(path, params, name)
}
@@ -0,0 +1,14 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/monitoring/history'
const name = 'monitoring-history'
export function getList(params: any = null) {
let url = path
if (params && params?.nop) {
url += `/${params.nop}`
delete params.nop
}
return base.getList(url, params, name)
}
@@ -0,0 +1,9 @@
// Base
import * as base from './_crud-base'
const path = '/api/vclaim/monitoring/kunjungan'
const name = 'monitoring-visit'
export function getList(params: any = null) {
return base.getList(path, params, name)
}
+2
View File
@@ -6,8 +6,10 @@ export default defineNuxtConfig({
devtools: { enabled: true }, devtools: { enabled: true },
runtimeConfig: { runtimeConfig: {
API_ORIGIN: process.env.NUXT_API_ORIGIN || 'https://main-api.dev-hopis.sabbi.id', API_ORIGIN: process.env.NUXT_API_ORIGIN || 'https://main-api.dev-hopis.sabbi.id',
VCLAIM: process.env.NUXT_API_VCLAIM || 'https://vclaim-api.multy.chat',
public: { public: {
API_ORIGIN: process.env.NUXT_API_ORIGIN || 'https://main-api.dev-hopis.sabbi.id', API_ORIGIN: process.env.NUXT_API_ORIGIN || 'https://main-api.dev-hopis.sabbi.id',
VCLAIM: process.env.NUXT_API_VCLAIM || 'https://vclaim-api.multy.chat',
} }
}, },
ssr: false, ssr: false,
+15 -5
View File
@@ -1,3 +1,4 @@
import { is } from 'date-fns/locale'
import { defineEventHandler, getCookie, getRequestHeaders, getRequestURL, readBody } from 'h3' import { defineEventHandler, getCookie, getRequestHeaders, getRequestURL, readBody } from 'h3'
export default defineEventHandler(async (event) => { export default defineEventHandler(async (event) => {
@@ -5,11 +6,16 @@ export default defineEventHandler(async (event) => {
const headers = getRequestHeaders(event) const headers = getRequestHeaders(event)
const url = getRequestURL(event) const url = getRequestURL(event)
const config = useRuntimeConfig() const config = useRuntimeConfig()
const apiOrigin = config.public.API_ORIGIN
const pathname = url.pathname.replace(/^\/api/, '')
const targetUrl = apiOrigin + pathname + (url.search || '') const apiOrigin = config.public.API_ORIGIN
const apiVclaim = config.public.VCLAIM
const pathname = url.pathname.replace(/^\/api/, '')
const isVclaim = pathname.includes('/vclaim')
let targetUrl = apiOrigin + pathname + (url.search || '')
if (pathname.includes('/vclaim')) {
targetUrl = apiVclaim + pathname.replace('/vclaim', '') + (url.search || '')
}
const verificationId = headers['verification-id'] as string | undefined const verificationId = headers['verification-id'] as string | undefined
let bearer = '' let bearer = ''
@@ -22,7 +28,7 @@ export default defineEventHandler(async (event) => {
const forwardHeaders = new Headers() const forwardHeaders = new Headers()
if (headers['content-type']) forwardHeaders.set('Content-Type', headers['content-type']) if (headers['content-type']) forwardHeaders.set('Content-Type', headers['content-type'])
forwardHeaders.set('Authorization', `Bearer ${bearer}`) if (!isVclaim) forwardHeaders.set('Authorization', `Bearer ${bearer}`)
let body: any let body: any
if (['POST', 'PATCH'].includes(method!)) { if (['POST', 'PATCH'].includes(method!)) {
@@ -41,5 +47,9 @@ export default defineEventHandler(async (event) => {
body, body,
}) })
if (isVclaim) {
console.log('res:', res)
}
return res return res
}) })