SPPIJ01900_중증수술기간산정관리.xrw 93 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114
  1. <?xml version="1.0" encoding="EUC-KR"?>
  2. <?xml-stylesheet type="text/css" href="../../../com/commonweb/css/common.css" ?>
  3. <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2002/01/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
  4. <xhtml:head>
  5. <xhtml:title>중증수술기간산정관리</xhtml:title>
  6. <model id="model1">
  7. <instance id="instance1">
  8. <root xmlns="">
  9. <main>
  10. <list1>
  11. <ownbamtlist>
  12. <fromdd/>
  13. <todd/>
  14. <ownbamt/>
  15. </ownbamtlist>
  16. </list1>
  17. <list2>
  18. <opcdlist>
  19. <snglcalcscorcd/>
  20. <hngnm/>
  21. <execdd/>
  22. <fromdd/>
  23. <todd/>
  24. <payamt/>
  25. <flag/>
  26. <applyop/>
  27. </opcdlist>
  28. </list2>
  29. <list3>
  30. <insulist>
  31. <pid/>
  32. <hngnm/>
  33. <indd/>
  34. <appdd/>
  35. <insukind/>
  36. <suppkind/>
  37. <fromdd/>
  38. <todd/>
  39. <ownbrate/>
  40. <instcd/>
  41. <opertodd/>
  42. <clamflag/>
  43. <seqno/>
  44. <mskind/>
  45. <cretno/>
  46. </insulist>
  47. </list3>
  48. <list4>
  49. <pmbminsu/>
  50. </list4>
  51. <list5>
  52. <payamtperday>
  53. <execdd/>
  54. <payamt/>
  55. </payamtperday>
  56. </list5>
  57. </main>
  58. <send>
  59. <cond>
  60. <pid/>
  61. <indd/>
  62. <cretno/>
  63. <mskind/>
  64. <instcd/>
  65. <vcode/>
  66. <brateflag/>
  67. <brthdd/>
  68. <saveyn/>
  69. <ownbrate/>
  70. <cfe/>
  71. </cond>
  72. <uptoperdd>
  73. <pid/>
  74. <indd/>
  75. <cretno/>
  76. <instcd/>
  77. <insukind/>
  78. <suppkind/>
  79. <fromdd/>
  80. <todd/>
  81. <mskind/>
  82. <newoperdd/>
  83. </uptoperdd>
  84. </send>
  85. <hidden>
  86. <list1>
  87. <insulist>
  88. <pid/>
  89. <hngnm/>
  90. <indd/>
  91. <appdd/>
  92. <insukind/>
  93. <col01/>
  94. <fromdd/>
  95. <todd/>
  96. <ownbrate/>
  97. <instcd/>
  98. <opertodd/>
  99. <mskind/>
  100. <cretno/>
  101. </insulist>
  102. </list1>
  103. <list2>
  104. <insulist>
  105. <iphs_status/>
  106. <iphs_pid/>
  107. <iphs_indd/>
  108. <iphs_cretno/>
  109. <iphs_mskind/>
  110. <iphs_fromdd/>
  111. <iphs_seqno/>
  112. <iphs_todd/>
  113. <iphs_instcd/>
  114. <iphs_insukind/>
  115. <iphs_suppkind/>
  116. <iphs_opertodd/>
  117. </insulist>
  118. <rslt/>
  119. </list2>
  120. <temp/>
  121. <list3>
  122. <opcdlist/>
  123. </list3>
  124. <list4>
  125. <pid/>
  126. <mskind/>
  127. <calcbasedd/>
  128. <instcd/>
  129. <cretno/>
  130. <indd/>
  131. </list4>
  132. <list5>
  133. <kindlist>
  134. <fromdd/>
  135. <todd/>
  136. <suppkind/>
  137. </kindlist>
  138. </list5>
  139. <source>
  140. <pid/>
  141. <indd/>
  142. <cretno/>
  143. <mskind/>
  144. <brateflag/>
  145. <brthdd/>
  146. </source>
  147. <newoperddsend>
  148. <newoperdd/>
  149. </newoperddsend>
  150. <newoperddresult>
  151. <result>
  152. <inpt_count/>
  153. </result>
  154. </newoperddresult>
  155. </hidden>
  156. </root>
  157. </instance>
  158. <script type="javascript" ev:event="xforms-model-construct-done">
  159. <![CDATA[
  160. // [자연분만, 중증질환 기간산정 유형변경 처리유형]
  161. //
  162. // 1. 한개의 유형 30일 안넘은 경우
  163. // (AS-IS의경우 처음부터 기간을 미리 적용해놓음)
  164. // => (넘겨줄파라미터)
  165. // iphs key , insukind, suppkind, fromdd, todd
  166. // 예) 입원일 : 20070101, 현재일자 :20070115
  167. // =>파라미터 :Fromdd : 20070101, Todd : 20070130
  168. // insukind : 11, suppkind : 05
  169. // => 결과 : 20070101-20070130 (11:05)
  170. // 20070131-99991231 (11:00)
  171. // 2개 발생되어야함.
  172. //
  173. // 2. 한개의 유형 30일 초과의 경우 중간에 끊는경우
  174. // => (넘겨줄파라미터)
  175. // iphs key , insukind, suppkind, fromdd, todd
  176. // 예) 입월일 :20070101, 현재일자 20070331
  177. // =>파라미터 :Fromdd : 20070131, Todd : 20070228
  178. // insukind : 11, suppkind : 05
  179. // => 결과 : 20070101-20070130 (11:00)
  180. // 20070131-20070228 (11:05)
  181. // 20070301-99991231 (11:00)
  182. // 3개 발생되어야함.
  183. //
  184. // 3. 유형이 두개(11, 22) 존재하고 기간을 걸쳐서 중증일자를 적용하는경우
  185. // => (넘겨줄파라미터) : 유형별로 각각 호출한다.
  186. // iphs key , insukind, suppkind, fromdd, todd
  187. // 예)입원일자 :20070101, 현재일자 20070501
  188. // 유형별 기간 11:00 => 20070101- 20070331
  189. // 22:00 => 20070401 - 99991231
  190. // 이상태에서 중증기간을 20070315 - 20070413 으로 적용할경우
  191. // 첫번째 호출 :
  192. // =>파라미터 :Fromdd : 20070315, Todd : 20070331
  193. // insukind : 11, suppkind : 05
  194. // => 결과 : 20070101-20070315 (11:00)
  195. // 20070316-20070331 (11:05)
  196. // 2개 발생되어야함.
  197. // 두번째 호출 :
  198. // =>파라미터 :Fromdd : 20070315, Todd : 20070331
  199. // insukind : 22, suppkind : 05
  200. // => 결과 : 20070401-20070413 (22:05)
  201. // 20070414-99991231 (22:00)
  202. // 2개 발생되어야함.
  203. // fInitialize();
  204. ]]>
  205. </script>
  206. <submission id="TRPIJ01901" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send/cond" resultref="/root/main"/>
  207. <submission id="TRPIJ01902" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send/cond" resultref="/root/hidden/list1"/>
  208. <submission id="TXPIJ01902" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/hidden/list2/insulist" resultref="/root/hidden/list2/rslt"/>
  209. <submission id="TXPIJ01903" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/hidden/list4" resultref="/root/hidden/list4/rslt"/>
  210. <submission id="TRPIJ01903" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send/cond" resultref="/root/"/>
  211. <submission id="TXPIJ01904" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/hidden/list2/insulist" resultref="/root/hidden/list2/rslt"/>
  212. <submission id="TXPIJ00205" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/hidden/list4/insulist"/>
  213. <submission id="TXPIJ01905" mediatype="application/x-www-form-urlencoded" method="post" ref="/root/send/uptoperdd" resultref="/root/hidden/newoperddresult/result"/>
  214. <script type="javascript" ev:event="xforms-ready">
  215. <![CDATA[
  216. fInitialize();
  217. ]]>
  218. </script>
  219. </model>
  220. <script type="javascript" src="../../../com/commonweb/js/common.js"/>
  221. <script type="javascript" src="../../../com/commonweb/js/numericHelper.js"/>
  222. <script type="javascript" src="../../../com/commonweb/js/dateHelper.js"/>
  223. <script type="javascript" src="../../../com/commonweb/js/stringHelper.js"/>
  224. <script type="javascript" src="../../../com/commonweb/js/tfHelper.js"/>
  225. <script type="javascript" src="../../../com/basiccodeweb/js/ZBC001.js"/>
  226. <script type="javascript" src="../../../pam/pamcomnweb/js/PAM.js"/>
  227. <script type="javascript">
  228. <![CDATA[
  229. // 화면 open시(와 초기화 버튼 클릭시) 화면 초기화 기능을 수행한다.
  230. function fInitialize() {
  231. model.removeNodeset("/root/main");
  232. //model.removeNodeset("/root/hidden");
  233. // 심사마감이나 퇴원이 되었을때는 조작을 할 수 없게 한다. - 20080924 박창원
  234. var saveyn = model.getValue("/root/send/cond/saveyn");
  235. if (saveyn == "Y") {
  236. messageBox("마감이나 퇴원, 중간청구,부적절한 유형적용,읽기전용 모드 상태입니다. 조작은 할 수","E001");
  237. btn_iphsrebuild.disabled = true;
  238. btn_opapply.disabled = true;
  239. btn_apply.disabled = true;
  240. }
  241. if (submit("TRPIJ01901")) {
  242. //var opcdcnt = getNodesetCount("/root/main/list2/opcdlist");
  243. var opcdcnt = getNodesetCount("/root/main/list2/opcdlist");
  244. var todd = "";
  245. opcdcnt = parseInt(opcdcnt);
  246. // 수술기간을 판단하여 금액을 산정한다.
  247. fOpPeriodAmt();
  248. // 첫번째 수술의 가장 많은 금액의 기간을 첫번째 수술의 기본적인 적용 시작일, 종료일로 해준다.
  249. grd_esscterm.colSort(grd_esscterm.colRef("ownbamt"))="desc";
  250. grd_esscterm.sort(1, 1, grd_esscterm.rows, 3)="usersort";
  251. grd_esscterm.gridToInstance();
  252. model.refresh();
  253. model.setValue("/root/main/list2/opcdlist[1]/fromdd", model.getValue("/root/main/list1/ownbamtlist[1]/fromdd"));
  254. model.setValue("/root/main/list2/opcdlist[1]/todd", model.getValue("/root/main/list1/ownbamtlist[1]/todd"));
  255. // 첫번째 수술에 급여총액 산출
  256. model.setValue("/root/main/list2/opcdlist[1]/payamt", model.getValue("/root/main/list1/ownbamtlist[1]/ownbamt"));
  257. grd_esscterm.colsort(1)="asc";
  258. grd_esscterm.sort(1, 1, grd_esscterm.rows, 3)="usersort";
  259. grd_esscterm.gridToInstance();
  260. model.refresh();
  261. if (opcdcnt > 1) {
  262. // 두번째 수술부터는 수술일로 부터 일괄적으로 30일을 적용한다.
  263. for (i=2;i<=opcdcnt;i++) {
  264. var execdd = model.getValue("/root/main/list2/opcdlist[" + i + "]/execdd");
  265. // 첫번째 수술과 수술일이 같은 경우는 날짜를 동일하게 맞춰준다. - 20090326 박창원
  266. var fstexecdd = model.getValue("/root/main/list2/opcdlist[1]/execdd");
  267. if (execdd == fstexecdd) {
  268. model.setValue("/root/main/list2/opcdlist[" + i + "]/fromdd", model.getValue("/root/main/list2/opcdlist[1]/fromdd"));
  269. model.setValue("/root/main/list2/opcdlist[" + i + "]/todd", model.getValue("/root/main/list2/opcdlist[1]/todd"));
  270. }else {
  271. model.setValue("/root/main/list2/opcdlist[" + i + "]/fromdd", execdd);
  272. thisYear = execdd.substring(0,4); // 현재 입력된 연
  273. thisMonth = execdd.substring(4,6); // 현재 입력된 월
  274. thisDay = execdd.substring(6,8); // 현재 입력된 일
  275. nextDate = new Date(thisYear, (thisMonth - 1), thisDay );
  276. nextDate.setDate(nextDate.getDate() + 29); // 30일 뒤인 다음날 날짜를 구한다.
  277. todd = "";
  278. todd += nextDate.getYear();
  279. if ((nextDate.getMonth() + 1) < 10) {
  280. todd += "0" + (nextDate.getMonth() + 1);
  281. }
  282. else {
  283. todd += (nextDate.getMonth() + 1);
  284. }
  285. if (nextDate.getDate() < 10) {
  286. todd += "0" + nextDate.getDate();
  287. } else {
  288. todd += nextDate.getDate();
  289. }
  290. model.setValue("/root/main/list2/opcdlist[" + i + "]/todd", todd);
  291. }
  292. model.setValue("/root/main/list2/opcdlist[" + i + "]/flag", "Y");
  293. // model.makeNode("/root/main/list2/opcdlist[" + i + "]/hfromdd");
  294. // model.setValue("/root/main/list2/opcdlist[" + i + "]/hfromdd", execdd);
  295. // 급여금액 계산
  296. // fCalcPayment(i,execdd,todd);
  297. // model.refresh();
  298. }
  299. for (j=2;j<=opcdcnt;j++) {
  300. var row = j;
  301. var payexecdd = model.getValue("/root/main/list2/opcdlist[" + j + "]/fromdd");
  302. var paytodd = model.getValue("/root/main/list2/opcdlist[" + j + "]/todd");
  303. fCalcPayment(row,payexecdd,paytodd);
  304. }
  305. model.refresh();
  306. }
  307. //submit("TRPIJ01903"); // 입원일부터 일자별로 급여 총액을 가져온다. 20080728 박창원
  308. model.refresh();
  309. }
  310. }
  311. // 수술기간을 판단하여 첫번째 수술의 금액을 산정하여 디스플레이한다. - 20080729 박창원
  312. function fOpPeriodAmt() {
  313. var sum_fromdd = new Array();
  314. var sum_todd = new Array();
  315. var sum_payamt = new Array();
  316. var opdd = new Array();
  317. var lowstartdd;
  318. var maxstartdd;
  319. var fromdd;
  320. var todd;
  321. var payamtsum = 0;
  322. var payamt = 0;
  323. var cnt = 0;
  324. var opcnt = 0;
  325. var indd = model.getValue("/root/send/cond/indd");
  326. // 수술일자를 setting
  327. for(i=1; i<=grd_operlist.rows; i++) {
  328. opdd[i] = model.getValue("/root/main/list2/opcdlist[" + i + "]/execdd");
  329. }
  330. // 무조건 오른쪽 리스트는 제1수술만 보여준다.
  331. // maxstartdd는 무조건 수술일
  332. maxstartdd = opdd[1];
  333. // 수술일과 입원일의 차이를 계산해서 29일 이내 이면 입원일이 lowstartdd이다.
  334. var interval = getDateInterval(indd,opdd[1]);
  335. if (interval < "29") {
  336. lowstartdd = indd;
  337. }
  338. else { // 29일 이내가 아니면 수술일로 부터 29일전이 lowstartdd이다.
  339. var tempdd;
  340. tempdd = opdd[1].toDate("YYYYMMDD");
  341. tempdd = tempdd.getAddDate(-29);
  342. lowstartdd = tempdd.getDateFormat();
  343. }
  344. //
  345. // 나눠진 lowstartdd, MaxStart기준으로 금액을 산정하여 합한다.
  346. for(i=1; i < 31;i++) {
  347. fromdd = lowstartdd;
  348. basedd = fromdd;
  349. // todd는 시작일로부터 29일을 더한다.
  350. todd = fromdd.toDate("YYYYMMDD");
  351. todd = todd.getAddDate(29);
  352. todd = todd.getDateFormat();
  353. // 금액을 합한다.
  354. for(j=1; j<31; j++) {
  355. payamt = model.getValue("/root/main/list5/payamtperday[execdd = " + basedd + "]/payamt");
  356. if (payamt == "") {
  357. payamt = 0;
  358. }
  359. if (isNaN(payamt) != true) {
  360. payamt = parseInt(payamt);
  361. payamtsum = payamtsum + payamt;
  362. }
  363. // basedd를 증가시킨다(하루씩)
  364. basedd = basedd.toDate("YYYYMMDD");
  365. basedd = basedd.getAddDate(1);
  366. basedd = basedd.getDateFormat();
  367. // basedd가 todd보다 클경우 빠져나간다.
  368. if (basedd > todd) {
  369. continue;
  370. }
  371. }
  372. // lowstartdd가 opdd보다 클경우 빠져나간다.
  373. if (fromdd > opdd[1]) {
  374. continue;
  375. }
  376. // 한 사이클의 시작종료에 대한 금액의 sum을 저장
  377. sum_fromdd[i] = fromdd;
  378. sum_todd[i] = todd;
  379. sum_payamt[i] = payamtsum;
  380. payamtsum = 0;
  381. cnt = cnt + 1;
  382. // lowstartdd를 증가시킨다(하루씩)
  383. lowstartdd = lowstartdd.toDate("YYYYMMDD");
  384. lowstartdd = lowstartdd.getAddDate(1);
  385. lowstartdd = lowstartdd.getDateFormat();
  386. }
  387. model.removeNodeset("/root/main/list1/ownbmtlist");
  388. for (i=1;i<cnt + 1;i++) {
  389. model.makeValue("/root/main/list1/ownbamtlist["+ i +"]/fromdd", sum_fromdd[i]);
  390. model.makeValue("/root/main/list1/ownbamtlist["+ i +"]/todd", sum_todd[i]);
  391. model.makeValue("/root/main/list1/ownbamtlist["+ i +"]/ownbamt", sum_payamt[i]);
  392. }
  393. /* // 수술이 두개일경우
  394. else if (grd_operlist.rows == 3) {
  395. // 두수술의 날짜가 30일 이상나는지 판단함
  396. // 첫번째 수술일과 두번째 수술일의 차이를 계산
  397. var interval = getDateInterval(opdd[2],opdd[1]);
  398. // 첫번째 수술일과 입원일의 차이를 계산
  399. var interval1 = getDateInterval(opdd[1],indd);
  400. // 두번째 수술일과 입원일의 차이를 계산
  401. var interval2 = getDateInterval(opdd[2],indd);
  402. // 명백하게 기간이 겹치기 때문에 합쳐야 되는 경우
  403. if (interval < "29" && interval1 < "29" && interval2 < "30") {
  404. fromdd = indd; // 시작일은 입원일이 된다.
  405. basedd = fromdd;
  406. // todd는 마지막수술일 + 29
  407. var lastopdd = opdd[2].toDate("YYYYMMDD");
  408. todd = lastopdd.getAddDate(29);
  409. todd = todd.getDateFormat();
  410. var period = getDateInterval(todd,fromdd);
  411. // 시작일 부터 종료일 까지 금액 함산
  412. for (i = 1; i<period; i++) {
  413. basedd = fromdd;
  414. payamt = model.getValue("/root/main/list5/payamtperday[execdd = " + basedd + "]/payamt");
  415. if (payamt == "") {
  416. payamt = 0;
  417. }
  418. if (isNaN(payamt) != true) {
  419. payamt = parseInt(payamt);
  420. payamtsum = payamtsum + payamt;
  421. }
  422. // basedd를 증가시킨다(하루씩)
  423. basedd = basedd.toDate("YYYYMMDD");
  424. basedd = basedd.getAddDate(1);
  425. basedd = basedd.getDateFormat();
  426. // 한 사이클의 시작종료에 대한 금액의 sum을 저장
  427. sum_fromdd[i] = fromdd;
  428. sum_todd[i] = todd;
  429. sum_payamt[i] = payamtsum;
  430. payamtsum = 0;
  431. cnt = cnt + 1;
  432. } // for i
  433. model.removeNodeset("/root/main/list1/ownbmtlist");
  434. for (i=1;i<cnt + 1;i++) {
  435. model.makeValue("/root/main/list1/ownbamtlist["+ i +"]/fromdd", sum_fromdd[i]);
  436. model.makeValue("/root/main/list1/ownbamtlist["+ i +"]/todd", sum_todd[i]);
  437. model.makeValue("/root/main/list1/ownbamtlist["+ i +"]/ownbamt", sum_payamt[i]);
  438. }
  439. } // if (interval < "29" && interval1 < "29" && interval2 < "30")
  440. } // else if (grd_operlist.rows == 2) */
  441. model.refresh();
  442. }
  443. // fromdd와 todd에 다른 급여 총액을 계산해서 수술코드 및 일자에 디스플레이
  444. function fCalcPayment(inptrow,fromdd,todd) {
  445. var row = inptrow;
  446. // 날짜에 따른 금액을 산정한다
  447. var payment = 0;
  448. var payfromdd = fromdd;
  449. var paytodd = todd;
  450. // 시작일과 종료일간의 차를 구함
  451. var period = getDateInterval(payfromdd, paytodd);
  452. // 시작일부터 종료일까지 금액산정
  453. for (i=1; i <= period + 1; i++) {
  454. var payexecdd = model.getValue("/root/main/list5/payamtperday[execdd =" + payfromdd + "]/payamt");
  455. if (payexecdd == "") {
  456. payexecdd = 0;
  457. }
  458. if (isNaN(payexecdd) != true) {
  459. payexecdd = parseInt(payexecdd);
  460. payment = payment + payexecdd;
  461. }
  462. // payfromdd 를 증가시킨다(하루씩)
  463. payfromdd = payfromdd.toDate("YYYYMMDD");
  464. payfromdd = payfromdd.getAddDate(1);
  465. payfromdd = payfromdd.getDateFormat();
  466. // payfromdd가 todd보다 클경우 빠져나간다.
  467. if (payfromdd > paytodd) {
  468. continue;
  469. }
  470. } //for i
  471. model.setValue("/root/main/list2/opcdlist[" + row + "]/payamt", payment);
  472. }
  473. //유형적용 완료후 소급처리 한다.
  474. function fReCalc() {
  475. // 입원일 부터 현재까지 계산한다(일일단위로 loop)
  476. var fromdd = model.getValue("/root/send/cond/indd");
  477. var curdd = getCurrentDate();
  478. var period = getDateInterval(fromdd, curdd);
  479. // fromdd부터 currentdate까지 loop
  480. for (i=1; i<= period + 1; i++) {
  481. model.makeNode("/root/hidden/list4/insulist/pid");
  482. model.makeNode("/root/hidden/list4/insulist/indd");
  483. model.makeNode("/root/hidden/list4/insulist/mskind");
  484. model.makeNode("/root/hidden/list4/insulist/calcbasedd");
  485. model.makeNode("/root/hidden/list4/insulist/cretno");
  486. model.setValue("/root/hidden/list4/insulist/pid", model.getValue("/root/send/cond/pid"));
  487. model.setValue("/root/hidden/list4/insulist/indd", model.getValue("/root/send/cond/indd"));
  488. model.setValue("/root/hidden/list4/insulist/mskind", model.getValue("/root/send/cond/mskind"));
  489. model.setValue("/root/hidden/list4/insulist/cretno", model.getValue("/root/send/cond/cretno"));
  490. model.setValue("/root/hidden/list4/insulist/calcbasedd", fromdd);
  491. submit("TXPIJ00205");
  492. // fromdd를 증가시킨다(하루씩)
  493. fromdd = fromdd.toDate("YYYYMMDD");
  494. fromdd = fromdd.getAddDate(1);
  495. fromdd = fromdd.getDateFormat();
  496. }
  497. }
  498. ]]>
  499. </script>
  500. </xhtml:head>
  501. <xhtml:body pagewidth="820" pageheight="750" guideline="1,800;2,734;" style="margin-left:8; margin-top:8; margin-right:8; margin-bottom:8; ">
  502. <group id="group3" scroll="auto" style="left:0px; top:0px; width:800px; height:705px; ">
  503. <caption id="caption1" class="tit_2" style="left:559px; top:10px; width:255px; height:13px; ">수술일자별 기간/ 급여총액</caption>
  504. <line id="line1" class="line_1" style="x1:553px; y1:27px; x2:791px; y2:26px; "/>
  505. <datagrid id="grd_esscterm" nodeset="/root/main/list1/ownbamtlist" caption="시작일^종료일^급여총액" colsep="^" colwidth="70, 70, 75" dataheight="25" ellipsis="true" mergecellsfixedrows="bycolrec" rowheader="seq" rowheight="25" rowsep="|" tooltip="true" style="left:553px; top:31px; width:240px; height:309px; ">
  506. <col ref="fromdd" format="yyyy-mm-dd"/>
  507. <col ref="todd" format="yyyy-mm-dd"/>
  508. <col ref="ownbamt" format="#,###" style="text-align:right; "/>
  509. <script type="javascript" ev:event="onclick">
  510. <![CDATA[
  511. var torow = grd_operlist.row;
  512. var fromrow = grd_esscterm.row;
  513. if (grd_esscterm.isCell(event.target) && grd_esscterm.row >= grd_esscterm.fixedRows) {
  514. if ( grd_operlist.row >= grd_operlist.fixedRows) {
  515. var execdd = model.getValue("/root/main/list2/opcdlist[" + torow + "]/execdd");
  516. var fromdd = model.getValue("/root/main/list1/ownbamtlist[" + fromrow + "]/fromdd");
  517. var todd = model.getValue("/root/main/list1/ownbamtlist[" + fromrow + "]/todd");
  518. model.setValue("/root/main/list2/opcdlist[" + torow + "]/fromdd",model.getValue("/root/main/list1/ownbamtlist[" + fromrow + "]/fromdd"));
  519. model.setValue("/root/main/list2/opcdlist[" + torow + "]/todd",model.getValue("/root/main/list1/ownbamtlist[" + fromrow + "]/todd"));
  520. model.setValue("/root/main/list2/opcdlist[" + torow + "]/flag","Y");
  521. }
  522. }
  523. model.refresh();
  524. ]]>
  525. </script>
  526. </datagrid>
  527. <line id="line2" class="line_1" style="x1:0px; y1:26px; x2:548px; y2:27px; "/>
  528. <datagrid id="grd_operlist" nodeset="/root/main/list2/opcdlist" caption="수술코드^코드명칭^수술일자^적용시작일자^적용종료일자^급여총액^적용여부^" colsep="^" colwidth="60, 148, 71, 86, 78, 80, 60" dataheight="25" ellipsis="true" mergecellsfixedrows="bycolrec" rowheader="seq" rowheight="25" rowsep="|" tooltip="true" style="left:0px; top:31px; width:550px; height:309px; ">
  529. <col ref="snglcalcscorcd"/>
  530. <col ref="hngnm"/>
  531. <col ref="execdd" visibility="visible" format="yyyy-mm-dd" style="text-align:center; "/>
  532. <col ref="fromdd" type="inputdate" format="yyyy-mm-dd" style="text-align:center; "/>
  533. <col ref="todd" format="yyyy-mm-dd" style="text-align:center; "/>
  534. <col ref="payamt" format="#,###" style="text-align:right; "/>
  535. <col ref="flag" visibility="hidden"/>
  536. <col ref="applyop" visibility="hidden"/>
  537. <script type="javascript" ev:event="xforms-value-changed">
  538. <![CDATA[
  539. var row = grd_operlist.row;
  540. var col = grd_operlist.col;
  541. var indd = model.getValue("/root/send/cond/indd");
  542. var fromdd = model.getValue("/root/main/list2/opcdlist[" + row + "]/fromdd");
  543. var todd = model.getValue("/root/main/list2/opcdlist[" + row + "]/todd");
  544. var chkopdd = model.getValue("/root/main/list2/opcdlist[" + row + "]/execdd");
  545. var chktodd = model.getValue("/root/main/list2/opcdlist[" + row + "]/fromdd");
  546. var applyop = model.getValue("/root/main/list2/opcdlist[" + row + "]/applyop");
  547. // 이미 적용된 날짜와 기간이 겹치지 않게 하기 위해 20080915 박창원
  548. var maxv191192todd = "";
  549. var maxclamtodd = "";
  550. var oprows = grd_operlist.rows;
  551. for(i=1; i < oprows; i++) {
  552. if(model.getValue("/root/main/list2/opcdlist[" + i + "]/applyop") == "Y") {
  553. maxv191192todd = model.getValue("/root/main/list2/opcdlist[" + i + "]/todd");
  554. }
  555. }
  556. chktodd = chktodd.toDate("YYYYMMDD");
  557. chktodd = chktodd.getAddDate(29);
  558. chktodd = chktodd.getDateFormat();
  559. // 이미 적용되어잇는 보조유형의 날자를 지정하면 알럿 20080915 박창원
  560. if(applyop == "Y") {
  561. messageBox("이미 유형적용이 된 수술입니다. 유형복원 후 처리","I006");
  562. todd = todd.toDate("YYYYMMDD");
  563. todd = todd.getAddDate(-29);
  564. fromdd = todd.getDateFormat();
  565. model.setValue("/root/main/list2/opcdlist[" + row + "]/fromdd", fromdd);
  566. return;
  567. }
  568. // 이미적용되어있는 보조유형의 날짜를 침범하면 error 20080915 박창원
  569. if (fromdd < maxv191192todd) {
  570. messageBox("이미 적용되어있는 수술기간과 겹치게 선택","E001");
  571. todd = todd.toDate("YYYYMMDD");
  572. todd = todd.getAddDate(-29);
  573. fromdd = todd.getDateFormat();
  574. model.setValue("/root/main/list2/opcdlist[" + row + "]/fromdd", fromdd);
  575. return;
  576. }
  577. // 적용시작일자가 입원일보다 작으면 ERROR
  578. if (fromdd < indd) {
  579. messageBox("적용시작일을 입원일 이전으로 선택","E001");
  580. todd = todd.toDate("YYYYMMDD");
  581. todd = todd.getAddDate(-29);
  582. fromdd = todd.getDateFormat();
  583. model.setValue("/root/main/list2/opcdlist[" + row + "]/fromdd", fromdd);
  584. return;
  585. } else if((fromdd > chkopdd) || (chktodd < chkopdd)) { // 수술일자는 적용기간내에 있어야 한다.
  586. messageBox("적용기간은 수술일을 제외하여 선택","E001");
  587. todd = todd.toDate("YYYYMMDD");
  588. todd = todd.getAddDate(-29);
  589. fromdd = todd.getDateFormat();
  590. model.setValue("/root/main/list2/opcdlist[" + row + "]/fromdd", fromdd);
  591. return;
  592. }
  593. var beforefromdd = "";
  594. var todd = "";
  595. if (row > 1) {
  596. var beforerow = eval(row) - 1;
  597. var beforefromdd = model.getValue("/root/main/list2/opcdlist[" + beforerow + "]/fromdd");
  598. if (beforefromdd > fromdd) {
  599. messageBox("이전 수술에 대한 적용시작일자 보다 이전일 적용시작일자로 선택","E001");
  600. model.setValue("/root/main/list2/opcdlist[" + row + "]/fromdd", model.getValue("/root/main/list2/opcdlist[" + row + "]/hfromdd"));
  601. return;
  602. }
  603. }
  604. if (row >= 1) {
  605. thisYear = fromdd.substring(0,4); // 현재 입력된 연
  606. thisMonth = fromdd.substring(4,6); // 현재 입력된 월
  607. thisDay = fromdd.substring(6,8); // 현재 입력된 일
  608. nextDate = new Date(thisYear, (thisMonth - 1), thisDay );
  609. nextDate.setDate(nextDate.getDate() + 29); // 30일 뒤인 다음날 날짜를 구한다.
  610. todd = "";
  611. todd += nextDate.getYear();
  612. if ((nextDate.getMonth() + 1) < 10) {
  613. todd += "0" + (nextDate.getMonth() + 1);
  614. }
  615. else {
  616. todd += (nextDate.getMonth() + 1);
  617. }
  618. if (nextDate.getDate() < 10) {
  619. todd += "0" + nextDate.getDate();
  620. } else {
  621. todd += nextDate.getDate();
  622. }
  623. model.setValue("/root/main/list2/opcdlist[" + row + "]/fromdd", fromdd);
  624. model.setValue("/root/main/list2/opcdlist[" + row + "]/todd", todd);
  625. model.setValue("/root/main/list2/opcdlist[" + row + "]/flag", "Y");
  626. }
  627. // 날짜에 따른 금액을 산정한다
  628. if (col == grd_operlist.colRef("fromdd")) {
  629. fCalcPayment(row,fromdd,todd);
  630. } // if (col == grd_operlist.colRef("fromdd"))
  631. model.refresh();
  632. ]]>
  633. </script>
  634. </datagrid>
  635. <caption id="caption2" class="tit_2" style="left:2px; top:10px; width:150px; height:13px; ">수술코드 및 수술일자</caption>
  636. <caption id="caption3" class="tit_2" style="left:5px; top:471px; width:210px; height:13px; ">기간별 본인부담율 적용 내역</caption>
  637. <line id="line3" class="line_1" style="x1:0px; y1:486px; x2:792px; y2:486px; "/>
  638. <datagrid id="grd_appterm" nodeset="/root/hidden/list1/insulist" caption="환자번호^환자이름^입원일자^적용일자^보험유형^유형보조^시작일자^종료일자^본인부담율^instcd^유형종료예정일^caption1" colsep="^" colwidth="70, 60, 70, 70, 60, 87, 85, 85, 83, 60, 95, 100" dataheight="25" ellipsis="true" mergecellsfixedrows="bycolrec" rowheader="seq" rowheight="25" rowsep="|" tooltip="true" style="left:0px; top:493px; width:792px; height:182px; ">
  639. <col ref="pid"/>
  640. <col ref="hngnm"/>
  641. <col ref="indd" format="yyyy-mm-dd"/>
  642. <col ref="appdd" format="yyyy-mm-dd"/>
  643. <col ref="insukind"/>
  644. <col id="col01" ref="col01" type="combo">
  645. <choices>
  646. <itemset nodeset="/root/main/list4/pmbminsu">
  647. <label ref="cdnm"/>
  648. <value ref="suppkind"/>
  649. </itemset>
  650. </choices>
  651. </col>
  652. <col ref="fromdd" type="inputdate" format="yyyy-mm-dd"/>
  653. <col ref="todd" type="inputdate" format="yyyy-mm-dd"/>
  654. <col ref="ownbrate"/>
  655. <col ref="instcd" visibility="hidden"/>
  656. <col ref="opertodd" type="inputdate" format="yyyy-mm-dd"/>
  657. <col ref="cretno" visibility="hidden"/>
  658. <script type="javascript" ev:event="xforms-value-changed">
  659. <![CDATA[
  660. var row = grd_appterm.row;
  661. var insukind = model.getValue( "/root/hidden/list1/insulist[" + row + "]/insukind");
  662. for (var i=1; i<grd_appterm.rows; i++) {
  663. grd_appterm.cellComboNodeset(i,6) = "/root/main/list4/pmbminsu[insukind = '"+insukind+"']";
  664. }
  665. ]]>
  666. </script>
  667. </datagrid>
  668. <datagrid id="grd_insulist" nodeset="/root/main/list3/insulist" caption="환자번호^환자이름^입원일자^적용일자^보험유형^유형보조^시작일자^종료일자^본인부담율^instcd^유형종료예정일^청구여부^seqno^mskind^cretno" colsep="^" colwidth="70, 60, 70, 70, 60, 60, 85, 85, 83, 60, 95, 100, 100, 100, 100" dataheight="25" ellipsis="true" mergecellsfixedrows="bycolrec" rowheader="seq" rowheight="25" rowsep="|" tooltip="true" style="left:0px; top:381px; width:792px; height:84px; ">
  669. <col ref="pid"/>
  670. <col ref="hngnm"/>
  671. <col ref="indd" format="yyyy-mm-dd"/>
  672. <col ref="appdd" format="yyyy-mm-dd"/>
  673. <col ref="insukind"/>
  674. <col ref="suppkind"/>
  675. <col ref="fromdd" format="yyyy-mm-dd"/>
  676. <col ref="todd" format="yyyy-mm-dd"/>
  677. <col ref="ownbrate"/>
  678. <col ref="instcd" visibility="hidden"/>
  679. <col ref="opertodd"/>
  680. <col ref="clamflag" visibility="hidden"/>
  681. <col ref="seqno" visibility="hidden"/>
  682. <col ref="mskind" visibility="hidden" format="yyyy-mm-dd"/>
  683. <col ref="cretno" visibility="hidden"/>
  684. </datagrid>
  685. <caption id="caption4" class="tit_2" style="left:5px; top:361px; width:165px; height:13px; ">현재보험정보</caption>
  686. <line id="line4" class="line_1" style="x1:0px; y1:376px; x2:792px; y2:376px; "/>
  687. <shape id="roundrect1" class="roundrect_example" appearance="roundrect" ellipsewidth="10" ellipseheight="7" style="left:554px; top:351px; width:238px; height:23px; "/>
  688. <input id="ipt_pid" ref="/root/hidden/newoperddsend/newoperdd" class="input_default" inputtype="date" maxlength="10" style="left:648px; top:353px; width:91px; height:19px; "/>
  689. <caption id="caption5" style="left:557px; top:356px; width:89px; height:15px; font-size:8pt; ">유형종료예정일 :</caption>
  690. </group>
  691. <group id="group1" style="left:0px; top:709px; width:800px; height:27px; ">
  692. <button id="btn_apply" class="btn4_letter2" style="left:676px; top:5px; width:56px; height:22px; ">
  693. <caption>확정</caption>
  694. <script type="javascript" ev:event="DOMActivate">
  695. <![CDATA[
  696. // for(i = 0; i < grd_insulist.rows; i++){
  697. // var chk = model.getValue("/root/main/list3/insulist[" + i + " ]/suppkind");
  698. // if(chk == "05"){
  699. // messageBox("이미 적용된 중증기간이 있습니다. 원무팀에 연락하여 변경처리 전에는 작업 ","E001");
  700. // return;
  701. // }
  702. // }
  703. // 자료수집이 되었거나 이미 적용이된 수술유형의 경우를 판별해서 해당 유형의 종료일 + 1을 소급계산의 시작일로 하여야 하고
  704. // 유형변경시에도 제외되어야 한다(자료수집이나 중증 수술 유형적용이 된 환자는 입원일로 부터 소급계산) 20080915 박창원
  705. var chkv191192 = "N";
  706. var chkclam = "N";
  707. var maxv191192todd = "19000101";
  708. var maxclamtodd = "19000101";
  709. var maxdate;
  710. var insurows = grd_insulist.rows;
  711. for(i=1; i < insurows; i++) {
  712. if(model.getValue("/root/main/list3/insulist[" + i + "]/clamflag") == "Y") {
  713. maxclamtodd = model.getValue("/root/main/list3/insulist[" + i + "]/todd");
  714. }
  715. // 20090325 차상위 2종 적용 - 박창원
  716. if((model.getValue("/root/main/list3/insulist[" + i + "]/suppkind") == "05") || (model.getValue("/root/main/list3/insulist[" + i + "]/suppkind") == "39")){
  717. maxv191192todd = model.getValue("/root/main/list3/insulist[" + i + "]/todd");
  718. }
  719. if(maxclamtodd >= maxv191192todd) {
  720. maxdate = maxclamtodd;
  721. }else{
  722. maxdate = maxv191192todd;
  723. }
  724. }
  725. var tmp = messageBox("기간별 본인부담율 적용내역으로 유형번경 처리를", "Q004");
  726. if(tmp != 6){
  727. return;
  728. }
  729. var pre_fromdd = "";
  730. var pre_todd = "";
  731. //필수값들을 체크한다.
  732. for (var i = 1; i < grd_appterm.rows; i++) {
  733. var fromdd = model.getValue("/root/hidden/list1/insulist[" + i + "]/fromdd");
  734. var todd = model.getValue("/root/hidden/list1/insulist[" + i + "]/todd");
  735. var opertodd = model.getValue("/root/hidden/list1/insulist[" + i + "]/opertodd");
  736. if(i == 1){
  737. if(fromdd > todd){
  738. messageBox("유형시작일자가 종료일자보다 클 수 없습니다. 변경처리를","E001");
  739. return;
  740. }
  741. }else{
  742. if(fromdd > todd){
  743. messageBox("유형시작일자가 종료일자보다 클 수 없습니다. 변경처리를","E001");
  744. return;
  745. }
  746. /* if(pre_todd >= fromdd){
  747. messageBox("적용시작일자가 이전유형 종료일자 보다 작거나 같을수 없습니다. 변경처리를","E001");
  748. return;
  749. } */
  750. //유형종료 예정일이 없는경우는 체크 하지 않기 위해서 todd로 셋팅해준다.
  751. if(opertodd == ""){
  752. opertodd = todd;
  753. }
  754. if(opertodd > todd ){
  755. messageBox("유형종료예정일이 종료일자보다 클수 없습니다. 변경처리를","E001");
  756. return;
  757. }
  758. }
  759. pre_fromdd = fromdd;
  760. pre_todd = todd;
  761. }
  762. //기간별 본인부담 적용율 내역갯수만큼 돌면서 10%구간을 체크하여 유형번경 로직을 호출한다.
  763. for (var i = 1; i < grd_appterm.rows; i++) {
  764. var fromdate = model.getValue("/root/hidden/list1/insulist[" + i + " ]/fromdd");
  765. var ownbrate = model.getValue("/root/hidden/list1/insulist[" + i + " ]/ownbrate");
  766. if(ownbrate == "10" && (fromdate > maxv191192todd) ){ // 조건추가 이미 수술로 인해 적용된 유형이 있으면 제외하고 함. 20080915 박창원
  767. var pid = model.getValue("/root/hidden/list1/insulist[" + i + "]/pid");
  768. var indd = model.getValue("/root/hidden/list1/insulist[" + i + "]/indd");
  769. var cretno = model.getValue("/root/main/list3/insulist[1]/cretno");
  770. var fromdd = model.getValue("/root/hidden/list1/insulist[" + i + "]/fromdd");
  771. var seqno = model.getValue("/root/main/list3/insulist[" + (grd_insulist.rows - 1) + "]/seqno");
  772. var mskind = model.getValue("/root/main/list3/insulist[1]/mskind");
  773. var todd = model.getValue("/root/hidden/list1/insulist[" + i + "]/todd");
  774. var insukind = model.getValue("/root/hidden/list1/insulist[" + i + "]/insukind");
  775. var suppkind = model.getValue("/root/hidden/list1/insulist[" + i + "]/col01");
  776. var instcd = model.getValue("/root/hidden/list1/insulist[" + i + "]/instcd");
  777. var opertodd = model.getValue("/root/hidden/list1/insulist[" + i + "]/todd");
  778. model.resetInstanceNode("/root/hidden/list2/insulist");
  779. var cNode = instance1.selectSingleNode("/root/hidden/list2/insulist");
  780. if(cNode == null){
  781. if(pid){
  782. model.makeNode("/root/hidden/list2/insulist/iphs_status");
  783. model.makeNode("/root/hidden/list2/insulist/iphs_pid");
  784. model.makeNode("/root/hidden/list2/insulist/iphs_indd");
  785. model.makeNode("/root/hidden/list2/insulist/iphs_cretno");
  786. model.makeNode("/root/hidden/list2/insulist/iphs_fromdd");
  787. model.makeNode("/root/hidden/list2/insulist/iphs_seqno");
  788. model.makeNode("/root/hidden/list2/insulist/iphs_mskind");
  789. model.makeNode("/root/hidden/list2/insulist/iphs_todd");
  790. model.makeNode("/root/hidden/list2/insulist/iphs_insukind");
  791. model.makeNode("/root/hidden/list2/insulist/iphs_suppkind");
  792. model.makeNode("/root/hidden/list2/insulist/iphs_instcd");
  793. model.makeNode("/root/hidden/list2/insulist/iphs_opertodd");
  794. model.setValue("/root/hidden/list2/insulist/iphs_status","B");
  795. model.setValue("/root/hidden/list2/insulist/iphs_pid",pid);
  796. model.setValue("/root/hidden/list2/insulist/iphs_indd",indd);
  797. model.setValue("/root/hidden/list2/insulist/iphs_cretno",cretno);
  798. model.setValue("/root/hidden/list2/insulist/iphs_fromdd",fromdd);
  799. model.setValue("/root/hidden/list2/insulist/iphs_seqno",seqno);
  800. model.setValue("/root/hidden/list2/insulist/iphs_mskind",mskind);
  801. // 20100423 JHP 개심개두 종료일자를 무조건 99991231에서 변경함. 현재일자 기준 종료일이 이전이면 todd, 같거나 크면 99991231로 변경 시작
  802. // model.setValue("/root/hidden/list2/insulist/iphs_todd", "99991231"); // 이전
  803. var getcurdd = getCurrentDate();
  804. if(getcurdd > todd){
  805. model.setValue("/root/hidden/list2/insulist/iphs_todd", todd);
  806. }else{
  807. model.setValue("/root/hidden/list2/insulist/iphs_todd", "99991231");
  808. }
  809. // 20100423 JHP 개심개두 종료일자를 무조건 99991231에서 변경함. 현재일자 기준 종료일이 이전이면 todd, 같거나 크면 99991231로 변경 끝
  810. model.setValue("/root/hidden/list2/insulist/iphs_insukind",insukind);
  811. model.setValue("/root/hidden/list2/insulist/iphs_suppkind",suppkind);
  812. model.setValue("/root/hidden/list2/insulist/iphs_instcd",instcd);
  813. model.setValue("/root/hidden/list2/insulist/iphs_opertodd",opertodd);
  814. }
  815. }else{
  816. if(pid){
  817. model.setValue("/root/hidden/list2/insulist/iphs_status","B");
  818. model.setValue("/root/hidden/list2/insulist/iphs_pid",pid);
  819. model.setValue("/root/hidden/list2/insulist/iphs_indd",indd);
  820. model.setValue("/root/hidden/list2/insulist/iphs_cretno",cretno);
  821. model.setValue("/root/hidden/list2/insulist/iphs_fromdd",fromdd);
  822. model.setValue("/root/hidden/list2/insulist/iphs_seqno",seqno);
  823. model.setValue("/root/hidden/list2/insulist/iphs_mskind",mskind);
  824. // 20100423 JHP 개심개두 종료일자를 무조건 99991231에서 변경함. 현재일자 기준 종료일이 이전이면 todd, 같거나 크면 99991231로 변경 시작
  825. // model.setValue("/root/hidden/list2/insulist/iphs_todd", "99991231"); // 이전
  826. var getcurdd = getCurrentDate();
  827. if(getcurdd > todd){
  828. model.setValue("/root/hidden/list2/insulist/iphs_todd", todd);
  829. }else{
  830. model.setValue("/root/hidden/list2/insulist/iphs_todd", "99991231");
  831. }
  832. // 20100423 JHP 개심개두 종료일자를 무조건 99991231에서 변경함. 현재일자 기준 종료일이 이전이면 todd, 같거나 크면 99991231로 변경 끝
  833. model.setValue("/root/hidden/list2/insulist/iphs_insukind",insukind);
  834. model.setValue("/root/hidden/list2/insulist/iphs_suppkind",suppkind);
  835. model.setValue("/root/hidden/list2/insulist/iphs_instcd",instcd);
  836. model.setValue("/root/hidden/list2/insulist/iphs_opertodd",opertodd);
  837. }
  838. }
  839. model.removenode("/root/hidden/list2/rslt");
  840. submit("TXPIJ01902");
  841. model.refresh();
  842. }
  843. }
  844. if(messageBox("유형변경이 완료 되었습니다. 변경된 내역의 소급처리를", "Q004") == 6){
  845. var sWindowMsg = "수가계산중입니다...";
  846. callLoadingWindow(sWindowMsg);
  847. fReCalc() ;
  848. removeLoadingWindow();
  849. }
  850. messageBox("소급계산이", "I002");
  851. opener.model.refresh();
  852. opener.javascript.fGetItemInfo();
  853. activateOpener(); // (common.js)에서 제공하는 함수로 opener를 activate한다.
  854. window.close(); // F5 실행시 IE를 종료시킨다.
  855. // model.removeNodeset("/root/main");
  856. // submit("TRPIJ01901");
  857. // model.refresh();
  858. ]]>
  859. </script>
  860. </button>
  861. <button id="button2" class="btn4_letter2" style="left:736px; top:5px; width:56px; height:22px; ">
  862. <caption>닫기</caption>
  863. <script type="javascript" ev:event="DOMActivate">
  864. <![CDATA[
  865. window.close(); // F5 실행시 IE를 종료시킨다.
  866. ]]>
  867. </script>
  868. </button>
  869. <line id="line32" class="line_6" style="x1:0px; y1:0px; x2:799px; "/>
  870. <button id="btn_opapply" class="btn4_letter4" style="left:593px; top:5px; width:80px; height:22px; ">
  871. <caption>기간적용</caption>
  872. <script type="javascript" ev:event="DOMActivate">
  873. <![CDATA[
  874. // 모든수술이 기간적용이 되어 있을 경우 기간적용 버튼을 조작 하면 알럿
  875. // 모든수술이 전부 적용되었는지 확인 - 20080926 박창원
  876. var rows = grd_operlist.rows;
  877. var apply = "Y"
  878. for (i=1; i< rows; i++) {
  879. var applyop = model.getValue("/root/main/list2/opcdlist[" + i + "]/applyop");
  880. if (applyop == "N") {
  881. apply = "N";
  882. }
  883. }
  884. if (applyop == "Y") {
  885. messageBox("모든 수술이 유형적용 되어있습니다. 복원후에","C003");
  886. return;
  887. }
  888. // loop : 입원일로 부터 현재일까지 날짜와 보조유형(수술일 지정체크) 해서 보조유형을 담아 놓는다.
  889. var days = new Array();
  890. var daysuppkind = new Array();
  891. var indd = model.getValue("/root/send/cond/indd");
  892. var curdd = getCurrentDate();
  893. var pid = model.getValue("/root/send/cond/pid");
  894. var hngnm = model.getValue("/root/main/list3/insulist[1]/hngnm");
  895. var insukind = model.getValue("/root/main/list3/insulist[1]/insukind");
  896. var ownbrate = model.getValue("/root/send/cond/ownbrate");
  897. var lastoptodd = model.getValue("/root/main/list2/opcdlist[" + (grd_operlist.rows-1) + "]/todd");
  898. var cretno = model.getValue("/root/send/cond/cretno");
  899. var cfe = model.getValue("/root/send/cond/cfe");
  900. // 추가 : 20091029 JHP 기간적용시 instcd가 없어서 이후 중증요율 적용시 inpt의 suppkind가 변경이 없다. 하여 보험정보에서 추가함.
  901. var instcd = model.getValue("/root/main/list3/insulist[1]/instcd");
  902. temptodd = lastoptodd.toDate("YYYYMMDD");
  903. temptodd = temptodd.getAddDate(1);
  904. temptodd = temptodd.getDateFormat();
  905. // model.removeNodeset("/root/hidden/list5/kindlist");
  906. // model.makeNode("/root/hidden/list5/kindlist[1]/fromdd");
  907. // model.makeNode("/root/hidden/list5/kindlist[1]/todd");
  908. // model.makeNode("/root/hidden/list5/kindlist[1]/suppkind");
  909. // loop의 범위는 입원일로 부터 마지막 수술적용일자 + 1 까지이다.
  910. var period = getDateInterval(indd,temptodd);
  911. // alert(period);
  912. var applydate = indd;
  913. for(i=1; i<= period; i++) {
  914. // 지정된 수술일자를 판단하여 해당일에 대한 보조유형을 산출
  915. for(j=1; j< grd_operlist.rows;j++) {
  916. var opfromdd = model.getValue("/root/main/list2/opcdlist[" + j + "]/fromdd");
  917. var optodd = model.getValue("/root/main/list2/opcdlist[" + j + "]/todd");
  918. if ((applydate >= opfromdd) && (applydate <= optodd)) {
  919. days[i] = applydate;
  920. // 20090325 차상위적용
  921. if (cfe == "E" || cfe == "F") {
  922. daysuppkind[i] = "39";
  923. }else {
  924. daysuppkind[i] = "05";
  925. }
  926. //alert(applydate);
  927. } // if ((applydate >= fromdd) && (applydate <= todd))
  928. else {
  929. if (daysuppkind[i] != "05" && daysuppkind[i] != "39") {
  930. //alert("a" + applydate);
  931. days[i] = applydate;
  932. if (cfe == "E" || cfe == "F") {
  933. daysuppkind[i] = "33";
  934. } else {
  935. daysuppkind[i] = "00";
  936. }
  937. } // if (daysuppkind[i] != "05")
  938. } // else
  939. } // for j
  940. // applydate를 하루씩 증가
  941. // alert(days[i] + " " + daysuppkind[i]);
  942. applydate = applydate.toDate("YYYYMMDD");
  943. applydate = applydate.getAddDate(1);
  944. applydate = applydate.getDateFormat();
  945. } // for i
  946. // 유형의 기본 자료를 생성한다.
  947. var kindcnt = 1;
  948. var kindchange = "N";
  949. for (k=1; k<= period; k++) {
  950. var beforefromdd;
  951. var basisdd;
  952. var todd;
  953. var suppkind;
  954. var basissuppkind;
  955. if(k == 1) {
  956. fromdd = days[k];
  957. basisdd = days[k];
  958. suppkind = daysuppkind[k];
  959. basissuppkind = daysuppkind[k];
  960. kindchage = "N";
  961. } else {
  962. if (kindchange == "Y") {
  963. fromdd = days[k];
  964. suppkind = daysuppkind[k];
  965. kindchange = "N";
  966. }
  967. basisdd = days[k];
  968. basissuppkind = daysuppkind[k];
  969. }
  970. if (suppkind != basissuppkind) {
  971. todd = days[k];
  972. todd = todd.toDate("YYYYMMDD");
  973. todd = todd.getAddDate(-1);
  974. todd = todd.getDateFormat();
  975. if (kindcnt == 1) {
  976. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/pid", pid);
  977. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/hngnm", hngnm);
  978. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/indd", indd);
  979. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/appdd", fromdd);
  980. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/insukind", insukind);
  981. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/col01", suppkind);
  982. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/fromdd", fromdd);
  983. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/todd", todd);
  984. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/cretno", cretno);
  985. if (suppkind == "00") {
  986. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/ownbrate", 20);
  987. } else if (suppkind == "33") {
  988. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/ownbrate", 14);
  989. } else {
  990. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/ownbrate", "10");
  991. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/opertodd", todd);
  992. }
  993. // 추가 : 20091029 JHP 기간적용시 instcd가 없어서 이후 중증요율 적용시 inpt의 suppkind가 변경이 없다. 하여 보험정보에서 추가함.
  994. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/instcd", instcd);
  995. /* model.setValue("/root/hidden/list5/kindlist[" + kindcnt + "]/fromdd", fromdd);
  996. model.setValue("/root/hidden/list5/kindlist[" + kindcnt + "]/todd", todd);
  997. model.setValue("/root/hidden/list5/kindlist[" + kindcnt + "]/suppkind", suppkind); */
  998. kindcnt++;
  999. kindchange = "Y";
  1000. } else {
  1001. grd_appterm.addRow(true, true);
  1002. fromdd = model.getValue("/root/hidden/list1/insulist[" + (kindcnt-1) + "]/todd").toDate("YYYYMMDD");
  1003. fromdd = fromdd.getAddDate(1);
  1004. fromdd = fromdd.getDateFormat();
  1005. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/pid", pid);
  1006. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/hngnm", hngnm);
  1007. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/indd", indd);
  1008. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/appdd", fromdd);
  1009. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/insukind", insukind);
  1010. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/col01", suppkind);
  1011. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/fromdd", fromdd);
  1012. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/todd", todd);
  1013. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/cretno", cretno);
  1014. if (suppkind == "00") {
  1015. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/ownbrate", 20);
  1016. } else if (suppkind == "33") {
  1017. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/ownbrate", 14);
  1018. } else {
  1019. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/ownbrate", "10");
  1020. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/opertodd", todd);
  1021. }
  1022. // 추가 : 20091029 JHP 기간적용시 instcd가 없어서 이후 중증요율 적용시 inpt의 suppkind가 변경이 없다. 하여 보험정보에서 추가함.
  1023. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/instcd", instcd);
  1024. kindcnt++;
  1025. kindchange = "Y";
  1026. }
  1027. }
  1028. if (k == period) {
  1029. if(suppkind == "05" || suppkind == "39") {
  1030. todd = lastoptodd;
  1031. if(kindcnt != 1) {
  1032. fromdd = model.getValue("/root/hidden/list1/insulist[" + (kindcnt-1) + "]/todd").toDate("YYYYMMDD");
  1033. fromdd = fromdd.getAddDate(1);
  1034. fromdd = fromdd.getDateFormat();
  1035. }
  1036. grd_appterm.addRow(true, true);
  1037. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/pid", pid);
  1038. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/hngnm", hngnm);
  1039. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/indd", indd);
  1040. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/appdd", fromdd);
  1041. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/insukind", insukind);
  1042. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/col01", suppkind);
  1043. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/fromdd", fromdd);
  1044. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/todd", todd);
  1045. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/ownbrate", "10");
  1046. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/opertodd", todd);
  1047. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/cretno", cretno);
  1048. // 추가 : 20091029 JHP 기간적용시 instcd가 없어서 이후 중증요율 적용시 inpt의 suppkind가 변경이 없다. 하여 보험정보에서 추가함.
  1049. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/instcd", instcd);
  1050. kindcnt ++;
  1051. var lastfromdd = lastoptodd.toDate("YYYYMMDD");
  1052. lastfromdd = lastfromdd.getAddDate(1);
  1053. lastfromdd = lastfromdd.getDateFormat();
  1054. todd = "99991231";
  1055. grd_appterm.addRow(true, true);
  1056. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/pid", pid);
  1057. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/hngnm", hngnm);
  1058. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/indd", indd);
  1059. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/appdd", lastfromdd);
  1060. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/insukind", insukind);
  1061. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/fromdd", lastfromdd);
  1062. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/todd", todd);
  1063. if (cfe == "E" || cfe == "F") {
  1064. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/col01","33");
  1065. } else {
  1066. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/col01","00");
  1067. }
  1068. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/cretno", cretno);
  1069. var suppkindcd = model.getValue("/root/hidden/list1/insulist[" + kindcnt + "]/col01");
  1070. if (suppkindcd == "00") {
  1071. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/ownbrate", 20);
  1072. } if (suppkindcd == "33") {
  1073. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/ownbrate", 14);
  1074. }else {
  1075. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/ownbrate", ownbrate);
  1076. }
  1077. // 추가 : 20091029 JHP 기간적용시 instcd가 없어서 이후 중증요율 적용시 inpt의 suppkind가 변경이 없다. 하여 보험정보에서 추가함.
  1078. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/instcd", instcd);
  1079. kindcnt++;
  1080. } else {
  1081. if (kindcnt != 1) {
  1082. fromdd = model.getValue("/root/hidden/list1/insulist[" + (kindcnt-1) + "]/todd").toDate("YYYYMMDD");
  1083. // alert(fromdd);
  1084. fromdd = fromdd.getAddDate(1);
  1085. fromdd = fromdd.getDateFormat();
  1086. // alert(fromdd);
  1087. }
  1088. todd = "99991231";
  1089. grd_appterm.addRow(true, true);
  1090. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/pid", pid);
  1091. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/hngnm", hngnm);
  1092. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/indd", indd);
  1093. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/appdd", fromdd);
  1094. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/insukind", insukind);
  1095. if (cfe == "E" || cfe == "F") {
  1096. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/col01","33");
  1097. } else {
  1098. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/col01","00");
  1099. }
  1100. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/fromdd", fromdd);
  1101. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/todd", todd);
  1102. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/cretno", cretno);
  1103. var suppkindcd = model.getValue("/root/hidden/list1/insulist[" + kindcnt + "]/col01");
  1104. if (suppkindcd == "00") {
  1105. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/ownbrate", 20);
  1106. } if (suppkindcd == "33") {
  1107. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/ownbrate", 14);
  1108. }else {
  1109. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/ownbrate", ownbrate);
  1110. }
  1111. // 추가 : 20091029 JHP 기간적용시 instcd가 없어서 이후 중증요율 적용시 inpt의 suppkind가 변경이 없다. 하여 보험정보에서 추가함.
  1112. model.setValue("/root/hidden/list1/insulist[" + kindcnt + "]/instcd", instcd);
  1113. kindcnt++;
  1114. }
  1115. }
  1116. } // for k
  1117. /* var insulist = instance1.selectSingleNode("/root/main/list2/opcdlist");
  1118. var new_todd = "";
  1119. var thisYear = ""; // 현재 입력된 연
  1120. var thisMonth = ""; // 현재 입력된 월
  1121. var thisDay = ""; // 현재 입력된 일
  1122. var nextDate = "";
  1123. var nextfromdd = "";
  1124. var beforefromdd = "";
  1125. var nexttodd = "";
  1126. var maxtodd = "";
  1127. var row = 0;
  1128. if(insulist != null){
  1129. model.removeNodeset("/root/hidden/list3");
  1130. var vcode = model.getValue("/root/send/cond/vcode");
  1131. var opcdcnt = getNodesetCount("/root/main/list2/opcdlist");
  1132. if (opcdcnt == 1) {
  1133. model.makeNode("/root/hidden/list3/opcdlist/fromdd");
  1134. model.makeNode("/root/hidden/list3/opcdlist/todd");
  1135. model.setValue("/root/hidden/list3/opcdlist[" + opcdcnt + "]/fromdd",model.getValue("/root/main/list2/opcdlist[" + opcdcnt + " ]/fromdd"));
  1136. model.setValue("/root/hidden/list3/opcdlist[" + opcdcnt + "]/todd",model.getValue("/root/main/list2/opcdlist[" + opcdcnt + " ]/todd"));
  1137. } else {
  1138. opcdcnt = eval(opcdcnt) +1;
  1139. var vfromdd = "";
  1140. var vtodd = "";
  1141. var vflag = "";
  1142. var pfromdd = "";
  1143. var ptodd = "";
  1144. for (i=1; i<opcdcnt; i++) {
  1145. row = row + 1;
  1146. vfromdd = model.getValue("/root/main/list2/opcdlist[" + row + " ]/fromdd");
  1147. vtodd = model.getValue("/root/main/list2/opcdlist[" + row + " ]/todd");
  1148. vflag = model.getValue("/root/main/list2/opcdlist[" + row + "]/flag");
  1149. if (vfromdd == "") {
  1150. messageBox("적용시작일자는","I003");
  1151. return;
  1152. }
  1153. if (vtodd == "") {
  1154. messageBox("적용종료일자는","I003");
  1155. return;
  1156. }
  1157. if (row == 1) {
  1158. pfromdd = vfromdd;
  1159. ptodd = vtodd;
  1160. model.makeNode("/root/hidden/list3/opcdlist[" + row + " ]/fromdd");
  1161. model.makeNode("/root/hidden/list3/opcdlist[" + row + " ]/todd");
  1162. model.makeNode("/root/hidden/list3/opcdlist[" + row + " ]/flag");
  1163. model.setValue("/root/hidden/list3/opcdlist[" + row + "]/fromdd",vfromdd);
  1164. model.setValue("/root/hidden/list3/opcdlist[" + row + "]/todd",vtodd);
  1165. model.setValue("/root/hidden/list3/opcdlist[" + row + "]/flag",vflag);
  1166. } else {
  1167. if (ptodd > vfromdd) {
  1168. row = row -1;
  1169. model.setValue("/root/hidden/list3/opcdlist[" + row + "]/todd",vtodd);
  1170. row = row +1;
  1171. } else {
  1172. var beforefromdd = "";
  1173. var nexttodd = "";
  1174. thisYear = ptodd.substring(0,4); // 현재 입력된 연
  1175. thisMonth = ptodd.substring(4,6); // 현재 입력된 월
  1176. thisDay = ptodd.substring(6,8); // 현재 입력된 일
  1177. nextDate = new Date(thisYear, (thisMonth - 1), thisDay);
  1178. nextDate.setHours(24); // 24시간 뒤인 다음날 날짜를 구한다.
  1179. beforefromdd = "";
  1180. beforefromdd += nextDate.getYear();
  1181. if ((nextDate.getMonth() + 1) < 10) {
  1182. beforefromdd += "0" + (nextDate.getMonth() + 1);
  1183. }
  1184. else {
  1185. beforefromdd += (nextDate.getMonth() + 1);
  1186. }
  1187. if (nextDate.getDate() < 10) {
  1188. beforefromdd += "0" + nextDate.getDate();
  1189. }
  1190. else {
  1191. beforefromdd += nextDate.getDate();
  1192. }
  1193. thisYear = vfromdd.substring(0,4); // 현재 입력된 연
  1194. thisMonth = vfromdd.substring(4,6); // 현재 입력된 월
  1195. thisDay = vfromdd.substring(6,8); // 현재 입력된 일
  1196. nextDate = new Date(thisYear, (thisMonth - 1), thisDay);
  1197. nextDate.setHours(24); // 24시간 뒤인 다음날 날짜를 구한다. vv
  1198. nexttodd = "";
  1199. nexttodd += nextDate.getYear();
  1200. if ((nextDate.getMonth() + 1) < 10) {
  1201. nexttodd += "0" + (nextDate.getMonth() + 1);
  1202. }
  1203. else {
  1204. nexttodd += (nextDate.getMonth() + 1);
  1205. }
  1206. if (nextDate.getDate() < 10) {
  1207. nexttodd += "0" + nextDate.getDate();
  1208. }
  1209. else {
  1210. nexttodd += nextDate.getDate();
  1211. }
  1212. pfromdd = vfromdd;
  1213. ptodd = vtodd;
  1214. // 적용 수술 건 중 적용기간 사이 기간을 새로운 기간으로 생성
  1215. model.makeNode("/root/hidden/list3/opcdlist[" + row + " ]/fromdd");
  1216. model.makeNode("/root/hidden/list3/opcdlist[" + row + " ]/todd");
  1217. model.makeNode("/root/hidden/list3/opcdlist[" + row + " ]/flag");
  1218. model.setValue("/root/hidden/list3/opcdlist[" + row + "]/fromdd",beforefromdd);
  1219. model.setValue("/root/hidden/list3/opcdlist[" + row + "]/todd",nexttodd);
  1220. model.setValue("/root/hidden/list3/opcdlist[" + row + "]/flag","N");
  1221. // 해당 수술 건의 적용 기간 설정
  1222. row = row +1;
  1223. model.makeNode("/root/hidden/list3/opcdlist[" + row + " ]/fromdd");
  1224. model.makeNode("/root/hidden/list3/opcdlist[" + row + " ]/todd");
  1225. model.makeNode("/root/hidden/list3/opcdlist[" + row + " ]/flag");
  1226. model.setValue("/root/hidden/list3/opcdlist[" + row + "]/fromdd",vfromdd);
  1227. model.setValue("/root/hidden/list3/opcdlist[" + row + "]/todd",vtodd);
  1228. model.setValue("/root/hidden/list3/opcdlist[" + row + "]/flag",vflag);
  1229. }
  1230. }
  1231. }
  1232. }
  1233. }
  1234. model.refresh();
  1235. var rowcnt = getNodesetCount("/root/hidden/list3/opcdlist");
  1236. model.removeNodeset("/root/hidden/list1");
  1237. model.removeNodeset("/root/hidden/list2");
  1238. model.refresh();
  1239. for (m=0; m<rowcnt; m++) {
  1240. var vcode = model.getValue("/root/send/cond/vcode");
  1241. var row = m+1;
  1242. var fromdd = model.getValue("/root/hidden/list3/opcdlist[" + row + " ]/fromdd");
  1243. var todd = model.getValue("/root/hidden/list3/opcdlist[" + row + " ]/todd");
  1244. var flag = model.getValue("/root/hidden/list3/opcdlist[" + row + " ]/flag");
  1245. var insucnt = grd_insulist.rows;
  1246. // 시작일자와 현재일자까지 30일 미만인 경우
  1247. if (getDateInterval(fromdd,getCurrentDate()) < 30 ) {
  1248. //보험정보 갯수 만큼 돌면서 체크한다.
  1249. for (var i = 1; i < insucnt; i++) {
  1250. var fromdd_term = model.getValue("/root/main/list3/insulist[" + i + " ]/fromdd");
  1251. var todd_term = model.getValue("/root/main/list3/insulist[" + i + " ]/todd");
  1252. var clamflag = model.getValue("/root/main/list3/insulist[" + i + " ]/clamflag");
  1253. if(fromdd_term < fromdd && todd_term == '99991231' && clamflag == 'N'){
  1254. grd_appterm.addrow();
  1255. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1256. thisYear = fromdd.substring(0,4); // 현재 입력된 연
  1257. thisMonth = fromdd.substring(4,6); // 현재 입력된 월
  1258. thisDay = fromdd.substring(6,8); // 현재 입력된 일
  1259. nextDate = new Date(thisYear, (thisMonth - 1), thisDay);
  1260. nextDate.setHours(-24); // 24시간 뒤인 다음날 날짜를 구한다.
  1261. nextfromdd = "";
  1262. nextfromdd += nextDate.getYear();
  1263. if ((nextDate.getMonth() + 1) < 10) {
  1264. nextfromdd += "0" + (nextDate.getMonth() + 1);
  1265. }
  1266. else {
  1267. nextfromdd += (nextDate.getMonth() + 1);
  1268. }
  1269. if (nextDate.getDate() < 10) {
  1270. nextfromdd += "0" + nextDate.getDate();
  1271. }
  1272. else {
  1273. nextfromdd += nextDate.getDate();
  1274. }
  1275. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/todd",nextfromdd);
  1276. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/opertodd",nextfromdd);
  1277. grd_appterm.addrow();
  1278. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1279. if(vcode == "V191"){
  1280. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1281. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1282. }else if(vcode == "V192"){
  1283. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1284. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1285. }
  1286. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/opertodd",todd);
  1287. }else if(todd_term != '99991231' && clamflag == 'Y'){
  1288. grd_appterm.addrow();
  1289. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1290. }else{
  1291. grd_appterm.addrow();
  1292. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1293. if(vcode == "V191"){
  1294. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1295. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1296. }else if(vcode == "V192"){
  1297. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1298. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1299. }
  1300. if(todd_term > todd){
  1301. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/opertodd",todd);
  1302. }
  1303. }
  1304. }
  1305. } else {
  1306. //보험정보 갯수 만큼 돌면서 체크한다.
  1307. for (var i = 1; i < insucnt; i++) {
  1308. var fromdd_term = model.getValue("/root/main/list3/insulist[" + i + " ]/fromdd");
  1309. var todd_term = model.getValue("/root/main/list3/insulist[" + i + " ]/todd");
  1310. //원유형 시작일자가, 적용 종료기간 보다 크면 해당 없음.
  1311. if(fromdd_term > todd){
  1312. continue;
  1313. }
  1314. maxtodd = model.getValue("/root/hidden/list1/insulist[" + grd_appterm.row + "]/todd");
  1315. // 이전에 생성된 기간별 본인 부담율 적용 내역의 종료일자 이후 일 경우에만 추가 생성
  1316. if (todd_term > maxtodd) {
  1317. //해당유형의 Fromdd 기 심사자 선택한 기간보다 작은경우 선택한 기간이전 유형을 하나더 발생시킨다.
  1318. if(fromdd_term < fromdd){
  1319. grd_appterm.addrow();
  1320. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1321. thisYear = fromdd.substring(0,4); // 현재 입력된 연
  1322. thisMonth = fromdd.substring(4,6); // 현재 입력된 월
  1323. thisDay = fromdd.substring(6,8); // 현재 입력된 일
  1324. nextDate = new Date(thisYear, (thisMonth - 1), thisDay);
  1325. nextDate.setHours(-24); // 24시간 뒤인 다음날 날짜를 구한다.
  1326. nextfromdd = "";
  1327. nextfromdd += nextDate.getYear();
  1328. if ((nextDate.getMonth() + 1) < 10) {
  1329. nextfromdd += "0" + (nextDate.getMonth() + 1);
  1330. }
  1331. else {
  1332. nextfromdd += (nextDate.getMonth() + 1);
  1333. }
  1334. if (nextDate.getDate() < 10) {
  1335. nextfromdd += "0" + nextDate.getDate();
  1336. }
  1337. else {
  1338. nextfromdd += nextDate.getDate();
  1339. }
  1340. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/todd",nextfromdd);
  1341. maxtodd = nextfromdd;
  1342. //해당유형의 Todd 기 심사자 선택한 기간보다 작은경우 선택한 기간이후 유형을 하나더 발생시킨다.
  1343. if(todd_term > todd){
  1344. grd_appterm.addrow();
  1345. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1346. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/fromdd", fromdd);
  1347. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/todd", todd);
  1348. if(vcode == "V191"){
  1349. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1350. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1351. }else if(vcode == "V192"){
  1352. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1353. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1354. }
  1355. grd_appterm.addrow();
  1356. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1357. new_todd = todd;
  1358. thisYear = new_todd.substring(0,4); // 현재 입력된 연
  1359. thisMonth = new_todd.substring(4,6); // 현재 입력된 월
  1360. thisDay = new_todd.substring(6,8); // 현재 입력된 일
  1361. nextDate = new Date(thisYear, (thisMonth - 1), thisDay);
  1362. nextDate.setHours(24); // 24시간 뒤인 다음날 날짜를 구한다.
  1363. nextfromdd = "";
  1364. nextfromdd += nextDate.getYear();
  1365. if ((nextDate.getMonth() + 1) < 10) {
  1366. nextfromdd += "0" + (nextDate.getMonth() + 1);
  1367. }
  1368. else {
  1369. nextfromdd += (nextDate.getMonth() + 1);
  1370. }
  1371. if (nextDate.getDate() < 10) {
  1372. nextfromdd += "0" + nextDate.getDate();
  1373. }
  1374. else {
  1375. nextfromdd += nextDate.getDate();
  1376. }
  1377. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/fromdd", nextfromdd);
  1378. }else if(todd_term == todd){
  1379. grd_appterm.addrow();
  1380. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1381. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/fromdd", fromdd);
  1382. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/todd", todd);
  1383. if(vcode == "V191"){
  1384. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1385. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1386. }else if(vcode == "V192"){
  1387. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1388. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1389. }
  1390. //심사자가 선택한 Todd가 기존데이터 보다 큰경우는 미래 날짜로 미리 유형을 하나 더 만들어 놓는다.
  1391. }else{
  1392. grd_appterm.addrow();
  1393. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1394. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/fromdd", fromdd);
  1395. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/opertodd", todd);
  1396. if(vcode == "V191"){
  1397. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1398. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1399. }else if(vcode == "V192"){
  1400. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1401. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1402. }
  1403. }
  1404. }else if(fromdd_term == fromdd){
  1405. if(todd_term > todd){
  1406. grd_appterm.addrow();
  1407. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1408. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/fromdd", fromdd);
  1409. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/todd", todd);
  1410. if(vcode == "V191"){
  1411. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1412. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1413. }else if(vcode == "V192"){
  1414. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1415. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1416. }
  1417. grd_appterm.addrow();
  1418. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1419. new_todd = todd;
  1420. thisYear = new_todd.substring(0,4); // 현재 입력된 연
  1421. thisMonth = new_todd.substring(4,6); // 현재 입력된 월
  1422. thisDay = new_todd.substring(6,8); // 현재 입력된 일
  1423. nextDate = new Date(thisYear, (thisMonth - 1), thisDay);
  1424. nextDate.setHours(24); // 24시간 뒤인 다음날 날짜를 구한다.
  1425. nextfromdd = "";
  1426. nextfromdd += nextDate.getYear();
  1427. if ((nextDate.getMonth() + 1) < 10) {
  1428. nextfromdd += "0" + (nextDate.getMonth() + 1);
  1429. }
  1430. else {
  1431. nextfromdd += (nextDate.getMonth() + 1);
  1432. }
  1433. if (nextDate.getDate() < 10) {
  1434. nextfromdd += "0" + nextDate.getDate();
  1435. }
  1436. else {
  1437. nextfromdd += nextDate.getDate();
  1438. }
  1439. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/fromdd", nextfromdd);
  1440. //심사자가 선택한 Todd가 기존데이터 보다 큰경우는 미래 날짜로 미리 유형을 하나 더 만들어 놓는다.
  1441. }else{
  1442. grd_appterm.addrow();
  1443. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1444. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/todd", todd);
  1445. maxtodd = todd;
  1446. if(vcode == "V191"){
  1447. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1448. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1449. }else if(vcode == "V192"){
  1450. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1451. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1452. }
  1453. grd_appterm.addrow();
  1454. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1455. new_todd = todd;
  1456. thisYear = new_todd.substring(0,4); // 현재 입력된 연
  1457. thisMonth = new_todd.substring(4,6); // 현재 입력된 월
  1458. thisDay = new_todd.substring(6,8); // 현재 입력된 일
  1459. nextDate = new Date(thisYear, (thisMonth - 1), thisDay);
  1460. nextDate.setHours(24); // 24시간 뒤인 다음날 날짜를 구한다.
  1461. nextfromdd = "";
  1462. nextfromdd += nextDate.getYear();
  1463. if ((nextDate.getMonth() + 1) < 10) {
  1464. nextfromdd += "0" + (nextDate.getMonth() + 1);
  1465. }
  1466. else {
  1467. nextfromdd += (nextDate.getMonth() + 1);
  1468. }
  1469. if (nextDate.getDate() < 10) {
  1470. nextfromdd += "0" + nextDate.getDate();
  1471. }
  1472. else {
  1473. nextfromdd += nextDate.getDate();
  1474. }
  1475. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/fromdd", nextfromdd);
  1476. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/todd", "99991211");
  1477. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/opertodd", todd);
  1478. }
  1479. }else{
  1480. grd_appterm.addrow();
  1481. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1482. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/todd",todd);
  1483. //해당유형의 Todd가 심사자 선택한 기간보다 작은경우 선택한 기간이후 유형을 하나더 발생시킨다.
  1484. if(todd_term > todd){
  1485. new_todd = todd;
  1486. thisYear = new_todd.substring(0,4); // 현재 입력된 연
  1487. thisMonth = new_todd.substring(4,6); // 현재 입력된 월
  1488. thisDay = new_todd.substring(6,8); // 현재 입력된 일
  1489. nextDate = new Date(thisYear, (thisMonth - 1), thisDay);
  1490. nextDate.setHours(24); // 24시간 뒤인 다음날 날짜를 구한다.
  1491. nextfromdd = "";
  1492. nextfromdd += nextDate.getYear();
  1493. if ((nextDate.getMonth() + 1) < 10) {
  1494. nextfromdd += "0" + (nextDate.getMonth() + 1);
  1495. }
  1496. else {
  1497. nextfromdd += (nextDate.getMonth() + 1);
  1498. }
  1499. if (nextDate.getDate() < 10) {
  1500. nextfromdd += "0" + nextDate.getDate();
  1501. }
  1502. else {
  1503. nextfromdd += nextDate.getDate();
  1504. }
  1505. if ( fromdd_term < todd && todd_term > todd ) {
  1506. if (flag == "Y") {
  1507. if(vcode == "V191"){
  1508. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1509. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1510. }else if(vcode == "V192"){
  1511. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1512. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1513. }
  1514. }
  1515. }
  1516. grd_appterm.addrow();
  1517. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1518. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/fromdd", nextfromdd);
  1519. //심사자가 선택한 Todd가 기존데이터 보다 큰경우는 미래 날짜로 미리 유형을 하나 더 만들어 놓는다.
  1520. }else{
  1521. grd_appterm.addrow();
  1522. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1523. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/todd", todd);
  1524. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/opertodd", todd);
  1525. }
  1526. }
  1527. } else {
  1528. // 수술일자가 적용 기간에 포함 되지 않을 경우 이면서 마지막 수술건을 경우
  1529. if ( todd >= nextfromdd && todd_term > todd ) {
  1530. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/todd", todd);
  1531. grd_appterm.addrow();
  1532. model.copyNode("/root/hidden/list1/insulist[" + grd_appterm.row + " ]", "/root/main/list3/insulist[" + i + " ]");
  1533. new_todd = todd;
  1534. thisYear = new_todd.substring(0,4); // 현재 입력된 연
  1535. thisMonth = new_todd.substring(4,6); // 현재 입력된 월
  1536. thisDay = new_todd.substring(6,8); // 현재 입력된 일
  1537. nextDate = new Date(thisYear, (thisMonth - 1), thisDay);
  1538. nextDate.setHours(24); // 24시간 뒤인 다음날 날짜를 구한다.
  1539. nextfromdd = "";
  1540. nextfromdd += nextDate.getYear();
  1541. if ((nextDate.getMonth() + 1) < 10) {
  1542. nextfromdd += "0" + (nextDate.getMonth() + 1);
  1543. }
  1544. else {
  1545. nextfromdd += (nextDate.getMonth() + 1);
  1546. }
  1547. if (nextDate.getDate() < 10) {
  1548. nextfromdd += "0" + nextDate.getDate();
  1549. }
  1550. else {
  1551. nextfromdd += nextDate.getDate();
  1552. }
  1553. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/fromdd", nextfromdd);
  1554. } else {
  1555. if (flag == "Y") {
  1556. if(vcode == "V191"){
  1557. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1558. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1559. }else if(vcode == "V192"){
  1560. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/suppkind", "05");
  1561. model.setValue("/root/hidden/list1/insulist[" + grd_appterm.row + " ]/ownbrate", "10");
  1562. }
  1563. }
  1564. }
  1565. } // end fi
  1566. } // end for
  1567. } // end for
  1568. } */
  1569. //보험유형에 따른 유형보조의 콤보값을 셋팅해준다.
  1570. for (var i=1; i<grd_appterm.rows; i++) {
  1571. var insukind = model.getValue( "/root/hidden/list1/insulist[" + i + "]/insukind");
  1572. grd_appterm.cellComboNodeset(i,6) = "/root/main/list4/pmbminsu[insukind = '"+insukind+"']";
  1573. }
  1574. model.refresh();
  1575. ]]>
  1576. </script>
  1577. </button>
  1578. <button id="btn_iphsrebuild" class="btn4_letter4" style="left:510px; top:5px; width:80px; height:22px; ">
  1579. <caption>유형복원</caption>
  1580. <script type="javascript" ev:event="DOMActivate">
  1581. <![CDATA[
  1582. // 2008.08.12 박창원
  1583. // 유형복원은 자료수집이 되었을때는 안된다.
  1584. // 유형복원은 현재 보험유형에서 선택된 row에 대해서만 작업한다.
  1585. // 유형복원은 보조유형을 정상으로 바꾸고 똑같은 유형끼리 합친다.(이부분은 추가 확인이 필요)
  1586. // 유형이 05 유형 하나밖에 없을 때에는 00으로 변경한다 - 20080926 박창원
  1587. var count = grd_insulist.rows;
  1588. if (count == 2) {
  1589. // 유형을 정상유형으로 -> 이부분은 다른 케이스가 있는지 찾아봐야함
  1590. model.resetInstanceNode("/root/hidden/list2/insulist");
  1591. var pid = model.getValue("/root/main/list3/insulist[1]/pid");
  1592. var indd = model.getValue("/root/main/list3/insulist[1]/indd");
  1593. var cretno = model.getValue("/root/main/list3/insulist[1]/cretno");
  1594. var fromdd = model.getValue("/root/main/list3/insulist[1]/fromdd");
  1595. var seqno = model.getValue("/root/main/list3/insulist[1]/seqno");
  1596. var mskind = model.getValue("/root/main/list3/insulist[1]/mskind");
  1597. var todd = model.getValue("/root/main/list3/insulist[1]/todd");
  1598. var insukind = model.getValue("/root/main/list3/insulist[1]/insukind");
  1599. var instcd = model.getValue("/root/main/list3/insulist[1]/instcd");
  1600. var cfe = model.getValue("/root/send/cond/cfe");
  1601. if (cfe == "E" || cfe == "F") {
  1602. suppkind = "33";
  1603. } else {
  1604. suppkind = "00";
  1605. }
  1606. var cNode = instance1.selectSingleNode("/root/hidden/list2/insulist");
  1607. if(cNode == null){
  1608. if(pid){
  1609. model.makeNode("/root/hidden/list2/insulist/iphs_status");
  1610. model.makeNode("/root/hidden/list2/insulist/iphs_pid");
  1611. model.makeNode("/root/hidden/list2/insulist/iphs_indd");
  1612. model.makeNode("/root/hidden/list2/insulist/iphs_cretno");
  1613. model.makeNode("/root/hidden/list2/insulist/iphs_fromdd");
  1614. model.makeNode("/root/hidden/list2/insulist/iphs_seqno");
  1615. model.makeNode("/root/hidden/list2/insulist/iphs_mskind");
  1616. model.makeNode("/root/hidden/list2/insulist/iphs_todd");
  1617. model.makeNode("/root/hidden/list2/insulist/iphs_insukind");
  1618. model.makeNode("/root/hidden/list2/insulist/iphs_suppkind");
  1619. model.makeNode("/root/hidden/list2/insulist/iphs_instcd");
  1620. model.setValue("/root/hidden/list2/insulist/iphs_status","B");
  1621. model.setValue("/root/hidden/list2/insulist/iphs_pid",pid);
  1622. model.setValue("/root/hidden/list2/insulist/iphs_indd",indd);
  1623. model.setValue("/root/hidden/list2/insulist/iphs_cretno",cretno);
  1624. model.setValue("/root/hidden/list2/insulist/iphs_fromdd",fromdd);
  1625. model.setValue("/root/hidden/list2/insulist/iphs_seqno",seqno);
  1626. model.setValue("/root/hidden/list2/insulist/iphs_mskind",mskind);
  1627. model.setValue("/root/hidden/list2/insulist/iphs_todd",todd);
  1628. model.setValue("/root/hidden/list2/insulist/iphs_instcd",instcd);
  1629. model.setValue("/root/hidden/list2/insulist/iphs_insukind",insukind);
  1630. model.setValue("/root/hidden/list2/insulist/iphs_suppkind",suppkind);
  1631. }
  1632. }else{
  1633. if(pid){
  1634. model.setValue("/root/hidden/list2/insulist/iphs_status","B");
  1635. model.setValue("/root/hidden/list2/insulist/iphs_pid",pid);
  1636. model.setValue("/root/hidden/list2/insulist/iphs_indd",indd);
  1637. model.setValue("/root/hidden/list2/insulist/iphs_cretno",cretno);
  1638. model.setValue("/root/hidden/list2/insulist/iphs_fromdd",fromdd);
  1639. model.setValue("/root/hidden/list2/insulist/iphs_seqno",seqno);
  1640. model.setValue("/root/hidden/list2/insulist/iphs_mskind",mskind);
  1641. model.setValue("/root/hidden/list2/insulist/iphs_todd",todd);
  1642. model.setValue("/root/hidden/list2/insulist/iphs_instcd",instcd);
  1643. model.setValue("/root/hidden/list2/insulist/iphs_insukind",insukind);
  1644. model.setValue("/root/hidden/list2/insulist/iphs_suppkind",suppkind);
  1645. }
  1646. }
  1647. model.removenode("/root/hidden/list2/rslt");
  1648. if (submit("TXPIJ01902")) { // 유형변경
  1649. model.removeNodeset("/root/main/list3/insulist");
  1650. // model.resetInstanceNode("/root/main/list3/insulist");
  1651. submit("TRPIJ01903") // 유형 다시로드
  1652. model.refresh();
  1653. if(messageBox("유형복원이 완료 되었습니다. 변경된 내역의 소급처리를", "Q004") == 6){
  1654. var sWindowMsg = "수가계산중입니다...";
  1655. callLoadingWindow(sWindowMsg);
  1656. fReCalc() ;
  1657. removeLoadingWindow();
  1658. }
  1659. opener.model.refresh();
  1660. opener.javascript.fGetItemInfo();
  1661. messageBox("소급계산이", "I002");
  1662. fInitialize();
  1663. return;
  1664. } else {
  1665. return;
  1666. }
  1667. }
  1668. // 선택된 유형의 자료수집여부를 판단하여 자료수집된 경우에는 유형복원 불가
  1669. var row = grd_insulist.row;
  1670. var clamflag = model.getValue("/root/main/list3/insulist[" + row + "]/clamflag");
  1671. if (clamflag == "Y") {
  1672. messageBox("자료수집이 되어 유형변경을 ","E001");
  1673. return;
  1674. }
  1675. var suppkind = model.getValue("/root/main/list3/insulist[" + row + "]/suppkind");
  1676. if (suppkind != "05" && suppkind != "39") {
  1677. messageBox(" 개두개심술 외에는 유형변경을 ","E001");
  1678. return;
  1679. }
  1680. // 유형을 정상유형으로 -> 이부분은 다른 케이스가 있는지 찾아봐야함
  1681. model.resetInstanceNode("/root/hidden/list2/insulist");
  1682. var pid = model.getValue("/root/main/list3/insulist[" + row + "]/pid");
  1683. var indd = model.getValue("/root/main/list3/insulist[" + row + "]/indd");
  1684. var cretno = model.getValue("/root/main/list3/insulist[" + row + "]/cretno");
  1685. var fromdd = model.getValue("/root/main/list3/insulist[" + row + "]/fromdd");
  1686. var seqno = model.getValue("/root/main/list3/insulist[" + row + "]/seqno");
  1687. var mskind = model.getValue("/root/main/list3/insulist[" + row + "]/mskind");
  1688. var todd = model.getValue("/root/main/list3/insulist[" + row + "]/todd");
  1689. var insukind = model.getValue("/root/main/list3/insulist[" + row + "]/insukind");
  1690. var instcd = model.getValue("/root/main/list3/insulist[1]/instcd");
  1691. suppkind = "00"
  1692. var cNode = instance1.selectSingleNode("/root/hidden/list2/insulist");
  1693. if(cNode == null){
  1694. if(pid){
  1695. model.makeNode("/root/hidden/list2/insulist/iphs_status");
  1696. model.makeNode("/root/hidden/list2/insulist/iphs_pid");
  1697. model.makeNode("/root/hidden/list2/insulist/iphs_indd");
  1698. model.makeNode("/root/hidden/list2/insulist/iphs_cretno");
  1699. model.makeNode("/root/hidden/list2/insulist/iphs_fromdd");
  1700. model.makeNode("/root/hidden/list2/insulist/iphs_seqno");
  1701. model.makeNode("/root/hidden/list2/insulist/iphs_mskind");
  1702. model.makeNode("/root/hidden/list2/insulist/iphs_todd");
  1703. model.makeNode("/root/hidden/list2/insulist/iphs_insukind");
  1704. model.makeNode("/root/hidden/list2/insulist/iphs_suppkind");
  1705. model.makeNode("/root/hidden/list2/insulist/iphs_instcd");
  1706. model.setValue("/root/hidden/list2/insulist/iphs_status","B");
  1707. model.setValue("/root/hidden/list2/insulist/iphs_pid",pid);
  1708. model.setValue("/root/hidden/list2/insulist/iphs_indd",indd);
  1709. model.setValue("/root/hidden/list2/insulist/iphs_cretno",cretno);
  1710. model.setValue("/root/hidden/list2/insulist/iphs_fromdd",fromdd);
  1711. model.setValue("/root/hidden/list2/insulist/iphs_seqno",seqno);
  1712. model.setValue("/root/hidden/list2/insulist/iphs_mskind",mskind);
  1713. model.setValue("/root/hidden/list2/insulist/iphs_todd",todd);
  1714. model.setValue("/root/hidden/list2/insulist/iphs_insukind",insukind);
  1715. model.setValue("/root/hidden/list2/insulist/iphs_suppkind",suppkind);
  1716. model.setValue("/root/hidden/list2/insulist/iphs_instcd",instcd);
  1717. }
  1718. }else{
  1719. if(pid){
  1720. model.setValue("/root/hidden/list2/insulist/iphs_status","B");
  1721. model.setValue("/root/hidden/list2/insulist/iphs_pid",pid);
  1722. model.setValue("/root/hidden/list2/insulist/iphs_indd",indd);
  1723. model.setValue("/root/hidden/list2/insulist/iphs_cretno",cretno);
  1724. model.setValue("/root/hidden/list2/insulist/iphs_fromdd",fromdd);
  1725. model.setValue("/root/hidden/list2/insulist/iphs_seqno",seqno);
  1726. model.setValue("/root/hidden/list2/insulist/iphs_mskind",mskind);
  1727. model.setValue("/root/hidden/list2/insulist/iphs_todd",todd);
  1728. model.setValue("/root/hidden/list2/insulist/iphs_insukind",insukind);
  1729. model.setValue("/root/hidden/list2/insulist/iphs_suppkind",suppkind);
  1730. model.setValue("/root/hidden/list2/insulist/iphs_instcd",instcd);
  1731. }
  1732. }
  1733. model.removenode("/root/hidden/list2/rslt");
  1734. submit("TXPIJ01902"); // 유형변경
  1735. model.removeNodeset("/root/main/list3/insulist");
  1736. // model.resetInstanceNode("/root/main/list3/insulist");
  1737. submit("TRPIJ01903") // 유형 다시로드
  1738. model.refresh();
  1739. // 여기서부터는 유형 합치기
  1740. // 합치기 위한 시작일자와 종료일자를 선정한다.(보험유형과 보조유형이 같으면 합치기 단, 자료수집이 된 유형은 합치는 대상에서 제외)
  1741. var curmskind = model.getValue("/root/main/list3/insulist[" + row + "]/mskind");
  1742. if (row == 1) {
  1743. var nextsuppkind = model.getValue("/root/main/list3/insulist[" + (row + 1) + "]/suppkind");
  1744. var nexttodd = model.getValue("/root/main/list3/insulist[" + (row + 1) + "]/todd");
  1745. var nextmskind = model.getValue("/root/main/list3/insulist[" + (row + 1) + "]/mskind");
  1746. var instcd = model.getValue("/root/main/list3/insulist[1]/instcd");
  1747. if (nextsuppkind == "00" && (curmskind == nextmskind)) {
  1748. todd = nexttodd;
  1749. model.setValue("/root/hidden/list2/insulist/iphs_todd",todd);
  1750. model.setValue("/root/hidden/list2/insulist/iphs_instcd",instcd); // 임시
  1751. } else {
  1752. model.setValue("/root/hidden/list2/insulist/iphs_todd",todd);
  1753. model.setValue("/root/hidden/list2/insulist/iphs_instcd",instcd); // 임시
  1754. }
  1755. if(submit("TXPIJ01904")){
  1756. model.removeNodeset("/root/main/list3/insulist");
  1757. submit("TRPIJ01903") // 유형 다시로드
  1758. model.refresh();
  1759. if(messageBox("유형복원이 완료 되었습니다. 변경된 내역의 소급처리를", "Q004") == 6){
  1760. var sWindowMsg = "수가계산중입니다...";
  1761. callLoadingWindow(sWindowMsg);
  1762. fReCalc() ;
  1763. removeLoadingWindow();
  1764. }
  1765. opener.model.refresh();
  1766. opener.javascript.fGetItemInfo();
  1767. messageBox("소급계산이", "I002");
  1768. fInitialize();
  1769. // activateOpener(); // (common.js)에서 제공하는 함수로 opener를 activate한다.
  1770. // window.close(); // F5 실행시 IE를 종료시킨다.
  1771. }
  1772. } else if (row > 1) {
  1773. var prevsuppkind = model.getValue("/root/main/list3/insulist[" + (row - 1) + "]/suppkind");
  1774. var prevfromdd = model.getValue("/root/main/list3/insulist[" + (row - 1) + "]/fromdd");
  1775. var prevmskind = model.getValue("/root/main/list3/insulist[" + (row - 1) + "]/mskind");
  1776. var prevclamflag = model.getValue("/root/main/list3/insulist[" + row + "]/clamflag");
  1777. var nextsuppkind = model.getValue("/root/main/list3/insulist[" + (row + 1) + "]/suppkind");
  1778. var nexttodd = model.getValue("/root/main/list3/insulist[" + (row + 1) + "]/todd");
  1779. var nextclamflag = model.getValue("/root/main/list3/insulist[" + (row + 1) + "]/clamflag");
  1780. var nextmskind = model.getValue("/root/main/list3/insulist[" + (row + 1) + "]/mskind");
  1781. var instcd = model.getValue("/root/main/list3/insulist[1]/instcd");
  1782. if (prevsuppkind == "00" && prevclamflag == "N" && (curmskind == prevmskind)) {
  1783. fromdd = prevfromdd;
  1784. model.setValue("/root/hidden/list2/insulist/iphs_fromdd",fromdd);
  1785. model.setValue("/root/hidden/list2/insulist/iphs_instcd",instcd); // 임시
  1786. }
  1787. if (nextsuppkind == "00"&& nextclamflag == "N" && (curmskind == nextmskind)) {
  1788. todd = nexttodd;
  1789. model.setValue("/root/hidden/list2/insulist/iphs_todd",todd);
  1790. model.setValue("/root/hidden/list2/insulist/iphs_instcd",instcd); // 임시
  1791. }
  1792. if(submit("TXPIJ01904")){
  1793. model.removeNodeset("/root/main/list3/insulist");
  1794. submit("TRPIJ01903") // 유형 다시로드
  1795. model.refresh();
  1796. if(messageBox("유형복원이 완료 되었습니다. 변경된 내역의 소급처리를", "Q004") == 6){
  1797. var sWindowMsg = "수가계산중입니다...";
  1798. callLoadingWindow(sWindowMsg);
  1799. fReCalc() ;
  1800. removeLoadingWindow();
  1801. }
  1802. opener.model.refresh();
  1803. opener.javascript.fGetItemInfo();
  1804. messageBox("소급계산이", "I002");
  1805. // activateOpener(); // (common.js)에서 제공하는 함수로 opener를 activate한다.
  1806. // window.close(); // F5 실행시 IE를 종료시킨다.
  1807. }
  1808. }
  1809. /*model.setValue("/root/hidden/list2/insulist/iphs_fromdd","20080715");
  1810. model.setValue("/root/hidden/list2/insulist/iphs_todd","99991231");
  1811. model.setValue("/root/hidden/list2/insulist/iphs_instcd","012");
  1812. submit("TXPIJ01904"); */
  1813. model.removeNodeset("/root/main/list3/insulist");
  1814. submit("TRPIJ01903") // 유형 다시로드
  1815. model.refresh();
  1816. /* model.resetInstanceNode("/root/hidden/source");
  1817. model.makevalue("/root/hidden/source/pid", model.getValue("/root/send/cond/pid"));
  1818. model.makevalue("/root/hidden/source/indd", model.getValue("/root/send/cond/indd"));
  1819. model.makevalue("/root/hidden/source/cretno", model.getValue("/root/send/cond/cretno"));
  1820. model.makevalue("/root/hidden/source/mskind", model.getValue("/root/send/cond/mskind"));
  1821. modal("../../../pam/ipatmngtweb/xrw/SMPMI00400", "1","50", "50", "SMPMI00400", "/root/hidden/source", "/root/hidden/source", "", ""); */
  1822. ]]>
  1823. </script>
  1824. </button>
  1825. </group>
  1826. <button id="btn_save" class="btn5_letter2" style="left:747px; top:353px; width:42px; height:19px; ">
  1827. <caption>저장</caption>
  1828. <script type="javascript" ev:event="DOMActivate">
  1829. <![CDATA[
  1830. var arow = grd_insulist.rows;
  1831. var hrow = grd_insulist.row;
  1832. if (hrow <= "0"){
  1833. messageBox("변경할 유형이력을","C002");
  1834. }else{
  1835. var newoperdd = model.getValue("/root/hidden/newoperddsend/newoperdd");
  1836. if(newoperdd == ""){
  1837. messageBox("변경할 유형종료예정일을","C001");
  1838. }else{
  1839. var pid = model.getValue("/root/main/list3/insulist[" + hrow + "]/pid");
  1840. var indd = model.getValue("/root/main/list3/insulist[" + hrow + "]/indd");
  1841. var cretno = model.getValue("/root/main/list3/insulist[" + hrow + "]/cretno");
  1842. var instcd = model.getValue("/root/main/list3/insulist[" + hrow + "]/instcd");
  1843. var insukind = model.getValue("/root/main/list3/insulist[" + hrow + "]/insukind");
  1844. var suppkind = model.getValue("/root/main/list3/insulist[" + hrow + "]/suppkind");
  1845. var fromdd = model.getValue("/root/main/list3/insulist[" + hrow + "]/fromdd");
  1846. var todd = model.getValue("/root/main/list3/insulist[" + hrow + "]/todd");
  1847. var mskind = model.getValue("/root/main/list3/insulist[" + hrow + "]/mskind");
  1848. model.setValue("/root/send/uptoperdd/pid",pid);
  1849. model.setValue("/root/send/uptoperdd/indd",indd);
  1850. model.setValue("/root/send/uptoperdd/cretno",cretno);
  1851. model.setValue("/root/send/uptoperdd/instcd",instcd);
  1852. model.setValue("/root/send/uptoperdd/insukind",insukind);
  1853. model.setValue("/root/send/uptoperdd/suppkind",suppkind);
  1854. model.setValue("/root/send/uptoperdd/fromdd",fromdd);
  1855. model.setValue("/root/send/uptoperdd/todd",todd);
  1856. model.setValue("/root/send/uptoperdd/mskind",mskind);
  1857. model.setValue("/root/send/uptoperdd/newoperdd",newoperdd);
  1858. submit("TXPIJ01905");
  1859. var result = model.getValue("/root/hidden/newoperddresult/result/inpt_count");
  1860. if(result == "완료"){
  1861. messageBox("유형종료예정일 저장이","I002");
  1862. fInitialize();
  1863. }else {
  1864. messageBox("유형종료예정일 저장에","E009");
  1865. }
  1866. }
  1867. }
  1868. ]]>
  1869. </script>
  1870. </button>
  1871. </xhtml:body>
  1872. </xhtml:html>