SPMMO33200.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. //SPMMO33200, SPMMO33400, SPMMO33400
  2. //화면 초기화 (진료과 정보 등을 조회)
  3. //flag(A:신청, R:도착, E:종료, P:결재/접수, S:집계, T:통계조회)
  4. var xSortCol = -1;
  5. var xSortType = "";
  6. function fInitOnCall(flag){
  7. model.setValue("/root/main/cond/condflag", flag);
  8. if( flag == "P" ){ //결재(접수) 화면
  9. model.setValue("/root/main/cond/condkind", "R");
  10. model.setValue("/root/main/cond/condacpt", "-");
  11. model.setValue("/root/main/cond/sortkind", "D");
  12. model.setValue("/root/main/cond/patflagcd", "-");
  13. fInitMngtOnCall(flag);
  14. fGetAfterOnCallList();
  15. }else if( flag == "S" ){ //집계 화면
  16. fInitMngtOnCall(flag);
  17. fGetSumOnCallList();
  18. var DayOfWeek = model.getValue("/root/main/oncalllist/month/day");
  19. if(!isNull(DayOfWeek)){
  20. grd_oncalllist.caption = "구분^calldeptcd^진료과^성명^사번^01^02^03^04^05^06^07^08^09^10^11^12^13^14^15^16^17^18^19^20^21^22^23^24^25^26^27^28^29^30^31|구분^calldeptcd^진료과^성명^사번^" + DayOfWeek;
  21. grd_oncalllist.refresh();
  22. }
  23. }else if( flag == "T" ){ //통계조회 화면
  24. fInitMngtOnCall(flag);
  25. fGetStatsOnCallList()
  26. }else if( flag == "V" ){ //통계조회 화면
  27. //fGetStatsOnCallList()
  28. //call 진료과 리스트를 조회;
  29. mmbfGetDeptCodeComboList("/root/send/reqdata", "/root/init/orddept" , "D");
  30. fInitMngtOnCall(flag);
  31. }else{ //신청-도착-완료 화면
  32. //call 진료과 리스트를 조회
  33. mmbfGetDeptCodeComboList("/root/send/reqdata", "/root/init/orddept" , "D");
  34. //각 화면의 초기화
  35. if( flag == "A" ){
  36. fInitAppOnCall();
  37. model.setValue("/root/main/oncallinfo/patflagcd", getScreenMenuParameter());
  38. }else{
  39. fInitMngtOnCall(flag);
  40. }
  41. //환자별 신청내역 조회
  42. fGetOnCallList();
  43. }
  44. model.refresh();
  45. }
  46. //신청화면 초기화
  47. function fInitAppOnCall(){
  48. //로그인한 사용자 정보
  49. var userid = getUserInfo("userid");
  50. var dutplcecd = getUserInfo("dutplcecd");
  51. model.setValue("/root/main/userinfo/orddrid" , userid);
  52. model.setValue("/root/main/userinfo/orddeptcd", dutplcecd);
  53. model.setValue("/root/main/userinfo/orddrnm" , getUserInfo("usernm"));
  54. model.setValue("/root/main/userinfo/orddeptnm", getUserInfo("dutplcenm"));
  55. model.setValue("/root/main/userinfo/mpphonno" , getUserInfo("mpphonno"));
  56. model.setValue("/root/main/userinfo/pdano" , getUserInfo("pdano"));
  57. //신청자 정보
  58. model.setValue("/root/main/oncallinfo/apporddrid" , userid);
  59. model.setValue("/root/main/oncallinfo/appdeptcd" , dutplcecd);
  60. model.setValue("/root/main/oncallinfo/appmpphonno", model.getValue("/root/main/userinfo/mpphonno"));
  61. //상단 환자정보
  62. var pid = getPatientInfo("pid");
  63. if( !isNull(pid) ){
  64. model.setValue("/root/main/oncallinfo/pid" , pid);
  65. model.setValue("/root/main/oncallinfo/hngnm" , getPatientInfo("pname"));
  66. //model.setValue("/root/main/oncallinfo/rrgstno", getPatientInfoDetail("rrgstno1") + "-" + getPatientInfoDetail("rrgstno2"));
  67. model.setValue("/root/main/cond/condpid" , pid);
  68. }else{
  69. model.setValue("/root/main/cond/condpid" , "-");
  70. }
  71. }
  72. //신청화면 초기화
  73. function fInitMngtOnCall(flag){
  74. var curDD = getCurrentDate();
  75. if( flag == "S" ){
  76. model.setValue("/root/main/cond/basemm" , curDD.substring(0,6)); //집계화면은 조회월 초기화
  77. }else if( flag == "T" ){
  78. model.setValue("/root/main/cond/fromdd" , getNewDate().getAddDate(-1, "M").getDateFormat("YYYYMMDD"));
  79. model.setValue("/root/main/cond/todd" , curDD);
  80. }else{
  81. model.setValue("/root/main/cond/fromdd" , curDD);
  82. model.setValue("/root/main/cond/todd" , curDD);
  83. }
  84. if( flag == "R" ){
  85. model.setValue("/root/main/cond/codnstat" , "A"); //도착화면은 신청내역 조회
  86. model.setValue("/root/main/oncallinfo/arvdd", curDD);
  87. }else if( flag == "E" ){
  88. model.setValue("/root/main/cond/codnstat" , "R"); //완료화면은 도착내역 조회
  89. model.setValue("/root/main/oncallinfo/enddd", curDD);
  90. }
  91. if( flag == "P" ) { // 온콜 내역화면
  92. if(fContainsHardCD("490", getUserInfo( "dutplcecd" ))) { // 저장버튼 활성화 부서
  93. btn_save.disabled = false;
  94. } else {
  95. btn_save.disabled = true;
  96. }
  97. }
  98. }
  99. //진료과 선택 시 해당과 진료의 리스트를 조회한다.
  100. function fGetOrdDrList(){
  101. cmb_orddept.refresh();
  102. model.setValue("/root/main/oncallinfo/calldeptnm", cmb_orddept.label);
  103. mmbfGetUserComboList("/root/send/reqdata", "/root/init/userlist" , cmb_orddept.value, "0330", "", "M");
  104. model.refresh();
  105. }
  106. function fGetOrdDrList1(retValue){
  107. mmbfGetUserComboList("/root/send/reqdata", "/root/init/userlist" , retValue, "0330", "", "M");
  108. model.refresh();
  109. }
  110. //On Call 리스트 중 선택한 정보를 화면에 display한다.
  111. function fGetOnCallInfo(flag){
  112. var iRow = grd_oncalllist.row;
  113. if(iRow <= 0 ) return;
  114. model.copyNode("/root/main/oncallinfo", "/root/main/oncalllist/info["+iRow+"]");
  115. fGetOrdDrList();
  116. if(flag == "R"){
  117. }else if(flag == "R"){
  118. var curDD = getCurrentDate();
  119. var curTM = getCurrentTime();
  120. if( model.getValue("/root/main/oncallinfo/arvdd") == "00000000" ){
  121. model.setValue("/root/main/oncallinfo/arvdd", curDD);
  122. }
  123. if( model.getValue("/root/main/oncallinfo/arvtm") == "000000" || model.getValue("/root/main/oncallinfo/arvtm") == "0000" ){
  124. model.setValue("/root/main/oncallinfo/arvtm", curTM);
  125. }
  126. }else if(flag == "E"){
  127. var curDD = getCurrentDate();
  128. var curTM = getCurrentTime();
  129. if( model.getValue("/root/main/oncallinfo/enddd") == "00000000" ){
  130. model.setValue("/root/main/oncallinfo/enddd", curDD);
  131. }
  132. if( model.getValue("/root/main/oncallinfo/endtm") == "000000" || model.getValue("/root/main/oncallinfo/endtm") == "0000" ){
  133. model.setValue("/root/main/oncallinfo/endtm", curTM);
  134. }
  135. }
  136. model.refresh();
  137. }
  138. //On Call 정보를 저장한다.
  139. //flag(A:신청, R:도착, E:종료, P:결재/접수, S:집계)
  140. function fSaveOnCallInfo(flag){
  141. if( flag == "P" ){
  142. copyNodeType("/root/send/savedata", "/root/main/oncalllist", "replace");
  143. }else{
  144. var appSeq = model.getValue("/root/main/oncallinfo/appseq");
  145. var statCd = model.getValue("/root/main/oncallinfo/statcd");
  146. var acptYn = model.getValue("/root/main/oncallinfo/acptyn");
  147. if(acptYn == "Y"){
  148. messageBox("결재가 완료되어 수정할 수 없습니다","I");
  149. return;
  150. }
  151. //필수값 체크 (신청 화면)
  152. if( flag == "A" ){
  153. if ( ! isRequiredControls("ipt_pid", "ipt_hngnm", "ipt_appmpphonno", "rdo_patflagcd", "cmb_orddept", "cmb_orddr") ) return false;
  154. model.setValue("/root/main/oncallinfo/statcd" , "A");
  155. if( isNull(appSeq) ){
  156. model.setValue("/root/main/oncallinfo/saveflag", "I");
  157. }else{
  158. model.setValue("/root/main/oncallinfo/saveflag", "U");
  159. }
  160. } else if( flag == "R" ){ //필수값 체크 (도착 화면)
  161. if(isNull(model.getValue("/root/main/oncallinfo/appseq"))){
  162. messageBox("신청내역을 선택하십시오.","I");
  163. return;
  164. }
  165. if ( ! isRequiredControls("ipt_arvdd", "ipt_arvtm") ) return false;
  166. var sCurrentDate = getCurrentDate();
  167. var appdt = model.getValue("/root/main/oncallinfo/appdt");
  168. var arvdd = model.getValue("/root/main/oncallinfo/arvdd");
  169. var arvtm = model.getValue("/root/main/oncallinfo/arvtm");
  170. if(arvdd == "00000000"){
  171. messageBox("도착일자를 정확히 입력하십시오.","I");
  172. return;
  173. }
  174. if( arvtm.getByteLength() < 4 ){
  175. messageBox("도착시간을 4자리 이상 입력하십시오.","I");
  176. return;
  177. }else{
  178. arvtm = arvtm.getRightPad(6, "0");
  179. }
  180. if( statCd == "" || statCd == "E" ){
  181. messageBox("수정할 수 없는 상태입니다.","I");
  182. return;
  183. }
  184. if(appdt.substr(0,6) != sCurrentDate.substr(0,6)) { // 이전달 신청내용은 이번달 5일까지만 수정 가능 하도록 요청번호 20150707019 2015.07.20 엄영만
  185. if(sCurrentDate.substr(0,6) + "05" < sCurrentDate) {
  186. messageBox("이전달 신청항목은 이번달 5일이후 수정이 불가능 합니다","E");
  187. return;
  188. }
  189. }
  190. //도착시간에 대한 수정하는 경우, 권한과 시간 체크
  191. if( model.getValue("/root/main/oncallinfo/endrgstdt") != "00000000000000" && getUserInfo("dutplcecd") != "3310000000" && getUserInfo("userid") != model.getValue("/root/main/oncallinfo/calldrid")){ //진료행정팀이나 진료의가 아닌 경우
  192. messageBox("해당 진료의가 아니면 수정 불가능합니다.","I");
  193. return;
  194. }
  195. model.setValue("/root/main/oncallinfo/arvdt" , arvdd + arvtm);
  196. model.setValue("/root/main/oncallinfo/saveflag", "U");
  197. model.setValue("/root/main/oncallinfo/statcd" , "R");
  198. }
  199. else if( flag == "E"
  200. ){ //필수값 체크 (종료 화면)
  201. if(isNull(model.getValue("/root/main/oncallinfo/appseq"))){
  202. messageBox("신청내역을 선택하십시오.","I");
  203. return;
  204. }
  205. if ( ! isRequiredControls("ipt_arvdd", "ipt_arvtm", "ipt_enddd", "ipt_endtm") ) return false;
  206. var sCurrentDate = getCurrentDate();
  207. var appdt = model.getValue("/root/main/oncallinfo/appdt");
  208. var arvdd = model.getValue("/root/main/oncallinfo/arvdd");
  209. var arvtm = model.getValue("/root/main/oncallinfo/arvtm");
  210. var enddd = model.getValue("/root/main/oncallinfo/enddd");
  211. var endtm = model.getValue("/root/main/oncallinfo/endtm");
  212. var checkyn = model.getValue("/root/main/oncallinfo/checkyn");
  213. var checkynetc = model.getValue("/root/main/oncallinfo/checkynetc");
  214. if( arvdd.getByteLength() < 6){
  215. messageBox("도착시간을 6자리 이상 입력하십시오.","I");
  216. return;
  217. }
  218. if( arvtm.getByteLength() < 4 ){
  219. messageBox("도착시간을 4자리 이상 입력하십시오.","I");
  220. return;
  221. }else{
  222. arvtm = arvtm.getRightPad(6, "0");
  223. }
  224. if(enddd == "00000000"){
  225. messageBox("완료일자를 정확히 입력하십시오.","I");
  226. return;
  227. }
  228. if( endtm.getByteLength() < 4 ){
  229. messageBox("완료시간을 4자리 이상 입력하십시오.","I");
  230. return;
  231. }else{
  232. endtm = endtm.getRightPad(6, "0");
  233. }
  234. if( statCd == "" || statCd == "A" ){
  235. messageBox("완료할 수 없는 상태입니다.","I");
  236. return;
  237. }
  238. //201711001 이돈희 추가 : 이순희선생님 요청으로 칠곡인 경우 비활성화
  239. var instcd = getUserInfo("dutplceinstcd");
  240. if(instcd == "031")
  241. {
  242. //20171030 이돈희 추가 : 완료시간이 도착시간보다 이전일인 경우 저장 안됨(요청번호 : 20171016008)
  243. if((arvdd+arvtm)>(enddd+endtm))
  244. {
  245. messageBox("완료시간은 도착시간보다 미래시간을 입력하십시오.", "I");
  246. return;
  247. }
  248. //20171031 이돈희 추가
  249. //이순희 선생님 요청사항 : 작성여부의 수술기록(1), 시술기록(2), 경과기록(3), 마취기록(4), 기타(5) 중
  250. // 체크된것이 있는 경우 저장 가능
  251. if(isNull(checkyn))
  252. {
  253. messageBox("작성여부를 체크하여 주십시오.", "I");
  254. return;
  255. }
  256. //20171101 이돈희 추가
  257. //이순희 선생님 요청사항 : 작성여부의 기타(5)가 체크된 경우 기타 에디트가 작성안된 경우 저장 안되도록 수정
  258. if(checkyn.indexOf("5") != -1)
  259. {
  260. if(isNull(checkynetc))
  261. {
  262. messageBox("작성여부의 기타란을 작성하여 주십시오.", "I");
  263. return;
  264. }
  265. }
  266. }
  267. if(appdt.substr(0,6) != sCurrentDate.substr(0,6)) { // 이전달 신청내용은 이번달 5일까지만 수정 가능 하도록 요청번호 20150707019 2015.07.20 엄영만
  268. if(sCurrentDate.substr(0,6) + "05" < sCurrentDate) {
  269. messageBox("이전달 신청항목은 이번달 5일이후 수정이 불가능 합니다","E");
  270. return;
  271. }
  272. }
  273. //완료시간에 대한 수정하는 경우, 권한과 시간 체크
  274. if( model.getValue("/root/main/oncallinfo/endrgstdt") != "00000000000000" && getUserInfo("dutplcecd") != "3310000000" && getUserInfo("userid") != model.getValue("/root/main/oncallinfo/calldrid")){ //진료행정팀이나 진료의가 아닌 경우
  275. messageBox("해당 진료의가 아니면 수정 불가능합니다.","I");
  276. return;
  277. }
  278. model.setValue("/root/main/oncallinfo/arvdt" , arvdd + arvtm);
  279. model.setValue("/root/main/oncallinfo/enddt" , enddd + endtm);
  280. model.setValue("/root/main/oncallinfo/saveflag", "U");
  281. model.setValue("/root/main/oncallinfo/statcd" , "E");
  282. } else if( flag == "X" ){ // 삭제처리
  283. if(isNull(model.getValue("/root/main/oncallinfo/appseq"))){
  284. messageBox("삭제 내역을 선택하십시오.","I");
  285. return;
  286. }
  287. if( statCd == "" || statCd == "A" ){
  288. messageBox("도착 또는 완료 상태일때만 삭제가 가능 합니다.","I");
  289. return;
  290. }
  291. //완료시간에 대한 수정하는 경우, 권한과 시간 체크
  292. if( getUserInfo("dutplcecd") != "3310000000" && getUserInfo("userid") != model.getValue("/root/main/oncallinfo/calldrid")){ //진료행정팀이나 진료의가 아닌 경우
  293. messageBox("해당 진료의가 아니면 삭제 불가능합니다.","I");
  294. return;
  295. }
  296. if ( messageBox ( "삭제 하시겠습니까?","Q") != "6" ) {
  297. return ;
  298. }
  299. model.setValue("/root/main/oncallinfo/arvdt" , "");
  300. model.setValue("/root/main/oncallinfo/enddt" , "");
  301. model.setValue("/root/main/oncallinfo/saveflag", "D");
  302. model.setValue("/root/main/oncallinfo/statcd" , "X");
  303. }
  304. model.copyNode("/root/send/savedata", "/root/main/oncallinfo");
  305. } //end else
  306. model.removeNode("/root/send/reqdata");
  307. model.makeNode("/root/send/reqdata");
  308. model.copyNode("/root/send/reqdata", "/root/main/cond");
  309. //저장
  310. if( submit("TXMMO33201", false) ){
  311. //신청 후에 메세지 보여줌
  312. if( flag == "A" ){
  313. if(model.getValue("/root/main/oncallinfo/sendsmsyn") == "Y") {
  314. mpphonno = model.getValue("/root/temp/callinfo/info/mpphonno");
  315. messageBox( mpphonno + " 번호로 SMS 전송되었습니다." ,"I");
  316. } else {
  317. messageBox("저장 되었습니다." ,"I");
  318. }
  319. } else if ( flag == "X" ){
  320. model.resetInstanceNode("/root/main/oncallinfo");
  321. }
  322. /*
  323. if( flag == "E" ){
  324. fGetOnCallList();
  325. }
  326. */
  327. model.refresh();
  328. }else{
  329. model.setValue("/root/main/oncallinfo/saveflag", "I");
  330. }
  331. }
  332. //환자별 OnCall 리스트를 조회한다.
  333. //fromdd:기간 시작일자, todd:기간 종료일자, condstat:환자상태 조건
  334. function fGetOnCallList(){
  335. submit("TRMMO33201");
  336. }
  337. //등록기간/시작시간 기준 OnCall 전체 리스트를 조회한다.
  338. function fGetAfterOnCallList(){
  339. submit("TRMMO33501");
  340. }
  341. //월별 On Call 수당지급내역을 조회한다.
  342. //fromdd:기간 시작일자, todd:기간 종료일자, condstat:환자상태 조건
  343. function fGetSumOnCallList(){
  344. submit("TRMMO33601");
  345. }
  346. //월별 On Call 수당을 집계한다.
  347. function fSaveSumOnCall(){
  348. if( submit("TXMMO33601") ){
  349. alert("집계가 완료되었습니다.");
  350. }
  351. }
  352. //월별 직급별 On Call 통계를 조회한다.
  353. function fGetStatsOnCallList(){
  354. submit("TRMMO33701");
  355. }
  356. /**
  357. * 환자기본정보 조회
  358. * @param
  359. * pid : 등록번호
  360. * stnddd : 기준일자
  361. */
  362. function fGetPatBaseInfo(){
  363. var pid = ipt_pid.currentText;
  364. model.setValue("/root/main/oncallinfo/pid", pid);
  365. if(submit("TRMMO33202")){
  366. if(!isNull(pid)){
  367. model.setValue("/root/main/oncallinfo/pid" , pid);
  368. model.setValue("/root/main/oncallinfo/hngnm" , model.getValue("/root/temp/patinfo/info/hngnm"));
  369. //model.setValue("/root/main/oncallinfo/rrgstno", model.getValue("/root/temp/patinfo/info/rrgstno"));
  370. model.refresh();
  371. model.setValue("/root/main/cond/condpid" , pid);
  372. fGetOnCallList();
  373. }else{
  374. model.setValue("/root/main/oncallinfo/pid" , "");
  375. model.setValue("/root/main/oncallinfo/hngnm" , "");
  376. //model.setValue("/root/main/oncallinfo/rrgstno", "");
  377. }
  378. }
  379. }
  380. function fGetUserCallInfo(){
  381. //model.removeNode("/root/send/reqdata");
  382. //model.makeNode("/root/send/reqdata");
  383. //model.makeValue("/root/send/reqdata/calldrid", model.getValue("/root/main/oncallinfo/calldrid"));
  384. model.setValue("/root/main/oncallinfo/calldrnm", cmb_orddr.label);
  385. if(submit("TRMMO33203")){
  386. }
  387. }