123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883 |
- /*
- - ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩
- MDCS ( SMMMD03600_MDCS.xrw - JScript )
- - ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩
- */
- /**
- * @desc : SMMMD03600_MDCS.xrw Calculator 버튼 클릭시 iviewer 페이지 결정
- * @
- * @param :
- * @return :
- * @author : 정연우
- */
- function fCalcBtnClick(){
- var trgObj = document.controls(event.target);
- if( trgObj.elementName == "xforms:button" ) {
- var buttonObj = trgObj;
- var buttonID = buttonObj.attribute("id");
-
- if (buttonID == "button1") {
- iviewer1.src = "SMMMD03700_혈중농도.xrw";
- } else if (buttonID == "button2") {
- iviewer1.src = "SMMMD04000_용량변경.xrw";
- } else if (buttonID == "button3") {
- iviewer1.src = "SMMMD04200_청소율.xrw";
- } else if (buttonID == "button6") {
- iviewer1.src = "SMMMD03800_투여량.xrw";
- } else if (buttonID == "button7") {
- alert("차후 화면추가 예정입니다.");
- } else if (buttonID == "button8") {
- iviewer1.src = "SMMMD04300_IBW.xrw";
- } else if (buttonID == "button9") {
- iviewer1.src = "SMMMD04100_Capacity.xrw";
- //iviewer1.src = "SMMMD04100_유지용량.xrw";
- } else if (buttonID == "button10") {
- //alert("구현중");
- } else if (buttonID == "button11") {
- iviewer1.src = "SMMMD03900_투여간격.xrw";
- } else if (buttonID == "button13") {
- iviewer1.src = "SMMMD04400_BMI.xrw";
- } else if (buttonID == "button16") {
- iviewer1.src = "SMMMD04500_Fluid volume.xrw";
- } else if (buttonID == "button17") {
- alert("차후 화면추가 예정입니다.");
- } else if (buttonID == "button5") {
- alert("차후 화면추가 예정입니다.");
- } else if (buttonID == "button15") {
- alert("차후 화면추가 예정입니다.");
- } else if (buttonID == "button20") {
- alert("차후 화면추가 예정입니다.");
- } else if (buttonID == "button4") {
- alert("차후 화면추가 예정입니다.");
- } else {
- alert("구현중");
- }
- }
- }
- // 엔터 입력시 포커스 이동
- function fMoveFocus(vCtrlID){
- if( event.keyCode == 13 ) {
- if( vCtrlID != "" ) model.setFocus(vCtrlID);
- }
- }
- // 소수점 자리수 자르기
- function getCutNumber(num, place) {
- return Math.floor( num * Math.pow(10,parseInt(place,10)) ) / Math.pow(10,parseInt(place,10));
- }
- /**
- * @desc : SMMMD03700_혈중농도.xrw 탭별 UI(Caption, input)결정
- * @
- * @param :
- * @return :
- * @author : 정연우
- */
- function fSetBolusUI(btnStr){
-
- if(btnStr == "ivbolus"){
- caption1.visible = true;
- caption2.visible = true;
- caption3.visible = false;
- caption4.visible = true;
- caption5.visible = true;
- caption6.visible = false;
- caption7.visible = true;
- caption8.visible = false;
- caption9.visible = true;
- caption11.visible = true;
- caption12.visible = true;
- caption14.visible = false;
- caption15.visible = false;
- caption16.visible = false;
- input1.visible = true;
- input2.visible = true;
- input3.visible = false;
- input4.visible = true;
- input5.visible = true;
- input6.visible = false;
- input7.visible = true;
- input8.visible = false;
- input9.visible = true;
- input10.visible = true;
- input11.visible = true;
- input13.visible = false;
- input14.visible = false;
- } else if(btnStr == "infusioninter"){
- caption1.visible = false;
- caption2.visible = true;
- caption3.visible = false;
- caption4.visible = true;
- caption5.visible = true;
- caption6.visible = false;
- caption7.visible = true;
- caption8.visible = true;
- caption9.visible = true;
- caption11.visible = true;
- caption12.visible = true;
- caption14.visible = false;
- caption15.visible = false;
- caption16.visible = true;
- input1.visible = true;
- input2.visible = true;
- input3.visible = false;
- input4.visible = true;
- input5.visible = true;
- input6.visible = false;
- input7.visible = true;
- input8.visible = true;
- input9.visible = true;
- input10.visible = true;
- input11.visible = true;
- input13.visible = false;
- input14.visible = false;
- } else if(btnStr == "infusioncont"){
- caption1.visible = false;
- caption2.visible = false;
- caption3.visible = false;
- caption4.visible = true;
- caption5.visible = false;
- caption6.visible = false;
- caption7.visible = true;
- caption8.visible = false;
- caption9.visible = true;
- caption11.visible = false;
- caption12.visible = false;
- caption14.visible = true;
- caption15.visible = false;
- caption16.visible = true;
- input1.visible = true;
- input2.visible = false;
- input3.visible = false;
- input4.visible = true;
- input5.visible = false;
- input6.visible = false;
- input7.visible = true;
- input8.visible = false;
- input9.visible = true;
- input10.visible = false;
- input11.visible = false;
- input13.visible = true;
- input14.visible = true;
- } else {
- caption1.visible = true;
- caption2.visible = true;
- caption3.visible = true;
- caption4.visible = true;
- caption5.visible = true;
- caption6.visible = true;
- caption7.visible = true;
- caption8.visible = false;
- caption9.visible = true;
- caption11.visible = false;
- caption12.visible = true;
- caption14.visible = true;
- caption15.visible = true;
- caption16.visible = false;
- input1.visible = true;
- input2.visible = true;
- input3.visible = true;
- input4.visible = true;
- input5.visible = true;
- input6.visible = true;
- input7.visible = true;
- input8.visible = false;
- input9.visible = true;
- input10.visible = true;
- input11.visible = true;
- input13.visible = false;
- input14.visible = false;
- }
- }
- // 혈중농도 - 혈중농도 계산
- function fCalcBloodBolus(selectedTab) {
- // 계산에 필요한 항목
- var admin_val = model.getValue("/root/main/cond/adminval"); // 투여량
- var admin_times = model.getValue("/root/main/cond/admintimes"); // 투여횟수
- var use_rate = model.getValue("/root/main/cond/userate"); // 생체이용률
- var range_capacity = model.getValue("/root/main/cond/rangecapacity"); // 분포용적
- var admin_interval = model.getValue("/root/main/cond/admininterval"); // 투여간격
- var suction_rate = model.getValue("/root/main/cond/suctionrate"); // 흡수율
- var half_life = model.getValue("/root/main/cond/halflife"); // 반감기
- var infusion_time1 = model.getValue("/root/main/cond/infusiontime1"); // Infusion 시간1
- var infusion_time2 = model.getValue("/root/main/cond/infusiontime2"); // Infusion 시간2
- var after_time = model.getValue("/root/main/cond/aftertime"); // 투여후 경과시간
-
- // Divide By Zero 관련 처리
- if(admin_val == "0") { messageBox("투여량은 '0'값을 입력", "E001"); model.setFocus("input1"); return; }
- else if(range_capacity == "0") { messageBox("분포용적은 '0'값을 입력", "E001"); model.setFocus("input4"); return; }
- else if(half_life == "0") { messageBox("반감기는 '0'값을 입력", "E001"); model.setFocus("input7"); return; }
- else if(admin_interval == "0") { messageBox("투여간격은 '0'값을 입력", "E001"); model.setFocus("input5"); return; }
-
- // 계산에 필요한 데이터 유무 검증
- if(admin_val == "" || range_capacity == "" || half_life == "" || after_time == "" ) { // 투여량, 분포용적, 반감기, 투여경과시간은 공통
- messageBox("모든 입력란은 ", "I003"); return;
- }
-
- // 탭별 계산에 필요한 데이터 유무검증 및 계산
- var ke = 0.693 / half_life; // 소실률(ke)
- ke = getCutNumber(ke, 4);
- var peak; var trough; var ivbolus; var statusbolus;
- if(selectedTab == "tab_ivbolus") {
- if(admin_times == "" || admin_interval == "") {
- messageBox("모든 입력란은 ", "I003"); return;
- }
- // IV bolus 계산
- peak = getBolusPeak(selectedTab, ke, admin_val, range_capacity, admin_interval, infusion_time1, use_rate);
- trough = getBolusTrough(selectedTab, ke, admin_val, range_capacity, admin_interval, infusion_time1, use_rate, suction_rate);
- ivbolus = getIvbolus(selectedTab, ke, admin_val, range_capacity, admin_interval, admin_times, after_time, infusion_time1, infusion_time2, use_rate, suction_rate);
- }else if(selectedTab == "tab_infusioninter") {
- if(admin_times == "" || admin_interval == "" || infusion_time1 == "") {
- messageBox("모든 입력란은 ", "I003"); return;
- }
- // IV infusion(inter) 계산
- peak = getBolusPeak(selectedTab, ke, admin_val, range_capacity, admin_interval, infusion_time1, use_rate);
- trough = getBolusTrough(selectedTab, ke, admin_val, range_capacity, admin_interval, infusion_time1, use_rate, suction_rate);
- ivbolus = getIvbolus(selectedTab, ke, admin_val, range_capacity, admin_interval, admin_times, after_time, infusion_time1, infusion_time2, use_rate, suction_rate);
- }else if(selectedTab == "tab_infusioncont") {
- if(infusion_time2 == "") {
- messageBox("모든 입력란은 ", "I003"); return;
- }
- // IV infusion(cont) 계산
- statusbolus = getStatusbolus(selectedTab, ke, admin_val, range_capacity);
- ivbolus = getIvbolus(selectedTab, ke, admin_val, range_capacity, admin_interval, admin_times, after_time, infusion_time1, infusion_time2, use_rate, suction_rate);
- }else{
- if(admin_times == "" || admin_interval == "" || use_rate == "" || suction_rate == "") {
- messageBox("모든 입력란은 ", "I003"); return;
- }
- // Oral bolus 계산
- peak = getBolusPeak(selectedTab, ke, admin_val, range_capacity, admin_interval, infusion_time1, use_rate); // Average 계산
- trough = getBolusTrough(selectedTab, ke, admin_val, range_capacity, admin_interval, infusion_time1, use_rate, suction_rate);
- ivbolus = getIvbolus(selectedTab, ke, admin_val, range_capacity, admin_interval, admin_times, after_time, infusion_time1, infusion_time2, use_rate, suction_rate);
- }
-
- // 계산된 값 셋팅
- model.setValue("/root/send/savedata/peak", peak); // Peak 계산값 셋팅(Oral bolus에서는 Average)
- model.setValue("/root/send/savedata/trough", trough); // Trough 계산값 셋팅
- model.setValue("/root/send/savedata/ivbolus", ivbolus); // 특정시간 경과후 농도 계산값 셋팅
- model.setValue("/root/send/savedata/statusbolus", statusbolus); // 항정상태에서의 농도 계산값 셋팅
- model.refresh();
- }
- // 혈중농도 - Peak 계산(Oral bolus에서는 Average)
- function getBolusPeak(selectedTab, ke, adminVal, rangeCapacity, adminInterval, infusionTime1, useRate){
- var thisPeak = 0;
- var temp1 = getCutNumber(Math.exp(-ke * adminInterval), 4);
- var temp2;
-
- // Divide By Zero 관련 처리
- if(temp1 == 1) { temp2 = 0; }
- else { temp2 = 1 / (1 - temp1); }
-
- if(selectedTab == "tab_ivbolus"){
- thisPeak = (adminVal / rangeCapacity) * temp2;
- }else if(selectedTab == "tab_infusioninter"){
- thisPeak = (adminVal / (ke * rangeCapacity)) * (1 - Math.exp(-ke * infusionTime1)) * temp2;
- }else if(selectedTab == "tab_oralbolus"){
- thisPeak = (useRate * adminVal) / (ke * rangeCapacity * adminInterval); //Average
- }
- return getCutNumber(thisPeak, 4);
- }
- // 혈중농도 - Trough 계산
- function getBolusTrough(selectedTab, ke, adminVal, rangeCapacity, adminInterval, infusionTime1, useRate, suctionRate){
- var thisTrough = 0;
- var temp1; var temp2; var temp3; var temp4;
- temp1 = getCutNumber(Math.exp(-ke * adminInterval), 4);
-
- // Divide By Zero 관련 처리
- if(temp1 == 1) { temp2 = 0; }
- else{ temp2 = 1 / (1 - temp1); }
-
- temp1 = Math.exp(-ke * infusionTime1);
- //alert("temp1:"+temp1);
- if(temp1 == 1) { temp3 = 0; }
- else{ temp3 = 1 - temp1; }
-
- temp1 = Math.exp(-suctionRate * adminInterval);
- if(temp1 == 1) { temp4 = 0; }
- else{ temp4 = 1 / (1 - temp1); }
-
- if(selectedTab == "tab_ivbolus"){
- thisTrough = (adminVal / rangeCapacity) * temp2 * Math.exp(-ke * adminInterval);
- }else if(selectedTab == "tab_infusioninter"){
- thisTrough = (adminVal / (ke * rangeCapacity)) * temp3 * temp2 * Math.exp(-ke * adminInterval);
- }else if(selectedTab == "tab_oralbolus"){
- thisTrough = ((useRate * adminVal) / rangeCapacity) * (suctionRate / (suctionRate - ke)) * (temp2 - temp4);
- }
- return getCutNumber(thisTrough, 4);
- }
- // 혈중농도 - 시간경과후 농도 계산
- function getIvbolus(selectedTab, ke, adminVal, rangeCapacity, adminInterval, adminTimes, afterTime, infusionTime1, infusionTime2, useRate, suctionRate){
- var thisIvbolus = 0;
- var temp1 = getCutNumber(Math.exp(-ke * adminInterval), 4);
- var temp2;
- var temp3 = getCutNumber(Math.exp(-suctionRate * adminInterval), 4);
- var temp4;
-
- // Divide By Zero 관련 처리
- if(temp1 == 1) { temp2 = 0; }
- else { temp2 = (1 - Math.exp(-ke * adminInterval * adminTimes)) / (1 - temp1); }
- if(temp3 == 1) { temp4 = 0; }
- else { temp4 = (1 - Math.exp(-suctionRate * adminInterval * adminTimes)) / (1 - temp3); }
-
- if(selectedTab == "tab_ivbolus"){
- thisIvbolus = (adminVal / rangeCapacity) * temp2 * Math.exp(-ke * afterTime);
- }else if(selectedTab == "tab_infusioninter"){
- thisIvbolus = (adminVal / (ke * rangeCapacity)) * (1 - Math.exp(-ke * infusionTime1)) * temp2 * Math.exp(-ke * adminInterval);
- }else if(selectedTab == "tab_infusioncont"){
- thisIvbolus = (adminVal / (ke * rangeCapacity)) * (1 - Math.exp(-ke * afterTime));
- }else if(selectedTab == "tab_oralbolus"){
- thisIvbolus = ((useRate * adminVal) / rangeCapacity) * (suctionRate / (suctionRate - ke)) * ((Math.exp(-ke * afterTime) * temp2) - (Math.exp(-suctionRate * afterTime) * temp4));
- }
- return getCutNumber(thisIvbolus, 4);
- }
- // 혈중농도 - 항정상태에서의 농도 계산
- function getStatusbolus(selectedTab, ke, adminVal, rangeCapacity){
- var thisStatusbolus = 0;
- thisStatusbolus = adminVal / (ke * rangeCapacity);
- return getCutNumber(thisStatusbolus, 4);
- }
- /**
- * @desc : SMMMD03800_투여량.xrw 탭별 UI(Caption, input)결정
- * @
- * @param :
- * @return :
- * @author : 정연우
- */
- function fSetAdminUI(btnStr){
- if(btnStr == "ivbolus"){
- caption1.visible = true;
- caption2.visible = true;
- caption3.visible = false;
- caption4.visible = true;
- caption5.visible = true;
- caption6.visible = false;
- caption7.visible = false;
- caption8.visible = true;
- caption9.visible = true;
- caption10.visible = true;
- caption11.visible = true;
- caption12.visible = false;
- caption13.visible = true;
- input1.visible = true;
- input2.visible = true;
- input3.visible = false;
- input4.visible = true;
- input5.visible = true;
- input6.visible = false;
- input7.visible = false;
- input8.visible = true;
- input9.visible = true;
- input10.visible = true;
- input11.visible = true;
- input12.visible = true;
- } else if(btnStr == "infusioninter"){
- caption1.visible = true;
- caption2.visible = true;
- caption3.visible = false;
- caption4.visible = true;
- caption5.visible = true;
- caption6.visible = false;
- caption7.visible = true;
- caption8.visible = true;
- caption9.visible = true;
- caption10.visible = true;
- caption11.visible = true;
- caption12.visible = false;
- caption13.visible = true;
- input1.visible = true;
- input2.visible = true;
- input3.visible = false;
- input4.visible = true;
- input5.visible = true;
- input6.visible = false;
- input7.visible = true;
- input8.visible = true;
- input9.visible = true;
- input10.visible = true;
- input11.visible = true;
- input12.visible = true;
- } else if(btnStr == "infusioncont"){
- caption1.visible = true;
- caption2.visible = false;
- caption3.visible = false;
- caption4.visible = true;
- caption5.visible = false;
- caption6.visible = false;
- caption7.visible = true;
- caption8.visible = true;
- caption9.visible = true;
- caption10.visible = true;
- caption11.visible = true;
- caption12.visible = false;
- caption13.visible = true;
- input1.visible = true;
- input2.visible = false;
- input3.visible = false;
- input4.visible = true;
- input5.visible = false;
- input6.visible = false;
- input7.visible = true;
- input8.visible = true;
- input9.visible = true;
- input10.visible = true;
- input11.visible = true;
- input12.visible = true;
- } else {
- caption1.visible = true;
- caption2.visible = true;
- caption3.visible = true;
- caption4.visible = true;
- caption5.visible = true;
- caption6.visible = true;
- caption7.visible = false;
- caption8.visible = true;
- caption9.visible = true;
- caption10.visible = false;
- caption11.visible = true;
- caption12.visible = true;
- caption13.visible = true;
- input1.visible = true;
- input2.visible = true;
- input3.visible = true;
- input4.visible = true;
- input5.visible = true;
- input6.visible = true;
- input7.visible = false;
- input8.visible = true;
- input9.visible = true;
- input10.visible = true;
- input11.visible = true;
- input12.visible = true;
- }
- }
- // 투여량 계산
- function fCalcAdminVal(selectedTab) {
- // 계산에 필요한 항목
- var range_capacity = model.getValue("/root/main/cond/rangecapacity"); // 분포용적
- var admin_times = model.getValue("/root/main/cond/admintimes"); // 투여횟수
- var use_rate = model.getValue("/root/main/cond/userate"); // 생체이용률
- var half_life = model.getValue("/root/main/cond/halflife"); // 반감기
- var admin_interval = model.getValue("/root/main/cond/admininterval"); // 투여간격
- var suction_rate = model.getValue("/root/main/cond/suctionrate"); // 흡수율
- var infusion_time = model.getValue("/root/main/cond/infusiontime"); // Infusion 시간
- //var special_time = model.getValue("/root/main/cond/specialtime");
- var after_time = model.getValue("/root/main/cond/specialtime"); // 특정시간
- var blood_bolus = model.getValue("/root/main/cond/bloodbolus"); // 혈중농도
- var peak_level = model.getValue("/root/main/cond/peaklevel"); // Peak level
- var tro_level = model.getValue("/root/main/cond/trolevel"); // Trough level
-
- // Divide By Zero 관련 처리
- if(range_capacity == "0") { messageBox("분포용적은 '0'값을 입력", "E001"); model.setFocus("input1"); return; }
- else if(use_rate == "0") { messageBox("생체이용률은 '0'값을 입력", "E001"); model.setFocus("input3"); return; }
- else if(half_life == "0") { messageBox("반감기는 '0'값을 입력", "E001"); model.setFocus("input4"); return; }
- else if(suction_rate == "0") { messageBox("흡수율은 '0'값을 입력", "E001"); model.setFocus("input6"); return; }
-
- // 계산에 필요한 데이터 유무 검증
- if(range_capacity == "" || half_life == "" || after_time == "" ) { // 투여량, 분포용적, 반감기, 투여경과시간은 공통
- messageBox("모든 입력란은 ", "I003"); return;
- }
-
- // 탭별 계산에 필요한 데이터 유무검증 및 계산
- var ke = 0.693 / half_life; // 소실률(ke)
- var calc_val_rslt; // 투여량 계산결과
- if(selectedTab == "tab_ivbolus") {
- if(admin_times == "" || admin_interval == "") {
- messageBox("모든 입력란은 ", "I003"); return;
- }
- calc_val_rslt = getCalcRslt(selectedTab, ke, range_capacity, admin_interval, admin_times, after_time, infusion_time, use_rate, suction_rate, blood_bolus, peak_level, tro_level);
- }else if(selectedTab == "tab_infusioninter") {
- calc_val_rslt = getCalcRslt(selectedTab, ke, range_capacity, admin_interval, admin_times, after_time, infusion_time, use_rate, suction_rate, blood_bolus, peak_level, tro_level);
- }else if(selectedTab == "tab_infusioncont") {
- calc_val_rslt = getCalcRslt(selectedTab, ke, range_capacity, admin_interval, admin_times, after_time, infusion_time, use_rate, suction_rate, blood_bolus, peak_level, tro_level);
- }else{
- calc_val_rslt = getCalcRslt(selectedTab, ke, range_capacity, admin_interval, admin_times, after_time, infusion_time, use_rate, suction_rate, blood_bolus, peak_level, tro_level);
- }
-
- // 계산된 값 셋팅
- model.setValue("/root/send/savedata/adminresult", calc_val_rslt);
- model.refresh();
- }
- // 투여량 - 투여량 계산결과
- function getCalcRslt(selectedTab, ke, rangeCapacity, adminInterval, adminTimes, afterTime, infusionTime, useRate, suctionRate, cTarget, cPeak, cTrough){
- var thisRslt = 0;
- var temp1 = getCutNumber(Math.exp(-ke * adminInterval * adminTimes), 4);
- var temp2;
- var temp3;
- var temp4;
- var temp5;
-
- // Divide By Zero 관련 처리
- if(temp1 == 1) { temp2 = 0; }
- else { temp2 = (1 - Math.exp(-ke * adminInterval)) / (1 - temp1); }
- temp1 = Math.exp(-ke * infusionTime);
- if(temp1 == 1) { temp3 = 0; }
- else { temp3 = (cTarget * ke * rangeCapacity) / (1 - temp1); }
- temp1 = Math.exp(-ke * afterTime);
- if(temp1 == 1) { temp5 = 0; // temp4가 '0'이면 divide by zero에 걸림
- } else {
- temp4 = 1 / (1 - temp1);
- temp5 = (cTarget * ke * rangeCapacity) / temp4
- }
-
- if(selectedTab == "tab_ivbolus"){
- thisRslt = ((cTarget * rangeCapacity) / (Math.exp(-ke * afterTime))) * temp2; //n회 투여후 특정시간 특정농도에 도달하기 위한 투여량
- //thisRslt = (cPeak * rangeCapacity) * ((1 - Math.exp(-ke * adminInterval)); // 항정상태에서 희망 peak level에 도달하기 위한 투여량
- //thisRslt = ((cTrough * rangeCapacity) / Math.exp(-ke * adminInterval)) * ((1 - Math.exp(-ke * adminInterval)); // 항정상태에서 희망 trough level에 도달하기 위한 투여량
- }else if(selectedTab == "tab_infusioninter"){
- thisRslt = temp3 * temp2 * temp4; //n회 투여후 특정시간 특정농도에 도달하기 위한 시간당 투여량
- //thisRslt = ((cPeak * ke * rangeCapacity) * ((1 - Math.exp(-ke * adminInterval)); // 항정상태에서 희망 peak level에 도달하기 위한 시간당 투여량
- //thisRslt = ((cTrough * ke * rangeCapacity) * ((1 - Math.exp(-ke * adminInterval)) * (1 / (1 - Math.exp(-ke * afterTime))); // 항정상태에서 희망 trough level에 도달하기 위한 시간당 투여량
- }else if(selectedTab == "tab_infusioncont"){
- thisRslt = temp5; // 특정시간 특정농도에 도달하기 위한 시간당 투여량
- //thisRslt = cPeak * ke * rangeCapacity; // 항정상태에서 희망 농도에 도달하기 위한 시간당 투여량
- }else if(selectedTab == "tab_oralbolus"){
- var temp1 = getCutNumber(Math.exp(-ke * afterTime), 4);
- var temp2 = getCutNumber(Math.exp(-ke * adminInterval * adminTimes), 4);
- var temp3 = getCutNumber(Math.exp(-ke * adminInterval), 4);
- var temp4 = getCutNumber(Math.exp(-suctionRate * afterTime), 4);
- var temp5 = getCutNumber(Math.exp(-suctionRate * adminInterval * adminTimes), 4);
- var temp6 = getCutNumber(Math.exp(-suctionRate * adminInterval), 4);
- var temp7;
- var temp8;
- var temp9;
-
- // Divide By Zero 관련 처리
- if(temp2 == 1 && temp3 == 1) { temp7 = 0; }
- else { temp7 = (1 - temp2) / (1 - temp3); }
- if(temp5 == 1 && temp6 == 1) { temp8 = 0; }
- else { temp8 = (1 - temp5) / (1 - temp6); }
-
- var temp = (temp1 * temp7) - (temp4 * temp8);
-
- // Divide By Zero 관련 처리
- temp = getCutNumber(temp, 4);
- if(temp == 0){ temp9 = 0; }
- else { temp9 = temp9 = getCutNumber((1 / temp),4); }
-
- thisRslt = getCutNumber(((cTarget * rangeCapacity) / useRate),4) * getCutNumber(((suctionRate - ke) / suctionRate),4) * temp9; //n회 투여후 특정시간 특정농도에 도달하기 위한 투여량
- //temp = (1 / (1 - Math.exp(-ke * adminInterval))) - (1 / (1 - Math.exp(-suctionRate * adminInterval)));
- //temp = getCutNumber(temp, 4);
- //thisRslt = ((cTrough * rangeCapacity) / useRate) * ((suctionRate - ke) / suctionRate) * (1 / temp); // 항정상태에서 희망 trough level에 도달하기 위한 투여량
- //thisRslt = (cPeak * ke * rangeCapacity * adminInterval) / useRate; // 항정상태에서 희망 average level에 도달하기 위한 투여량
- }
- return getCutNumber(thisRslt, 4);
- }
- // 투여간격 계산
- function fCalcAdminItv() {
- // 계산에 필요한 항목
- var peak_level = model.getValue("/root/main/cond/peaklevel"); // Peak level
- var tro_level = model.getValue("/root/main/cond/trolevel"); // Trough level
- var half_life = model.getValue("/root/main/cond/halflife"); // 반감기
-
- // Divide By Zero 관련 처리
- if(peak_level == "0") { messageBox("peak level은 '0'값을 입력", "E001"); model.setFocus("input1"); return; }
- else if(tro_level == "0") { messageBox("trough level은 '0'값을 입력", "E001"); model.setFocus("input2"); return; }
- else if(half_life == "0") { messageBox("반감기는 '0'값을 입력", "E001"); model.setFocus("input3"); return; }
-
- // 계산에 필요한 데이터 유무 검증
- if(peak_level == "" || tro_level == "" || half_life == "" ) { // Peak level, Trough level, 반감기
- messageBox("모든 입력란은 ", "I003"); return;
- }
-
- // 탭별 계산에 필요한 데이터 유무검증 및 계산
- var ke = 0.693 / half_life; // 소실률(ke)
- var calc_itv_rslt; // 투여간격 계산결과
-
- calc_itv_rslt = getCalcItvRslt(ke, peak_level, tro_level);
- // 계산된 값 셋팅
- model.setValue("/root/send/savedata/intervalresult", calc_itv_rslt);
- model.refresh();
- }
- // 투여간격 계산 결과
- function getCalcItvRslt(ke, cPeak, cTrough){
- var thisRslt = 0;
- var temp = cPeak / cTrough;
-
- temp = getCutNumber(temp, 4);
- ke = getCutNumber(ke, 4);
-
- thisRslt = Math.log(temp) / ke; // Natural log cf) base 10 log -> log10(double a)
- return getCutNumber(thisRslt, 4);
- }
- // 용량변경
- function fCalcAdmin(){
- // 계산에 필요한 항목
- var base_val = model.getValue("/root/main/cond/baseval"); // 기존투여량
- var calc_concent = model.getValue("/root/main/cond/calcconcentration"); // 측정혈중농도
- var expect_concent = model.getValue("/root/main/cond/expectconcentration"); // 희망혈중농도
-
- // Divide By Zero 관련 처리
- if(calc_concent == "0") { messageBox("측정혈중농도는 '0'값을 입력", "E001"); model.setFocus("input2"); return; }
-
- // 계산에 필요한 데이터 유무 검증
- if(base_val == "" || calc_concent == "" || expect_concent == "" ) { // 기존투여량, 측정혈중농도, 희망혈중농도
- messageBox("모든 입력란은 ", "I003"); return;
- }
- var calc_admin_rslt;
-
- calc_value_rslt = getCalcAdmin(base_val, calc_concent, expect_concent);
- // 계산된 값 셋팅
- model.setValue("/root/send/savedata/valresult", calc_value_rslt);
- model.refresh();
- }
- // 용량변경 계산 결과
- function getCalcAdmin(baseVal, calcConcent, expectConcent){
- var thisRslt = 0;
- thisRslt = (expectConcent * baseVal) / calcConcent
- return getCutNumber(thisRslt, 4);
- }
- // 유지용량 계산
- function fCalcMaintenance() {
- // 계산에 필요한 항목
- var loading_dose = model.getValue("/root/main/cond/loadingdose"); // Loading dose
- var half_life = model.getValue("/root/main/cond/halflife"); // 반감기
- var admin_interval = model.getValue("/root/main/cond/admininterval"); // 유지용량 투여간격
-
- // Divide By Zero 관련 처리
- if(half_life == "0") { messageBox("반감기는 '0'값을 입력", "E001"); model.setFocus("input2"); return; }
- // 계산에 필요한 데이터 유무 검증
- if(loading_dose == "" || half_life == "" || admin_interval == "" ) { // Loading dose, 반감기, 유지용량 투여간격
- messageBox("모든 입력란은 ", "I003"); return;
- }
-
- var ke = 0.693 / half_life; // 소실률(ke)
- ke = getCutNumber(ke, 4);
- var calc_itv_rslt; // 유지용량 투여간격
-
- calc_value_rslt = getCalcValRslt(ke, loading_dose, admin_interval);
- // 계산된 값 셋팅
- model.setValue("/root/send/savedata/valresult", calc_value_rslt);
- model.refresh();
- }
- // 유지용량 계산 결과
- function getCalcValRslt(ke, loadingDose, adminInterval){
- var thisRslt = 0;
- thisRslt = loadingDose * (1 - Math.exp(-ke * adminInterval));
- return getCutNumber(thisRslt, 4);
- }
- // 청소율 계산
- function fCalcCleanRate() {
- // 계산에 필요한 항목
- var weight = model.getValue("/root/main/cond/weight"); // 체중
- var height = model.getValue("/root/main/cond/height"); // 키
- var scr = model.getValue("/root/main/cond/scr"); // scr
- var sex = model.getValue("/root/main/cond/sex"); // 성별
- var age = model.getValue("/root/main/cond/patage"); // 나이
-
- if(age == 0) {
- messageBox("환자정보가 없어 계산","E001");
- return;
- }
-
- // Divide By Zero 관련 처리
- if(weight == "0") { messageBox("몸누게는 '0'값을 입력", "E001"); model.setFocus("input2"); return; }
- else if(height == "0") { messageBox("키는 '0'값을 입력", "E001"); model.setFocus("input2"); return; }
- else if(scr == "0") { messageBox("Scr은 '0'값을 입력", "E001"); model.setFocus("input2"); return; }
- // 계산에 필요한 데이터 유무 검증
- if(weight == "" || height == "" || scr == "" || sex == "") { // 체중, 키, scr, 성별
- messageBox("모든 입력란은 ", "I003"); return;
- }
-
- var adult_cl; var adult_gfr; var child_cl; var child_gfr;
-
- adult_cl = getAdultCl(weight, height, scr, sex, age);
- adult_gfr = getAdultGfr(weight, height, scr, sex, age);
- child_cl = getChildCl(weight, height, scr, sex, age);
- child_gfr = getChildGfr(weight, height, scr, sex, age);
- // 계산된 값 셋팅
- model.setValue("/root/send/savedata/adulcl", adult_cl);
- model.setValue("/root/send/savedata/adulgfr", adult_gfr);
- model.setValue("/root/send/savedata/childcl", child_cl);
- model.setValue("/root/send/savedata/childgfr", child_gfr);
- model.refresh();
- }
- // 청소율 - Adult Cl
- function getAdultCl(weight, height, scr, sex, age){
- var thisRslt = 0;
- if(sex == "M"){ // 남자
- thisRslt = ((140 - age) * weight) / (72 * scr);
- } else { // 여자
- thisRslt = ((140 - age) * weight) / (72 * scr) * 0.85;
- }
- return getCutNumber(thisRslt, 4);
- }
- // 청소율 - Adult GFR
- function getAdultGfr(weight, height, scr, sex, age){
- var thisRslt = 0;
-
- if(sex == "M"){ // 남자
- thisRslt = 186 / ((Math.pow(scr, 1.154) * Math.pow(age, 0.203)));
- } else { // 여자
- thisRslt = (186 * 0.742) / ((Math.pow(scr, 1.154) * Math.pow(age, 0.203)));
- }
- return getCutNumber(thisRslt, 4);
- }
- // 청소율 - Child Cl
- function getChildCl(height, scr){
- var thisRslt = 0;
- thisRslt = (0.55 * height) / scr;
- return getCutNumber(thisRslt, 4);
- }
- // 청소율 - Child GFR
- function getChildGfr(weight, height, scr, sex, age){
- var thisRslt = 0;
- thisRslt = (0.43 * height) / scr;
- return getCutNumber(thisRslt, 4);
- }
- // IBW 계산
- function fCalcIBW() {
- // 계산에 필요한 항목
- var weight = model.getValue("/root/main/cond/weight"); // 체중
- var height = model.getValue("/root/main/cond/height"); // 키
- var sex = model.getValue("/root/main/cond/sex"); // 성별
- var age = model.getValue("/root/main/cond/patage"); // 나이
-
- // Divide By Zero 관련 처리
- // 계산에 필요한 데이터 유무 검증
- if(weight == "" || height == "" || sex == "") { // 체중, 키, 성별
- messageBox("모든 입력란은 ", "I003"); return;
- }
-
- var devine; var robinson; var miller; var lemmens;
-
- devine = getCalcIBW(weight, height, sex, 50, 2.3, 45.5, 2.3); // Devine equation
- robinson = getCalcIBW(weight, height, sex, 52, 1.9, 49, 1.7); // Robinson equation
- miller = getCalcIBW(weight, height, sex, 56.2, 1.41, 53.1, 1.36); // Miller equation
- lemmens = getLemmens(weight, height); // Lemmens equation
- // 계산된 값 셋팅
- model.setValue("/root/send/savedata/adulcl", devine);
- model.setValue("/root/send/savedata/adulgfr", robinson);
- model.setValue("/root/send/savedata/childcl", miller);
- model.setValue("/root/send/savedata/childgfr", lemmens);
- model.refresh();
- }
- // IBW - Devine equation, Robinson equation, Miller equation
- function getCalcIBW(weight, height, sex, var1, var2, var3, var4){
- var thisRslt = 0;
- var temp = 0;
-
- if(height > 152.4){
- temp = (height - 152.4) / 2.54;
- temp = getCutNumber(temp, 4);
- }
-
- if(sex == "M"){ // 남자
- thisRslt = var1 + (var2 * temp);
- } else { // 여자
- thisRslt = var3 + (var4 * temp);
- }
- return getCutNumber(thisRslt, 4);
- }
- // IBW - Lemmens
- function getLemmens(weight, height){
- var thisRslt = 0;
- thisRslt = 22 * Math.pow(height, 2)
- return getCutNumber(thisRslt, 4);
- }
- // BMI 계산
- function fCalcBMI() {
- // 계산에 필요한 항목
- var weight = model.getValue("/root/main/cond/weight"); // 체중
- var height = model.getValue("/root/main/cond/height"); // 키
-
- // Divide By Zero 관련 처리
- if(height == "0") { messageBox("키는 '0'값을 입력", "E001"); model.setFocus("input5"); return; }
- // 계산에 필요한 데이터 유무 검증
- if(weight == "" || height == "") { // 체중, 키
- messageBox("모든 입력란은 ", "I003"); return;
- }
-
- var cal_bmi;
-
- bmi_result = getCalcBMI(weight, height);
- // 계산된 값 셋팅
- model.setValue("/root/send/savedata/bmiresult", bmi_result);
- model.refresh();
- }
- // BMI 계산결과
- function getCalcBMI(weight, height){
- var thisRslt = 0;
- thisRslt = weight / Math.pow(height, 2)
- return getCutNumber(thisRslt, 4);
- }
- // Fluid volume 계산
- function fCalcFluidVol(selectedTab) {
- /*
- // 계산에 필요한 항목
- var weight = model.getValue("/root/main/cond/weight"); // 체중
- var surface = model.getValue("/root/main/cond/surface"); // 체표면적
- var kcal = model.getValue("/root/main/cond/kcal"); // 칼로리
-
- // Divide By Zero 관련 처리
-
- // 계산에 필요한 데이터 유무 검증
-
- //if(weight == "" || surface == "" || kcal == "" ) { // 체중, 체표면적, 칼로리
- // messageBox("모든 입력란은 ", "I003"); return;
- //}
-
- var calc_day_water; // 1일수분유지량
- var calc_na; // Na
- var calc_k; // k
- var calc_glucose; // glucose
- // if(admin_times == "" || admin_interval == "") {
- // messageBox("모든 입력란은 ", "I003"); return;
- // }
- calc_day_water = getCalcWater(selectedTab, weight, surface, kcal);
- // 계산된 값 셋팅
- model.setValue("/root/send/savedata/daywater", calc_day_water);
- model.refresh();
- */
- alert("해당 계산식 점검중입니다.");
- }
- // BMI 계산결과
- function getCalcWater(selectedTab, weight, surface, kca){
- var thisRslt = 0;
- //thisRslt = weight / Math.pow(height, 2)
- return getCutNumber(thisRslt, 4);
- }
|