feat(sep): integrate visit sep

This commit is contained in:
riefive
2025-10-20 14:14:17 +07:00
parent 499548c770
commit 9647cfa3ff
6 changed files with 154 additions and 10 deletions
+41 -4
View File
@@ -2,12 +2,13 @@
import { ref, onMounted } from 'vue'
// Components
import AppListHistoryDialog from '~/components/app/sep/list-history-dialog.vue'
import AppViewHistory from '~/components/app/sep/view-history.vue'
// Types
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
import type { PatientEntity } from '~/models/patient'
import type { SepHistoryData } from '~/components/app/sep/list-cfg.history'
import type { SepVisitData } from '~/components/app/sep/list-cfg.visit'
// Services
import { getPatientDetail, getPatients } from '~/services/patient.service'
@@ -15,6 +16,7 @@ import { getList as getProvinceList } from '~/services/vclaim-region-province.se
import { getList as getCityList } from '~/services/vclaim-region-city.service'
import { getList as getDistrictList } from '~/services/vclaim-region-district.service'
import { getValueLabelList as getDoctorLabelList } from '~/services/vclaim-doctor.service'
import { getValueLabelList as getHealthFacilityLabelList } from '~/services/vclaim-health-facility.service'
import { getList as getDiagnoseReferralList } from '~/services/vclaim-diagnose-referral.service'
import { getList as geMonitoringVisitList } from '~/services/vclaim-monitoring-visit.service'
import { getList as getMonitoringHistoryList } from '~/services/vclaim-monitoring-history.service'
@@ -26,10 +28,11 @@ const selectedPatient = ref('')
const selectedPatientObject = ref<PatientEntity | null>(null)
const selectedLetter = ref('SK22334442')
const histories = ref<Array<SepHistoryData>>([])
const visits = ref<Array<SepVisitData>>([])
// patients used by AppSepTableSearchPatient (will be filled from API)
const patients = ref<Array<{ id: string; identity: string; number: string; bpjs: string; name: string }>>([])
const doctors = ref<Array<{ value: string | number; label: string }>>([])
const facilities = ref<Array<{ value: string | number; label: string }>>([])
const isPatientsLoading = ref(false)
const paginationMeta = ref<PaginationMeta>({
recordCount: 0,
@@ -101,7 +104,14 @@ async function getPatientCurrent(id: string) {
async function getMonitoringHistoryMappers() {
histories.value = []
const result = await getMonitoringHistoryList({ nop: '0002078925513', tglawal: '2025-07-20', tglakhir: '2025-10-10' })
const dateFirst = new Date()
const dateLast = new Date()
dateLast.setMonth(dateFirst.getMonth() - 3)
const result = await getMonitoringHistoryList({
nop: '0002078925513',
tglawal: dateFirst.toISOString().substring(0, 10),
tglakhir: dateLast.toISOString().substring(0, 10),
})
if (result && result.success && result.body) {
const historiesRaw = result.body?.response?.histori || []
if (!historiesRaw) return
@@ -121,6 +131,31 @@ async function getMonitoringHistoryMappers() {
}
}
async function getMonitoringVisitMappers() {
visits.value = []
const dateFirst = new Date()
const result = await geMonitoringVisitList({
nop: '0002078925513',
tglpelayanan: dateFirst.toISOString().substring(0, 10),
jnspelayanan: 1,
})
if (result && result.success && result.body) {
const visitsRaw = result.body?.response?.visit || []
if (!visitsRaw) return
visitsRaw.forEach((result: any) => {
visits.value.push({
letterNumber: result.noSuratKontrol,
letterDate: result.tglRencanaKontrol,
sepNumber: result.noSep,
patientName: result.namaPasien,
bpjsNumber: result.noKartuBPJS,
clinic: '-',
doctor: '-',
})
})
}
}
const letters = [
{
noSurat: 'SK22334442',
@@ -188,6 +223,7 @@ onMounted(async () => {
'tgl-pelayanan': new Date().toISOString().substring(0, 10),
'kode-spesialis': 0,
})
facilities.value = await getHealthFacilityLabelList({ faskes: 'Puskesmas', 'jenis-faskes': 1 })
getProvinceList().then((value) => {
console.log('value:', value)
})
@@ -220,6 +256,7 @@ onMounted(async () => {
</div>
<AppSepEntryForm
:doctors="doctors"
:facilities="facilities"
:patient="selectedPatientObject"
@event="handleEvent"
/>
@@ -237,7 +274,7 @@ onMounted(async () => {
:letters="letters"
@save="handleSaveLetter"
/>
<AppListHistoryDialog
<AppViewHistory
v-model:open="openHistory"
:histories="histories"
/>