179 lines
5.8 KiB
JavaScript
179 lines
5.8 KiB
JavaScript
// 1 => LOADING
|
|
// 2 => DONE
|
|
// 3 => ERROR
|
|
import * as api from "../api/re_lcprep.js"
|
|
window.api = api
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state: {
|
|
get_data_status:0,
|
|
save_status:0,
|
|
dialog_lcprep:false,
|
|
diagnosis_klinis:'',
|
|
makroskopis:'',
|
|
mikroskopis:'',
|
|
kesimpulan:'',
|
|
saran:'',
|
|
selected_lcprep:{},
|
|
results:[],
|
|
doctors:[],
|
|
selected_doctor:{},
|
|
adekuasi:[],
|
|
kategoriumum:[],
|
|
interpretasi:[],
|
|
maturasi:[],
|
|
onprocess:false,
|
|
langs:[],
|
|
selected_lang:{},
|
|
other_results:[],
|
|
order:{}
|
|
},
|
|
mutations: {
|
|
update_order(state,value) {
|
|
state.order = value
|
|
},
|
|
update_langs(state,value) {
|
|
state.langs = value
|
|
},
|
|
update_selected_lang(state,value) {
|
|
state.selected_lang = value
|
|
},
|
|
update_other_results(state,value) {
|
|
state.other_results = value
|
|
},
|
|
update_onprocess(state,value) {
|
|
state.onprocess = value
|
|
},
|
|
update_maturasi(state,value) {
|
|
state.maturasi = value
|
|
},
|
|
update_doctors(state,value) {
|
|
state.doctors = value
|
|
},
|
|
update_selected_doctor(state,value) {
|
|
state.selected_doctor = value
|
|
},
|
|
update_save_status(state,value) {
|
|
state.save_status = value
|
|
},
|
|
update_results(state,value) {
|
|
state.results = value
|
|
},
|
|
update_adekuasi(state,value) {
|
|
state.adekuasi = value
|
|
},
|
|
update_kategoriumum(state,value) {
|
|
state.kategoriumum = value
|
|
},
|
|
update_interpretasi(state,value) {
|
|
state.interpretasi = value
|
|
},
|
|
update_get_data_status(state,value) {
|
|
state.get_data_status = value
|
|
},
|
|
update_selected_lcprep(state,value) {
|
|
state.selected_lcprep = value
|
|
},
|
|
update_dialog_lcprep(state,value) {
|
|
state.dialog_lcprep = value
|
|
},
|
|
update_diagnosis_klinis(state,value) {
|
|
state.diagnosis_klinis = value
|
|
},
|
|
update_makroskopis(state,value) {
|
|
state.makroskopis = value
|
|
},
|
|
update_mikroskopis(state,value) {
|
|
state.mikroskopis = value
|
|
},
|
|
update_kesimpulan(state,value) {
|
|
state.kesimpulan = value
|
|
},
|
|
update_saran(state,value) {
|
|
state.saran = value
|
|
}
|
|
},
|
|
actions: {
|
|
async get_lcprepresult(context,prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.getlcprepresult(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
|
|
context.commit("update_results", data.records['results'])
|
|
context.commit("update_other_results", data.records['other_results'])
|
|
context.commit("update_langs", data.records['langs'])
|
|
context.commit("update_selected_lang", data.records['selected_lang'])
|
|
context.commit("update_adekuasi", data.records['adekuasi'])
|
|
context.commit("update_kategoriumum", data.records['kategoriumum'])
|
|
context.commit("update_interpretasi", data.records['interpretasi'])
|
|
context.commit("update_doctors", data.records['doctors'])
|
|
var selected_doctor = {
|
|
id:data.records['results'][0]['doctor_id'],
|
|
name:data.records['results'][0]['doctor_name']
|
|
}
|
|
context.commit("update_selected_doctor", selected_doctor)
|
|
context.commit("update_order", data.records['order'])
|
|
context.commit("update_dialog_lcprep", true)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async get_doctors(context,prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.get_doctors(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_doctors", data.records)
|
|
context.commit("update_selected_doctor", {})
|
|
context.commit("update_dialog_fna", true)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async saveresult_lcprep(context,prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
//prm.id = context.state.selected_fna.id
|
|
prm.token = one_token()
|
|
let resp = await api.saveresult_lcprep(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_onprocess", false)
|
|
context.commit("update_dialog_lcprep", false)
|
|
context.dispatch('re_px/search','',{root:true})
|
|
context.dispatch('re_patient/info_req','',{root:true})
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|