Files
FE_CPONE/test/vuex/cpone-resultentry-other-fisik-mobile--/modules/patient.js
2026-04-27 10:13:31 +07:00

1178 lines
48 KiB
JavaScript

// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/patient.js"
export default {
namespaced: true,
state: {
lastidx: 0,
lookup_status: 0,
lookup_error_message: '',
search_patient: 0,
search_error_message: '',
start_date: moment(new Date()).format('YYYY-MM-DD'),
end_date: moment(new Date()).format('YYYY-MM-DD'),
search: '',
total_patiens: 0,
total_filter_patiens: 0,
total_patients_all: 0,
patients: [],
total_patient: 0,
selected_patient: { totalbill: 0 },
save_error_message: '',
statuses: [],
selected_status: {},
open_alert_no_pay: false,
msg_alert_no_pay: "Loh ... Gak jadi bayar dong ?",
current_page: 1,
total_page: 0,
filters: [{ id: 'day', name: 'Hari ini' }, { id: 'notsampled', name: 'Belum sampling' }, { id: 'all', name: 'Tampilkan semua' }],
selected_filter: { id: 'day', name: 'Hari ini' },
promise_dialog: false,
promises: [],
errors: [],
save_status: 0,
save_error_message: '',
barcodes: [],
dialog_barcode: false,
autocomplete_status: 0,
companies: [],
selected_company: { id: 0, name: 'Semua' },
dialog_details: false,
order_id: 0,
noreg: '',
data_patient: [],
data_packet: [],
data_tests: [],
data_sample_lab: [],
data_sample_lab_undone: [],
data_sample_lab_done: [],
data_sample_radiodiagnostic: [],
data_sample_electromedic: [],
data_sample_other: [],
data_requirement: [],
dialog_scanner: false,
selected_patient: {},
sampletypes: [],
act_scan: '',
alert_msg: "",
alert_status: false,
isScanning: false,
html5QrCode: null,
stations: [],
selected_station: {},
locations: [],
selected_location: {},
get_data_status: 0,
isdone: "X",
url_labnumber: "",
dialog_done: false,
status_done: false,
station_id: -1,
location_id: -1,
value_tb: 0,
value_bb: 0,
value_bf: 0,
tkod: '',
tkos: '',
dkod: '',
dkos: '',
btwrn: 'N',
withCorection: false,
visusAdd: '',
odSph: '',
odCyl: '',
odX: '',
osSph: '',
osCyl: '',
osX: '',
colorBlindNumber: '',
dialogError: false,
errorMsg: '',
urls: {},
glucoses:[],
datas:[],
dt_umum:[],
dt_keluhan:['fisik_keluhan_1','fisik_keluhan_3','fisik_keluhan_5','fisik_keluhan_15','fisik_keluhan_17','fisik_keluhan_19','fisik_keluhan_23','fisik_keluhan_24','fisik_keluhan_27','fisik_keluhan_26','fisik_keluhan_16','fisik_keluhan_28'],
dt_riwayat_details:[],
dt_patient:{},
open_listing_abnormal_kepala:false,
open_listing_abnormal_mata:false,
open_listing_abnormal_telinga:false,
open_listing_abnormal_hidung:false,
open_listing_abnormal_gigi:false,
open_listing_abnormal_mulut:false,
open_listing_abnormal_tenggorokan:false,
open_listing_abnormal_leher:false,
open_listing_abnormal_paru:false,
open_listing_abnormal_kulit:false,
open_listing_abnormal_ekstremitas_atas:false,
open_listing_abnormal_ekstremitas_bawah:false,
open_listing_abnormal_smell:false,
normal_abdomen:'',
open_listing_abnormal_normal_abdomen:false,
next_url:'',
keluhan_lain:false,
kepala_lain:false,
mulut_lain:false,
tenggorokan_lain:false,
mata_lain:false,
telinga_lain:false,
hidung_lain:false,
leher_lain:false,
paru_lain:false,
kulit_lain:false,
ekstremitas_atas_lain:false,
ekstremitas_bawah_lain:false,
},
mutations: {
update_ekstremitas_bawah_lain(state, val) {
state.ekstremitas_bawah_lain = val
},
update_ekstremitas_atas_lain(state, val) {
state.ekstremitas_atas_lain = val
},
update_kulit_lain(state, val) {
state.kulit_lain = val
},
update_paru_lain(state, val) {
state.paru_lain = val
},
update_leher_lain(state, val) {
state.leher_lain = val
},
update_hidung_lain(state, val) {
state.hidung_lain = val
},
update_telinga_lain(state, val) {
state.telinga_lain = val
},
update_mata_lain(state, val) {
state.mata_lain = val
},
update_tenggorokan_lain(state, val) {
state.tenggorokan_lain = val
},
update_mulut_lain(state, val) {
state.mulut_lain = val
},
update_kepala_lain(state, val) {
state.kepala_lain = val
},
update_keluhan_lain(state, val) {
state.keluhan_lain = val
},
update_next_url(state, val) {
state.next_url = val
},
update_normal_abdomen(state, val) {
state.normal_abdomen = val
},
update_open_listing_abnormal_normal_abdomen(state, val) {
state.open_listing_abnormal_normal_abdomen = val
},
update_open_listing_abnormal_smell(state, val) {
state.open_listing_abnormal_smell = val
},
update_open_listing_abnormal_ekstremitas_bawah(state, val) {
state.open_listing_abnormal_ekstremitas_bawah = val
},
update_open_listing_abnormal_ekstremitas_atas(state, val) {
state.open_listing_abnormal_ekstremitas_atas = val
},
update_open_listing_abnormal_kulit(state, val) {
state.open_listing_abnormal_kulit = val
},
update_open_listing_abnormal_paru(state, val) {
state.open_listing_abnormal_paru = val
},
update_open_listing_abnormal_leher(state, val) {
state.open_listing_abnormal_leher = val
},
update_open_listing_abnormal_tenggorokan(state, val) {
state.open_listing_abnormal_tenggorokan = val
},
update_open_listing_abnormal_mulut(state, val) {
state.open_listing_abnormal_mulut = val
},
update_open_listing_abnormal_gigi(state, val) {
state.open_listing_abnormal_gigi = val
},
update_open_listing_abnormal_hidung(state, val) {
state.open_listing_abnormal_hidung = val
},
update_open_listing_abnormal_telinga(state, val) {
state.open_listing_abnormal_telinga = val
},
update_open_listing_abnormal_mata(state, val) {
state.open_listing_abnormal_mata = val
},
update_open_listing_abnormal_kepala(state, val) {
state.open_listing_abnormal_kepala = val
},
update_dt_patient(state, val) {
state.dt_patient = val
},
update_dt_riwayat_details(state, val) {
state.dt_riwayat_details = val
},
update_dt_keluhan(state, val) {
state.dt_keluhan = val
},
update_dt_umum(state, val) {
state.dt_umum = val
},
update_datas(state, val) {
state.datas = val
},
update_glucoses(state, val) {
state.glucoses = val
},
update_urls(state, val) {
state.urls = val
},
update_btwrn(state, val) {
state.btwrn = val
},
update_dkod(state, val) {
state.dkod = val
},
update_dkos(state, val) {
state.dkos = val
},
update_tkod(state, val) {
state.tkod = val
},
update_tkos(state, val) {
state.tkos = val
},
update_value_bb(state, val) {
state.value_bb = val
},
update_value_bf(state, val) {
state.value_bf = val
},
update_value_tb(state, val) {
state.value_tb = val
},
update_location_id(state, val) {
state.location_id = val
},
update_station_id(state, val) {
state.station_id = val
},
update_status_done(state, val) {
state.status_done = val
},
update_dialog_done(state, val) {
state.dialog_done = val
},
update_url_labnumber(state, val) {
state.url_labnumber = val
},
update_isdone(state, val) {
state.isdone = val
},
update_get_data_status(state, val) {
state.get_data_status = val
},
update_locations(state, val) {
state.locations = val
},
update_selected_location(state, val) {
state.selected_location = val
},
update_stations(state, val) {
state.stations = val
},
update_selected_station(state, val) {
state.selected_station = val
},
update_html5QrCode(state, val) {
state.html5QrCode = val
},
update_isScanning(state, val) {
state.isScanning = val
},
update_alert_msg(state, val) {
state.alert_msg = val
},
update_alert_status(state, val) {
state.alert_status = val
},
update_act_scan(state, val) {
state.act_scan = val
},
update_sampletypes(state, val) {
state.sampletypes = val
},
update_selected_patient(state, val) {
state.selected_patient = val
},
update_dialog_scanner(state, val) {
state.dialog_scanner = val
},
update_data_sample_other(state, val) {
state.data_sample_other = val
},
update_data_sample_electromedic(state, val) {
state.data_sample_electromedic = val
},
update_data_sample_radiodiagnostic(state, val) {
state.data_sample_radiodiagnostic = val
},
update_data_sample_lab_undone(state, val) {
state.data_sample_lab_undone = val
},
update_data_sample_lab_done(state, val) {
state.data_sample_lab_done = val
},
update_data_sample_lab(state, val) {
state.data_sample_lab = val
},
update_data_tests(state, val) {
state.data_tests = val
},
update_data_packet(state, val) {
state.data_packet = val
},
update_data_patient(state, val) {
state.data_patient = val
},
update_order_id(state, val) {
state.order_id = val
},
update_noreg(state, val) {
state.noreg = val
},
update_dialog_details(state, val) {
state.dialog_details = val
},
update_companies(state, val) {
state.companies = val
},
update_selected_company(state, val) {
state.selected_company = val
},
update_dialog_barcode(state, val) {
state.dialog_barcode = val
},
update_statuses(state, val) {
state.statuses = val
},
update_total_patients_all(state, val) {
state.total_patients_all = val
},
update_save_status(state, val) {
state.save_status = val
},
update_save_error_message(state, val) {
state.save_error_message = val
},
update_lookup_error_message(state, val) {
state.lookup_error_message = val
},
update_lookup_status(state, status) {
state.lookup_status = status
},
update_promise_dialog(state, val) {
state.promise_dialog = val
},
update_promises(state, val) {
state.promises = val
},
update_errors(state, val) {
state.errors = val
},
update_lastidx(state, val) {
state.lastidx = val
},
update_selected_filter(state, val) {
state.selected_filter = val
},
update_filters(state, val) {
state.filters = val
},
update_total_page(state, val) {
state.total_page = val
},
update_total_patient(state, val) {
state.total_patient = val
},
update_current_page(state, val) {
state.current_page = val
},
update_search_error_message(state, patient) {
state.search_error_message = patient
},
update_search_patient(state, patient) {
state.search_patient = patient
},
update_patients(state, data) {
state.patients = data
},
update_selected_patient(state, val) {
state.selected_patient = val
},
update_start_date(state, val) {
state.start_date = val
},
update_autocomplete_status(state, val) {
state.autocomplete_status = val
},
update_end_date(state, val) {
state.end_date = val
},
update_search(state, val) {
state.search = val
},
update_selected_status(state, val) {
state.selected_status = val
},
update_open_alert_no_pay(state, val) {
state.open_alert_no_pay = val
},
update_msg_alert_no_pay(state, val) {
state.msg_alert_no_pay = val
},
update_data_requirement(state, val) {
state.data_requirement = val
},
update_withCorection(state, val) {
state.withCorection = val
},
update_odSph(state, val) {
state.odSph = val
},
update_odCyl(state, val) {
state.odCyl = val
},
update_odX(state, val) {
state.odX = val
},
update_osSph(state, val) {
state.osSph = val
},
update_osCyl(state, val) {
state.osCyl = val
},
update_osX(state, val) {
state.osX = val
},
update_colorBlindNumber(state, val) {
state.colorBlindNumber = val
},
update_visusAdd(state, val) {
state.visusAdd = val
},
update_dialogError(state, val) {
state.dialogError = val
},
update_errorMsg(state, val) {
state.errorMsg = val
},
},
actions: {
async load_data(context) {
context.commit("update_search_patient", 1)
try {
//console.log(prm)
let prm = {}
prm.order_id = context.state.order_id
prm.noreg = context.state.noreg
let resp = await api.search_patient(prm)
if (resp.status != "OK") {
context.commit("update_search_patient", 3)
context.commit("update_search_error_message", resp.message)
context.commit("update_errorMsg", resp.message)
context.commit("update_dialogError", true)
} else {
context.commit("update_search_patient", 2)
context.commit("update_search_error_message", "")
let data_patient = resp.data.data_patient
let data_packet = resp.data.data_packet
let data_tests = resp.data.data_tests
let data_sample_lab = resp.data.data_sample_lab
let data_sample_radiodiagnostic = resp.data.data_sample_radiodiagnostic
let data_sample_electromedic = resp.data.data_sample_electromedic
let data_sample_other = resp.data.data_sample_other
let data_req = resp.data.data_requirement
console.log("Data req");
console.log(data_req);
context.commit("update_data_patient", data_patient)
context.commit("update_data_packet", data_packet)
context.commit("update_data_tests", data_tests)
context.commit("update_data_sample_lab", data_sample_lab)
context.commit("update_data_sample_radiodiagnostic", data_sample_radiodiagnostic)
context.commit("update_data_sample_electromedic", data_sample_electromedic)
context.commit("update_data_sample_other", data_sample_other)
context.commit("update_data_requirement", data_req)
}
} catch (e) {
context.commit("update_search_patient", 3)
context.commit("update_search_error_message", e.message)
context.commit("update_errorMsg", e.message)
context.commit("update_dialogError", true)
console.log(e)
}
},
async scan_patient(context, prm) {
context.commit("update_search_patient", 1)
context.commit("update_status_done", false)
try {
//console.log(prm)
prm.token = one_token()
//prm.station_id = context.state.selected_station.id
//prm.location_id = context.state.selected_location.locationID
let resp = await api.scan_patient(prm)
if (resp.status != "OK") {
context.commit("update_search_patient", 3)
context.commit("update_search_error_message", resp.message)
context.commit("update_errorMsg", resp.message)
context.commit("update_dialogError", true)
} else {
context.commit("update_search_patient", 2)
context.commit("update_search_error_message", "")
console.log("creturn")
console.log(_.isEmpty(resp.data.data_patient))
if (!_.isEmpty(resp.data.data_patient)) {
console.log('Y')
context.commit("update_data_patient", resp.data.data_patient)
context.commit("update_data_packet", resp.data.data_packet)
context.commit("update_data_tests", resp.data.data_tests)
context.commit("update_data_sample_lab", resp.data.data_sample_lab)
context.commit("update_data_sample_lab_undone", resp.data.data_sample_lab_undone)
context.commit("update_data_sample_lab_done", resp.data.data_sample_lab_done)
context.commit("update_data_requirement", resp.data.data_requirement)
context.commit("update_glucoses",resp.data.data_glucoses)
if (resp.data.data_sample_lab_undone.length === 0 && resp.data.data_sample_lab_done.length === resp.data.data_sample_lab.length) {
context.commit("update_status_done", true)
context.commit("update_dialog_done", true)
}
}
else {
if (resp.data.status && resp.data.status === "NOTCAL") {
context.commit("update_dialog_scanner", false)
context.commit("update_alert_msg", "Pasien dengan nomor lab " + prm.labnumber + " masih di station " + resp.data.data.T_SampleStationName)
context.commit("update_alert_status", true)
} else {
console.log('N')
context.commit("update_dialog_scanner", false)
context.commit("update_alert_msg", "Pasien dengan nomor lab " + prm.labnumber + " tidak ditemukan di station dan lokasi yang dipilih!")
context.commit("update_alert_status", true)
}
}
}
} catch (e) {
context.commit("update_search_patient", 3)
context.commit("update_search_error_message", e.message)
context.commit("update_errorMsg", e.message)
context.commit("update_dialogError", true)
console.log(e)
}
},
async scan_barcode(context, prm) {
context.commit("update_search_patient", 1)
context.commit("update_status_done", false)
try {
//console.log(prm)
prm.token = one_token()
prm.station = context.state.selected_station
prm.location_id = context.state.selected_location.locationID
prm.patient = context.state.data_patient
prm.value_bb = context.state.value_bb
prm.value_bf = context.state.value_bf
prm.value_tb = context.state.value_tb
prm.tkod = context.state.tkod
prm.tkos = context.state.tkos
prm.dkod = context.state.dkod
prm.dkos = context.state.dkos
prm.btwrn = context.state.btwrn
prm.withCorection = context.state.withCorection ? 'Y' : "N"
prm.visusAdd = context.state.visusAdd
prm.odSph = context.state.odSph
prm.odCyl = context.state.odCyl
prm.odX = context.state.odX
prm.osSph = context.state.osSph
prm.osCyl = context.state.osCyl
prm.osX = context.state.osX
prm.colorBlindNumber = context.state.colorBlindNumber
prm.glucoses = context.state.glucoses
// console.log(prm);
// return;
let resp = await api.scanbarcode(prm)
if (resp.status != "OK") {
context.commit("update_search_patient", 3)
context.commit("update_search_error_message", resp.message)
context.commit("update_errorMsg", resp.message)
context.commit("update_dialogError", true)
} else {
context.commit("update_search_patient", 2)
context.commit("update_search_error_message", "")
if (resp.data.status_log === "Y") {
console.log(resp.data)
if (resp.data.isdone === "N")
location.reload()
else
location.replace("/one-ui/" + context.state.urls.url_sampling + "?stat=" + prm.station.id + "&loc=" + prm.location_id)
}
else {
context.commit("update_alert_msg", "Barcode " + prm.barcode + " tidak ditemukan pada pasien ini, pastikan barcode yang discan sudah benar")
context.commit("update_alert_status", true)
}
}
} catch (e) {
context.commit("update_search_patient", 3)
context.commit("update_search_error_message", e.message)
context.commit("update_errorMsg", e.message)
context.commit("update_dialogError", true)
console.log(e)
}
},
async lookup_statuses(context, prm) {
context.commit("update_lookup_status", 1)
try {
prm.token = one_token()
let resp = await api.lookup_statuses(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_lookup_error_message", resp.message)
context.commit("update_errorMsg", resp.message)
context.commit("update_dialogError", true)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_lookup_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_statuses", data.records)
//context.commit("update_promise_dialog",true)
}
} catch (e) {
context.commit("update_lookup_status", 3)
context.commit("update_lookup_error_message", e.message)
context.commit("update_errorMsg", e.message)
context.commit("update_dialogError", true)
}
},
async getdatabarcodes(context, prm) {
context.commit("update_lookup_status", 1)
try {
prm.token = one_token()
let resp = await api.getdatabarcodes(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_lookup_error_message", resp.message)
context.commit("update_errorMsg", resp.message)
context.commit("update_dialogError", true)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_lookup_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_barcodes", data.records)
context.commit("update_dialog_barcode", true)
}
} catch (e) {
context.commit("update_lookup_status", 3)
context.commit("update_lookup_error_message", e.message)
context.commit("update_errorMsg", e.message)
context.commit("update_dialogError", true)
}
},
async serahkan(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.serahkan(prm)
if (resp.status != "OK") {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", resp.message)
context.commit("update_errorMsg", resp.message)
context.commit("update_dialogError", true)
} else {
context.commit("update_save_status", 2)
context.commit("update_save_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total
}
var row_data = prm
row_data.status = 'D'
row_data.received_time = resp.data.records.received_time
var patients = context.state.patients
//console.log(patients)
//console.log(prm.last_idx)
//console.log(prm.last_detail_idx)
//console.log(patients.details)
patients[prm.spk_idx].details[prm.last_idx].details[prm.last_detail_idx] = row_data
context.commit("update_patients", patients)
context.commit("update_dialog_details", false)
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
context.commit("update_errorMsg", e.message)
context.commit("update_dialogError", true)
console.log(e)
}
},
async searchcompany(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.searchcompany(one_token(), prm)
if (resp.status != "OK") {
context.commit("update_autocomplete_status", 3)
} else {
context.commit("update_autocomplete_status", 2)
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_companies", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async getstations(context) {
context.commit("update_get_data_status", 1);
try {
let resp = await api.getstations(one_token());
if (resp.status != "OK") {
context.commit("update_get_data_status", 3);
context.commit("update_errorMsg", resp.message)
context.commit("update_dialogError", true)
} else {
context.commit("update_get_data_status", 2);
let data = {
records: resp.data.records,
total: resp.data.total,
};
context.commit("update_stations", data.records.stations)
context.commit("update_urls", resp.data.urls)
if (context.state.station_id !== -1) {
console.log('in station id')
console.log(context.state.station_id)
let xidx = _.findIndex(data.records.stations, function (o) { return o.id == context.state.station_id })
console.log(xidx)
context.commit("update_selected_station", data.records.stations[xidx])
context.commit("update_station_id", 0)
context.dispatch("getLocation", data.records.stations[xidx].id)
} else {
console.log('another way')
context.commit("update_selected_station", data.records.stations[0])
context.dispatch("getLocation", data.records.stations[0].id)
}
}
} catch (e) {
console.log(e);
context.commit("update_errorMsg", e.message)
context.commit("update_dialogError", true)
context.commit("update_get_data_status", 3);
}
},
async getLocation(context, prm) {
context.commit("update_get_data_status", 1);
try {
let param = { token: one_token(), station_id: prm };
let resp = await api.getLocation(param);
if (resp.status != "OK") {
context.commit("update_get_data_status", 3);
context.commit("update_errorMsg", resp.message)
context.commit("update_dialogError", true)
} else {
context.commit("update_get_data_status", 2);
context.commit("update_locations", resp.data.records);
console.log('location')
console.log(context.state.location_id)
if (context.state.location_id !== -1) {
console.log("location inter")
//console.log(context.state.location_id)
let xidx = _.findIndex(resp.data.records, function (o) { return parseInt(o.locationID) == parseInt(context.state.location_id) })
console.log(xidx)
if (xidx > -1) {
context.commit("update_selected_location", resp.data.records[xidx])
} else {
context.commit("update_selected_location", resp.data.records[0])
}
context.commit("update_location_id", 0)
} else
context.commit("update_selected_location", resp.data.records[0])
}
} catch (e) {
console.log(e);
context.commit("update_errorMsg", e.message)
context.commit("update_dialogError", true)
context.commit("update_get_data_status", 3);
}
},
async skipaction(context) {
context.commit("update_get_data_status", 1);
try {
let param = {
token: one_token(),
order_id: context.state.data_patient.xid,
location_id: context.state.selected_location,
station: context.state.selected_station
}
//param.station = context.state.selected_station
let resp = await api.skipaction(param);
if (resp.status != "OK") {
context.commit("update_get_data_status", 3);
context.commit("update_errorMsg", resp.message)
context.commit("update_dialogError", true)
} else {
context.commit("update_get_data_status", 2);
let station = context.state.selected_station
let location = context.state.selected_location
//location.replace("/one-ui/test/vuex/cpone-sample-lab-mobile-v3/")
window.location = "/one-ui/" + context.state.urls.url_sampling + "?stat=" + station.id + "&loc=" + location.locationID
}
} catch (e) {
console.log(e);
context.commit("update_errorMsg", e.message)
context.commit("update_dialogError", true)
context.commit("update_get_data_status", 3);
}
},
async savefisik(context,prm) {
context.commit("update_get_data_status", 1);
try {
prm.token = one_token()
let resp = await api.savefisik(prm);
if (resp.status != "OK") {
context.commit("update_get_data_status", 3);
context.commit("update_errorMsg", resp.message)
context.commit("update_dialogError", true)
} else {
context.commit("update_get_data_status", 2);
alert('data sudah tersimpan')
let labnumber = context.state.url_labnumber
let station_id = context.state.station_id
let location_id = context.state.location_id
window.location = "/one-ui/" + context.state.next_url +"?labnumber="+labnumber + "&stat=" + station_id + "&loc=" + location_id
}
} catch (e) {
console.log(e);
context.commit("update_errorMsg", e.message)
context.commit("update_dialogError", true)
context.commit("update_get_data_status", 3);
}
},
async get_patient(context,prm) {
context.commit("update_get_data_status", 1);
try {
prm.token = one_token()
let resp = await api.get_patient(prm);
if (resp.status != "OK") {
context.commit("update_get_data_status", 3);
context.commit("update_errorMsg", resp.message)
context.commit("update_dialogError", true)
} else {
context.commit("update_get_data_status", 2);
let datas = resp.data.records[0].details[0]
console.log(datas)
context.commit("update_datas", datas);
context.commit("update_dt_patient", resp.data.records[0]);
context.commit("update_next_url", resp.data.next_url);
console.log(context.state.dt_patient)
context.dispatch("getumum",datas)
}
} catch (e) {
console.log(e);
context.commit("update_errorMsg", e.message)
context.commit("update_dialogError", true)
context.commit("update_get_data_status", 3);
}
},
async getumum(context,prm) {
context.commit("update_get_data_status", 1);
try {
prm.token = one_token()
let resp = await api.getumum(prm);
if (resp.status != "OK") {
context.commit("update_get_data_status", 3);
context.commit("update_errorMsg", resp.message)
context.commit("update_dialogError", true)
} else {
context.commit("update_get_data_status", 2);
let datas = resp.data.records
if(datas.riwayats[0].details[27].chx){
context.commit("update_keluhan_lain", true);
}
if(datas.fisiks[2].details[4].chx){
context.commit("update_kepala_lain", true);
}
if(datas.fisiks[3].details[9].chx){
context.commit("update_mata_lain", true);
}
if(datas.fisiks[5].details[5].chx){
context.commit("update_telinga_lain", true);
}
if(datas.fisiks[6].details[3].chx){
context.commit("update_hidung_lain", true);
}
if(datas.fisiks[8].details[0].details[3].chx){
context.commit("update_mulut_lain", true);
}
if(datas.fisiks[8].details[1].details[4].chx){
context.commit("update_tenggorokan_lain", true);
}
if(datas.fisiks[9].details[5].chx){
context.commit("update_leher_lain", true);
}
if(datas.fisiks[11].details[4].chx){
context.commit("update_paru_lain", true);
}
if(datas.fisiks[14].details[0].details[3].chx){
context.commit("update_kulit_lain", true);
}
if(datas.fisiks[16].details[0].details[6].chx){
context.commit("update_ekstremitas_atas_lain", true);
}
if(datas.fisiks[16].details[0].details[5].chx){
context.commit("update_ekstremitas_bawah_lain", true);
}
let kepala_chx = []
datas.fisiks[2].details.forEach(item => {
if(item.chx && item.is_normal !== 'Y'){
kepala_chx.push(item)
}
});
context.commit("update_open_listing_abnormal_kepala", false);
if(kepala_chx.length > 0){
context.commit("update_open_listing_abnormal_kepala", true);
}
let mata_chx = []
datas.fisiks[3].details.forEach(item => {
if(item.chx && item.is_normal !== 'Y'){
mata_chx.push(item)
}
});
context.commit("update_open_listing_abnormal_mata", false);
if(mata_chx.length > 0){
context.commit("update_open_listing_abnormal_mata", true);
}
let telinga_chx = []
datas.fisiks[5].details.forEach(item => {
if(item.chx && item.is_normal !== 'Y'){
telinga_chx.push(item)
}
});
context.commit("update_open_listing_abnormal_telinga", false);
if(telinga_chx.length > 0){
context.commit("update_open_listing_abnormal_telinga", true);
}
let hidung_chx = []
datas.fisiks[6].details.forEach(item => {
if(item.chx && item.is_normal !== 'Y'){
hidung_chx.push(item)
}
});
context.commit("update_open_listing_abnormal_hidung", false);
if(hidung_chx.length > 0){
context.commit("update_open_listing_abnormal_hidung", true);
}
let gigi_chx = []
datas.fisiks[7].details.forEach(item => {
if(item.chx && item.is_normal !== 'Y'){
gigi_chx.push(item)
}
});
context.commit("update_open_listing_abnormal_gigi", false);
if(gigi_chx.length > 0){
context.commit("update_open_listing_abnormal_gigi", true);
}
let mulut_chx = []
datas.fisiks[8].details[0].details.forEach(item => {
if(item.chx && item.is_normal !== 'Y'){
mulut_chx.push(item)
}
});
context.commit("update_open_listing_abnormal_mulut", false);
if(mulut_chx.length > 0){
context.commit("update_open_listing_abnormal_mulut", true);
}
let tenggorokan_chx = []
datas.fisiks[8].details[1].details.forEach(item => {
if(item.chx && item.is_normal !== 'Y'){
tenggorokan_chx.push(item)
}
});
context.commit("update_open_listing_abnormal_tenggorokan", false);
if(tenggorokan_chx.length > 0){
context.commit("update_open_listing_abnormal_tenggorokan", true);
}
let leher_chx = []
datas.fisiks[9].details.forEach(item => {
if(item.chx && item.is_normal !== 'Y'){
leher_chx.push(item)
}
});
context.commit("update_open_listing_abnormal_leher", false);
if(leher_chx.length > 0){
context.commit("update_open_listing_abnormal_leher", true);
}
let paru_chx = []
datas.fisiks[11].details.forEach(item => {
if(item.chx && item.is_normal !== 'Y'){
leher_chx.push(item)
}
});
context.commit("update_open_listing_abnormal_paru", false);
if(paru_chx.length > 0){
context.commit("update_open_listing_abnormal_paru", true);
}
let ekstremitas_atas_chx = []
datas.fisiks[16].details[0].details.forEach(item => {
if(item.chx && item.is_normal !== 'Y'){
ekstremitas_atas_chx.push(item)
}
});
context.commit("update_open_listing_abnormal_ekstremitas_atas", false);
if(ekstremitas_atas_chx.length > 0){
context.commit("update_open_listing_abnormal_ekstremitas_atas", true);
}
let ekstremitas_bawah_chx = []
datas.fisiks[16].details[1].details.forEach(item => {
if(item.chx && item.is_normal !== 'Y'){
ekstremitas_bawah_chx.push(item)
}
});
context.commit("update_open_listing_abnormal_ekstremitas_bawah", false);
if(ekstremitas_bawah_chx.length > 0){
context.commit("update_open_listing_abnormal_ekstremitas_bawah", true);
}
let smell_chx = []
datas.fisiks[18].details[0].details.forEach(item => {
if(item.chx && item.is_normal !== 'Y'){
smell_chx.push(item)
}
});
context.commit("update_open_listing_abnormal_smell", false);
if(smell_chx.length > 0){
context.commit("update_open_listing_abnormal_smell", true);
}
let normal_abdomen = ''
console.log(datas.fisiks[13].details[0].details[0].id_code+' '+datas.fisiks[13].details[0].details[0].chx)
console.log(datas.fisiks[13].details[1].details[0].id_code+' '+datas.fisiks[13].details[1].details[0].chx)
console.log(datas.fisiks[13].details[2].details[0].id_code+' '+datas.fisiks[13].details[2].details[0].chx)
console.log(datas.fisiks[13].details[3].details[0].id_code+' '+datas.fisiks[13].details[3].details[0].chx)
console.log(datas.fisiks[13].details[4].details[0].id_code+' '+datas.fisiks[13].details[4].details[0].chx)
console.log(datas.fisiks[13].details[5].details[0].id_code+' '+datas.fisiks[13].details[5].details[0].chx )
console.log(datas.fisiks[13].details[5].details[1].id_code+' '+datas.fisiks[13].details[5].details[1].chx)
if(datas.fisiks[13].details[0].details[0].chx &&
datas.fisiks[13].details[1].details[0].chx &&
datas.fisiks[13].details[2].details[0].chx &&
datas.fisiks[13].details[3].details[0].chx &&
datas.fisiks[13].details[4].details[0].chx &&
( datas.fisiks[13].details[5].details[0].chx || datas.fisiks[13].details[5].details[1].chx)
){
console.log('XIC')
normal_abdomen = true
}
if(datas.fisiks[13].details[0].details[1].chx ||
datas.fisiks[13].details[0].details[4].chx ||
datas.fisiks[13].details[0].details[2].chx ||
datas.fisiks[13].details[1].details[1].chx ||
datas.fisiks[13].details[4].details[1].details[1].chx_a_value ||
datas.fisiks[13].details[4].details[1].details[1].chx_b_value ||
datas.fisiks[13].details[4].details[1].details[0].chx_value ||
datas.fisiks[13].details[4].details[1].details[2].chx_a_value ||
datas.fisiks[13].details[4].details[1].details[2].chx_b_value ||
datas.fisiks[13].details[5].details[2].chx
){
console.log('XIB')
normal_abdomen = false
context.commit("update_open_listing_abnormal_normal_abdomen", true);
}
console.log(normal_abdomen)
context.commit("update_normal_abdomen", normal_abdomen);
/*if(!datas.fisiks[4].details[0].chx_x && !datas.fisiks[4].details[0].chx_y){
datas.fisiks[4].details[0].chx_y = true
}
let mulut_chx = []
datas.fisiks[8].details[0].details.forEach(item => {
if(item.chx && item.is_normal !== 'Y'){
mulut_chx.push(item)
}
});
if(mulut_chx.length == 0){
datas.fisiks[8].details[0].details[0].chx = true
}
let tenggorokan_chx = []
datas.fisiks[8].details[1].details.forEach(item => {
if(item.chx && item.is_normal !== 'Y'){
tenggorokan_chx.push(item)
}
});
if(tenggorokan_chx.length == 0){
datas.fisiks[8].details[1].details[0].chx = true
}
console.log(datas)
console.log('before_teng')*/
context.commit("update_dt_umum", datas);
console.log(_.isEmpty(context.state.dt_umum))
}
} catch (e) {
console.log(e);
context.commit("update_errorMsg", e.message)
context.commit("update_dialogError", true)
context.commit("update_get_data_status", 3);
}
},
}
}