MMR03200.js 64 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799
  1. /**
  2. * @desc : 아파치항목값 저장
  3. * @
  4. * @param :
  5. * @return :
  6. * @author :
  7. * @---------------------------------------------------
  8. */
  9. //function fSaveApache(){
  10. function fSaveApache(flag){
  11. ////아파치 기록정보 인증저장
  12. //function fSaveApchEspi(flag)
  13. //{
  14. if (flag == null) {
  15. flag = "N"
  16. }
  17. var apchhr = "06"; //아파치적용시간
  18. var instcd = getUserInfo("dutplceinstcd");
  19. var pid = opener.javascript.getParameter("SPMMR03200_pid");
  20. var orddd = opener.javascript.getParameter("SPMMR03200_orddd");
  21. var cretno = opener.javascript.getParameter("SPMMR03200_cretno");
  22. //var apchdd = opener.javascript.getParameter("SPMMR03200_apchdd");
  23. model.setValue("/root/send/selectdata/status", status);
  24. model.refresh();
  25. if(model.getValue("/root/send/selectdata/ordinfo") == "" ){
  26. messageBox("입실, 재원중, 퇴실 여부를 ", "C002" );
  27. return;
  28. }
  29. submit("TRMMR03213");
  30. var cnt = getNodesetCount("/root/temp/apchlist");
  31. if(cnt > 0){
  32. var status = "u";
  33. var m = "u";
  34. }else if(cnt <= 0){
  35. var status = "i";
  36. var m = "i";
  37. }
  38. var currentdate = getCurrentDate() + getCurrentTime();
  39. var ref = "/root/main/apchitem/item";
  40. var dataCnt = getNodesetCnt(model, ref);
  41. var savedata1 ="status▦instcd▦pid▦orddd▦cretno▦apchdd▦apchitemcd▦reptrslt▦rsltrgstdt▦apchval▦apchscore▦apchlabel▩"; //헤더부분 컬럼
  42. var savedata2 ="m▦instcd▦pid▦orddd▦cretno▦apchdd▦apchscore▦dethrate▦apchscorea▦dethratea▦apchhr▦adjustednm▦ordinfo▦lastespiyn▦signno▩"; //헤더부분 컬럼
  43. var dataString1 = "";
  44. var dataString2 = "";
  45. var apchdd = model.getValue("/root/main/reqstnddd");
  46. for (var i=1 ; i <= dataCnt ; i++) {
  47. var apchitemcd = model.getValue(ref + "[" + i + "]/apchitemcd");
  48. var reptrslt = model.getValue(ref + "[" + i + "]/apchitemvalue");
  49. var rsltrgstdt = model.getValue(ref + "[" + i + "]/apchitemdt");
  50. var apchval = model.getValue(ref + "[" + i + "]/apchitemval");
  51. var apchscore = model.getValue(ref + "[" + i + "]/apchitemscore");
  52. //model.setValue(ref + "[" + i + "]/apchitemlabel", model.getValue("/root/init/item/apchitemlabel["+ i +"]"));
  53. var apchlabel = model.getValue(ref + "[" + i + "]/apchitemlabel");
  54. dataString1 = dataString1 + status + "▦" + instcd + "▦" + pid + "▦" + orddd + "▦" + cretno + "▦" + apchdd + "▦";
  55. dataString1 = dataString1 + apchitemcd + "▦" + reptrslt + "▦" + rsltrgstdt + "▦" + apchval + "▦" + apchscore + "▦" + apchlabel+ "▩";
  56. }//for i END
  57. var apchscore = model.getValue(ref + "[apchitemcd='18']/apchitemscore");
  58. var dethrate = model.getValue(ref + "[apchitemcd='19']/apchitemscore");
  59. var apchscorea = model.getValue(ref + "[apchitemcd='20']/apchitemscore");
  60. var dethratea = model.getValue(ref + "[apchitemcd='21']/apchitemscore");
  61. var adjustednm = model.getValue("/root/send/selectdata/adjustednm");
  62. var ordinfo = model.getValue("/root/send/selectdata/ordinfo");
  63. model.setValue("/root/send/selectdata/lastespiyn",flag);
  64. var lastespiyn = model.getValue("/root/send/selectdata/lastespiyn");
  65. //model.setValue("/root/send/selectdata/signno",model.getValue("/root/temp/sign/no"));
  66. var signno = model.getValue("/root/send/selectdata/signno");
  67. var fstrgstrid = model.getValue("/root/send/selectdata/fstrgstrid");
  68. var fstrgstdt = model.getValue("/root/send/selectdata/fstrgstdt");
  69. var lastupdtrid = model.getValue("/root/send/selectdata/lastupdtrid");
  70. var lastupdtdt = model.getValue("/root/send/selectdata/lastupdtdt");
  71. dataString2 = dataString2 + m + "▦" + instcd + "▦" + pid + "▦" + orddd + "▦" + cretno + "▦" + apchdd + "▦";
  72. dataString2 = dataString2 + apchscore + "▦" + dethrate + "▦" + apchscorea + "▦" + dethratea + "▦" + apchhr + "▦";
  73. dataString2 = dataString2 + adjustednm + "▦" + ordinfo + "▦" + lastespiyn + "▦" + signno + "▦";
  74. dataString2 = dataString2 + fstrgstrid + "▦" + fstrgstdt + "▦" + lastupdtrid + "▦" + lastupdtdt + "▩";
  75. if(dataString1.length > 0 && dataString2.length > 0) {
  76. model.setValue("/root/send/savedata/apchitem", savedata1 + dataString1);
  77. model.setValue("/root/send/savedata/apchscore", savedata2 + dataString2);
  78. if(model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore") != "N"){
  79. //항목별
  80. model.removeNode("/root/main/apchresult");
  81. model.makeNode("/root/main/apchresult");
  82. copyNodeset("/root/main/apchresult", "/root/main/apchitem", "", model, model);
  83. // 인증정보
  84. if(submit("TXMMR03210")==true){
  85. if (flag == "Y") {
  86. // 2009.08.10. *** 아파치기록정보 인증데이타 만들기..
  87. fGetApchRecCert();
  88. }
  89. //if(submit("TXMMR03210")==true){
  90. messageBox("저장","I002");
  91. fInit();
  92. }
  93. }else{
  94. messageBox("APACHE Ⅱ - ADJUSTED 항목을 ", "C002" );
  95. return;
  96. }
  97. model.refresh();
  98. }//if END
  99. }//fSaveApache END
  100. /**
  101. * @desc : 아파치 상세항목 Excel 파일로 저장
  102. * @
  103. * @param :
  104. * @return :
  105. * @author :
  106. * @---------------------------------------------------
  107. */
  108. function fSelect(){
  109. model.setValue("/root/main/apchitem/item[apchitemcd='01']/apchitemlabel", cmb_temp.label);
  110. model.setValue("/root/main/apchitem/item[apchitemcd='02']/apchitemlabel", cmb_zpam.label);
  111. model.setValue("/root/main/apchitem/item[apchitemcd='03']/apchitemlabel", cmb_zfc.label);
  112. model.setValue("/root/main/apchitem/item[apchitemcd='04']/apchitemlabel", cmb_zfr.label);
  113. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemlabel", cmb_zaa.label);
  114. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemlabel", cmb_pao.label);
  115. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemlabel", cmb_hco.label);
  116. model.setValue("/root/main/apchitem/item[apchitemcd='08']/apchitemlabel", cmb_ph.label);
  117. model.setValue("/root/main/apchitem/item[apchitemcd='09']/apchitemlabel", cmb_na.label);
  118. model.setValue("/root/main/apchitem/item[apchitemcd='10']/apchitemlabel", cmb_ka.label);
  119. model.setValue("/root/main/apchitem/item[apchitemcd='11']/apchitemlabel", cmb_uree.label);
  120. model.setValue("/root/main/apchitem/item[apchitemcd='12']/apchitemlabel", cmb_urea.label);
  121. model.setValue("/root/main/apchitem/item[apchitemcd='13']/apchitemlabel", cmb_hc.label);
  122. model.setValue("/root/main/apchitem/item[apchitemcd='14']/apchitemlabel", cmb_gb.label);
  123. model.setValue("/root/main/apchitem/item[apchitemcd='15']/apchitemlabel", cmb_glas.label);
  124. model.setValue("/root/main/apchitem/item[apchitemcd='16']/apchitemlabel", cmb_age.label);
  125. model.setValue("/root/main/apchitem/item[apchitemcd='17']/apchitemlabel", cmb_mcro.label);
  126. model.setValue("/root/main/apchitem/item[apchitemcd='23']/apchitemlabel", cmb_simple.label);
  127. model.setValue("/root/main/apchitem/item[apchitemcd='24']/apchitemlabel", ipt_fio2.value);
  128. model.setValue("/root/main/apchitem/item[apchitemcd='25']/apchitemlabel", opt_aao2.value);
  129. model.setValue("/root/main/apchitem/item[apchitemcd='26']/apchitemlabel", ipt_paco2.value);
  130. model.setValue("/root/main/apchitem/item[apchitemcd='27']/apchitemlabel", ipt_pao2.value);
  131. model.setValue("/root/main/apchitem/item[apchitemcd='28']/apchitemlabel", ipt_hco3.value);
  132. model.refresh();
  133. }
  134. function fSaveExcel() {
  135. var fileName = window.fileDialog("save", ",", false, "excel", "xls", "Excel Files(*.xls)|*.xls|All Files (*.*)|*.*");
  136. if (fileName != "") {
  137. item.saveExcel(fileName, "SheetName", true, true, "", "", "Boolean colHiddenExtend");
  138. }
  139. }
  140. /**
  141. * @desc : 아파치 스코어 디폴트값 지정
  142. * @
  143. * @param :
  144. * @return :
  145. * @author :
  146. * @---------------------------------------------------
  147. */
  148. function fInit(){
  149. var instcd = getUserInfo("dutplceinstcd");
  150. var vNowDD = getCurrentDate();
  151. var ref = "/root/main/apchitem/item";
  152. var dataCnt = getNodesetCnt(model, ref);
  153. var node = getGlobalVariable("paminfo");
  154. var pid = opener.javascript.getParameter("SPMMR03200_pid");
  155. var hngnm = opener.javascript.getParameter("SPMMR03200_hngnm");
  156. var orddd = opener.javascript.getParameter("SPMMR03200_orddd");
  157. var cretno = opener.javascript.getParameter("SPMMR03200_cretno");
  158. var apchdd = opener.javascript.getParameter("SPMMR03200_apchdd");
  159. var age = opener.javascript.getParameter("SPMMR03200_age");
  160. var fromdd = opener.javascript.getParameter("SPMMR03200_fromdd");
  161. var todd = opener.javascript.getParameter("SPMMR03200_todd");
  162. if(model.getValue("/root/send/selectdata/daylist") != apchdd && model.getValue("/root/send/selectdata/daylist") != ""){
  163. model.setValue("/root/main/reqstnddd", model.getValue("/root/send/selectdata/daylist"));
  164. }else if(model.getValue("/root/send/selectdata/daylist") == apchdd || model.getValue("/root/send/selectdata/daylist") == ""){
  165. model.setValue("/root/main/reqstnddd", apchdd);
  166. }
  167. if (pid!=""){
  168. model.setValue("/root/send/selectdata/hngnm",hngnm);
  169. model.setValue("/root/send/selectdata/pid",pid);
  170. model.setValue("/root/send/selectdata/instcd",instcd);
  171. model.setValue("/root/send/selectdata/orddd",orddd);
  172. model.setValue("/root/send/selectdata/cretno",cretno);
  173. model.setValue("/root/send/selectdata/apchdd",model.getValue("/root/main/reqstnddd"));
  174. model.setValue("/root/send/selectdata/fromdd",fromdd);
  175. model.setValue("/root/send/selectdata/todd",todd);
  176. //ipt_zage.value = age;
  177. submit("TRMMR03214");
  178. //cmb_daylist.select(0);
  179. model.refresh();
  180. }
  181. cmb_device.visible = false;
  182. cmb_nasal.visible = false;
  183. cmb_simple.visible = false;
  184. cpt_O2.visible = false;
  185. cpt_L.visible = false;
  186. model.refresh();
  187. submit("TRMMR03210");
  188. //나이
  189. if(model.getValue("/root/main/apchitem/item[apchitemcd='16']/apchitemvalue") == ""){
  190. ipt_zage.value = age;
  191. }else{
  192. ipt_zage.value = model.getValue("/root/main/apchitem/item[apchitemcd='16']/apchitemvalue");
  193. }
  194. //기록정보 유형
  195. if(model.getValue("/root/temp/apchpidlist/item/ordinfo") == ""){
  196. if(model.getValue("/root/send/selectdata/apchdd") == model.getValue("/root/send/selectdata/fromdd")){
  197. rdo_ordinfo.value = "1";
  198. }
  199. }else{
  200. rdo_ordinfo.value = model.getValue("/root/temp/apchpidlist/item/ordinfo");
  201. }
  202. //Adjusted 명칭
  203. if(opt_zmorta.value != ""){
  204. if(model.getValue("/root/temp/apchpidlist/item/adjustednm") != ""){
  205. opt_content.value = model.getValue("/root/temp/apchpidlist/item/adjustednm");
  206. }
  207. }else{
  208. opt_content.value = "";
  209. }
  210. //인증저장정보
  211. model.setValue("/root/send/selectdata/lastespiyn", model.getValue("/root/temp/apchpidlist/item/lastespiyn"));
  212. //signno
  213. model.setValue("/root/send/selectdata/signno", model.getValue("/root/temp/apchpidlist/item/signno"));
  214. model.refresh();
  215. fView();
  216. }
  217. /**
  218. * @desc : 아파치 상세항목 선택 스코어값 저장
  219. * @
  220. * @param :
  221. * @return :
  222. * @author :
  223. * @---------------------------------------------------
  224. */
  225. // 1. Temperature
  226. function fValueTEMP() {
  227. setInputNodeCurText();
  228. if (ipt_ztemp.currentText == ""){
  229. cmb_temp.value = "90";
  230. } else if (ipt_ztemp.currentText <= 29.9){
  231. cmb_temp.value = "14";
  232. } else if (ipt_ztemp.currentText >= 30 && ipt_ztemp.currentText <= 31.9){
  233. cmb_temp.value = "13";
  234. } else if (ipt_ztemp.currentText >= 32 && ipt_ztemp.currentText <= 33.9){
  235. cmb_temp.value = "12";
  236. } else if (ipt_ztemp.currentText >= 34 && ipt_ztemp.currentText <= 35.9){
  237. cmb_temp.value = "11";
  238. } else if (ipt_ztemp.currentText >= 36 && ipt_ztemp.currentText <= 38.4){
  239. cmb_temp.value = "10";
  240. } else if (ipt_ztemp.currentText >= 38.5 && ipt_ztemp.currentText <= 38.9){
  241. cmb_temp.value = "21";
  242. } else if (ipt_ztemp.currentText >= 39 && ipt_ztemp.currentText <= 40.9){
  243. cmb_temp.value = "23";
  244. } else if (ipt_ztemp.currentText >= 41){
  245. cmb_temp.value = "24";
  246. }
  247. fCalcTEMP();
  248. model.refresh();
  249. }
  250. function fCalcTEMP() {
  251. //99 opt_ztemp.value = cmb_temp.value.substr(1, 2);
  252. ztemp = cmb_temp.value.substr(1, 2);
  253. lbtemp = cmb_temp.label;
  254. opt_zapa.value = fCalcAPA();
  255. opt_zmort.value = fCalcMort();
  256. //opt_zmorta.value = fCalcMorta();
  257. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  258. opt_zmorta.value = fCalcMort();
  259. }else{
  260. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  261. }
  262. //99 if(opt_zmorta.value == ""){
  263. //99 if(opt_ztemp.value == ""){
  264. if(ztemp == ""){
  265. model.setValue("/root/init/item/apchitemscore1", "0");
  266. model.setValue("/root/init/item/apchitemlabel1", "");
  267. //99 model.makeValue("/root/init/item2/apchitemscore[1]", "0");
  268. }else{
  269. //99 model.setValue("/root/main/apchitem/item[apchitemcd='01']/apchitemscore", opt_ztemp.value);
  270. model.setValue("/root/init/item/apchitemscore1", ztemp);
  271. model.setValue("/root/init/item/apchitemlabel1", lbtemp);
  272. //99 model.makeValue("/root/init/item2/apchitemscore[1]", "0");
  273. }
  274. model.refresh();
  275. }
  276. // 2. Mean Arterial Pressure
  277. function fValuePAM() {
  278. setInputNodeCurText();
  279. if (ipt_zpam.currentText == ""){
  280. cmb_zpam.value = "90";
  281. } else if (ipt_zpam.currentText <= 49){
  282. cmb_zpam.value = "14";
  283. } else if (ipt_zpam.currentText >= 50 && ipt_zpam.currentText <= 69){
  284. cmb_zpam.value = "12";
  285. } else if (ipt_zpam.currentText >= 70 && ipt_zpam.currentText <= 109){
  286. cmb_zpam.value = "10";
  287. } else if (ipt_zpam.currentText >= 110 && ipt_zpam.currentText <= 129){
  288. cmb_zpam.value = "22";
  289. } else if (ipt_zpam.currentText >= 130 && ipt_zpam.currentText <= 159){
  290. cmb_zpam.value = "23";
  291. } else if (ipt_zpam.currentText >= 160){
  292. cmb_zpam.value = "24";
  293. }
  294. fCalcPAM();
  295. model.refresh();
  296. }
  297. function fCalcPAM() {
  298. //99 opt_zpam.value = cmb_zpam.value.substr(1,2);
  299. zpam = cmb_zpam.value.substr(1,2);
  300. lbpam = cmb_zpam.label;
  301. opt_zapa.value = fCalcAPA();
  302. opt_zmort.value = fCalcMort();
  303. //opt_zmorta.value = fCalcMorta();
  304. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  305. opt_zmorta.value = fCalcMort();
  306. }else{
  307. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  308. }
  309. //99 if(opt_zpam.value == ""){
  310. if(zpam == ""){
  311. model.setValue("/root/init/item/apchitemscore2", "0");
  312. model.setValue("/root/init/item/apchitemlabel2", "");
  313. }else{
  314. //99 model.setValue("/root/main/apchitem/item[apchitemcd='02']/apchitemscore", opt_zpam.value);
  315. model.setValue("/root/init/item/apchitemscore2", zpam);
  316. model.setValue("/root/init/item/apchitemlabel2", lbpam);
  317. }
  318. model.refresh();
  319. }
  320. // 3. Heart Rate
  321. function fValueFC() {
  322. setInputNodeCurText();
  323. if (ipt_zfc.currentText == ""){
  324. cmb_zfc.value = "90";
  325. } else if (ipt_zfc.currentText <= 39){
  326. cmb_zfc.value = "14";
  327. } else if (ipt_zfc.currentText >= 40 && ipt_zfc.currentText <= 54){
  328. cmb_zfc.value = "13";
  329. } else if (ipt_zfc.currentText >= 55 && ipt_zfc.currentText <= 69){
  330. cmb_zfc.value = "12";
  331. } else if (ipt_zfc.currentText >= 70 && ipt_zfc.currentText <= 109){
  332. cmb_zfc.value = "10";
  333. } else if (ipt_zfc.currentText >= 110 && ipt_zfc.currentText <= 139){
  334. cmb_zfc.value = "22";
  335. } else if (ipt_zfc.currentText >= 140 && ipt_zfc.currentText <= 179){
  336. cmb_zfc.value = "23";
  337. } else if (ipt_zfc.currentText >= 180){
  338. cmb_zfc.value = "24";
  339. }
  340. fCalcFC();
  341. model.refresh();
  342. }
  343. function fCalcFC() {
  344. //99 opt_zfc.value = cmb_zfc.value.substr(1,2);
  345. zfc = cmb_zfc.value.substr(1,2);
  346. lbfc = cmb_zfc.label;
  347. opt_zapa.value = fCalcAPA();
  348. opt_zmort.value = fCalcMort();
  349. //opt_zmorta.value = fCalcMorta();
  350. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  351. opt_zmorta.value = fCalcMort();
  352. }else{
  353. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  354. }
  355. //99 if(opt_zfc.value == ""){
  356. if(zfc == ""){
  357. model.setValue("/root/init/item/apchitemscore3", "0");
  358. model.setValue("/root/init/item/apchitemlabel3", "");
  359. }else{
  360. //model.setValue("/root/main/apchitem/item[apchitemcd='03']/apchitemscore", opt_zfc.value);
  361. model.setValue("/root/init/item/apchitemscore3", zfc);
  362. model.setValue("/root/init/item/apchitemlabel3", lbfc);
  363. }
  364. model.refresh();
  365. }
  366. // 4. Respiratory Rate
  367. function fValueFR() {
  368. setInputNodeCurText();
  369. if (ipt_zfr.currentText == ""){
  370. cmb_zfr.value = "90";
  371. } else if (ipt_zfr.currentText <= 5){
  372. cmb_zfr.value = "14";
  373. } else if (ipt_zfr.currentText >= 6 && ipt_zfr.currentText <= 9){
  374. cmb_zfr.value = "12";
  375. } else if (ipt_zfr.currentText >= 10 && ipt_zfr.currentText <= 11){
  376. cmb_zfr.value = "11";
  377. } else if (ipt_zfr.currentText >= 12 && ipt_zfr.currentText <= 24){
  378. cmb_zfr.value = "10";
  379. } else if (ipt_zfr.currentText >= 25 && ipt_zfr.currentText <= 34){
  380. cmb_zfr.value = "21";
  381. } else if (ipt_zfr.currentText >= 35 && ipt_zfr.currentText <= 49){
  382. cmb_zfr.value = "23";
  383. } else if (ipt_zfr.currentText >= 50){
  384. cmb_zfr.value = "24";
  385. }
  386. fCalcFR();
  387. model.refresh();
  388. }
  389. function fCalcFR() {
  390. //99 opt_zfr.value = cmb_zfr.value.substr(1,2);
  391. zfr = cmb_zfr.value.substr(1,2);
  392. lbfr = cmb_zfr.label;
  393. opt_zapa.value = fCalcAPA();
  394. opt_zmort.value = fCalcMort();
  395. //opt_zmorta.value = fCalcMorta();
  396. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  397. opt_zmorta.value = fCalcMort();
  398. }else{
  399. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  400. }
  401. //99 if(opt_zfr.value == ""){
  402. if(zfr == ""){
  403. model.setValue("/root/init/item/apchitemscore4", "0");
  404. model.setValue("/root/init/item/apchitemlabel4", "");
  405. }else{
  406. //model.setValue("/root/main/apchitem/item[apchitemcd='04']/apchitemscore", opt_zfr.value);
  407. model.setValue("/root/init/item/apchitemscore4", zfr);
  408. model.setValue("/root/init/item/apchitemlabel4", lbfr);
  409. }
  410. model.refresh();
  411. }
  412. // 5. If FIO2>=0, 5:(A-a)O2
  413. function fValueAA() {
  414. if (ipt_zaa.currentText == ""){
  415. cmb_zaa.value = "90";
  416. } else if (ipt_zaa.currentText < 200){
  417. cmb_zaa.value = "20";
  418. } else if (ipt_zaa.currentText >= 200 && ipt_zaa.currentText <= 349){
  419. cmb_zaa.value = "22";
  420. } else if (ipt_zaa.currentText >= 350 && ipt_zaa.currentText <= 499){
  421. cmb_zaa.value = "23";
  422. } else if (ipt_zaa.currentText >= 500){
  423. cmb_zaa.value = "24";
  424. }
  425. fCalcAA();
  426. model.refresh();
  427. }
  428. function fCalcAA() {
  429. //99 opt_zaa.value = cmb_zaa.value.substr(1,2);
  430. zaa = cmb_zaa.value.substr(1,2);
  431. lbaa = cmb_zaa.label;
  432. opt_zapa.value = fCalcAPA();
  433. opt_zmort.value = fCalcMort();
  434. //opt_zmorta.value = fCalcMorta();
  435. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  436. opt_zmorta.value = fCalcMort();
  437. }else{
  438. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  439. }
  440. //99 if(opt_zaa.value == ""){
  441. if(zaa == ""){
  442. model.setValue("/root/init/item/apchitemscore5", "0");
  443. model.setValue("/root/init/item/apchitemlabel5", "");
  444. }else{
  445. //model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemscore", opt_zaa.value);
  446. model.setValue("/root/init/item/apchitemscore5", zaa);
  447. model.setValue("/root/init/item/apchitemlabel5", lbaa);
  448. }
  449. model.refresh();
  450. }
  451. // 6. If FIO2<0, 5:PaO2
  452. function fValuePAO() {
  453. if (ipt_zpao.currentText == ""){
  454. cmb_pao.value = "90";
  455. } else if (ipt_zpao.currentText < 55){
  456. cmb_pao.value = "14";
  457. } else if (ipt_zpao.currentText >= 55 && ipt_zpao.currentText <= 60){
  458. cmb_pao.value = "13";
  459. } else if (ipt_zpao.currentText >= 61 && ipt_zpao.currentText <= 70){
  460. cmb_pao.value = "11";
  461. } else if (ipt_zpao.currentText > 70){
  462. cmb_pao.value = "20";
  463. }
  464. fCalcPAO();
  465. model.refresh();
  466. }
  467. function fCalcPAO() {
  468. //99 opt_zpao.value = cmb_pao.value.substr(1,2);
  469. zpao = cmb_pao.value.substr(1,2);
  470. lbpao = cmb_pao.label;
  471. opt_zapa.value = fCalcAPA();
  472. opt_zmort.value = fCalcMort();
  473. //opt_zmorta.value = fCalcMorta();
  474. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  475. opt_zmorta.value = fCalcMort();
  476. }else{
  477. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  478. }
  479. //99 if(opt_zpao.value == ""){
  480. if(zpao == ""){
  481. model.setValue("/root/init/item/apchitemscore6", "0");
  482. model.setValue("/root/init/item/apchitemlabel6", "");
  483. }else{
  484. //model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemscore", opt_zpao.value);
  485. model.setValue("/root/init/item/apchitemscore6", zpao);
  486. model.setValue("/root/init/item/apchitemlabel6", lbpao);
  487. }
  488. model.refresh();
  489. }
  490. // 7. If no A.B Gs: Serum HCO3-
  491. function fValueHCO() {
  492. if (ipt_zhco.currentText == ""){
  493. cmb_hco.value = "90";
  494. } else if (ipt_zhco.currentText >= 52){
  495. cmb_hco.value = "14";
  496. } else if (ipt_zhco.currentText >= 41 && ipt_zhco.currentText <= 51.9){
  497. cmb_hco.value = "13";
  498. } else if (ipt_zhco.currentText >= 32 && ipt_zhco.currentText <= 40.9){
  499. cmb_hco.value = "11";
  500. } else if (ipt_zhco.currentText >= 22 && ipt_zhco.currentText <= 31.9){
  501. cmb_hco.value = "10";
  502. } else if (ipt_zhco.currentText >= 18 && ipt_zhco.currentText <= 21.9){
  503. cmb_hco.value = "22";
  504. } else if (ipt_zhco.currentText >= 15 && ipt_zhco.currentText <= 17.9){
  505. cmb_hco.value = "23";
  506. } else if (ipt_zhco.currentText < 15){
  507. cmb_hco.value = "24";
  508. }
  509. fCalcHCO();
  510. model.refresh();
  511. }
  512. function fCalcHCO() {
  513. //99 opt_zhco.value = cmb_hco.value.substr(1,2);
  514. zhco = cmb_hco.value.substr(1,2);
  515. lbhco = cmb_hco.label;
  516. opt_zapa.value = fCalcAPA();
  517. opt_zmort.value = fCalcMort();
  518. //opt_zmorta.value = fCalcMorta();
  519. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  520. opt_zmorta.value = fCalcMort();
  521. }else{
  522. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  523. }
  524. //99 if(opt_zhco.value == ""){
  525. if(zhco == ""){
  526. model.setValue("/root/init/item/apchitemscore7", "0");
  527. model.setValue("/root/init/item/apchitemlabel7", "");
  528. }else{
  529. //model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemscore", opt_zhco.value);
  530. model.setValue("/root/init/item/apchitemscore7", zhco);
  531. model.setValue("/root/init/item/apchitemlabel7", lbhco);
  532. }
  533. model.refresh();
  534. }
  535. // 8. Aterial pH.
  536. function fValuePH() {
  537. setInputNodeCurText();
  538. if (ipt_zph.currentText == ""){
  539. cmb_ph.value = "90";
  540. } else if (ipt_zph.currentText >= 7.7){
  541. cmb_ph.value = "14";
  542. } else if (ipt_zph.currentText >= 7.6 && ipt_zph.currentText <= 7.69){
  543. cmb_ph.value = "13";
  544. } else if (ipt_zph.currentText >= 7.5 && ipt_zph.currentText <= 7.59){
  545. cmb_ph.value = "11";
  546. } else if (ipt_zph.currentText >= 7.33 && ipt_zph.currentText <= 7.49){
  547. cmb_ph.value = "10";
  548. } else if (ipt_zph.currentText >= 7.25 && ipt_zph.currentText <= 7.32){
  549. cmb_ph.value = "22";
  550. } else if (ipt_zph.currentText >= 7.15 && ipt_zph.currentText <= 7.24){
  551. cmb_ph.value = "23";
  552. } else if (ipt_zph.currentText < 7.15){
  553. cmb_ph.value = "24";
  554. }
  555. fCalcPH();
  556. model.refresh();
  557. }
  558. function fCalcPH() {
  559. //99 opt_zph.value = cmb_ph.value.substr(1,2);
  560. zph = cmb_ph.value.substr(1,2);
  561. lbph = cmb_ph.label;
  562. opt_zapa.value = fCalcAPA();
  563. opt_zmort.value = fCalcMort();
  564. //opt_zmorta.value = fCalcMorta();
  565. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  566. opt_zmorta.value = fCalcMort();
  567. }else{
  568. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  569. }
  570. //99 if(opt_zph.value == ""){
  571. if(zph == ""){
  572. model.setValue("/root/init/item/apchitemscore8", "0");
  573. model.setValue("/root/init/item/apchitemlabel8", "");
  574. }else{
  575. //model.setValue("/root/main/apchitem/item[apchitemcd='08']/apchitemscore", opt_zph.value);
  576. model.setValue("/root/init/item/apchitemscore8", zph);
  577. model.setValue("/root/init/item/apchitemlabel8", lbph);
  578. }
  579. model.refresh();
  580. }
  581. // 9. Serum Sodium
  582. function fValueNA() {
  583. setInputNodeCurText();
  584. if (ipt_zna.currentText == ""){
  585. cmb_na.value = "90";
  586. } else if (ipt_zna.currentText >= 180){
  587. cmb_na.value = "14";
  588. } else if (ipt_zna.currentText >= 160 && ipt_zna.currentText <= 179){
  589. cmb_na.value = "13";
  590. } else if (ipt_zna.currentText >= 155 && ipt_zna.currentText <= 159){
  591. cmb_na.value = "12";
  592. } else if (ipt_zna.currentText >= 150 && ipt_zna.currentText <= 154){
  593. cmb_na.value = "11";
  594. } else if (ipt_zna.currentText >= 130 && ipt_zna.currentText <= 149){
  595. cmb_na.value = "10";
  596. } else if (ipt_zna.currentText >= 120 && ipt_zna.currentText <= 129){
  597. cmb_na.value = "22";
  598. } else if (ipt_zna.currentText >= 111 && ipt_zna.currentText <= 119){
  599. cmb_na.value = "23";
  600. } else if (ipt_zna.currentText <= 110){
  601. cmb_na.value = "24";
  602. }
  603. fCalcNA();
  604. model.refresh();
  605. }
  606. function fCalcNA() {
  607. //99 opt_zna.value = cmb_na.value.substr(1,2);
  608. zna = cmb_na.value.substr(1,2);
  609. lbna = cmb_na.label;
  610. opt_zapa.value = fCalcAPA();
  611. opt_zmort.value = fCalcMort();
  612. //opt_zmorta.value = fCalcMorta();
  613. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  614. opt_zmorta.value = fCalcMort();
  615. }else{
  616. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  617. }
  618. //99 if(opt_zna.value == ""){
  619. if(zna == ""){
  620. model.setValue("/root/init/item/apchitemscore9", "0");
  621. model.setValue("/root/init/item/apchitemlabel9", "");
  622. }else{
  623. //model.setValue("/root/main/apchitem/item[apchitemcd='09']/apchitemscore", opt_zna.value);
  624. model.setValue("/root/init/item/apchitemscore9", zna);
  625. model.setValue("/root/init/item/apchitemlabel9", lbna);
  626. }
  627. model.refresh();
  628. }
  629. // 10. Serum Potassium
  630. function fValueKA() {
  631. setInputNodeCurText();
  632. if (ipt_zka.currentText == ""){
  633. cmb_ka.value = "90";
  634. } else if (ipt_zka.currentText >= 7){
  635. cmb_ka.value = "14";
  636. } else if (ipt_zka.currentText >= 6 && ipt_zka.currentText <= 6.9){
  637. cmb_ka.value = "13";
  638. } else if (ipt_zka.currentText >= 5.5 && ipt_zka.currentText <= 5.9){
  639. cmb_ka.value = "11";
  640. } else if (ipt_zka.currentText >= 3.5 && ipt_zka.currentText <= 5.4){
  641. cmb_ka.value = "10";
  642. } else if (ipt_zka.currentText >= 3 && ipt_zka.currentText <= 3.4){
  643. cmb_ka.value = "21";
  644. } else if (ipt_zka.currentText >= 2.5 && ipt_zka.currentText <= 2.9){
  645. cmb_ka.value = "22";
  646. } else if (ipt_zka.currentText < 2.5){
  647. cmb_ka.value = "24";
  648. }
  649. fCalcKA();
  650. model.refresh();
  651. }
  652. function fCalcKA() {
  653. //99 opt_zka.value = cmb_ka.value.substr(1,2);
  654. zka = cmb_ka.value.substr(1,2);
  655. lbka = cmb_ka.label;
  656. opt_zapa.value = fCalcAPA();
  657. opt_zmort.value = fCalcMort();
  658. //opt_zmorta.value = fCalcMorta();
  659. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  660. opt_zmorta.value = fCalcMort();
  661. }else{
  662. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  663. }
  664. //99 if(opt_zka.value == ""){
  665. if(zka == ""){
  666. model.setValue("/root/init/item/apchitemscore10", "0");
  667. model.setValue("/root/init/item/apchitemlabel10", "");
  668. }else{
  669. //model.setValue("/root/main/apchitem/item[apchitemcd='10']/apchitemscore", opt_zka.value);
  670. model.setValue("/root/init/item/apchitemscore10", zka);
  671. model.setValue("/root/init/item/apchitemlabel10", lbka);
  672. }
  673. model.refresh();
  674. }
  675. // 11. Serum Creatinine With Acute Renal Failure
  676. function fValueUREE() {
  677. setInputNodeCurText();
  678. if (ipt_zuree.currentText == ""){
  679. cmb_uree.value = "90";
  680. } else if (ipt_zuree.currentText < 0.6){
  681. cmb_uree.value = "14";
  682. } else if (ipt_zuree.currentText >= 0.6 && ipt_zuree.currentText <= 1.4){
  683. cmb_uree.value = "20";
  684. } else if (ipt_zuree.currentText >= 1.5 && ipt_zuree.currentText <= 1.9){
  685. cmb_uree.value = "24";
  686. } else if (ipt_zuree.currentText >= 2 && ipt_zuree.currentText <= 3.4){
  687. cmb_uree.value = "26";
  688. } else if (ipt_zuree.currentText >= 3.5){
  689. cmb_uree.value = "28";
  690. }
  691. fCalcUREE();
  692. model.refresh();
  693. }
  694. function fCalcUREE() {
  695. //99 opt_zuree.value = cmb_uree.value.substr(1,2);
  696. zuree = cmb_uree.value.substr(1,2);
  697. lburee = cmb_uree.label;
  698. opt_zapa.value = fCalcAPA();
  699. opt_zmort.value = fCalcMort();
  700. //opt_zmorta.value = fCalcMorta();
  701. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  702. opt_zmorta.value = fCalcMort();
  703. }else{
  704. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  705. }
  706. //99 if(opt_zuree.value == ""){
  707. if(zuree == ""){
  708. model.setValue("/root/init/item/apchitemscore11", "0");
  709. model.setValue("/root/init/item/apchitemlabel11", "");
  710. }else{
  711. //model.setValue("/root/main/apchitem/item[apchitemcd='11']/apchitemscore", opt_zuree.value);
  712. model.setValue("/root/init/item/apchitemscore11", zuree);
  713. model.setValue("/root/init/item/apchitemlabel11", lburee);
  714. }
  715. model.refresh();
  716. }
  717. // 12. Serum Creatinine Without Acute Renal Failure
  718. function fValueUREA() {
  719. setInputNodeCurText();
  720. if (ipt_zurea.currentText == ""){
  721. cmb_urea.value = "90";
  722. } else if (ipt_zurea.currentText < 0.6){
  723. cmb_urea.value = "12";
  724. } else if (ipt_zurea.currentText >= 0.6 && ipt_zurea.currentText <= 1.4){
  725. cmb_urea.value = "20";
  726. } else if (ipt_zurea.currentText >= 1.5 && ipt_zurea.currentText <= 1.9){
  727. cmb_urea.value = "22";
  728. } else if (ipt_zurea.currentText >= 2 && ipt_zurea.currentText <= 3.4){
  729. cmb_urea.value = "23";
  730. } else if (ipt_zurea.currentText >= 3.5){
  731. cmb_urea.value = "24";
  732. }
  733. fCalcUREA();
  734. model.refresh();
  735. }
  736. function fCalcUREA() {
  737. //99 opt_zurea.value = cmb_urea.value.substr(1,2);
  738. zurea = cmb_urea.value.substr(1,2);
  739. lburea = cmb_urea.label;
  740. opt_zapa.value = fCalcAPA();
  741. opt_zmort.value = fCalcMort();
  742. //opt_zmorta.value = fCalcMorta();
  743. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  744. opt_zmorta.value = fCalcMort();
  745. }else{
  746. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  747. }
  748. //99 if(opt_zurea.value == ""){
  749. if(zurea == ""){
  750. model.setValue("/root/init/item/apchitemscore12", "0");
  751. model.setValue("/root/init/item/apchitemlabel12", "");
  752. }else{
  753. //model.setValue("/root/main/apchitem/item[apchitemcd='12']/apchitemscore", opt_zurea.value);
  754. model.setValue("/root/init/item/apchitemscore12", zurea);
  755. model.setValue("/root/init/item/apchitemlabel12", lburea);
  756. }
  757. model.refresh();
  758. }
  759. // 13. Ht
  760. function fValueHC() {
  761. setInputNodeCurText();
  762. if (ipt_zhc.currentText == ""){
  763. cmb_hc.value = "90";
  764. } else if (ipt_zhc.currentText < 20){
  765. cmb_hc.value = "14";
  766. } else if (ipt_zhc.currentText >= 20 && ipt_zhc.currentText <= 29.9){
  767. cmb_hc.value = "12";
  768. } else if (ipt_zhc.currentText >= 30 && ipt_zhc.currentText <= 45.9){
  769. cmb_hc.value = "10";
  770. } else if (ipt_zhc.currentText >= 46 && ipt_zhc.currentText <= 49.9){
  771. cmb_hc.value = "21";
  772. } else if (ipt_zhc.currentText >= 50 && ipt_zhc.currentText <= 59.9){
  773. cmb_hc.value = "22";
  774. } else if (ipt_zhc.currentText >= 60){
  775. cmb_hc.value = "24";
  776. }
  777. fCalcHC();
  778. model.refresh();
  779. }
  780. function fCalcHC() {
  781. //99 opt_zhc.value = cmb_hc.value.substr(1,2);
  782. zhc = cmb_hc.value.substr(1,2);
  783. lbhc = cmb_hc.label;
  784. opt_zapa.value = fCalcAPA();
  785. opt_zmort.value = fCalcMort();
  786. //opt_zmorta.value = fCalcMorta();
  787. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  788. opt_zmorta.value = fCalcMort();
  789. }else{
  790. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  791. }
  792. //99 if(opt_zhc.value == ""){
  793. if(zhc == ""){
  794. model.setValue("/root/init/item/apchitemscore13", "0");
  795. model.setValue("/root/init/item/apchitemlabel13", "");
  796. }else{
  797. //model.setValue("/root/main/apchitem/item[apchitemcd='13']/apchitemscore", opt_zhc.value);
  798. model.setValue("/root/init/item/apchitemscore13", zhc);
  799. model.setValue("/root/init/item/apchitemlabel13", lbhc);
  800. }
  801. model.refresh();
  802. }
  803. // 14. W.B.C
  804. function fValueGB() {
  805. setInputNodeCurText();
  806. if (ipt_zgb.currentText == ""){
  807. cmb_gb.value = "90";
  808. } else if (ipt_zgb.currentText < 1){
  809. cmb_gb.value = "14";
  810. } else if (ipt_zgb.currentText >= 1 && ipt_zgb.currentText <= 2.9){
  811. cmb_gb.value = "12";
  812. } else if (ipt_zgb.currentText >= 3 && ipt_zgb.currentText <= 14.9){
  813. cmb_gb.value = "10";
  814. } else if (ipt_zgb.currentText >= 15 && ipt_zgb.currentText <= 19.9){
  815. cmb_gb.value = "21";
  816. } else if (ipt_zgb.currentText >= 20 && ipt_zgb.currentText <= 39.9){
  817. cmb_gb.value = "22";
  818. } else if (ipt_zgb.currentText >= 40){
  819. cmb_gb.value = "24";
  820. }
  821. fCalcGB();
  822. model.refresh();
  823. }
  824. function fCalcGB() {
  825. //99 opt_zgb.value = cmb_gb.value.substr(1,2);
  826. zgb = cmb_gb.value.substr(1,2);
  827. lbgb = cmb_gb.label;
  828. opt_zapa.value = fCalcAPA();
  829. opt_zmort.value = fCalcMort();
  830. //opt_zmorta.value = fCalcMorta();
  831. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  832. opt_zmorta.value = fCalcMort();
  833. }else{
  834. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  835. }
  836. //99 if(opt_zgb.value == ""){
  837. if(zgb == ""){
  838. model.setValue("/root/init/item/apchitemscore14", "0");
  839. model.setValue("/root/init/item/apchitemlabel14", "");
  840. }else{
  841. //model.setValue("/root/main/apchitem/item[apchitemcd='14']/apchitemscore", opt_zgb.value);
  842. model.setValue("/root/init/item/apchitemscore14", zgb);
  843. model.setValue("/root/init/item/apchitemlabel14", lbgb);
  844. }
  845. model.refresh();
  846. }
  847. // 15. Glasgow Coma Score
  848. function fValueGLAS() {
  849. //setInputNodeCurText();
  850. if (ipt_zglas.currentText == ""){
  851. cmb_glas.value = "90";
  852. } else if (ipt_zglas.currentText == 15){
  853. cmb_glas.value = "0";
  854. } else if (ipt_zglas.currentText == 14){
  855. cmb_glas.value = "1";
  856. } else if (ipt_zglas.currentText == 13){
  857. cmb_glas.value = "2";
  858. } else if (ipt_zglas.currentText == 12){
  859. cmb_glas.value = "3";
  860. } else if (ipt_zglas.currentText == 11){
  861. cmb_glas.value = "4";
  862. } else if (ipt_zglas.currentText == 10){
  863. cmb_glas.value = "5";
  864. } else if (ipt_zglas.currentText == 9){
  865. cmb_glas.value = "6";
  866. } else if (ipt_zglas.currentText == 8){
  867. cmb_glas.value = "7";
  868. } else if (ipt_zglas.currentText == 7){
  869. cmb_glas.value = "8";
  870. } else if (ipt_zglas.currentText == 6){
  871. cmb_glas.value = "9";
  872. } else if (ipt_zglas.currentText == 5){
  873. cmb_glas.value = "10";
  874. } else if (ipt_zglas.currentText == 4){
  875. cmb_glas.value = "11";
  876. } else if (ipt_zglas.currentText == 3){
  877. cmb_glas.value = "12";
  878. }
  879. fCalcGLAS();
  880. model.refresh();
  881. }
  882. function fCalcGLAS() {
  883. if (cmb_glas.value == 90) {
  884. //99 opt_zglas.value = cmb_glas.value.substr(1,2);
  885. zglas = cmb_glas.value.substr(1,2);
  886. } else {
  887. //99 opt_zglas.value = cmb_glas.value;
  888. zglas = cmb_glas.value;
  889. }
  890. lbglas = cmb_glas.label;
  891. opt_zapa.value = fCalcAPA();
  892. opt_zmort.value = fCalcMort();
  893. //opt_zmorta.value = fCalcMorta();
  894. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  895. opt_zmorta.value = fCalcMort();
  896. }else{
  897. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  898. }
  899. //99 if(opt_zglas.value == ""){
  900. if(zglas == ""){
  901. model.setValue("/root/init/item/apchitemscore15", "0");
  902. model.setValue("/root/init/item/apchitemlabel15", "");
  903. }else{
  904. //model.setValue("/root/main/apchitem/item[apchitemcd='15']/apchitemscore", opt_zglas.value);
  905. model.setValue("/root/init/item/apchitemscore15", zglas);
  906. model.setValue("/root/init/item/apchitemlabel15", lbglas);
  907. }
  908. model.refresh();
  909. }
  910. // 16. Age
  911. function fValueAGE() {
  912. setInputNodeCurText();
  913. if (ipt_zage.currentText == ""){
  914. cmb_age.value = "90";
  915. } else if (ipt_zage.currentText <= 44){
  916. cmb_age.value = "10";
  917. } else if (ipt_zage.currentText >= 45 && ipt_zage.currentText <= 54){
  918. cmb_age.value = "12";
  919. } else if (ipt_zage.currentText >= 55 && ipt_zage.currentText <= 64){
  920. cmb_age.value = "13";
  921. } else if (ipt_zage.currentText >= 65 && ipt_zage.currentText <= 74){
  922. cmb_age.value = "15";
  923. } else if (ipt_zage.currentText >= 75){
  924. cmb_age.value = "16";
  925. }
  926. fCalcAGE();
  927. model.refresh();
  928. }
  929. function fCalcAGE() {
  930. //99 opt_zage.value = cmb_age.value.substr(1,2);
  931. zage = cmb_age.value.substr(1,2);
  932. lbage = cmb_age.label;
  933. opt_zapa.value = fCalcAPA();
  934. opt_zmort.value = fCalcMort();
  935. //opt_zmorta.value = fCalcMorta();
  936. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  937. opt_zmorta.value = fCalcMort();
  938. }else{
  939. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  940. }
  941. //99 if(opt_zage.value == ""){
  942. if(zage == ""){
  943. model.setValue("/root/init/item/apchitemscore16", "0");
  944. model.setValue("/root/init/item/apchitemlabel16", "");
  945. }else{
  946. //model.setValue("/root/main/apchitem/item[apchitemcd='16']/apchitemscore", opt_zage.value);
  947. model.setValue("/root/init/item/apchitemscore16", zage);
  948. model.setValue("/root/init/item/apchitemlabel16", lbage);
  949. }
  950. model.refresh();
  951. }
  952. // 17. Chronic Organ Insufficiency immuno-compromised
  953. function fCalcMCRO() {
  954. //99 opt_zmcro.value = cmb_mcro.value.substr(1,2);
  955. zmcro = cmb_mcro.value.substr(1,2);
  956. lbmcro = cmb_mcro.label;
  957. opt_zapa.value = fCalcAPA();
  958. opt_zmort.value = fCalcMort();
  959. //opt_zmorta.value = fCalcMorta();
  960. if(model.getValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore") == ""){
  961. opt_zmorta.value = fCalcMort();
  962. }else{
  963. opt_zmorta.value = model.getValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore");
  964. }
  965. //99 if(opt_zmcro.value == ""){
  966. if(zmcro == ""){
  967. model.setValue("/root/init/item/apchitemscore17", "0");
  968. model.setValue("/root/init/item/apchitemlabel17", "");
  969. }else{
  970. //model.setValue("/root/main/apchitem/item[apchitemcd='17']/apchitemscore", opt_zmcro.value);
  971. model.setValue("/root/init/item/apchitemscore17", zmcro);
  972. model.setValue("/root/init/item/apchitemlabel17", lbmcro);
  973. }
  974. model.refresh();
  975. }
  976. function fCalcAPA() {
  977. var z = eval(opt_ztemp.value);
  978. z = z + eval(opt_zpam.value);
  979. z = z + eval(opt_zfc.value);
  980. z = z + eval(opt_zfr.value);
  981. z = z + eval(opt_zaa.value);
  982. z = z + eval(opt_zpao.value);
  983. z = z + eval(opt_zhco.value);
  984. z = z + eval(opt_zph.value);
  985. z = z + eval(opt_zna.value);
  986. z = z + eval(opt_zka.value);
  987. z = z + eval(opt_zuree.value);
  988. z = z + eval(opt_zurea.value);
  989. z = z + eval(opt_zhc.value);
  990. z = z + eval(opt_zgb.value);
  991. z = z + eval(opt_zage.value);
  992. z = z + eval(opt_zglas.value);
  993. z = z + eval(opt_zmcro.value);
  994. if (opt_zuree.value > 0 && opt_zurea.value > 0) {
  995. alert("Acute renal failure or not ?");
  996. }
  997. if (opt_zph.value > 0 && opt_zhco.value > 0) {
  998. alert(" Serum HCO3 : use only if no ABGs");
  999. }
  1000. if (opt_zaa.value > 0 && opt_zpao.value > 0) {
  1001. alert(" FIO2 > or< 0.5 ?");
  1002. }
  1003. model.setValue("/root/main/apchitem/item[apchitemcd='18']/apchitemscore", z);
  1004. model.refresh();
  1005. return ''+z;
  1006. }
  1007. function fCalcMort(){
  1008. z = eval(opt_zapa.value);
  1009. z = -3.517 + z * (0.146);
  1010. z = Math.exp(z) / (1 + Math.exp(z));
  1011. z = fFmt(100 * z);
  1012. return z;
  1013. model.setValue("/root/main/apchitem/item[apchitemcd='19']/apchitemscore", opt_zmort.value); // %
  1014. model.refresh();
  1015. }
  1016. function fCalcMorta() {
  1017. /*
  1018. var z = 0;
  1019. z = eval(model.getValue("/root/main/y") + "+z");
  1020. z = Math.exp(z) / (1 + Math.exp(z));
  1021. z = fFmt(100 * z);
  1022. opt_zmorta.value = z;
  1023. */
  1024. var z = 0;
  1025. t = eval(model.getValue("/root/main/y"));
  1026. z = eval(model.getValue("/root/main/zapa"));
  1027. b = -3.517 + z * (0.146);
  1028. z = b + t;
  1029. z = Math.exp(z) / (1 + Math.exp(z));
  1030. z = fFmt(100 * z);
  1031. opt_zmorta.value = z;
  1032. return z;
  1033. }
  1034. function fFmt(x) {
  1035. var v
  1036. if(x >= 0) {
  1037. v = '' + (x + 0.05)
  1038. } else {
  1039. v = '' + (x - 0.05)
  1040. }
  1041. return v.substring(0,v.indexOf('.')+2)
  1042. }
  1043. function fPrd(){
  1044. var adjusted = model.getValue("/root/main/y");
  1045. var content = model.getValue("/root/main/content");
  1046. var pdr = model.getValue("/root/main/pdeathrate");
  1047. opener.model.setValue("/root/main/apchitem/item[apchitemcd='20']/apchitemscore", adjusted);
  1048. opener.model.setValue("/root/send/selectdata/adjustednm", content);
  1049. opener.model.setValue("/root/main/apchitem/item[apchitemcd='21']/apchitemscore", pdr);
  1050. opener.model.refresh();
  1051. window.close();
  1052. }
  1053. function fGubun() {
  1054. //var fio2 = model.getValue("/root/main/apchitem/item[apchitemcd='23']/apchitemvalue");
  1055. var fio2 = cmb_fio2.value;
  1056. var lbfio2 = cmb_fio2.label;
  1057. model.setValue("/root/main/apchitem/item[apchitemcd='23']/apchitemlabel", lbfio2);
  1058. if (fio2 == "0"){
  1059. cmb_device.visible = false;
  1060. cmb_nasal.visible = false;
  1061. cmb_simple.visible = false;
  1062. cpt_O2.visible = false;
  1063. cpt_L.visible = false;
  1064. model.setValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue", "21");
  1065. model.refresh();
  1066. var paco2 = model.getValue("/root/main/apchitem/item[apchitemcd='28']/apchitemvalue");
  1067. if(paco2 != ""){
  1068. fValue();
  1069. model.setFocus("ipt_zpao");
  1070. ipt_zpao.dispatch("onkeydown");
  1071. fValuePAO();
  1072. }else{
  1073. model.setFocus("ipt_paco2");
  1074. }
  1075. }else if(fio2 == "1"){
  1076. cmb_device.visible = true;
  1077. cmb_nasal.visible = true;
  1078. cmb_simple.visible = false;
  1079. cpt_O2.visible = true;
  1080. cpt_L.visible = true;
  1081. model.setValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue", "");
  1082. fDevice();
  1083. fValue();
  1084. }else if(fio2 == "2"){
  1085. cmb_device.visible = false;
  1086. cmb_nasal.visible = false;
  1087. cmb_simple.visible = false;
  1088. cpt_O2.visible = false;
  1089. cpt_L.visible = false;
  1090. model.setValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue", "");
  1091. fDevice();
  1092. //fValue();
  1093. model.setFocus("ipt_fio2");
  1094. }
  1095. /*
  1096. var fio2 = model.getValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue");
  1097. var paco2 = model.getValue("/root/main/apchitem/item[apchitemcd='28']/apchitemvalue");
  1098. var pao2 = model.getValue("/root/main/apchitem/item[apchitemcd='29']/apchitemvalue");
  1099. var aao2value = (760-47) * fio2 * 0.01 - paco2 - pao2;
  1100. model.setValue("/root/main/apchitem/item[apchitemcd='27']/apchitemvalue", aao2value);
  1101. */
  1102. model.refresh();
  1103. //fValue();
  1104. }
  1105. function fDevice() {
  1106. var device = model.getValue("/root/main/apchitem/item[apchitemcd='24']/apchitemvalue");
  1107. var lbdevice = cmb_device.label;
  1108. model.setValue("/root/main/apchitem/item[apchitemcd='24']/apchitemlabel", lbdevice);
  1109. model.setValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue","");
  1110. if (device == "0"){ //Nasal cauuula
  1111. cpt_L.visible = true;
  1112. cmb_nasal.visible = true;
  1113. cmb_simple.visible = false;
  1114. }else if(device == "1"){ //Simple face mask
  1115. cpt_L.visible = true;
  1116. cmb_nasal.visible = false;
  1117. cmb_simple.visible = true;
  1118. }else if(device =="2"){ //Ventilator
  1119. cpt_L.visible = false;
  1120. cmb_nasal.visible = false;
  1121. cmb_simple.visible = false;
  1122. model.setFocus("ipt_fio2");
  1123. //model.setValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue", "");
  1124. }else{
  1125. cpt_L.visible = false;
  1126. cmb_nasal.visible = false;
  1127. cmb_simple.visible = false;
  1128. }
  1129. model.refresh();
  1130. }
  1131. function fNasal() {
  1132. var napro = model.getValue("/root/main/apchitem/item[apchitemcd='25']/apchitemvalue");
  1133. model.setValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue", napro);
  1134. if(model.getValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue") >= 50){
  1135. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemvalue", model.getValue("/root/main/apchitem/item[apchitemcd='27']/apchitemvalue"));
  1136. model.setFocus("ipt_zaa");
  1137. ipt_zaa.dispatch("onkeydown");
  1138. fValueAA();
  1139. }else if (model.getValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue") < 50){
  1140. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemvalue", model.getValue("/root/main/apchitem/item[apchitemcd='29']/apchitemvalue"));
  1141. model.setFocus("ipt_zpao");
  1142. ipt_zpao.dispatch("onkeydown");
  1143. fValuePAO();
  1144. }else if (model.getValue("/root/main/apchitem/item[apchitemcd='28']/apchitemvalue") == "" && model.getValue("/root/main/apchitem/item[apchitemcd='29']/apchitemvalue") == ""){
  1145. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemvalue", model.getValue("/root/main/apchitem/item[apchitemcd='30']/apchitemvalue"));
  1146. model.setFocus("ipt_zhco");
  1147. ipt_zhco.dispatch("onkeydown");
  1148. fValueHCO();
  1149. }
  1150. model.refresh();
  1151. }
  1152. function fSimple() {
  1153. var simpro = model.getValue("/root/main/apchitem/item[apchitemcd='25']/apchitemvalue");
  1154. model.setValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue", simpro);
  1155. if(model.getValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue") >= 50){
  1156. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemvalue", model.getValue("/root/main/apchitem/item[apchitemcd='27']/apchitemvalue"));
  1157. fCalcAao2();
  1158. fValue();
  1159. model.setFocus("ipt_zaa");
  1160. ipt_zaa.dispatch("onkeydown");
  1161. fValueAA();
  1162. }else if (model.getValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue") < 50){
  1163. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemvalue", model.getValue("/root/main/apchitem/item[apchitemcd='29']/apchitemvalue"));
  1164. fCalcAao2();
  1165. fValue();
  1166. model.setFocus("ipt_zpao");
  1167. ipt_zpao.dispatch("onkeydown");
  1168. fValuePAO();
  1169. }else if (model.getValue("/root/main/apchitem/item[apchitemcd='28']/apchitemvalue") == "" && model.getValue("/root/main/apchitem/item[apchitemcd='29']/apchitemvalue") == ""){
  1170. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemvalue", model.getValue("/root/main/apchitem/item[apchitemcd='30']/apchitemvalue"));
  1171. fCalcAao2();
  1172. fValue();
  1173. model.setFocus("ipt_zhco");
  1174. ipt_zhco.dispatch("onkeydown");
  1175. fValueHCO();
  1176. }
  1177. model.refresh();
  1178. }
  1179. function fCalcAao2() {
  1180. //var fio2 = model.getValue("/root/main/apchbun/apchfio2per");
  1181. //var paco2 = model.getValue("/root/main/apchbun/apchpaco2");
  1182. //var pao2 = model.getValue("/root/main/apchbun/apchpao2");
  1183. var fio2 = model.getValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue");
  1184. var paco2 = model.getValue("/root/main/apchitem/item[apchitemcd='28']/apchitemvalue");
  1185. var pao2 = model.getValue("/root/main/apchitem/item[apchitemcd='29']/apchitemvalue");
  1186. var aao2value = (760-47) * fio2 * 0.01 - paco2 - pao2;
  1187. model.setValue("/root/main/apchitem/item[apchitemcd='27']/apchitemvalue", aao2value);
  1188. model.refresh();
  1189. }
  1190. function fValue() {
  1191. var apchitemdt = getCurrentDate() + getCurrentTime();
  1192. //If FiO2>=0.5 : (A-a)O2
  1193. if(model.getValue("/root/main/apchitem/item[apchitemcd='27']/apchitemvalue") != "" && model.getValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue") >= 50){
  1194. if(model.getValue("/root/main/apchitem/item[apchitemcd='06']/apchitemvalue") != ""){
  1195. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemvalue", "");
  1196. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemval", "");
  1197. }
  1198. if(model.getValue("/root/main/apchitem/item[apchitemcd='07']/apchitemvalue") != ""){
  1199. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemvalue", "");
  1200. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemval", "");
  1201. }
  1202. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemvalue", model.getValue("/root/main/apchitem/item[apchitemcd='27']/apchitemvalue"));
  1203. model.refresh();
  1204. //If FiO2<0.5 : PaO2
  1205. }else if (model.getValue("/root/main/apchitem/item[apchitemcd='28']/apchitemvalue") != "" && model.getValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue") < 50){
  1206. if(model.getValue("/root/main/apchitem/item[apchitemcd='05']/apchitemvalue") != ""){
  1207. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemvalue", "");
  1208. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemval", "");
  1209. }
  1210. if(model.getValue("/root/main/apchitem/item[apchitemcd='07']/apchitemvalue") != ""){
  1211. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemvalue", "");
  1212. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemval", "");
  1213. }
  1214. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemvalue", model.getValue("/root/main/apchitem/item[apchitemcd='29']/apchitemvalue"));
  1215. model.refresh();
  1216. //If no A.B Gs : Serum HCO3-
  1217. }else if (model.getValue("/root/main/apchitem/item[apchitemcd='28']/apchitemvalue") == "" && model.getValue("/root/main/apchitem/item[apchitemcd='29']/apchitemvalue") == ""){
  1218. //setInputNodeCurText();
  1219. if(model.getValue("/root/main/apchitem/item[apchitemcd='05']/apchitemvalue") != ""){
  1220. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemvalue", "");
  1221. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemval", "");
  1222. }
  1223. if(model.getValue("/root/main/apchitem/item[apchitemcd='06']/apchitemvalue") != ""){
  1224. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemvalue", "");
  1225. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemval", "");
  1226. }
  1227. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemvalue", model.getValue("/root/main/apchitem/item[apchitemcd='30']/apchitemvalue"));
  1228. model.refresh();
  1229. }
  1230. model.refresh();
  1231. }
  1232. function fValue_Back() {
  1233. var apchitemdt = getCurrentDate() + getCurrentTime();
  1234. //If FiO2>=0.5 : (A-a)O2
  1235. //if(model.getValue("/root/main/apchbun/apchpaco2") != "" && model.getValue("/root/main/apchbun/apchfio2per") >= 0.5){
  1236. if(model.getValue("/root/main/apchitem/item[apchitemcd='27']/apchitemvalue") != "" && model.getValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue") >= 50){
  1237. if(model.getValue("/root/main/apchitem/item[apchitemcd='06']/apchitemvalue") != ""){
  1238. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemvalue", "");
  1239. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemval", "");
  1240. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemscore", "0");
  1241. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemdt", "");
  1242. }
  1243. if(model.getValue("/root/main/apchitem/item[apchitemcd='07']/apchitemvalue") != ""){
  1244. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemvalue", "");
  1245. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemval", "");
  1246. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemscore", "0");
  1247. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemdt", "");
  1248. }
  1249. //var aao2 = model.getValue("/root/main/apchbun/apchaao2");
  1250. //ipt_zaa.currentText = aao2;
  1251. //model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemvalue", model.getValue("/root/main/apchbun/apchaao2"));
  1252. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemvalue", model.getValue("/root/main/apchitem/item[apchitemcd='27']/apchitemvalue"));
  1253. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemscore", "0");
  1254. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemdt", "");
  1255. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemscore", "0");
  1256. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemdt", "");
  1257. model.refresh();
  1258. //If FiO2<0.5 : PaO2
  1259. //}else if (model.getValue("/root/main/apchbun/apchpaco2") != "" && model.getValue("/root/main/apchbun/apchfio2per") < 0.5){
  1260. }else if (model.getValue("/root/main/apchitem/item[apchitemcd='28']/apchitemvalue") != "" && model.getValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue") < 50){
  1261. if(model.getValue("/root/main/apchitem/item[apchitemcd='05']/apchitemvalue") != ""){
  1262. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemvalue", "");
  1263. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemval", "");
  1264. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemscore", "0");
  1265. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemdt", "");
  1266. }
  1267. if(model.getValue("/root/main/apchitem/item[apchitemcd='07']/apchitemvalue") != ""){
  1268. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemvalue", "");
  1269. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemval", "");
  1270. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemscore", "0");
  1271. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemdt", "");
  1272. }
  1273. //model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemvalue", model.getValue("/root/main/apchbun/apchpao2"));
  1274. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemvalue", model.getValue("/root/main/apchitem/item[apchitemcd='29']/apchitemvalue"));
  1275. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemscore", "0");
  1276. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemdt", "");
  1277. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemscore", "0");
  1278. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemdt", "");
  1279. model.refresh();
  1280. //If no A.B Gs : Serum HCO3-
  1281. //}else if (model.getValue("/root/main/apchbun/apchpaco2") == "" && model.getValue("/root/main/apchbun/apchpao2") == ""){
  1282. }else if (model.getValue("/root/main/apchitem/item[apchitemcd='28']/apchitemvalue") == "" && model.getValue("/root/main/apchitem/item[apchitemcd='29']/apchitemvalue") == ""){
  1283. setInputNodeCurText();
  1284. if(model.getValue("/root/main/apchitem/item[apchitemcd='05']/apchitemvalue") != ""){
  1285. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemvalue", "");
  1286. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemval", "");
  1287. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemscore", "0");
  1288. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemdt", "");
  1289. }
  1290. if(model.getValue("/root/main/apchitem/item[apchitemcd='06']/apchitemvalue") != ""){
  1291. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemvalue", "");
  1292. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemval", "");
  1293. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemscore", "0");
  1294. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemdt", "");
  1295. }
  1296. //model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemvalue", model.getValue("/root/main/apchbun/apchhco3"));
  1297. model.setValue("/root/main/apchitem/item[apchitemcd='07']/apchitemvalue", model.getValue("/root/main/apchitem/item[apchitemcd='30']/apchitemvalue"));
  1298. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemscore", "0");
  1299. model.setValue("/root/main/apchitem/item[apchitemcd='05']/apchitemdt", "");
  1300. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemscore", "0");
  1301. model.setValue("/root/main/apchitem/item[apchitemcd='06']/apchitemdt", "");
  1302. model.refresh();
  1303. }
  1304. model.refresh();
  1305. }
  1306. function fView() {
  1307. var fio2 = model.getValue("/root/main/apchitem/item[apchitemcd='23']/apchitemvalue");
  1308. var lbfio2 = cmb_fio2.label;
  1309. model.setValue("/root/main/apchitem/item[apchitemcd='23']/apchitemlabel", lbfio2);
  1310. if (fio2 == "0"){
  1311. cpt_O2.visible = false;
  1312. cpt_L.visible = false;
  1313. cmb_device.visible = false;
  1314. cmb_nasal.visible = false;
  1315. cmb_simple.visible = false;
  1316. //model.setValue("/root/main/apchbun/apchfio2per", "0.21");
  1317. model.setValue("/root/main/apchitem/item[apchitemcd='26']/apchitemvalue", "21");
  1318. }else if(fio2 == "1"){
  1319. cpt_O2.visible = true;
  1320. cpt_L.visible = true;
  1321. cmb_device.visible = true;
  1322. fDevice();
  1323. }else if(fio2 == "2"){
  1324. cpt_O2.visible = false;
  1325. cpt_L.visible = false;
  1326. cmb_device.visible = false;
  1327. fDevice();
  1328. }
  1329. submit("TRMMR03212");
  1330. model.setValue("/root/init/item/apchitemlabel1", cmb_temp.label);
  1331. model.setValue("/root/init/item/apchitemlabel2", cmb_zpam.label);
  1332. model.setValue("/root/init/item/apchitemlabel3", cmb_zfc.label);
  1333. model.setValue("/root/init/item/apchitemlabel4", cmb_zfr.label);
  1334. model.setValue("/root/init/item/apchitemlabel5", cmb_zaa.label);
  1335. model.setValue("/root/init/item/apchitemlabel6", cmb_pao.label);
  1336. model.setValue("/root/init/item/apchitemlabel7", cmb_hco.label);
  1337. model.setValue("/root/init/item/apchitemlabel8", cmb_ph.label);
  1338. model.setValue("/root/init/item/apchitemlabel9", cmb_na.label);
  1339. model.setValue("/root/init/item/apchitemlabel10", cmb_ka.label);
  1340. model.setValue("/root/init/item/apchitemlabel11", cmb_uree.label);
  1341. model.setValue("/root/init/item/apchitemlabel12", cmb_urea.label);
  1342. model.setValue("/root/init/item/apchitemlabel13", cmb_hc.label);
  1343. model.setValue("/root/init/item/apchitemlabel14", cmb_gb.label);
  1344. model.setValue("/root/init/item/apchitemlabel15", cmb_glas.label);
  1345. model.setValue("/root/init/item/apchitemlabel16", cmb_age.label);
  1346. model.setValue("/root/init/item/apchitemlabel17", cmb_mcro.label);
  1347. for (var i = 1; i < 18; i++){
  1348. model.setValue("/root/main/apchitem/item[" + i + "]/apchitemlabel", model.getValue("/root/init/item/apchitemlabel" + i));
  1349. }
  1350. /*
  1351. var ref = "/root/main/apchitem/item";
  1352. var dataCnt = getNodesetCnt(model, ref);
  1353. for (var i = 1; i < 18; i++){
  1354. if((model.getValue("/root/main/apchitem/item[" + i + "]/apchitemvalue") == "") && (i != 17)){
  1355. model.setValue("/root/main/apchitem/item[" + i + "]/apchitemscore", "0");
  1356. }else if(model.getValue("/root/init/item/apchitemscore" + i) != ""){
  1357. model.setValue("/root/main/apchitem/item[" + i + "]/apchitemscore", model.getValue("/root/init/item/apchitemscore" + i));
  1358. }
  1359. model.setValue("/root/main/apchitem/item[" + i + "]/apchitemlabel", model.getValue("/root/init/item/apchitemlabel" + i));
  1360. }
  1361. */
  1362. //나이
  1363. var age = model.getValue("/root/temp/apchpidlist/item/age");
  1364. if(model.getValue("/root/main/apchitem/item[apchitemcd='16']/apchitemvalue") == ""){
  1365. ipt_zage.value = age;
  1366. }else{
  1367. ipt_zage.value = model.getValue("/root/main/apchitem/item[apchitemcd='16']/apchitemvalue");
  1368. }
  1369. //기록정보 유형
  1370. if(model.getValue("/root/temp/apchpidlist/item/ordinfo") == ""){
  1371. if(model.getValue("/root/send/selectdata/apchdd") == model.getValue("/root/send/selectdata/fromdd")){
  1372. rdo_ordinfo.value = "1";
  1373. }
  1374. }else{
  1375. rdo_ordinfo.value = model.getValue("/root/temp/apchpidlist/item/ordinfo");
  1376. }
  1377. //Adjusted 명칭
  1378. if(model.getValue("/root/temp/apchpidlist/item/adjustednm") != ""){
  1379. opt_content.value = model.getValue("/root/temp/apchpidlist/item/adjustednm");
  1380. }
  1381. //인증저장정보
  1382. model.setValue("/root/send/selectdata/lastespiyn", model.getValue("/root/temp/apchpidlist/item/lastespiyn"));
  1383. //signno
  1384. model.setValue("/root/send/selectdata/signno", model.getValue("/root/temp/apchpidlist/item/signno"));
  1385. //최초작성자
  1386. model.setValue("/root/send/selectdata/fstrgstrid", model.getValue("/root/temp/apchpidlist/item/fstrgstrid"));
  1387. model.setValue("/root/send/selectdata/fstrgstdt", model.getValue("/root/temp/apchpidlist/item/fstrgstdt"));
  1388. //최종작성자
  1389. model.setValue("/root/send/selectdata/lastupdtrid", model.getValue("/root/temp/apchpidlist/item/lastupdtrid"));
  1390. model.setValue("/root/send/selectdata/lastupdtdt", model.getValue("/root/temp/apchpidlist/item/lastupdtdt"));
  1391. model.refresh();
  1392. }
  1393. // 계산 버튼
  1394. function fCalc() {
  1395. var ref = "/root/main/apchitem/item";
  1396. var dataCnt = getNodesetCnt(model, ref);
  1397. var apchitemdt = getCurrentDate() + getCurrentTime();
  1398. //for (var i = 1; i < dataCnt; i++){
  1399. for (var i = 1; i < 18; i++){
  1400. if((model.getValue("/root/main/apchitem/item[" + i + "]/apchitemvalue") == "") && (i != 17)){
  1401. model.setValue("/root/main/apchitem/item[" + i + "]/apchitemscore", "0");
  1402. }else if(model.getValue("/root/init/item/apchitemscore" + i) != ""){
  1403. model.setValue("/root/main/apchitem/item[" + i + "]/apchitemscore", model.getValue("/root/init/item/apchitemscore" + i));
  1404. }
  1405. model.setValue("/root/main/apchitem/item[" + i + "]/apchitemlabel", model.getValue("/root/init/item/apchitemlabel" + i));
  1406. //if((model.getValue("/root/main/apchitem/item[" + i + "]/apchitemdt") == "") && (i != 5) && (i != 6) && (i != 7)){
  1407. if(((model.getValue("/root/main/apchitem/item[" + i + "]/apchitemdt") == "") &&
  1408. (model.getValue("/root/main/apchitem/item[" + i + "]/apchitemvalue") == ""))||
  1409. ((model.getValue("/root/main/apchitem/item[" + i + "]/apchitemdt") == "") &&
  1410. (model.getValue("/root/main/apchitem/item[" + i + "]/apchitemvalue") != ""))){
  1411. model.setValue("/root/main/apchitem/item[" + i + "]/apchitemdt", apchitemdt);
  1412. }
  1413. if(i == 16){
  1414. model.setValue("/root/main/apchitem/item[" + i + "]/apchitemdt", apchitemdt);
  1415. }
  1416. }
  1417. opt_zapa.value = fCalcAPA();
  1418. opt_zmort.value = fCalcMort();
  1419. opt_zmorta.value = fCalcMorta();
  1420. if(model.getValue("/root/main/apchitem/item[apchitemcd='19']/apchitemscore") == "N"){
  1421. //opt_zmorta.value = fCalcMort();
  1422. fCalcMort();
  1423. fCalcMorta();
  1424. }
  1425. model.refresh();
  1426. }
  1427. /**
  1428. * @ver : 2009.08.10.
  1429. * @---------------------------------------------------
  1430. * @type : function
  1431. * @access : public
  1432. * @desc : 아파치 기록정보 인증저장
  1433. * @param : pFlag : TempSave : 임시저장, CertSave : 인증저장
  1434. * @return :
  1435. * @---------------------------------------------------
  1436. */
  1437. function fGetApchRecCert(){
  1438. model.removeNode("/root/main/signSaveData");
  1439. model.makeNode("/root/main/signSaveData");
  1440. //copyNodeset("/root/main/signSaveData/apchinfo", "/root/main/apchitem", "", model, model);
  1441. copyNodeset("/root/main/signSaveData/apchinfo", "/root/main/apchresult", "", model, model);
  1442. //var dataCnt = getNodesetCnt(model, "/root/main/apchitem/item");
  1443. var dataCnt = getNodesetCnt(model, "/root/main/apchresult/item");
  1444. for (var i=1 ; i <= dataCnt ; i++) {
  1445. /*
  1446. var apchitemnm = model.getValue("/root/main/apchitem/item["+ i +"]/apchitemnm");
  1447. var apchitemvalue = model.getValue("/root/main/apchitem/item["+ i +"]/apchitemvalue");
  1448. var apchitemlabel = model.getValue("/root/main/apchitem/item["+ i +"]/apchitemlabel");
  1449. //var apchitemlabel = model.getValue("/root/init/item/apchitemlabel["+ i +"]");
  1450. alert("apchitemlabel : " + apchitemlabel);
  1451. var apchitemval = model.getValue("/root/main/apchitem/item["+ i +"]/apchitemval");
  1452. var apchitemscore = model.getValue("/root/main/apchitem/item["+ i +"]/apchitemscore");
  1453. var apchitemdt = model.getValue("/root/main/apchitem/item["+ i +"]/apchitemdt");
  1454. */
  1455. var apchitemnm = model.getValue("/root/main/apchresult/item["+ i +"]/apchitemnm");
  1456. var apchitemvalue = model.getValue("/root/main/apchresult/item["+ i +"]/apchitemvalue");
  1457. var apchitemlabel = model.getValue("/root/main/apchresult/item["+ i +"]/apchitemlabel");
  1458. //var apchitemlabel = model.getValue("/root/init/item/apchitemlabel["+ i +"]");
  1459. var apchitemval = model.getValue("/root/main/apchresult/item["+ i +"]/apchitemval");
  1460. var apchitemscore = model.getValue("/root/main/apchresult/item["+ i +"]/apchitemscore");
  1461. var apchitemdt = model.getValue("/root/main/apchresult/item["+ i +"]/apchitemdt");
  1462. model.makeValue("/root/main/signSaveData/apchinfo/item["+ i +"]/apchitemnm", apchitemnm);
  1463. model.makeValue("/root/main/signSaveData/apchinfo/item["+ i +"]/apchitemvalue", apchitemvalue);
  1464. model.makeValue("/root/main/signSaveData/apchinfo/item["+ i +"]/apchitemlabel", apchitemlabel);
  1465. model.makeValue("/root/main/signSaveData/apchinfo/item["+ i +"]/apchitemval", apchitemval);
  1466. model.makeValue("/root/main/signSaveData/apchinfo/item["+ i +"]/apchitemscore", apchitemscore);
  1467. model.makeValue("/root/main/signSaveData/apchinfo/item["+ i +"]/apchitemdt", apchitemdt);
  1468. }
  1469. copyNodeset("/root/main/signSaveData/espidata", "/root/send/selectdata" , "", model, model);
  1470. //인증저장
  1471. if (!fSign()) return;
  1472. if(submit("TXMMR03212")){
  1473. model.removenodeset("/root/main/signSaveData");
  1474. //alert("기록지가 저장되었습니다.");
  1475. } else {
  1476. alert("기록지가 저장되지 않았습니다.");
  1477. }
  1478. }
  1479. /**
  1480. * @group :
  1481. * @ver : 2009.08.10.
  1482. * @---------------------------------------------------
  1483. * @type : function
  1484. * @access : public
  1485. * @desc : 인증로직
  1486. * @param :
  1487. * @return :
  1488. * @---------------------------------------------------
  1489. */
  1490. function fSign(){
  1491. //var node = getGlobalVariable("paminfo");
  1492. //model.removeNodeset("/root/main/paminfo/list");
  1493. //setCSVToNode("/root/main/paminfo", node);
  1494. sPid = model.getValue("/root/send/selectdata/pid"); // 환자번호
  1495. sOrddd = model.getValue("/root/send/selectdata/orddd"); // 입원일자
  1496. sCretNo = model.getValue("/root/send/selectdata/cretno"); // 환자 일자별 일련번호
  1497. sApchdd = model.getValue("/root/send/selectdata/apchdd"); // 환자 일자별 일련번호
  1498. submit("TRMMR03215");
  1499. sFormcd = model.getValue("/root/temp/cd/formcd"); //서식코드
  1500. Sign.certreload = true ; // 전자서명 호출시 인증저장 버튼을 누늘때마다 인증서가 뜨도록 처리
  1501. if(Sign.signprocess() == true){
  1502. // 전자인증 관련 환자 인적 정보를 보내줌.
  1503. model.makeValue("/root/send/signdata/pid", sPid );//등록번호
  1504. model.makeValue("/root/send/signdata/orddd", sOrddd);//입원일자(입원,응급)/진료일자(외래)
  1505. model.makeValue("/root/send/signdata/signno", ""); //서명번호
  1506. model.makeValue("/root/send/signdata/cretno", sCretNo); //일련번호
  1507. model.makeValue("/root/send/signdata/recdd", sApchdd);// 실제 기록이 이루어진 기록일자
  1508. model.makeValue("/root/send/signdata/rectm", getCurrentTime());//실제 기록이 이루어진 기록시간
  1509. model.makeValue("/root/send/signdata/recsaveflag" , "Y"); //전자서명 인적정보 변경여부(기록일시 변경되는 경우 : Y, 그외 : N)
  1510. model.makeValue("/root/send/signdata/signflag" , "01" ); //서명자료구분 (01 : 진료, 02 : 간호, 03 : LIS, 04 : 진료지원)
  1511. model.makeValue("/root/send/signdata/signgenrflag", "I"); //외래/입원구분(코드정의서 M0010 참조)
  1512. //model.makeValue("/root/send/signdata/formcd" , "0900006103"); //아파치기록지 서식코드
  1513. model.makeValue("/root/send/signdata/formcd" , sFormcd); //아파치기록지 서식코드
  1514. model.makeValue("/root/send/signdata/orddeptcd" , getUserInfo("dutplcecd")); //진료부서코드
  1515. model.makeValue("/root/send/signdata/orddrid" , getUserInfo("userid")); //진료의사ID
  1516. model.makeValue("/root/send/signdata/dispyn" , "Y"); //기록뷰어에는 조회안되도록
  1517. // 인증할 데이터 정보(미기록 노드 제거된 정보)
  1518. // 미기록 노드 제거전 원본 노드 정보 : Sign.signedInfos[3]
  1519. model.makeValue("/root/send/signdata/signbfcnts" , Sign.signedInfos[1]);
  1520. // 공인인증 처리후 데이터
  1521. model.makeValue("/root/send/signdata/signaftcnts" , Sign.signedInfos[2]);
  1522. }else{
  1523. return false;
  1524. }
  1525. model.makeValue("/root/send/signdata/screenid", getScreenID());
  1526. return true;
  1527. }
  1528. /**
  1529. * @group :
  1530. * @ver : 2009.08.10
  1531. * @---------------------------------------------------
  1532. * @type : function
  1533. * @access : public
  1534. * @desc : 인증데이터 생성함수
  1535. * @param :
  1536. * @return :
  1537. * @---------------------------------------------------
  1538. */
  1539. function fMake_SignData(){
  1540. Sign.addnode("/root/main/signSaveData");
  1541. }