843 lines
31 KiB
JavaScript
843 lines
31 KiB
JavaScript
// 1 => LOADING
|
|
// 2 => DONE
|
|
// 3 => ERROR
|
|
import * as api from "../api/order.js"
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state: {
|
|
order_id: 0,
|
|
queue: "",
|
|
is_from_clinic: false,
|
|
|
|
catatan_fo: '',
|
|
diagnosa: '',
|
|
patient_note: '',
|
|
|
|
finish_dialog_is_active: false,
|
|
current_order: {},
|
|
|
|
received_sample: {
|
|
flag: 'N',
|
|
time: ''
|
|
},
|
|
|
|
tabs: [
|
|
{ "label": "DEMOGRAFI", "icon": "opacity", "code": "01", "enabled": true },
|
|
{ "label": "PEMERIKSAAN", "icon": "verified_user", "code": "02", "enabled": true },
|
|
{ "label": "PEMBAYARAN", "icon": "motorcycle", "code": "03", "enabled": false }
|
|
],
|
|
|
|
print_dialog_is_active: false,
|
|
rpt_url: window.BASE_URL + '/one-ui/test/vuex/common/under-cons.pdf',
|
|
dialog_start: true,
|
|
status_start: 'Y',
|
|
time_start: undefined,
|
|
elapsedTime: 0,
|
|
show_time: null,
|
|
loading_process: false,
|
|
stest: [],
|
|
mcuid: 0,
|
|
preid: 0,
|
|
patientBarcode: [],
|
|
url_preregister : '',
|
|
url_register: '',
|
|
in_saving: false,
|
|
loading_data_patient: false,
|
|
uuid: '',
|
|
form_code: '',
|
|
url_qrform: '',
|
|
preregister_promise:'',
|
|
message_error:'',
|
|
dialog_pop_up_error: false,
|
|
loading_save: false,
|
|
url_menu_cashier: ''
|
|
},
|
|
mutations: {
|
|
update_url_menu_cashier(state, val) {
|
|
state.url_menu_cashier = val
|
|
},
|
|
update_loading_save(state, val) {
|
|
state.loading_save = val
|
|
},
|
|
update_message_error(state, val) {
|
|
state.message_error = val
|
|
},
|
|
update_dialog_pop_up_error(state, val) {
|
|
state.dialog_pop_up_error = val
|
|
},
|
|
update_preregister_promise(state, val) {
|
|
state.preregister_promise = val
|
|
},
|
|
update_url_qrform(state, val) {
|
|
state.url_qrform = val
|
|
},
|
|
update_uuid(state, val) {
|
|
state.uuid = val
|
|
},
|
|
update_form_code(state, val) {
|
|
state.form_code = val
|
|
},
|
|
update_loading_data_patient(state, val) {
|
|
state.loading_data_patient = val
|
|
},
|
|
update_in_saving(state, val) {
|
|
state.in_saving = val
|
|
},
|
|
update_url_preregister(state, val) {
|
|
state.url_preregister = val
|
|
},
|
|
update_url_register(state, val) {
|
|
state.url_register = val
|
|
},
|
|
update_patientBarcode(state, val) {
|
|
state.patientBarcode = val
|
|
},
|
|
update_preid(state, val) {
|
|
state.preid = val
|
|
},
|
|
update_mcuid(state, val) {
|
|
state.mcuid = val
|
|
},
|
|
update_stest(state, val) {
|
|
state.stest = val
|
|
},
|
|
update_loading_process(state, val) {
|
|
state.loading_process = val
|
|
},
|
|
update_show_time(state, val) {
|
|
state.show_time = val
|
|
},
|
|
update_elapsedTime(state, val) {
|
|
state.elapsedTime = val
|
|
},
|
|
update_dialog_start(state, val) {
|
|
state.dialog_start = val
|
|
},
|
|
update_status_start(state, val) {
|
|
state.status_start = val
|
|
},
|
|
update_time_start(state, val) {
|
|
state.time_start = val
|
|
},
|
|
update_patient_note(state, val) {
|
|
state.patient_note = val
|
|
},
|
|
update_catatan_fo(state, val) {
|
|
state.catatan_fo = val
|
|
},
|
|
update_diagnosa(state, val) {
|
|
state.diagnosa = val
|
|
},
|
|
update_finish_dialog_is_active(state, val) {
|
|
state.finish_dialog_is_active = val
|
|
},
|
|
update_current_order(state, val) {
|
|
state.current_order = val
|
|
},
|
|
|
|
update_received_sample(state, val) {
|
|
state.received_sample = val
|
|
},
|
|
|
|
update_tab_enable(state, v) {
|
|
state.tabs[v[0]].enabled = v[1]
|
|
},
|
|
|
|
update_from_clinic(state, v) {
|
|
state.is_from_clinic = v
|
|
},
|
|
|
|
update_queue(state, v) {
|
|
state.queue = v
|
|
},
|
|
|
|
update_order_id(state, v) {
|
|
state.order_id = v
|
|
},
|
|
|
|
reset_form(state) {
|
|
state.order_id = 0
|
|
state.queue = ""
|
|
state.is_from_clinic = false
|
|
state.catatan_fo = ""
|
|
state.diagnosa = ""
|
|
state.patient_note = ""
|
|
},
|
|
|
|
update_print_dialog_is_active(state, val) {
|
|
state.print_dialog_is_active = val
|
|
},
|
|
|
|
update_rpt_url(state, v) {
|
|
state.rpt_url = v
|
|
}
|
|
},
|
|
actions: {
|
|
async save(context) {
|
|
|
|
var req = [];
|
|
var detail = [];
|
|
var px_tmp = [];
|
|
var st = context.rootState.px.selected_test;
|
|
for (let i in st) {
|
|
let x = {
|
|
t_id: st[i]['T_TestID'],
|
|
t_name: st[i]['T_TestName'],
|
|
t_amount: st[i]['T_PriceAmount'],
|
|
t_discount: st[i]['T_PriceDisc'],
|
|
t_discount_rp: st[i]['T_PriceDiscRp'],
|
|
t_subtotal: st[i]['T_PriceSubTotal'],
|
|
t_total: st[i]['T_PriceTotal'],
|
|
t_cito: st[i]['T_TestIsCito']?st[i]['T_TestIsCito']:'N',
|
|
nat_test: st[i]['nat_test']?st[i]['nat_test']:null,
|
|
t_req: 'N',
|
|
t_reqnote: '',
|
|
t_ispacket: st[i]['is_packet']?st[i]['is_packet']:'N',
|
|
t_packetid: st[i]['packet_id']?st[i]['packet_id']:0,
|
|
packet_type: st[i]['packet_type']?st[i]['packet_type']:'',
|
|
packet_name: st[i]['packet_name']?st[i]['packet_name']:'',
|
|
t_px_type: st[i]['px_type']?st[i]['px_type']:'PX'
|
|
}
|
|
|
|
let rq = context.rootState.px.requirement
|
|
for (let j in rq) {
|
|
if (rq[j].label == st[i].T_TestRequirement) {
|
|
x.t_req = (rq[j].checked ? 'Y' : 'N')
|
|
x.t_reqnote = rq[j].note
|
|
}
|
|
}
|
|
|
|
px_tmp.push(x)
|
|
}
|
|
|
|
let req_status = context.rootState.px.req_status
|
|
req = {
|
|
status : req_status,
|
|
reqs : req_status == 'Y' ? [] : context.rootState.px.reqs
|
|
}
|
|
|
|
detail = px_tmp;
|
|
|
|
let prm = {}
|
|
prm.token = one_token()
|
|
prm.selected_patient = context.rootState.patient.selected_patient
|
|
prm.patient_age = context.rootState.patient.selected_patient.patient_age
|
|
prm.patient_note = context.state.patient_note
|
|
prm.diagnosa = context.state.diagnosa
|
|
prm.catatan_fo = context.state.catatan_fo
|
|
prm.selected_icd10 = context.rootState.patient.selected_icd10
|
|
prm.selected_doctor = context.rootState.doctor.selected_doctor
|
|
prm.selected_language = context.rootState.language.selected_language ? context.rootState.language.selected_language.id : 1
|
|
prm.selected_language_2 = context.rootState.language.selected_language_2 ? context.rootState.language.selected_language_2.id : 0
|
|
prm.selected_project = context.rootState.company.selected_project
|
|
prm.selected_fisik_template = context.rootState.company.selected_fisik_template
|
|
prm.selected_company = context.rootState.company.selected_company
|
|
prm.selected_mou = context.rootState.company.selected_mou
|
|
prm.detail = px_tmp
|
|
prm.received_sample = context.rootState.order.received_sample.flag ?context.rootState.order.received_sample.flag:"N"
|
|
|
|
// Konversi format waktu ke MySQL format (YYYY-MM-DD H:i:s)
|
|
// Format input: "301220250900" (ddmmyyyyhhmm) -> Output: "2025-12-30 09:00:00"
|
|
let receivedTime = context.rootState.order.received_sample.time
|
|
if (receivedTime) {
|
|
// Parse format ddmmyyyyhhmm (12 digit tanpa separator)
|
|
// Contoh: "301220250900" -> "30-12-2025 09:00"
|
|
if (receivedTime.match(/^\d{12}$/)) {
|
|
let day = receivedTime.substring(0, 2) // 30
|
|
let month = receivedTime.substring(2, 4) // 12
|
|
let year = receivedTime.substring(4, 8) // 2025
|
|
let hour = receivedTime.substring(8, 10) // 09
|
|
let minute = receivedTime.substring(10, 12) // 00
|
|
|
|
// Format MySQL: YYYY-MM-DD H:i:s
|
|
receivedTime = `${year}-${month}-${day} ${hour}:${minute}:00`
|
|
}
|
|
}
|
|
prm.received_sample_time = receivedTime
|
|
prm.queue = context.state.queue
|
|
prm.queue_id = context.state.queue_id
|
|
prm.deliveries = context.rootState.delivery.data_deliveries
|
|
prm.cito_id = context.rootState.px.selected_cito ? context.rootState.px.selected_cito.Nat_CitoID : 0
|
|
prm.schedule = context.rootState.px.appx_schedule
|
|
prm.req = req
|
|
|
|
|
|
try {
|
|
let refs = context.rootState.reference.selected_reference || [];
|
|
if (!Array.isArray(refs)) refs = [refs];
|
|
refs = refs.filter(r => r && r.M_ReferenceID);
|
|
|
|
prm.reference = refs;
|
|
|
|
let ordertype = context.rootState.reference.selected_ordertype || null;
|
|
prm.ordertype = ordertype;
|
|
|
|
let resp = await api.save(prm);
|
|
|
|
console.log('save respon' , resp.data)
|
|
if (resp.status != "200") {
|
|
context.commit('update_in_saving', false)
|
|
context.commit('update_loading_process', false)
|
|
context.commit('update_dialog_loading', false, { root: true })
|
|
context.commit('update_message_error', resp.data.message)
|
|
context.commit('update_dialog_pop_up_error', true)
|
|
} else {
|
|
// Dialog loading
|
|
|
|
if(resp.data.status != 'OK'){
|
|
context.commit('update_in_saving', false)
|
|
context.commit('update_loading_process', false)
|
|
context.commit('update_dialog_loading', false, { root: true })
|
|
context.commit('update_message_error', resp.data.message)
|
|
context.commit('update_dialog_pop_up_error', true)
|
|
return;
|
|
}
|
|
|
|
context.commit('update_loading_process', false)
|
|
context.commit('update_dialog_loading', false, { root: true })
|
|
context.commit('update_in_saving', false)
|
|
|
|
if(resp.data.data.tipe == 'new'){
|
|
context.commit('patient/update_selected_patient', resp.data.data.order_header, { root: true })
|
|
context.commit('payment/update_selected_patient', resp.data.data.order_header, { root: true })
|
|
context.commit("update_current_order", resp.data.data)
|
|
context.commit('update_uuid', resp.data.data.uuid)
|
|
context.commit('update_form_code', resp.data.data.form_code)
|
|
context.commit('update_url_qrform', resp.data.data.url_qrform)
|
|
context.commit('update_finish_dialog_is_active', true)
|
|
|
|
context.commit('payment/update_order_id', resp.data.data.order_id, { root: true })
|
|
context.commit("payment/update_order", resp.data.data, { root: true })
|
|
context.commit('update_url_menu_cashier', resp.data.data.url_menu_cashier)
|
|
}
|
|
}
|
|
} catch (e) {
|
|
context.commit('update_loading_process', false)
|
|
context.commit('update_dialog_loading', false, { root: true })
|
|
context.commit('update_in_saving', false)
|
|
}
|
|
},
|
|
|
|
async load_from_clinic(context) {
|
|
let queue = context.state.queue;
|
|
|
|
try {
|
|
let resp = await api.load_from_clinic(queue)
|
|
|
|
if (resp.status != "200") {
|
|
// context.commit("update_search_status",3)
|
|
// context.commit("update_search_error_message",resp.message)
|
|
alert('error')
|
|
} else {
|
|
|
|
if (resp.data.status != "OK") {
|
|
|
|
return;
|
|
}
|
|
|
|
let data = resp.data.data
|
|
context.commit('update_from_clinic', true)
|
|
|
|
context.commit('patient/update_selected_patient', data.patient, { root: true })
|
|
context.commit('doctor/update_doctors', { records: [data.doctor], total: 1 }, { root: true })
|
|
context.commit('doctor/update_selected_doctor', data.doctor, { root: true })
|
|
context.commit('doctor/update_search', data.doctor.search, { root: true })
|
|
|
|
// Delivery
|
|
context.commit('delivery/update_params', { p_id: data.patient.M_PatientID }, { root: true })
|
|
context.commit('delivery/update_params', { d_id: data.doctor.M_DoctorID }, { root: true })
|
|
|
|
|
|
// Company
|
|
let search = data.company.search
|
|
delete (data.company.search)
|
|
|
|
setTimeout(function () { context.commit('company/update_companies', { records: [data.company], total: 1 }, { root: true }) }, 0)
|
|
setTimeout(function () { context.commit('company/update_search', search, { root: true }) }, 0)
|
|
setTimeout(function () { context.commit('company/update_selected_company', data.company, { root: true }) }, 0)
|
|
|
|
setTimeout(function () { context.commit('company/update_selected_mou', data.company.mou[0], { root: true }) }, 0)
|
|
// setTimeout(function() { context.commit('company/selected_xx', data.company.mou[0], {root:true}) }, 0)
|
|
|
|
// PX
|
|
// context.commit("px/update_selected_test", data.test, {root:true})
|
|
// context.commit("px/update_requirement", data.req, {root:true})
|
|
|
|
// Delivery
|
|
context.dispatch('delivery/search', null, { root: true })
|
|
|
|
// PX
|
|
context.dispatch('px/search_pxs_clinic', data.order_id, { root: true })
|
|
}
|
|
} catch (e) {
|
|
// context.commit("update_search_status",3)
|
|
// context.commit("update_search_error_message",e.message )
|
|
}
|
|
},
|
|
async load(context) {
|
|
let id = context.state.order_id;
|
|
|
|
try {
|
|
let resp = await api.load(id)
|
|
|
|
if (resp.status != "200") {
|
|
// context.commit("update_search_status",3)
|
|
// context.commit("update_search_error_message",resp.message)
|
|
alert('error')
|
|
} else {
|
|
|
|
if (resp.data.status != "OK") {
|
|
return;
|
|
}
|
|
|
|
let data = resp.data.data
|
|
|
|
|
|
if (id !== -1)
|
|
context.commit('patient/update_selected_patient', data.patient, { root: true })
|
|
|
|
//context.commit('doctor/update_doctors', { records: [data.doctor], total: 1 }, { root: true })
|
|
// context.commit('doctor/update_selected_doctor', data.doctor, { root: true })
|
|
context.commit('doctor/update_search', data.doctor.search, { root: true })
|
|
|
|
// Delivery
|
|
context.commit('delivery/update_params', { p_id: data.patient.M_PatientID }, { root: true })
|
|
context.commit('delivery/update_params', { d_id: data.doctor.M_DoctorID }, { root: true })
|
|
|
|
|
|
// Company
|
|
let search = data.company.search
|
|
delete (data.company.search)
|
|
|
|
setTimeout(function () { context.commit('company/update_companies', { records: [data.company], total: 1 }, { root: true }) }, 0)
|
|
setTimeout(function () { context.commit('company/update_search', search, { root: true }) }, 0)
|
|
setTimeout(function () { context.commit('company/update_selected_company', data.company, { root: true }) }, 0)
|
|
|
|
setTimeout(function () { context.commit('company/update_selected_mou', data.company.mou[0], { root: true }) }, 0)
|
|
// setTimeout(function() { context.commit('company/selected_xx', data.company.mou[0], {root:true}) }, 0)
|
|
|
|
context.commit('update_received_sample', data.order.rec_sample);
|
|
|
|
// PX
|
|
context.commit("px/update_selected_test", data.test, { root: true })
|
|
context.commit("px/update_requirement", data.req, { root: true })
|
|
|
|
// Delivery
|
|
context.dispatch('delivery/search', null, { root: true })
|
|
|
|
// Enable tab
|
|
context.commit('update_tab_enable', [2, true])
|
|
|
|
setTimeout(function () {
|
|
context.commit('update_from_clinic', false)
|
|
}, 15000)
|
|
|
|
}
|
|
} catch (e) {
|
|
// context.commit("update_search_status",3)
|
|
// context.commit("update_search_error_message",e.message )
|
|
}
|
|
},
|
|
|
|
async reset_form(context) {
|
|
context.commit("reset_form")
|
|
context.commit("patient/update_selected_patient", {}, { root: true })
|
|
context.commit("doctor/update_doctors", { records: [], total: 0 }, { root: true })
|
|
context.commit("doctor/update_selected_doctor", {}, { root: true })
|
|
context.commit("doctor/update_selected_doctor_pj", {}, { root: true })
|
|
|
|
// context.commit("delivery/update_deliveries", [], {root:true})
|
|
// context.commit("delivery/update_selected_delivery", {}, {root:true})
|
|
context.commit("delivery/update_params", { p_id: 0, d_id: 0, o_id: 0 }, { root: true })
|
|
context.dispatch("delivery/search", null, { root: true })
|
|
|
|
context.commit("px/update_selected_test", [], { root: true })
|
|
context.commit("px/update_requirement", [], { root: true })
|
|
|
|
// Company
|
|
context.commit("company/reset_company")
|
|
},
|
|
async load_preregister(context, prm) {
|
|
//context.commit("update_search_status",1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.load_preregister(prm)
|
|
//alert("dasdasd")
|
|
// console.log(resp)
|
|
|
|
// context.commit("update_search_status",2)
|
|
// context.commit("update_search_error_message","")
|
|
// alert("aaaaaaaaaaaaaa")
|
|
//console.log("dasdasdasd")
|
|
let data = {
|
|
records: resp.data.records
|
|
}
|
|
console.log(resp)
|
|
var rst = resp.data.data.records
|
|
|
|
console.log(rst)
|
|
context.commit('patient/update_selected_patient', rst['patient'], { root: true })
|
|
if (rst['patient']['M_PatientPhoto']) {
|
|
context.commit('photo/update_photo_url', rst['patient']['M_PatientPhoto'], { root: true })
|
|
}
|
|
|
|
let refs = rst['selected_reference'] || [];
|
|
if (!Array.isArray(refs)) refs = [refs];
|
|
|
|
let doctors = []
|
|
doctors.push(rst['selected_doctor'])
|
|
console.log(doctors)
|
|
|
|
context.commit('doctor/update_doctors', { records: doctors, total: doctors.length }, { root: true })
|
|
context.commit('doctor/update_selected_doctor', doctors[0], { root: true })
|
|
context.commit('doctor/update_selected_address', rst['selected_address'], { root: true })
|
|
context.commit('reference/update_references', refs, { root: true })
|
|
context.commit('reference/update_selected_reference', refs, { root: true })
|
|
console.log('selesai doctor')
|
|
console.log(rst['companies'])
|
|
context.commit('company/update_companies', { records: rst['companies'], total: 1 }, { root: true })
|
|
console.log(context.rootState.company.companies)
|
|
context.commit('company/update_order_companies', rst['companies'], { root: true })
|
|
//console.log(context.rootState.company.companies)
|
|
context.commit('company/update_selected_company', rst['selected_company'], { root: true })
|
|
context.commit('company/update_selected_mou', rst['selected_mou'], { root: true })
|
|
console.log('selesai company')
|
|
context.commit('delivery/update_data_deliveries', rst['data_deliveries'], { root: true })
|
|
console.log('selesai delivery')
|
|
context.commit('update_stest', rst['tests'])
|
|
console.log('selesai test 1')
|
|
//context.commit('history/update_history_dialog',false,{root:true})
|
|
//context.dispatch('px/search', {}, { root: true })
|
|
if (rst['tests']) {
|
|
rst['tests'].forEach(function (test) {
|
|
context.dispatch('selectPx', test)
|
|
});
|
|
|
|
}
|
|
context.commit('update_preregister_promise', rst['result_promise'])
|
|
console.log('selesai load')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
// context.commit("update_search_status",3)
|
|
// context.commit("update_search_error_message",e.message )
|
|
}
|
|
},
|
|
async selectPx(context, px) {
|
|
// console.log(context)
|
|
var in_selectPx = false
|
|
console.log(px)
|
|
//debugger
|
|
console.log("start select px")
|
|
if (!window.one_token()) {
|
|
//context.commit('update_message_error', 'Maaf, koneksi Anda sempat terputus silahkan Log Out dan Login kembali',{root:true})
|
|
//context.commit('update_dialog_error', true,{root:true})
|
|
return
|
|
}
|
|
|
|
|
|
try {
|
|
console.log(in_selectPx)
|
|
// START LOADING
|
|
//context.commit('update_dialog_loading', true)
|
|
console.log('px type ' + px.px_type)
|
|
|
|
// IF PROFILE
|
|
if (px.px_type == "PR" || px.px_type == "PXR")
|
|
return context.dispatch('selectProfile', px)
|
|
|
|
|
|
// SEARCH NAT TEST
|
|
let nt = context.rootState.px.nat_test
|
|
let found_nt = false
|
|
for (let i in px.nat_test) {
|
|
if (nt.indexOf(px.nat_test[i]) > -1)
|
|
found_nt = true
|
|
}
|
|
|
|
if (found_nt) {
|
|
alert('Pemeriksaan tersebut sudah ada !')
|
|
// END LOADING
|
|
//context.commit('update_dialog_loading', false,{root:true})
|
|
return
|
|
}
|
|
|
|
//if (in_selectPx) return
|
|
in_selectPx = true
|
|
let selected_test = context.rootState.px.selected_test
|
|
let flag_found = false
|
|
selected_test.forEach(function (t, idx) {
|
|
if (t.T_TestID == px.T_TestID) {
|
|
selected_test[idx] = px
|
|
flag_found = true
|
|
}
|
|
})
|
|
if (!flag_found) {
|
|
selected_test.push(px)
|
|
let tests = context.rootState.px.tests
|
|
let p_idx = -1
|
|
tests.forEach(function (t, idx) {
|
|
if (t.T_TestID == px.T_TestID) {
|
|
p_idx = idx
|
|
}
|
|
})
|
|
if (p_idx >= 0) {
|
|
_.pullAt(tests, [p_idx])
|
|
let dt = {
|
|
records: tests,
|
|
total: tests.length
|
|
}
|
|
context.commit('px/update_tests', dt, { root: true })
|
|
}
|
|
}
|
|
context.commit('px/update_selected_test', selected_test, { root: true })
|
|
console.log('load data patient px')
|
|
context.commit('update_loading_data_patient', true)
|
|
if (px.px_type !== "PN") {
|
|
let req = px.requirement
|
|
let reqs = context.rootState.px.requirement
|
|
if (req.length > 0) {
|
|
for (let i in req) {
|
|
let found = false
|
|
for (let j in reqs) {
|
|
if (reqs[j]['req_id'] == req[i]['req_id'])
|
|
found = j
|
|
}
|
|
|
|
if (!found)
|
|
reqs.push({
|
|
px_id: [px.T_TestID],
|
|
label: req[i]['req_name'],
|
|
error_message: 'Hasil harus di isi',
|
|
is_error: true,
|
|
checked: false,
|
|
note: '',
|
|
req_id: req[i]['req_id']
|
|
})
|
|
else
|
|
reqs[found].px_id.push(px.T_TestID)
|
|
}
|
|
|
|
context.commit('px/update_requirement', reqs, { root: true })
|
|
}
|
|
}
|
|
|
|
|
|
context.dispatch('px/appx_schedule', {}, { root: true })
|
|
|
|
in_selectPx = false
|
|
context.commit('px/update_nat_test', {}, { root: true })
|
|
context.commit('update_loading_data_patient', true)
|
|
console.log('load data patient px')
|
|
|
|
// END LOADING
|
|
if (px.px_type == "PN")
|
|
//context.commit('update_loading_data_patient', false)
|
|
context.dispatch('px/packet_reqs', { pxs: px.child_test }, { root: true })
|
|
//context.commit('update_dialog_loading', false,{root:true})
|
|
} catch (e) {
|
|
console.log(e)
|
|
in_selectPx = false
|
|
}
|
|
},
|
|
|
|
async selectProfile(context, px) {
|
|
|
|
try {
|
|
var in_selectPx = false
|
|
// SEARCH NAT TEST
|
|
let nt = context.rootState.px.nat_test
|
|
let found_nt = false
|
|
for (let i in px.nat_test) {
|
|
if (nt.indexOf(px.nat_test[i]) > -1)
|
|
found_nt = true
|
|
}
|
|
|
|
if (found_nt) {
|
|
alert('Pemeriksaan tersebut sudah ada !')
|
|
// END LOADING
|
|
// context.commit('update_dialog_loading', false,{root:true})
|
|
return
|
|
}
|
|
|
|
let pxs = px.child_test
|
|
|
|
for (let i in pxs) {
|
|
px = pxs[i]
|
|
|
|
let selected_test = context.rootState.px.selected_test
|
|
let flag_found = false
|
|
|
|
selected_test.push(px)
|
|
let tests = context.rootState.px.tests
|
|
let p_idx = -1
|
|
tests.forEach(function (t, idx) {
|
|
if (t.T_TestID == px.T_TestID) {
|
|
p_idx = idx
|
|
}
|
|
})
|
|
|
|
if (p_idx >= 0) {
|
|
_.pullAt(tests, [p_idx])
|
|
let dt = {
|
|
records: tests,
|
|
total: tests.length
|
|
}
|
|
context.commit('px/update_tests', dt, { root: true })
|
|
}
|
|
|
|
context.commit('px/update_selected_test', selected_test, { root: true })
|
|
|
|
let req = px.requirement
|
|
|
|
let reqs = context.rootState.px.requirement
|
|
if (req.length > 0) {
|
|
for (let i in req) {
|
|
let found = false
|
|
for (let j in reqs) {
|
|
if (reqs[j]['req_id'] == req[i]['req_id'])
|
|
found = j
|
|
}
|
|
|
|
if (!found)
|
|
reqs.push({
|
|
px_id: [px.T_TestID],
|
|
label: req[i]['req_name'],
|
|
error_message: 'Hasil harus di isi',
|
|
is_error: true,
|
|
checked: false,
|
|
note: '',
|
|
req_id: req[i]['req_id']
|
|
})
|
|
else
|
|
reqs[found].px_id.push(px.T_TestID)
|
|
}
|
|
|
|
context.commit('px/update_requirement', reqs, { root: true })
|
|
}
|
|
}
|
|
|
|
context.dispatch('px/appx_schedule', {}, { root: true })
|
|
//in_selectPx = false
|
|
context.commit('px/update_nat_test', {}, { root: true })
|
|
console.log('load data patient profile')
|
|
context.commit('update_loading_data_patient', true)
|
|
|
|
// END LOADING
|
|
//context.commit('update_dialog_loading', false,{root:true})
|
|
|
|
} catch (e) {
|
|
console.log(e)
|
|
// END LOADING
|
|
//context.commit('update_dialog_loading', false,{root:true})
|
|
// in_selectPx = false
|
|
}
|
|
},
|
|
async get_time_start(context, prm) {
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.get_time_start(prm)
|
|
if (resp.data.status != "OK") {
|
|
|
|
} else {
|
|
var t_orderid = resp.data.data.orderid
|
|
var url_preregister = resp.data.data.url_preregister
|
|
var url_register = resp.data.data.url_register
|
|
console.log(t_orderid)
|
|
console.log(url_preregister)
|
|
console.log(url_register)
|
|
|
|
context.commit('update_url_preregister', url_preregister)
|
|
context.commit('update_url_register', url_register)
|
|
if(t_orderid > 0){
|
|
alert('Data telah terdaftar !!!')
|
|
var url_string = window.location.href
|
|
var url = new URL(url_string);
|
|
var mcuid = url.searchParams.get("mcuid")
|
|
location.replace("/one-ui/" +url_preregister +"?mcuid="+mcuid)
|
|
|
|
}else{
|
|
context.commit('update_dialog_start', false)
|
|
context.commit('update_show_time', resp.data.data.records)
|
|
context.commit('update_status_start', 'Y')
|
|
if (prm.pre_id) {
|
|
context.dispatch("load_preregister", { id: context.state.order_id })
|
|
}
|
|
}
|
|
|
|
}
|
|
} catch (e) {
|
|
|
|
}
|
|
|
|
},
|
|
async getbarcode(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token();
|
|
console.log(prm);
|
|
let resp = await api.lookupbarcodes(prm)
|
|
if (resp.status != "OK") {
|
|
// context.commit("update_get_data_status", 3)
|
|
var snackbar = context.state.snackbar
|
|
snackbar.color = 'red'
|
|
snackbar.value = true
|
|
snackbar.multi_line = 'single-line'
|
|
snackbar.text = 'Gagal get barcode'
|
|
context.commit("update_snackbar", snackbar)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
let barcodes = resp.data.records
|
|
context.commit("update_patientBarcode", data.records)
|
|
let arrprm = [];
|
|
let arrprmst = [];
|
|
for (let index = 0; index < barcodes.length; index++) {
|
|
const e = barcodes[index];
|
|
arrprm.push(e.T_BarcodeLabBarcode)
|
|
if (e.type === 'nonlab') {
|
|
arrprmst.push(e.T_SampleTypeID)
|
|
console.log('print so')
|
|
console.log("nolab so ganti group")
|
|
console.log("param ganti")
|
|
console.log("balik lagi")
|
|
// one_print_barcode_so(e.T_SampleTypeID)
|
|
}
|
|
}
|
|
if (arrprm.length > 0) {
|
|
//one_print_barcode_pk(arrprm.join(","));
|
|
}
|
|
|
|
if (arrprmst.length > 0) {
|
|
one_print_barcode_sov1(arrprmst.join(","));
|
|
}
|
|
// let inp = {};
|
|
// inp.id = prm.id;
|
|
// inp.no_lab = prm.no_lab;
|
|
// inp.name = prm.name;
|
|
// inp.register_date = prm.register_date;
|
|
// one_print_qrcode(inp);
|
|
// // console.log("Input prm")
|
|
// // console.log(inp)
|
|
// console.log("print barcode new")
|
|
// console.log(inp)
|
|
// one_print_qrcode_patient(inp);
|
|
|
|
}
|
|
} catch (e) {
|
|
console.log(e)
|
|
// context.commit("update_get_data_status", 3)
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|