665 lines
24 KiB
JavaScript
665 lines
24 KiB
JavaScript
// 1 => LOADING
|
|
// 2 => DONE
|
|
// 3 => ERROR
|
|
import * as api from "../api/normalvalue.js"
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state: {
|
|
last_id: -1,
|
|
last_saved_id: -1,
|
|
x_pat_id: 0,
|
|
act: 'edit',
|
|
act_comp: 'new',
|
|
act_pat: 'new',
|
|
act_pat_abnormal: 'new',
|
|
act_send: 'N',
|
|
get_data_status: 0,
|
|
search_normalvalue: 0,
|
|
search_status: 0,
|
|
search_error_message: '',
|
|
dialog_form_order: false,
|
|
dialog_edit_form_order:false,
|
|
dialog_status_order: false,
|
|
norm: '',
|
|
normalvalue_name: '',
|
|
normalvalues: [],
|
|
total_normalvalues: 0,
|
|
normalvalue_nilainormal: [],
|
|
date: '',
|
|
note: '',
|
|
sdate:moment(new Date()).format('YYYY-MM-DD'),
|
|
companies: [],
|
|
company: {},
|
|
mous: [],
|
|
mou: {},
|
|
total_normalvalue: 0,
|
|
selected_normalvalue: {},
|
|
save_status: 0,
|
|
btn_save_seen: true,
|
|
pgrs_save: false,
|
|
save_error_message: '',
|
|
no_save: 0,
|
|
open_alert_confirmation: false,
|
|
alert_success: false,
|
|
msg_success: "",
|
|
dialog_success: false,
|
|
dialog_confirmation_delete: false,
|
|
msg_confirmation_delete: "",
|
|
dialog_confirmation_send: false,
|
|
msg_confirmation_send: "",
|
|
dialog_confirmation_delete_pat: false,
|
|
msg_confirmation_delete_pat: "",
|
|
autocomplete_status: 0,
|
|
dialog_form_nilainormal: false,
|
|
dialog_form_nilaiabnormal: false,
|
|
errors: [],
|
|
nilainormals: [],
|
|
minage: '',
|
|
maxage: '',
|
|
minvalue: '',
|
|
maxvalue: '',
|
|
note: '',
|
|
description: '',
|
|
sexes: [],
|
|
selected_sex: {},
|
|
orderautotests:[],
|
|
orderautotest:{},
|
|
ordertests:[],
|
|
deleted_ordertests:[],
|
|
statuss:[],
|
|
open_print_note:false,
|
|
methodes: [],
|
|
methode: {},
|
|
normalvaluetypees: [],
|
|
selected_normalvaluetype: {},
|
|
flages: [],
|
|
selected_flag: {},
|
|
ageunites: [],
|
|
selected_ageunit: {},
|
|
validdate:moment(new Date()).format('YYYY-MM-DD'),
|
|
selected_filter_sex:{},
|
|
selected_filter_flag:{},
|
|
f_sexs:[],
|
|
f_flags:[]
|
|
|
|
},
|
|
mutations: {
|
|
update_selected_filter_sex(state, val) {
|
|
state.selected_filter_sex = val
|
|
},
|
|
update_selected_filter_flag(state, val) {
|
|
state.selected_filter_flag = val
|
|
},
|
|
update_f_sexs(state, val) {
|
|
state.f_sexs = val
|
|
},
|
|
update_f_flags(state, val) {
|
|
state.f_flags = val
|
|
},
|
|
update_x_pat_id(state, val) {
|
|
state.x_pat_id = val
|
|
},
|
|
update_last_id(state, val) {
|
|
state.last_id = val
|
|
},
|
|
update_last_saved_id(state, val) {
|
|
state.last_saved_id = val
|
|
},
|
|
update_act(state, val) {
|
|
state.act = val
|
|
},
|
|
update_act_comp(state, val) {
|
|
state.act_comp = val
|
|
},
|
|
update_act_pat(state, val) {
|
|
state.act_pat = val
|
|
},
|
|
update_act_pat_abnormal(state, val) {
|
|
state.act_pat_abnormal = val
|
|
},
|
|
update_act_send(state, val) {
|
|
state.act_send = val
|
|
},
|
|
update_get_data_status(state, val) {
|
|
state.get_data_status = val
|
|
},
|
|
update_search_error_message(state, normalvalue) {
|
|
state.search_error_message = normalvalue
|
|
},
|
|
update_search_normalvalue(state, normalvalue) {
|
|
state.search_normalvalue = normalvalue
|
|
},
|
|
update_dialog_form_order(state, val) {
|
|
state.dialog_form_order = val
|
|
},
|
|
update_dialog_edit_form_order(state, val) {
|
|
state.dialog_edit_form_order = val
|
|
},
|
|
update_dialog_status_order(state, val) {
|
|
state.dialog_status_order = val
|
|
},
|
|
update_normalvalue_name(state, val) {
|
|
state.normalvalue_name = val
|
|
},
|
|
update_date(state, val) {
|
|
state.date = val
|
|
},
|
|
update_sdate(state,val){
|
|
state.sdate = val
|
|
},
|
|
update_note(state, val) {
|
|
state.note = val
|
|
},
|
|
update_normalvalues(state, data) {
|
|
state.normalvalues = data
|
|
},
|
|
update_selected_normalvalue(state, val) {
|
|
state.selected_normalvalue = val
|
|
},
|
|
update_save_status(state, val) {
|
|
state.save_status = val
|
|
},
|
|
update_btn_save_seen(state, val) {
|
|
state.btn_save_seen = val
|
|
},
|
|
update_pgrs_save(state, val) {
|
|
state.pgrs_save = val
|
|
},
|
|
update_save_error_message(state, msg) {
|
|
state.save_error_message = ''
|
|
},
|
|
update_no_save(state, val) {
|
|
state.no_save = val
|
|
},
|
|
update_open_alert_confirmation(state, val) {
|
|
state.open_alert_confirmation = val
|
|
},
|
|
update_alert_success(state, val) {
|
|
state.alert_success = val
|
|
},
|
|
update_msg_success(state, val) {
|
|
state.msg_success = val
|
|
},
|
|
update_dialog_success(state, val) {
|
|
state.dialog_success = val
|
|
},
|
|
update_dialog_confirmation_delete(state, val) {
|
|
state.dialog_confirmation_delete = val
|
|
},
|
|
update_msg_confirmation_delete(state, val) {
|
|
state.msg_confirmation_delete = val
|
|
},
|
|
update_dialog_confirmation_send(state, val) {
|
|
state.dialog_confirmation_send = val
|
|
},
|
|
update_msg_confirmation_send(state, val) {
|
|
state.msg_confirmation_send = val
|
|
},
|
|
update_dialog_confirmation_delete_pat(state, val) {
|
|
state.dialog_confirmation_delete_pat = val
|
|
},
|
|
update_msg_confirmation_delete_pat(state, val) {
|
|
state.msg_confirmation_delete_pat = val
|
|
},
|
|
update_nilainormals(state, val) {
|
|
state.nilainormals = val
|
|
},
|
|
update_autocomplete_status(state, val) {
|
|
state.autocomplete_status = val
|
|
},
|
|
update_dialog_form_nilainormal(state, val) {
|
|
state.dialog_form_nilainormal = val
|
|
},
|
|
update_dialog_form_nilaiabnormal(state, val) {
|
|
state.dialog_form_nilaiabnormal = val
|
|
},
|
|
update_label_nilainormal(state, val) {
|
|
state.label_nilainormal = val
|
|
},
|
|
update_companies(state, val) {
|
|
state.companies = val
|
|
},
|
|
update_company(state, val) {
|
|
state.company = val
|
|
},
|
|
update_mous(state, val) {
|
|
state.mous = val
|
|
},
|
|
update_mou(state, val) {
|
|
state.mou = val
|
|
},
|
|
update_search_status(state, val) {
|
|
state.search_status = val
|
|
},
|
|
update_errors(state, val) {
|
|
state.errors = val
|
|
},
|
|
update_total_normalvalues(state, val) {
|
|
state.total_normalvalues = val
|
|
},
|
|
update_minage(state, val) {
|
|
state.minage = val
|
|
},
|
|
update_maxage(state, val) {
|
|
state.maxage = val
|
|
},
|
|
update_minvalue(state, val) {
|
|
state.minvalue = val
|
|
},
|
|
update_maxvalue(state, val) {
|
|
state.maxvalue = val
|
|
},
|
|
update_note(state, val) {
|
|
state.note = val
|
|
},
|
|
update_description(state, val) {
|
|
state.description = val
|
|
},
|
|
update_noref(state, val) {
|
|
state.noref = val
|
|
},
|
|
update_nama_pasien(state, val) {
|
|
state.namapasien = val
|
|
},
|
|
update_sexes(state, val) {
|
|
state.sexes = val
|
|
},
|
|
update_selected_sex(state, val) {
|
|
state.selected_sex = val
|
|
},
|
|
update_orderautotests(state,data){
|
|
state.orderautotests = data
|
|
},
|
|
update_orderautotest(state,val){
|
|
state.orderautotest = val
|
|
},
|
|
update_ordertests(state,data){
|
|
state.ordertests = data
|
|
},
|
|
update_deleted_ordertests(state,data){
|
|
state.deleted_ordertests = data
|
|
},
|
|
update_statuss(state,data){
|
|
state.statuss = data
|
|
},
|
|
update_open_print_note(state,val) {
|
|
state.open_print_note=val
|
|
},
|
|
update_methodes(state, data) {
|
|
state.methodes = data
|
|
},
|
|
update_methode(state, val) {
|
|
state.methode = val
|
|
},
|
|
update_normalvaluetypees(state, val) {
|
|
state.normalvaluetypees = val
|
|
},
|
|
update_selected_normalvaluetype(state, val) {
|
|
state.selected_normalvaluetype = val
|
|
},
|
|
update_flages(state, val) {
|
|
state.flages = val
|
|
},
|
|
update_selected_flag(state, val) {
|
|
state.selected_flag = val
|
|
},
|
|
update_ageunites(state, val) {
|
|
state.ageunites = val
|
|
},
|
|
update_selected_ageunit(state, val) {
|
|
state.selected_ageunit = val
|
|
},
|
|
update_validdate(state,val){
|
|
state.validdate = val
|
|
}
|
|
},
|
|
actions: {
|
|
async search(context, prm) {
|
|
context.commit("update_search_normalvalue", 1)
|
|
try {
|
|
let resp = await api.search(one_token(), prm.code, prm.name)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_search_normalvalue", 3)
|
|
context.commit("update_search_error_message", resp.message)
|
|
} else {
|
|
context.commit("update_search_normalvalue", 2)
|
|
context.commit("update_search_error_message", "")
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_normalvalues", data.records)
|
|
context.commit("update_total_normalvalues", data.total)
|
|
context.commit("update_no_save", 0)
|
|
|
|
context.commit("update_selected_normalvalue", data.records[0])
|
|
var pat = data.records[0]
|
|
context.commit("update_normalvalue_name", pat.Nat_TestName)
|
|
context.dispatch("getnilainormal", {
|
|
id: pat.Nat_TestID,
|
|
methodename : '',
|
|
sexid: 0,
|
|
flagid: 0
|
|
})
|
|
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_search_normalvalue", 3)
|
|
context.commit("update_search_error_message", e.message)
|
|
console.log(e)
|
|
}
|
|
},
|
|
async getsexreg(context) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
let resp = await api.getsexreg(one_token())
|
|
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_sexes", data.records.sexes)
|
|
context.commit("update_normalvaluetypees", data.records.normalvaluetypees)
|
|
context.commit("update_flages", data.records.flages)
|
|
context.commit("update_ageunites", data.records.ageunites)
|
|
context.commit("update_f_sexs",data.records.f_sexs)
|
|
context.commit("update_f_flags",data.records.f_flags)
|
|
context.commit("update_selected_filter_sex",data.records.f_sexs[0])
|
|
context.commit("update_selected_filter_flag",data.records.f_flags[0])
|
|
prm.sexid = data.records.f_sexs[0].Nat_SexID
|
|
prm.flagid = data.records.f_flags[0].Nat_FlagID
|
|
context.dispatch("getnilainormal",prm)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async save(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.save(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_last_id", prm.Nat_TestID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Data pasien " + prm.M_PatientName + " sudah terupdate dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async newnormalvalue(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.newnormalvalue(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
console.log(resp.data.id)
|
|
context.commit("update_last_id", resp.data.id)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Data berhasil disimpan"
|
|
context.commit("update_msg_success", msg)
|
|
context.commit("update_dialog_form_order", false)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async delete(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.xdelete(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_last_id", 0)
|
|
context.commit("update_dialog_confirmation_delete", false)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Data pasien " + prm.M_PatientName + " sudah dihapus dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
context.commit("update_normalvalue_name", '')
|
|
context.commit("update_selected_title", {})
|
|
context.commit("update_selected_sex", {})
|
|
context.commit("update_selected_religion", {})
|
|
context.commit("update_dob", '')
|
|
context.commit("update_hp", '')
|
|
context.commit("update_phone", '')
|
|
context.commit("update_email", '')
|
|
context.commit("update_selected_kartuidentitas", {})
|
|
context.commit("update_noidentitas", '')
|
|
context.commit("update_note", '')
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async sendorder(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.sendorder(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_confirmation_send", false)
|
|
context.commit("update_last_id", prm.Nat_TestID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Permintaan nomor " + prm.Nat_TestNumber + " sudah berhasil dikirim ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async getnilainormal(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.getnilainormal(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_nilainormals", data.records)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async searchmethode(context, prm) {
|
|
context.commit("update_autocomplete_status", 1)
|
|
try {
|
|
let resp = await api.searchmethode(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_methodes", resp.data.records)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_autocomplete_status", 3)
|
|
}
|
|
},
|
|
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 getmou(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
let resp = await api.getmou(one_token(), 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_mous", resp.data.records)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async searchtest(context,prm) {
|
|
context.commit("update_autocomplete_status",1)
|
|
try {
|
|
let resp= await api.searchtest(one_token(), prm.tes, prm.mouid)
|
|
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_orderautotests",resp.data.records)
|
|
}
|
|
} catch(e) {
|
|
context.commit("update_autocomplete_status",3)
|
|
}
|
|
},
|
|
async savenewnilainormal(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.savenewnilainormal(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_form_nilainormal", false)
|
|
context.commit("update_last_id", prm.Nat_NormalValueNat_TestID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Penambahan data normal value pemeriksaan " + prm.Nat_TestName + " sudah berhasil dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async saveeditnilainormal(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.saveeditnilainormal(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_form_nilainormal", false)
|
|
context.commit("update_last_id", prm.Nat_NormalValueNat_TestID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Penambahan data nilai normal pemeriksaan " + prm.Nat_TestName + " sudah berhasil dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async savenewnilaiabnormal(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.savenewnilaiabnormal(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_form_nilaiabnormal", false)
|
|
context.commit("update_last_id", prm.Nat_NormalValueNat_TestID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Penambahan data nilai abnormal pemeriksaan " + prm.Nat_TestName + " sudah berhasil dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async savenormalvaluelang(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.savenormalvaluelang(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_form_nilainormal", false)
|
|
context.commit("update_last_id", prm.Nat_NormalValueNat_TestID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Penambahan bahasa nilai normal sudah berhasil dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async deletenilainormal(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.deletenilainormal(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_confirmation_delete_pat", false)
|
|
context.commit("update_last_id", prm.Nat_NormalValueNat_TestID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Penghapusan data nilai normal dari pemeriksaan " + prm.Nat_TestName + " sudah berhasil dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
}
|
|
}
|
|
} |