transfusion.js 98 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394
  1. "use strict";
  2. /**
  3. * mplus_safety_bleeding
  4. * 2020.02.06
  5. */
  6. var mplus_transfusion = function() {
  7. // 상속
  8. mplus_common.call(this);
  9. var self = this;
  10. /* Fatima 전역 변수 */
  11. var bloodArr = []; // API 호출 lists 를 담는 List
  12. var patientArr = []; // 환자 정보 List
  13. var executionDtTm = self.util.toDatetimeFatima2(new Date());
  14. var selectItem = []; // 선택된 아이템 정보
  15. // 인증저장 완료 후 초기화 필요함
  16. var doctorInfo = []; // 시작 및 간호사 정보
  17. var failedArr = []; // 마지막 활력징후 API 에서 실패한 데이터
  18. var successArr = []; // 마지막 활력징후 API 에서 성공한 데이터
  19. var xmlDataArr = []; // native Callback XML 데이터 저장
  20. var signDataArr = []; // native Callback 인증 데이터 저장
  21. var certXml = ""; // toNative 로 던져주기 위한 Xml String
  22. var maxIndex = 0;
  23. this.maxLengthCheck = function(object){
  24. if (object.value.length > object.maxLength){
  25. object.value = object.value.slice(0, object.maxLength);
  26. }
  27. if (object.id == "inputTemperature" && object.value.length == 2) {
  28. $("#inputTemperatureSub").focus();
  29. }
  30. if (object.id == "inputTemperature2" && object.value.length == 2) {
  31. $("#inputTemperatureSub2").focus();
  32. }
  33. if (object.id == "inputTemperature3" && object.value.length == 2) {
  34. $("#inputTemperatureSub3").focus();
  35. }
  36. if (object.id == "inputTemperatureSub" && object.value.length == 1) {
  37. $("#inputSbp").focus();
  38. }
  39. if (object.id == "inputTemperatureSub2" && object.value.length == 1) {
  40. $("#inputSbp2").focus();
  41. }
  42. if (object.id == "inputTemperatureSub3" && object.value.length == 1) {
  43. $("#inputSbp3").focus();
  44. }
  45. if (object.id == "nfcDoctorId1" && object.value.length == 6) {
  46. var doctorId = String($("#nfcDoctorId1").val()).padStart(6, "0");
  47. var type = "first";
  48. if ($("#nfcDoctorId2").val() == "" || $("#nfcDoctorId2").val() == null) {
  49. getDoctorId(doctorId, type);
  50. } else {
  51. if ($("#nfcDoctorId2").val() == $("#nfcDoctorId1").val()) {
  52. alert("의료진은 중복으로 입력될 수 없습니다.");
  53. $("#nfcDoctorId1").val("");
  54. } else {
  55. getDoctorId(doctorId, type);
  56. }
  57. }
  58. }
  59. if (object.id == "nfcDoctorId2" && object.value.length == 6) {
  60. var doctorId = String($("#nfcDoctorId2").val()).padStart(6, "0");
  61. var type = "second";
  62. if ($("#nfcDoctorId1").val() == "" || $("#nfcDoctorId1").val() == null) {
  63. getDoctorId(doctorId, type);
  64. }
  65. else {
  66. if ($("#nfcDoctorId2").val() == $("#nfcDoctorId1").val()) {
  67. alert("의료진은 중복으로 입력될 수 없습니다.");
  68. $("#nfcDoctorId2").val("");
  69. }
  70. else {
  71. getDoctorId(doctorId, type);
  72. }
  73. }
  74. }
  75. };
  76. /* Fatima 전역 변수 */
  77. /**
  78. * 초기화
  79. */
  80. this.init = function() {
  81. localStorage.removeItem("defaultHomePage");
  82. localStorage.setItem("defaultHomePage", "transfusion");
  83. // 초기 화면 조건 구성
  84. initCondition();
  85. // 이벤트 초기화
  86. addEvent();
  87. $("#txtTransFusionSearch").focus();
  88. };
  89. //==== 초기화 설정 { ====
  90. var initCondition = function() {
  91. // 초기 화면 조건 구성
  92. //환자정보 초기화
  93. initPatientInfo();
  94. };
  95. /**
  96. * 2020.02.06
  97. * 수혈 환자 정보 초기화
  98. */
  99. var initPatientInfo = function() {
  100. $(".patient-name").text("환자명");
  101. $(".patient-gender-age").text("성별/나이");
  102. $(".patient-birthDt").text("생년월일");
  103. $("#patientInfo").text("성별/나이");
  104. $(".dept-name").text("실시부서");
  105. $(".user-name").text("실시자명");
  106. $(".user-code").text("(사원번호)");
  107. $(".patient-name button").attr("style", "display: none");
  108. };
  109. var initList = function() {
  110. $("#bloodListGroup").empty();
  111. $("#scanBarcodeGroup").attr("style", "display: ;");
  112. $("#bloodDetail").attr("style", "display: none;");
  113. }
  114. function initLayout() {
  115. $("#inputPulse").val("");
  116. $("#inputRespiration").val("");
  117. $("#inputTemperature").val("");
  118. $("#inputTemperatureSub").val("");
  119. $("#inputSbp").val("");
  120. $("#inputDbp").val("");
  121. $("#inputPulse2").val("");
  122. $("#inputRespiration2").val("");
  123. $("#inputTemperature2").val("");
  124. $("#inputTemperatureSub2").val("");
  125. $("#inputSbp2").val("");
  126. $("#inputDbp2").val("");
  127. $(".modal-body.pt-4.pb-4").children().remove();
  128. $("#inputPulse3").val("");
  129. $("#inputRespiration3").val("");
  130. $("#inputTemperature3").val("");
  131. $("#inputTemperatureSub3").val("");
  132. $("#inputSbp3").val("");
  133. $("#inputDbp3").val("");
  134. }
  135. /**
  136. *
  137. * 환자 기본정보 호출
  138. * @param {*} patientId 입력받은 환자번호
  139. * @param {*} isSecondTrial 두 번째 호출 여부
  140. */
  141. var getPocPatientInfo = function(patientId, isSecondTrial) {
  142. var param = {
  143. hospitalCd: localStorage.getItem("hospitalCd"),
  144. userId: gLoginUserId,
  145. patientId: patientId,
  146. isSecondTrial: isSecondTrial
  147. };
  148. self.safety.getPocPatientInfo(param, patientId, isSecondTrial, processGetPocPatientInfo);
  149. };
  150. /**
  151. * 호출된 기본정보를 화면에 매핑
  152. * @param {*} lists API 호출 후 반환되는 처방정보
  153. * @param {*} barPid 입력받은 환자번호
  154. * @param {*} isSecondTrial 2 번째 호출 여부
  155. */
  156. var processGetPocPatientInfo = function(lists, barPid, isSecondTrial) {
  157. patientArr = [];
  158. if(self.util.isEmpty(lists) || lists.length == 0){
  159. initPatientInfo();
  160. initList();
  161. $("#Modal01 .modal-body h4").text("환자정보 조회 실패");
  162. $("#Modal01 .modal-body p").text("환자정보 조회에 실패하였습니다.");
  163. $("#Modal01").modal("show");
  164. $('#txtTransFusionSearch').blur();
  165. return;
  166. }
  167. // 1. 만일 환자 정보가 맞다면 환자 정보를 보여준다.
  168. if (barPid == lists[0].patientId) {
  169. patientArr = lists;
  170. $(".patient-name").text(lists[0].patientNm);
  171. $("#patientInfo").text(lists[0].age + "/" + lists[0].gender + " " + lists[0].roomNm + "호");
  172. $(".patient-birthDt").text(lists[0].birthDt);
  173. $(".dept-name").text(localStorage.getItem("selectedDeptNm"));
  174. $(".user-name").text(gLoginUserNm);
  175. $(".user-code").text("(" + gLoginUserId + ")");
  176. $(".patient-name").append("<button type=\"button\" class=\"btn btn-blood\">" + lists[0].bloodType + "</button>");
  177. var summaryCd = lists[0].patientSummaryCd.split(",");
  178. var spanTag = "";
  179. for (var i = 0; i < summaryCd.length; i++) {
  180. var sCd = summaryCd[i];
  181. if (sCd == "!") {
  182. sCd = "t";
  183. } else if (sCd == "₩") {
  184. sCd = "w";
  185. }
  186. spanTag = "<span class=\"glyphicon ico ico_" + sCd.toLowerCase() + " align-middle\" aria-hidden=\"true\"></span>"
  187. $("#patientInfo").append(spanTag);
  188. }
  189. getBloodCheckList(false);
  190. }
  191. // 2. 환자 정보가 맞지 않으면
  192. else {
  193. // 2.1 2번째 호출이 아니면 다시 환자 정보 조회
  194. if (!isSecondTrial) {
  195. getPocPatientInfo(barPid, true);
  196. }
  197. // 2.2 2번째 호출이면 Alert
  198. else {
  199. initPatientInfo();
  200. initList();
  201. $("#Modal01 .modal-body h4").text("환자정보 조회 실패");
  202. $("#Modal01 .modal-body p").text("시스템 이용량이 많습니다. 다시 조회해 주세요.");
  203. $("#Modal01").modal("show");
  204. }
  205. }
  206. }
  207. /**
  208. * 바코드 콜백
  209. */
  210. this.barcodeCallback = function(data) {
  211. var result = "";
  212. // null 이라면 반환
  213. if(self.util.isEmpty(data)){
  214. return;
  215. }
  216. else{
  217. result = self.util.decodeBarcode(data);
  218. }
  219. if(self.util.isEmpty(result) || result.type == 'errBarcode'){
  220. $("#txtTransFusionSearch").blur();
  221. $("#Modal01 .modal-body h4").text("수혈실시 바코드가 아닙니다.");
  222. $("#Modal01 .modal-body p").text("바코드를 다시 확인해주세요.");
  223. $("#Modal01").modal("show");
  224. return;
  225. }
  226. else if (result.type == 'pid') {
  227. var patientId = result.data;
  228. $("#txtTransFusionSearch").val(patientId)
  229. getPocPatientInfo(patientId, false);
  230. $("#btnTransFusionSearch").removeClass("btn-secondary").addClass("btn-primary");
  231. $("#txtTransFusionSearch").blur();
  232. }
  233. else if (result.type == "medicine") {
  234. $("#txtTransFusionSearch").blur();
  235. if (patientArr.length == 0) {
  236. $("#Modal01 .modal-body h4").text("환자 정보가 없습니다.");
  237. $("#Modal01 .modal-body p").text("환자 조회를 해주세요.");
  238. $("#Modal01").modal("show");
  239. return;
  240. }
  241. var foundCnt = 0;
  242. for(var idx = 0; idx < bloodArr.length; idx++){
  243. if(bloodArr[idx].prescriptionNo == result.data.replace("B", "")){
  244. // console.log("label[for='checkBloodSel_" + idx + "']");
  245. var labelObj = $("label[for='checkBloodSel_" + idx + "']");
  246. labelObj.attr('class', 'btn btn-barcode icon');
  247. var iptObj = $('input:checkbox[id="checkBloodSel_' + idx + '"]');
  248. iptObj.prop('checked', true);
  249. var li = $('li[id="listGroupItem_' + idx + '"]');
  250. li.addClass("active");
  251. foundCnt++;
  252. }
  253. }
  254. if(foundCnt == 0){
  255. $("#Modal01 .modal-body h4").text("실시할 수 없는 수혈 바코드 입니다.");
  256. $("#Modal01 .modal-body p").text("");
  257. $("#Modal01").modal("show");
  258. }
  259. }
  260. else{
  261. $("#txtTransFusionSearch").blur();
  262. $("#Modal01 .modal-body h4").text("수혈실시 바코드가 아닙니다.");
  263. $("#Modal01 .modal-body p").text("바코드를 다시 확인해주세요.");
  264. $("#Modal01").modal("show");
  265. }
  266. };
  267. /**
  268. * 혈액내역정보 리스트 호출
  269. * @param {*} isSecondTrial 두 번째 호출여부
  270. */
  271. var getBloodCheckList = function(isSecondTrial) {
  272. var param = {
  273. hospitalCd: localStorage.getItem("hospitalCd"),
  274. userId : gLoginUserId,
  275. patientId: $("#txtTransFusionSearch").val(),
  276. isSecondTrial: isSecondTrial
  277. };
  278. self.safety.getBloodCheckList(param, isSecondTrial, processGetBloodCheckList);
  279. }
  280. /**
  281. * 혈액내역정보 호출된 리스트 매핑
  282. * @param {*} isSecondTrial 2번째 호출 여부
  283. * @param {*} lists API 반환 데이터
  284. */
  285. var processGetBloodCheckList = function(isSecondTrial, lists) {
  286. console.log("bloodList -- > " + JSON.stringify(lists));
  287. bloodArr = [];
  288. var strListTemp = "";
  289. $("#bloodListGroup").empty();
  290. // 예외처리
  291. if(self.util.isEmpty(lists) || lists.length == 0){
  292. // $("#Modal01 .modal-body h4").text("수혈정보 조회");
  293. // $("#Modal01 .modal-body p").text("조회된 혈액정보가 없습니다.");
  294. // $("#Modal01").modal("show");
  295. return;
  296. }
  297. // 1. 기존 환자 ID와 반환되는 환자 ID가 일치하다면 정상적으로 실행
  298. if (patientArr[0].patientId == lists[0].patientId) {
  299. bloodArr = lists;
  300. $("#scanBarcodeGroup").attr("style", "display: none;");
  301. $("#bloodDetail").attr("style", "display: ");
  302. for (var i = 0; i < lists.length; i++) {
  303. var statusMapping = lists[i].bloodCheckupStatus;
  304. var bloodCheckupStatus = "";
  305. var prcpNm = "";
  306. var dTtm = "";
  307. if (lists[i].releaseDtTm == null || lists[i].releaseDtTm == "" || lists[i].releaseDtTm == undefined) {
  308. lists[i].releaseDtTm = "";
  309. }
  310. if (statusMapping == "00") {
  311. bloodCheckupStatus = "혈액불출";
  312. prcpNm = "불출일시";
  313. dTtm = (lists[i].releaseDtTm).substring(4, 6) + "-" + (lists[i].releaseDtTm).substring(6, 8) + "<br>" + (lists[i].releaseDtTm).substring(8, 10)
  314. + ":" + (lists[i].releaseDtTm).substring(10, 12);
  315. } else if (statusMapping == "01") {
  316. bloodCheckupStatus = "환자/혈액/의료진 확인";
  317. prcpNm = "불출일시";
  318. dTtm = (lists[i].releaseDtTm).substring(4, 6) + "-" + (lists[i].releaseDtTm).substring(6, 8) + "<br>" + (lists[i].releaseDtTm).substring(8, 10)
  319. + ":" + (lists[i].releaseDtTm).substring(10, 12);
  320. } else if (statusMapping == "02") {
  321. bloodCheckupStatus = "수혈안내동의";
  322. prcpNm = "승인일시";
  323. dTtm = (lists[i].approvalDtTm).substring(4, 6) + "-" + (lists[i].approvalDtTm).substring(6, 8) + "<br>" + (lists[i].approvalDtTm).substring(8, 10)
  324. + ":" + (lists[i].approvalDtTm).substring(10, 12);
  325. } else if (statusMapping == "03") {
  326. bloodCheckupStatus = "약물투여확인";
  327. prcpNm = "승인일시";
  328. dTtm = (lists[i].approvalDtTm).substring(4, 6) + "-" + (lists[i].approvalDtTm).substring(6, 8) + "<br>" + (lists[i].approvalDtTm).substring(8, 10)
  329. + ":" + (lists[i].approvalDtTm).substring(10, 12);
  330. } else if (statusMapping == "04") {
  331. bloodCheckupStatus = "활력징후 측정(15분후)";
  332. prcpNm = "수혈시작";
  333. dTtm = (lists[i].startDtTm).substring(4, 6) + "-" + (lists[i].startDtTm).substring(6, 8) + "<br>" + (lists[i].startDtTm).substring(8, 10)
  334. + ":" + (lists[i].startDtTm).substring(10, 12);
  335. } else if (statusMapping == "05") {
  336. bloodCheckupStatus = "활력징후 측정(수혈종료)";
  337. prcpNm = "수혈시작";
  338. dTtm = (lists[i].startDtTm).substring(4, 6) + "-" + (lists[i].startDtTm).substring(6, 8) + "<br>" + (lists[i].startDtTm).substring(8, 10)
  339. + ":" + (lists[i].startDtTm).substring(10, 12);
  340. } else {
  341. bloodCheckupStatus = "활력징후 측정(수혈종료)";
  342. prcpNm = "수혈시작";
  343. dTtm = (lists[i].startDtTm).substring(4, 6) + "-" + (lists[i].startDtTm).substring(6, 8) + "<br>" + (lists[i].startDtTm).substring(8, 10)
  344. + ":" + (lists[i].startDtTm).substring(10, 12);
  345. }
  346. strListTemp +=
  347. "<li class=\"list-group-item\" id=\"listGroupItem_" + i + "\">"
  348. + "<div class=\"row\">"
  349. // CheckBox 시작
  350. + "<div class=\"col-xs-2 text-center select_ico\">"
  351. + "<input type=\"checkbox\" class=\"checkClassBloodSel\" id=\"checkBloodSel_" + i + "\" autocomplete=\"off\"/>"
  352. + "<div class=\"group\">"
  353. + "<label class=\"btn btn-check icon\" for=\"checkBloodSel_" + i + "\" >"
  354. + "<span class=\"glyphicon glyphicon-ok\" aria-hidden=\"true\"></span>"
  355. + "</label>"
  356. + "<label class=\"btn btn-outline-check icon\" for=\"checkBloodSel_" + i + "\">"
  357. + "<span class=\"glyphicon\" aria-hidden=\"true\"></span>"
  358. + "</label>"
  359. + "</div>"
  360. + "</div>"
  361. // CheckBox 끝
  362. //혈액 정보(활력징후 시작시간 혈액형 혈액처방정보 출력
  363. + "<div class=\"col-xs-6\">"
  364. + "<p class=\"title\" id=statusSetting>" + bloodCheckupStatus + "</p>"
  365. + "<p class=\"blood\" id=prcpDdSetting>" + lists[i].bloodNo +"<span>&nbsp;</span><span class=\"btn btn-blood\">" + lists[i].bloodType + lists[i].bloodRhType + "</span></p>"
  366. + "<p>" + lists[i].bloodProduct + "</p>"
  367. + "</div>"
  368. //혈액 정보(활력징후 시작시간 혈액형 혈액처방정보 출력 끝
  369. //수혈 진행 상황 및 시간 출력
  370. + "<div class=\"col-xs-3 text-center align-middle blood\">"
  371. + "<span>" + prcpNm + "</span>"
  372. + "</br>"
  373. + "<span>" + dTtm + "</span>"
  374. + "</div>"
  375. //수혈 진행 상황 및 시간 출력
  376. // //리스트 오른쪽 버튼
  377. + "<div class=\"col-xs-1 text-muted text-right\" >"
  378. + "<h3>"
  379. + "<a href=\"#\" id=\"btnItemDetail_" + i + "\">"
  380. + "<span class=\"glyphicon glyphicon-option-vertical\" aria-hidden=\"true\" >"
  381. + "</span>"
  382. + "</a>"
  383. + "</h3>"
  384. + "</div>"
  385. // // 리스트 오른쪽 버튼
  386. + "</li>"
  387. + "</div>";
  388. }
  389. $("#bloodListGroup").append(strListTemp);
  390. openDetailModal();
  391. inputCheckedItem();
  392. inputListClick();
  393. // 2. 환자정보가 일치하지 않다면
  394. } else {
  395. // 2.1 첫번째 호출인가
  396. if (!isSecondTrial) {
  397. getBloodCheckList(true);
  398. // 2.2 두번째 호출인가
  399. } else {
  400. $("#Modal01 .modal-body h4").text("수혈정보 조회 오류");
  401. $("#Modal01 .modal-body p").text("시스템 이용량이 많습니다. 다시 조회해 주세요.");
  402. $("#Modal01").modal("show");
  403. }
  404. }
  405. }
  406. /**
  407. * 체크박스 선택 아이템
  408. */
  409. var inputCheckedItem = function() {
  410. // $("#bloodListGroup li input").off("click");
  411. $("#bloodListGroup li input").on("click", function() {
  412. var li = $(this).parent().parent().parent();
  413. var id = li.attr("id");
  414. var rowNum = id.split('_')[1];
  415. var checkBox = $("#checkBloodSel_" + rowNum);
  416. var firstLabel = checkBox.parent().children().children().eq(0);
  417. var secondLabel = checkBox.parent().children().children().eq(1);
  418. if (checkBox.is(":checked") == true) {
  419. li.toggleClass("active");
  420. } else {
  421. li.toggleClass("active");
  422. firstLabel.attr("class", "btn btn-check icon");
  423. secondLabel.attr("class", "btn btn-outline-check icon");
  424. }
  425. });
  426. };
  427. function openDetailModal() {
  428. $(".list-group li a").on("click", function () {
  429. var id = $(this).attr("id");
  430. var index = id.split("_")[1];
  431. var checkYn = "";
  432. var hospitalCd = localStorage.getItem("hospitalCd");
  433. var userId = gLoginUserId;
  434. var patientId = $("#txtTransFusionSearch").val();
  435. var prescriptionNo = bloodArr[index].prescriptionNo;
  436. var bloodNo = bloodArr[index].bloodNo;
  437. var bloodSeq = bloodArr[index].bloodSeq;
  438. var bloodProduct = bloodArr[index].bloodProduct;
  439. var param = {
  440. hospitalCd : hospitalCd ,
  441. userId : userId ,
  442. patientId : patientId ,
  443. prescriptionNo : prescriptionNo,
  444. bloodNo : bloodNo ,
  445. bloodSeq : bloodSeq ,
  446. bloodProduct : bloodProduct
  447. };
  448. self.safety.getBloodDetailInfo(param, index, bloodDetailInfoCallback);
  449. });
  450. }
  451. var bloodDetailInfoCallback = function(index, output) {
  452. $("#detailBloodSeq").attr("style", "display: none;");
  453. $("#detailBloodCheckupNm").attr("style", "display: none;");
  454. $("#detailBloodCheckupNm2").attr("style", "display: none;");
  455. $("#detailStartDtTm").attr("style", "display: none;");
  456. $("#detailBf").attr("style", "display: none;");
  457. $("#detail15").attr("style", "display: none;");
  458. if (output.length == 0) {
  459. $("#Modal01 .modal-body h4").text("수혈 상세정보가 없습니다.");
  460. $("#Modal01 .modal-body p").text("");
  461. $("#Modal01").modal("show");
  462. return;
  463. }
  464. else{
  465. if (bloodArr[index].prescriptionNo != output[0].prescriptionNo) {
  466. $("#Modal01 .modal-body h4").text("상세정보 조회 오류");
  467. $("#Modal01 .modal-body p").text("상세정보 조회에 실패하였습니다.");
  468. $("#Modal01").modal("show");
  469. return;
  470. }
  471. $("#ModalDetail").modal("show");
  472. var transBfDiastolicBp = output[0].transBfDiastolicBp == undefined ? "" : output[0].transBfDiastolicBp;
  473. var trans15DiastolicBp = output[0].trans15DiastolicBp == undefined ? "" : output[0].trans15DiastolicBp;
  474. var bloodSeq = output[0].bloodSeq == undefined ? "" : output[0].bloodSeq;
  475. var bloodType = output[0].bloodType == undefined ? "" : output[0].bloodType;
  476. var transBfSystolicBp = output[0].transBfSystolicBp == undefined ? "" : output[0].transBfSystolicBp;
  477. var transBfRespiration = output[0].transBfRespiration == undefined ? "" : output[0].transBfRespiration;
  478. var prcpHistNo = output[0].prcpHistNo == undefined ? "" : output[0].prcpHistNo;
  479. var transAfRespiration = output[0].transAfRespiration == undefined ? "" : output[0].transAfRespiration;
  480. var transBfBodytemperature = output[0].transBfBodytemperature == undefined ? "" : output[0].transBfBodytemperature;
  481. var ird = output[0].ird == undefined ? "" : output[0].ird;
  482. var trans15SystolicBp = output[0].trans15SystolicBp == undefined ? "" : output[0].trans15SystolicBp;
  483. var hospitalCd = output[0].hospitalCd == undefined ? "" : output[0].hospitalCd;
  484. var transAfDiastolicBp = output[0].transAfDiastolicBp == undefined ? "" : output[0].transAfDiastolicBp;
  485. var transAfSystolicBp = output[0].transAfSystolicBp == undefined ? "" : output[0].transAfSystolicBp;
  486. var transCheckupId2 = output[0].transCheckupId2 == undefined ? "" : output[0].transCheckupId2;
  487. var prcpDd = output[0].prcpDd == undefined ? "" : output[0].prcpDd;
  488. var transCheckupId1 = output[0].transCheckupId1 == undefined ? "" : output[0].transCheckupId1;
  489. var prcpNm = output[0].prcpNm == undefined ? "" : output[0].prcpNm;
  490. var approvalDtTm = output[0].approvalDtTm == undefined ? "" : output[0].approvalDtTm;
  491. var releaseDtTm = output[0].releaseDtTm == undefined ? "" : output[0].releaseDtTm;
  492. var prcpCd = output[0].prcpCd == undefined ? "" : output[0].prcpCd;
  493. var bloodNo = output[0].bloodNo == undefined ? "" : output[0].bloodNo;
  494. var startDtTm = output[0].startDtTm == undefined ? "" : output[0].startDtTm;
  495. var bloodProduct = output[0].bloodProduct == undefined ? "" : output[0].bloodProduct;
  496. var prescriptionNo = output[0].prescriptionNo == undefined ? "" : output[0].prescriptionNo;
  497. var transBfPulse = output[0].transBfPulse == undefined ? "" : output[0].transBfPulse;
  498. var trans15Bodytemperature = output[0].trans15Bodytemperature == undefined ? "" : output[0].trans15Bodytemperature;
  499. var receiveId = output[0].receiveId == undefined ? "" : output[0].receiveId;
  500. var transCheckupNm1 = output[0].transCheckupNm1 == undefined ? "" : output[0].transCheckupNm1;
  501. var transAfBodytemperature = output[0].transAfBodytemperature == undefined ? "" : output[0].transAfBodytempera;
  502. var receiveNm = output[0].receiveNm == undefined ? "" : output[0].receiveNm;
  503. var trans15Pulse = output[0].trans15Pulse == undefined ? "" : output[0].trans15Pulse;
  504. var transAfPulse = output[0].transAfPulse == undefined ? "" : output[0].transAfPulse;
  505. var trans15Respiration = output[0].trans15Respiration == undefined ? "" : output[0].trans15Respiration;
  506. var transCheckupNm2 = output[0].transCheckupNm2 == undefined ? "" : output[0].transCheckupNm2;
  507. var bloodRhType = output[0].bloodRhType == undefined ? "" : output[0].bloodRhType;
  508. var sideEffectNms = output[0].sideEffectNms == undefined? "" : output[0].sideEffectNms;
  509. var transStopYn = output[0].transStopYn == undefined? "" : output[0].transStopYn;
  510. var transStopReasonNm = output[0].transStopReasonNm == undefined? "" : output[0].transStopReasonNm;
  511. $("#bloodNo").text(bloodNo);
  512. $("#bloodProduct").text(prcpNm);
  513. $("#bloodType").text(bloodType+bloodRhType);
  514. $("#ird").text(ird);
  515. $("#bloodSeq").text(bloodSeq);
  516. $("#transCheckupNm1").text(transCheckupNm1);
  517. $("#transCheckupNm2").text(transCheckupNm2);
  518. $("#receiveNm").text(receiveNm);
  519. if (sideEffectNms == null || sideEffectNms == "" || sideEffectNms == undefined) {
  520. $("#detailSideEffect").attr("style", "display: none;");
  521. } else {
  522. // var sideEffectNm = sideEffectNms.replace(" /", ",");
  523. // sideEffectNm[0].substring(1);
  524. // $("#detailSideEffectNm").empty();
  525. // for (var i = 0; i < sideEffectNm.length; i++) {
  526. // $("#detailSideEffectNm").append("<p>" + sideEffectNm[i] +"</p>");
  527. // }
  528. // $("#detailSideEffect").attr("style", "display: ;");
  529. // }
  530. var sideEffectNm = sideEffectNms.substring(1);
  531. $("#detailSideEffectNm").empty();
  532. $("#detailSideEffectNm").append("<p>" + sideEffectNm +"</p>");
  533. $("#detailSideEffect").attr("style", "display: ;");
  534. }
  535. if (transStopYn == null || transStopYn == "" || transStopYn == undefined) {
  536. $("#detailTransYn").attr("style", "display: none;");
  537. $("#detailTransNm").attr("style", "display: none;");
  538. } else {
  539. $("#detailTransYn2").text(transStopYn);
  540. $("#detailTransYn").attr("style", "display: ;");
  541. if (transStopYn == "N") {
  542. $("#detailTransNm").attr("style", "display: none;");
  543. } else {
  544. var transStopReasonNms = transStopReasonNm.trim();
  545. $("#detailTransNms").empty();
  546. $("#detailTransNms").text(transStopReasonNms);
  547. $("#detailTransNm").attr("style", "display: ;");
  548. }
  549. }
  550. if (releaseDtTm != "") {
  551. $("#releaseDtTm").text(moment(fullDateParse(releaseDtTm)).format("YYYY-MM-DD HH:mm:ss"));
  552. }
  553. if (approvalDtTm != "") {
  554. $("#approvalDtTm").text(moment(fullDateParse(approvalDtTm)).format("YYYY-MM-DD HH:mm:ss"));
  555. }
  556. if (startDtTm != "") {
  557. $("#startDtTm").text(moment(dateParse(startDtTm)).format("YYYY-MM-DD HH:mm"));
  558. }
  559. if (!self.util.isEmpty(transBfPulse)) {
  560. $("#detailBloodSeq").attr("style", "display: ;");
  561. $("#detailBloodCheckupNm").attr("style", "display: ;");
  562. $("#detailBloodCheckupNm2").attr("style", "display: ;");
  563. $("#detailStartDtTm").attr("style", "display: ;");
  564. $("#detailBf").attr("style", "display: ;");
  565. }
  566. $("#transBfPulseRespiration").text("맥박 : " + transBfPulse + "회, " + "호흡 : " + transBfRespiration + "회");
  567. $("#transBfBodytemperature").text("체온 : " + transBfBodytemperature + ", 혈압 : " + transBfSystolicBp + " / " + transBfDiastolicBp);
  568. $("#trans15PulseRespiration").text("맥박 : " + trans15Pulse + "회, " + "호흡 : " + trans15Respiration + "회");
  569. $("#trans15Bodytemperature").text("체온 : " + trans15Bodytemperature + ", 혈압 : " + trans15SystolicBp + " / " + trans15DiastolicBp);
  570. if (self.util.isEmpty(trans15Pulse)) {
  571. $("#newBadge").attr("style", "display: none");
  572. } else {
  573. $("#newBadge").attr("style", "display: none");
  574. $("#detail15").attr("style", "display: ;");
  575. }
  576. }
  577. }
  578. /**
  579. * 리스트 아이템 선택 이벤트
  580. */
  581. var inputListClick = function () {
  582. // $("#bloodListGroup li").off("click");
  583. $("#bloodListGroup li").on("click", function(e) {
  584. if(e.target.localName != "input" && e.target.localName != "label" && e.target.localName != "span"){
  585. selectItem = [];
  586. var li = $(this);
  587. var id = li.attr("id");
  588. var input = li.children().children().children("input");
  589. var bloodCheckupStatus = [];
  590. bloodCheckupStatus.push(bloodArr[id.split("_")[1]].bloodCheckupStatus);
  591. var bCheckUpStatus = bloodArr[id.split("_")[1]].bloodCheckupStatus;
  592. input.prop("checked", true);
  593. li.addClass("active");
  594. var selectList = $('#bloodListGroup li[class="list-group-item active"] input');
  595. for (var i = 0; i < selectList.length; i++) {
  596. var _id = selectList[i].id.split("_")[1];
  597. var _bloodCheckupStatus = bloodArr[_id].bloodCheckupStatus;
  598. for (var j = 0; j < bloodCheckupStatus.length; j++) {
  599. if (_bloodCheckupStatus != bloodCheckupStatus[j]) {
  600. $("#Modal01 .modal-body h4").text("같은 단계의 혈액팩이 아닙니다.");
  601. $("#Modal01 .modal-body p").text("일괄처리를 할 수 없습니다.");
  602. $("#Modal01").modal("show");
  603. input.prop("checked", false);
  604. li.removeClass("active");
  605. return;
  606. }
  607. }
  608. selectItem.push(bloodArr[_id]);
  609. }
  610. if (bCheckUpStatus == "00") { // 혈액불출
  611. openStep2Modal();
  612. } else if (bCheckUpStatus == "04") { // 활력징후 측정(수혈전)
  613. openStep3Modal();
  614. } else if (bCheckUpStatus == "05") { // 활력징후 측정(15분후)
  615. openStep4Modal();
  616. } else if (bCheckUpStatus == "06") {
  617. openStep4Modal();
  618. }
  619. }
  620. });
  621. };
  622. function openStep2Modal() {
  623. $(".modal").modal("hide");
  624. $(".modal-backdrop").modal("hide");
  625. $("#step3").modal("show");
  626. var patientId = patientArr[0].patientId;
  627. var patientNm = patientArr[0].patientNm;
  628. var bloodType = patientArr[0].bloodType;
  629. var gender = patientArr[0].gender;
  630. var age = patientArr[0].age;
  631. var birthDt = moment(patientArr[0].birthDt).format("YYYY-MM-DD");
  632. var deptNm = localStorage.getItem("selectedDeptNm");
  633. var summaryCd = patientArr[0].patientSummaryCd.split(",");
  634. var wardNm = patientArr[0].wardNm;
  635. var roomNm = patientArr[0].roomNm;
  636. var bedNm = patientArr[0].bedNm;
  637. var inDd = patientArr[0].inDd;
  638. var doctorNm = patientArr[0].doctorNm;
  639. $(".h2PatientInfo").text(patientId + " " + patientNm);
  640. $(".h2PatientInfo").append("<span class=\"blood\">" + " " + bloodType +"</span>");
  641. $(".patientSexNAge").text(gender + "/" + age + " " + roomNm + "호");
  642. $(".userInfo").html("<strong>실시부서</strong> : " + deptNm +"<span class=\"px-1\">|</span>" + gLoginUserNm + "(" +gLoginUserId +")");
  643. $(".date span").eq(0).remove();
  644. $(".date").html("<span>" + self.util.toDatetimeFatima(new Date()) + "</span>");
  645. var spanTag = "";
  646. for (var i = 0; i < summaryCd.length; i++) {
  647. var sCd = summaryCd[i];
  648. if (sCd == "!") {
  649. sCd = "t";
  650. } else if (sCd == "₩") {
  651. sCd = "w";
  652. }
  653. spanTag = "<span class=\"glyphicon ico ico_" + sCd.toLowerCase() + " align-middle\" aria-hidden=\"true\"></span>"
  654. $(".patientSexNAge").append(spanTag);
  655. }
  656. $("#patientIdName2").text(patientId + " " + patientNm);
  657. $("#patientSexNAge2").text(gender + "/" + age + " " + birthDt);
  658. $("#blood2").text(bloodType);
  659. $("#wardInfo").text(wardNm + "/" + roomNm + "/" + bedNm);
  660. $("#inDd").text(moment(inDd).format("YYYY-MM-DD"));
  661. var collapseDiv = $("#collapse2 div[class=row]");
  662. var badgeCount = (selectItem.length -1);
  663. var badgeCountTag = "<span class=\"badge\"> + " + badgeCount +"</span>";
  664. $("#heading2 button[data-toggle=collapse] div[class=row]").children().eq(0).text(selectItem[0].bloodNo);
  665. $("#heading2 button[data-toggle=collapse] div[class=row]").children().eq(1).html(selectItem[0].prcpNm + (badgeCount > 0 ? badgeCountTag : ""));
  666. collapseDiv.children().remove();
  667. var divItem = "";
  668. for (var i = 1; i < selectItem.length; i++) {
  669. divItem = "<div class=\"col-xs-4\">"+ selectItem[i].bloodNo + "</div>"
  670. + "<div class=\"col-xs-8\">" + selectItem[i].prcpNm + "</div>";
  671. collapseDiv.append(divItem);
  672. }
  673. $("#nfcDoctorName1").text("");
  674. $("#nfcDoctorId1").val("");
  675. $("#checkUpDoctorId1").remove();
  676. $("#nfcDoctorName2").text("");
  677. $("#nfcDoctorId2").val("");
  678. $("#checkUpDoctorId2").remove();
  679. $("#save3").off("click");
  680. $("#save3").on("click", function() {
  681. var nfcDoctorId1 = $("#nfcDoctorId1").val().trim();
  682. var nfcDoctorId2 = $("#nfcDoctorId2").val().trim();
  683. if (nfcDoctorId1 != "" && nfcDoctorId2 != "") {
  684. $("#checkUpDoctorId1").remove();
  685. $("#checkUpDoctorId2").remove();
  686. $("#nfcDoctorId1").parent().append("<input type=\"hidden\" id=\"checkUpDoctorId1\" name=\"checkUpDoctorId\" value=\"" + nfcDoctorId1 + "\" />");
  687. $("#nfcDoctorId2").parent().append("<input type=\"hidden\" id=\"checkUpDoctorId2\" name=\"checkUpDoctorId\" value=\"" + nfcDoctorId2 + "\" />");
  688. // var result = inputCheckupId();
  689. } else {
  690. alert("의료진은 2명이 필수 입력입니다.");
  691. return;
  692. }
  693. var inputPulse = $("#inputPulse").val();
  694. var inputRespiration = $("#inputRespiration").val();
  695. var inputTemperature = $("#inputTemperature").val();
  696. var inputTemperatureSub = $("#inputTemperatureSub").val();
  697. var inputSbp = $("#inputSbp").val();
  698. var inputDbp = $("#inputDbp").val();
  699. if (inputPulse == "" || inputRespiration == "" || inputTemperature == "" || inputTemperatureSub == ""
  700. || inputSbp == "" || inputDbp == "") {
  701. alert("미입력된 항목이 있습니다. \n입력 후, 진행이 가능합니다.");
  702. } else {
  703. inputBloodHealthCheckStep3();
  704. // openStep3Modal();
  705. }
  706. });
  707. }
  708. function openStep3Modal() {
  709. getSideEffectList();
  710. getTransStopReasonList("Step2");
  711. $(".modal").modal("hide");
  712. $(".modal-backdrop").modal("hide");
  713. $("#step4").modal("show");
  714. var patientId = patientArr[0].patientId;
  715. var patientNm = patientArr[0].patientNm;
  716. var bloodType = patientArr[0].bloodType;
  717. var gender = patientArr[0].gender;
  718. var age = patientArr[0].age;
  719. var deptNm = localStorage.getItem("selectedDeptNm");
  720. var summaryCd = patientArr[0].patientSummaryCd.split(",");
  721. var roomNm = patientArr[0].roomNm;
  722. $("#patientInfo2").text(patientId + " " + patientNm);
  723. $("#patientInfo2").append("<span class=\"blood\">" + " " + bloodType +"</span>");
  724. $("#patientSexAge2").text(gender + "/" + age + " " + roomNm + "호");
  725. $(".userInfo").html("<strong>실시부서</strong> : " + deptNm +"<span class=\"px-1\">|</span>" + gLoginUserNm + "(" +gLoginUserId +")");
  726. $(".date span").eq(0).remove();
  727. $(".date").html("<span>" + self.util.toDatetimeFatima(new Date()) + "</span>");
  728. var startDtTm = selectItem[0].startDtTm;
  729. if (selectItem[0].startDtTm == null || selectItem[0].startDtTm == "" || selectItem[0].startDtTm == undefined) {
  730. startDtTm = executionDtTm;
  731. }
  732. var badgeCount = (selectItem.length -1);
  733. var badgeCountTag = "<span class=\"badge\"> + " + badgeCount +"</span>";
  734. $("#heading4 button[data-toggle=collapse] div[class=row]").children().eq(0).text(selectItem[0].bloodNo);
  735. $("#heading4 button[data-toggle=collapse] div[class=row]").children().eq(1).html(selectItem[0].prcpNm + (badgeCount > 0 ? badgeCountTag : ""));
  736. if (startDtTm != "") {
  737. var strDate = moment(dateParse(startDtTm)).format("YYYY-MM-DD HH:mm");
  738. var addDate = new Date(strDate);
  739. var convertAddDate = addDate.setMinutes(addDate.getMinutes() + 15);
  740. var convertStrDate = moment(new Date(convertAddDate)).format("YYYY-MM-DD HH:mm");
  741. $(".time_box").children().eq(0).text("시작 : " + strDate);
  742. // console.log("strDate -- > " + strDate);
  743. $(".info_box2 p[class=blood]").text("15분 : " + convertStrDate);
  744. } else {
  745. $(".time_box").children().eq(0).text("시작 : ");
  746. $(".info_box2 p[class=blood]").text("15분 : ");
  747. }
  748. var collapseDiv = $("#collapse4 div[class=row]");
  749. collapseDiv.children().remove();
  750. var divItem = "";
  751. for (var i = 1; i < selectItem.length; i++) {
  752. divItem = "<div class=\"col-xs-4\">"+ selectItem[i].bloodNo + "</div>"
  753. + "<div class=\"col-xs-8\">" + selectItem[i].prcpNm + "</div>";
  754. collapseDiv.append(divItem);
  755. }
  756. $("#sideEffectEmpty").on("click", function() {
  757. for (var i = 0; i < $("input[name=sideEffectChk]").length; i++) {
  758. $("input[name=sideEffectChk]").eq(i).prop("checked", false);
  759. }
  760. $("#inputEtc").val("");
  761. $("#inputEtc").attr("disabled", true);
  762. });
  763. $(".sideEffect").on("click", function(){
  764. // getSideEffectList();
  765. $("#sideEffect_pop").modal("show");
  766. // $("#sideEffect_pop").attr("style", "display: block");
  767. });
  768. $("#save4").off("click");
  769. $("#save4").on("click", function() {
  770. var inputPulse = $("#inputPulse2").val();
  771. var inputRespiration = $("#inputRespiration2").val();
  772. var inputTemperature = $("#inputTemperature2").val();
  773. var inputTemperatureSub = $("#inputTemperatureSub2").val();
  774. var inputSbp = $("#inputSbp2").val();
  775. var inputDbp = $("#inputDbp2").val();
  776. var stopYn = "N";
  777. if ($("#raY1").is(":checked") == true) {
  778. stopYn = "Y";
  779. } else if ($("#raN1").is(":checked") == true) {
  780. stopYn = "N";
  781. }
  782. if (inputPulse == "" || inputRespiration == "" || inputTemperature == "" || inputTemperatureSub == ""
  783. || inputSbp == "" || inputDbp == "") {
  784. alert("미입력된 항목이 있습니다. \n입력 후, 진행이 가능합니다.");
  785. } else {
  786. if (stopYn == "Y") {
  787. if ($("#reasonBox option:selected").text().trim() == "기타") {
  788. if ($("#reasonEtc").val() == "") {
  789. alert("미입력된 항목이 있습니다. \n입력 후, 진행이 가능합니다.");
  790. } else {
  791. inputBloodHealthCheckStep4(stopYn, convertStrDate);
  792. }
  793. } else {
  794. inputBloodHealthCheckStep4(stopYn, convertStrDate);
  795. }
  796. } else {
  797. inputBloodHealthCheckStep4(stopYn, convertStrDate);
  798. }
  799. }
  800. });
  801. }
  802. function openStep4Modal() {
  803. getTransStopReasonList("Step3");
  804. getSideFinishEffectList();
  805. $(".modal").modal("hide");
  806. $(".modal-backdrop").modal("hide");
  807. $("#step5").modal("show");
  808. var patientId = patientArr[0].patientId;
  809. var patientNm = patientArr[0].patientNm;
  810. var bloodType = patientArr[0].bloodType;
  811. var gender = patientArr[0].gender;
  812. var age = patientArr[0].age;
  813. var deptNm = localStorage.getItem("selectedDeptNm");
  814. var summaryCd = patientArr[0].patientSummaryCd.split(",");
  815. var roomNm = patientArr[0].roomNm;
  816. $("#patientInfo3").text(patientId + " " + patientNm);
  817. $("#patientInfo3").append("<span class=\"blood\">" + " " + bloodType +"</span>");
  818. $("#patientSexAge3").text(gender + "/" + age + " " + roomNm + "호");
  819. $(".userInfo").html("<strong>실시부서</strong> : " + deptNm +"<span class=\"px-1\">|</span>" + gLoginUserNm + "(" +gLoginUserId +")");
  820. $(".date span").eq(0).remove();
  821. $(".date").html("<span>" + self.util.toDatetimeFatima(new Date()) + "</span>");
  822. var badgeCount = (selectItem.length -1);
  823. var badgeCountTag = "<span class=\"badge\"> + " + badgeCount +"</span>";
  824. $("#heading5 button[data-toggle=collapse] div[class=row]").children().eq(0).text(selectItem[0].bloodNo);
  825. $("#heading5 button[data-toggle=collapse] div[class=row]").children().eq(1).html(selectItem[0].prcpNm + (badgeCount > 0 ? badgeCountTag : ""));
  826. var collapseDiv = $("#collapse5 div[class=row]");
  827. collapseDiv.children().remove();
  828. var divItem = "";
  829. for (var i = 1; i < selectItem.length; i++) {
  830. divItem = "<div class=\"col-xs-4\">"+ selectItem[i].bloodNo + "</div>"
  831. + "<div class=\"col-xs-8\">" + selectItem[i].prcpNm + "</div>";
  832. collapseDiv.append(divItem);
  833. }
  834. $("#sideEffectInputN").off("click");
  835. $("#sideEffectInputN").on("click", function() {
  836. // console.log("sideEffectInputN");
  837. $("#sideEffetcValue").val("N");
  838. for (var i = 0; i < $("input[name=sideEffectChk2]").length; i++) {
  839. $("input[name=sideEffectChk2]").eq(i).prop("checked", false);
  840. }
  841. $("#inputFinishEtc").val("");
  842. });
  843. $("#sideEffectInputY").off("click");
  844. $("#sideEffectInputY").on("click", function() {
  845. // console.log("sideEffectInputY");
  846. $("#sideEffetcValue").val("Y");
  847. // getSideFinishEffectList();
  848. $("#sideEffect_pop2").modal("show");
  849. });
  850. $("#saveEndNext").off("click");
  851. $("#saveEndNext").on("click", function() {
  852. saveEndEvent("saveEndNext");
  853. });
  854. $("#saveEnd").off("click");
  855. $("#saveEnd").on("click", function() {
  856. saveEndEvent("saveEnd");
  857. });
  858. }
  859. function saveEndEvent(type) {
  860. var inputPulse = $("#inputPulse3").val();
  861. var inputRespiration = $("#inputRespiration3").val();
  862. var inputTemperature = $("#inputTemperature3").val();
  863. var inputTemperatureSub = $("#inputTemperatureSub3").val();
  864. var inputSbp = $("#inputSbp3").val();
  865. var inputDbp = $("#inputDbp3").val();
  866. var stopYn = "N";
  867. var index = selectItem.length - 1;
  868. if ($("#raY2").is(":checked") == true) {
  869. stopYn = "Y";
  870. } else if ($("#raN2").is(":checked") == true) {
  871. stopYn = "N";
  872. }
  873. if (inputPulse == "" || inputRespiration == "" || inputTemperature == "" || inputTemperatureSub == ""
  874. || inputSbp == "" || inputDbp == "") {
  875. alert("미입력된 항목이 있습니다. \n입력 후, 진행이 가능합니다.");
  876. } else {
  877. if (stopYn == "Y") {
  878. if ($("#reasonBox2 option:selected").text().trim() == "기타") {
  879. if ($("#reasonEtc2").val() == "") {
  880. alert("미입력된 항목이 있습니다. \n입력 후, 진행이 가능합니다.");
  881. } else {
  882. inputBloodHealthCheckFinishStep(stopYn);
  883. }
  884. } else {
  885. inputBloodHealthCheckFinishStep(stopYn);
  886. }
  887. } else {
  888. inputBloodHealthCheckFinishStep(stopYn);
  889. }
  890. }
  891. }
  892. async function inputBloodHealthCheckFinishStep(stopYn) {
  893. stopYn = stopYn == "Y" ? stopYn : "N";
  894. var sideEffect = "N";
  895. var sideEffectCode = "";
  896. var sideEffectName = "";
  897. for (var i = 0; i < $("input[name=sideEffectChk2]").length; i++) {
  898. if ($("input[name=sideEffectChk2]").eq(i).is(":checked") == true) {
  899. sideEffect = "Y";
  900. var _sideEffectName = $("input[name=sideEffectChk2]").eq(i).parent().parent().children().eq(1).text().trim();
  901. var _sideEffectCode = $("input[name=sideEffectCode2]").eq(i).val().trim();
  902. // sideEffectCode += "CD:" + _sideEffectCode + "^";
  903. sideEffectCode += _sideEffectCode + "^";
  904. if (_sideEffectName == "기타") {
  905. sideEffectName = $("#inputFinishEtc").val();
  906. }
  907. }
  908. }
  909. var transStopReasonCd = "";
  910. var transStopReasonEtc = "";
  911. if (stopYn == "Y") {
  912. if ($("#raY2").is(":checked") == true) {
  913. transStopReasonCd = $("#reasonBox2 option:selected").val();
  914. if ($("#reasonBox2 option:selected").text().trim() == "기타") {
  915. transStopReasonEtc = $("#reasonEtc2").val();
  916. }
  917. } else {
  918. transStopReasonCd = "";
  919. transStopReasonEtc = "";
  920. }
  921. } else {
  922. transStopReasonCd = "";
  923. transStopReasonEtc = "";
  924. }
  925. sideEffectCode = sideEffectCode.slice(0,-1);
  926. executionDtTm = "";
  927. var cnt = 0;
  928. for (var i = 0; i < selectItem.length; i++) {
  929. var hospitalCd = localStorage.getItem("hospitalCd");
  930. var userId = gLoginUserId;
  931. var userDeptCd = localStorage.getItem("selectedDeptCd");
  932. var patientId = $("#txtTransFusionSearch").val();
  933. var prescriptionNo = selectItem[i].prescriptionNo;
  934. var bloodNo = selectItem[i].bloodNo;
  935. var bloodSeq = selectItem[i].bloodSeq;
  936. var bloodProduct = selectItem[i].bloodProduct;
  937. var bloodCheckupStatus = "06";
  938. var pulse = $("#inputPulse3").val();
  939. var respiration = $("#inputRespiration3").val();
  940. var bodytemperature = $("#inputTemperature3").val() + "." + $("#inputTemperatureSub3").val(); //체온
  941. var systolicBp = $("#inputSbp3").val();
  942. var diastolicBp = $("#inputDbp3").val();
  943. var sideEffectYn = sideEffect;
  944. var sideEffectCds = sideEffectCode;
  945. var sideEffectNm = sideEffectName;
  946. var transStopYn = stopYn;
  947. executionDtTm = self.util.toDatetimeFatima2(new Date());
  948. var bloodType = selectItem[i].bloodType;
  949. var bloodRhType = selectItem[i].bloodRhType;
  950. var prcpNm = selectItem[i].prcpNm;
  951. var prcpCd = selectItem[i].prcpCd;
  952. var prcpDd = selectItem[i].prcpDd;
  953. var transCheckupId1 = "";
  954. var transCheckupId2 = "";
  955. var param = {
  956. hospitalCd : hospitalCd ,
  957. userId : userId ,
  958. userDeptCd : userDeptCd ,
  959. patientId : patientId ,
  960. prescriptionNo : prescriptionNo ,
  961. bloodNo : bloodNo ,
  962. bloodSeq : bloodSeq ,
  963. bloodProduct : bloodProduct ,
  964. bloodCheckupStatus : bloodCheckupStatus,
  965. pulse : pulse ,
  966. respiration : respiration ,
  967. bodytemperature : bodytemperature ,
  968. systolicBp : systolicBp ,
  969. diastolicBp : diastolicBp ,
  970. sideEffectYn : sideEffectYn ,
  971. sideEffectCds : sideEffectCds ,
  972. sideEffectNm : sideEffectNm ,
  973. transStopYn : transStopYn ,
  974. executionDtTm : executionDtTm ,
  975. bloodType : bloodType ,
  976. bloodRhType : bloodRhType ,
  977. prcpNm : prcpNm ,
  978. prcpCd : prcpCd ,
  979. prcpDd : prcpDd ,
  980. transCheckupId1 : "" ,
  981. transCheckupId2 : "" ,
  982. transCheckupNm1 : "" ,
  983. transCheckupNm2 : "" ,
  984. transStopReasonCd : transStopReasonCd ,
  985. transStopReasonEtc : transStopReasonEtc
  986. }
  987. self.safety.inputBloodHealthCheck(param, selectItem, inputBloodHealthCheckCallback, "finish");
  988. // inputBloodHealthCheckCallback("", i, 3, "finish");
  989. }
  990. }
  991. function inputBloodHealthCheckStep3() {
  992. executionDtTm = "";
  993. var cnt = 0;
  994. for (var i = 0; i < selectItem.length; i++) {
  995. var hospitalCd = localStorage.getItem("hospitalCd");
  996. var userId = gLoginUserId;
  997. var userDeptCd = localStorage.getItem("selectedDeptCd");
  998. var patientId = $("#txtTransFusionSearch").val();
  999. var prescriptionNo = selectItem[i].prescriptionNo;
  1000. var bloodNo = selectItem[i].bloodNo;
  1001. var bloodSeq = selectItem[i].bloodSeq;
  1002. var bloodProduct = selectItem[i].bloodProduct;
  1003. var bloodCheckupStatus = "04"; // 00
  1004. var pulse = $("#inputPulse").val();
  1005. var respiration = $("#inputRespiration").val();
  1006. var bodytemperature = $("#inputTemperature").val() + "." + $("#inputTemperatureSub").val(); //체온
  1007. var systolicBp = $("#inputSbp").val();
  1008. var diastolicBp = $("#inputDbp").val();
  1009. var sideEffectYn = "N";
  1010. var sideEffectCds = "";
  1011. var sideEffectNm = "";
  1012. var transStopYn = "N";
  1013. executionDtTm = self.util.toDatetimeFatima2(new Date());
  1014. var bloodType = selectItem[i].bloodType;
  1015. var bloodRhType = selectItem[i].bloodRhType;
  1016. var prcpNm = selectItem[i].prcpNm;
  1017. var prcpCd = selectItem[i].prcpCd;
  1018. var prcpDd = selectItem[i].prcpDd;
  1019. var transCheckupId1 = $("#nfcDoctorId1").val();
  1020. var transCheckupId2 = $("#nfcDoctorId2").val();
  1021. var transCheckupNm1 = $("#nfcDoctorName1").text();
  1022. var transCheckupNm2 = $("#nfcDoctorName2").text();
  1023. var transStopReasonCd = "";
  1024. var transStopReasonEtc = "";
  1025. var param = {
  1026. hospitalCd : hospitalCd ,
  1027. userId : userId ,
  1028. userDeptCd : userDeptCd ,
  1029. patientId : patientId ,
  1030. prescriptionNo : prescriptionNo ,
  1031. bloodNo : bloodNo ,
  1032. bloodSeq : bloodSeq ,
  1033. bloodProduct : bloodProduct ,
  1034. bloodCheckupStatus : bloodCheckupStatus,
  1035. pulse : pulse ,
  1036. respiration : respiration ,
  1037. bodytemperature : bodytemperature ,
  1038. systolicBp : systolicBp ,
  1039. diastolicBp : diastolicBp ,
  1040. sideEffectYn : sideEffectYn ,
  1041. sideEffectCds : sideEffectCds ,
  1042. sideEffectNm : sideEffectNm ,
  1043. transStopYn : transStopYn ,
  1044. executionDtTm : executionDtTm ,
  1045. bloodType : bloodType ,
  1046. bloodRhType : bloodRhType ,
  1047. prcpNm : prcpNm ,
  1048. prcpCd : prcpCd ,
  1049. prcpDd : prcpDd ,
  1050. transCheckupId1 : transCheckupId1 ,
  1051. transCheckupId2 : transCheckupId2 ,
  1052. transCheckupNm1 : transCheckupNm1,
  1053. transCheckupNm2 : transCheckupNm2,
  1054. transStopReasonCd : transStopReasonCd,
  1055. transStopReasonEtc : transStopReasonEtc
  1056. }
  1057. console.log("step3 param -- > " + JSON.stringify(param));
  1058. self.safety.inputBloodHealthCheck(param, selectItem, inputBloodHealthCheckCallback, "step3");
  1059. }
  1060. }
  1061. function inputBloodHealthCheckCallback(result, checkCnt, itemCount, stepName) {
  1062. // stepName 마지막 단계인 경우 인증저장 시작
  1063. if (stepName == "finish1") {
  1064. if (checkCnt == itemCount) {
  1065. if (result == undefined) {
  1066. alert("저장에 실패하였습니다.");
  1067. }
  1068. else {
  1069. // 인증저장에 필요한 전역변수 초기화
  1070. successArr = [];
  1071. failedArr = [];
  1072. signDataArr = [];
  1073. xmlDataArr = [];
  1074. signDataArr = [];
  1075. certXml = "";
  1076. maxIndex = 0;
  1077. // result = "0000,0001,0000";
  1078. // 활력징후 입력 API 성공 여부 조회
  1079. var resultAr = result.split(",");
  1080. for (var i = 0; i < resultAr.length; i++) {
  1081. var resCode = resultAr[i];
  1082. if (resCode != "0000") {
  1083. failedArr.push(selectItem[i]); // 활력징후 입력 실패
  1084. } else {
  1085. successArr.push(selectItem[i]); // 활력징후 입력 성공
  1086. }
  1087. }
  1088. maxIndex = successArr.length - 1; // 네이티브 콜백에서 인덱스를 비교하기 위한 인덱스
  1089. for (var i = 0; i < successArr.length; i++) {
  1090. var prescriptionNo = successArr[i].prescriptionNo;
  1091. var bloodNo = successArr[i].bloodNo;
  1092. var bloodSeq = successArr[i].bloodSeq;
  1093. var bloodProduct = successArr[i].bloodProduct;
  1094. var index = i;
  1095. getCertDetailInfo(prescriptionNo, bloodNo, bloodSeq, bloodProduct, index);
  1096. }
  1097. }
  1098. }
  1099. } else {
  1100. if (checkCnt == itemCount) {
  1101. if (result == undefined) {
  1102. alert("저장에 실패하였습니다.");
  1103. } else {
  1104. result = result.slice(0,-1);
  1105. var resultAr = result.split(",");
  1106. for (var i = 0; i < resultAr.length; i++) {
  1107. var resCode = resultAr[i];
  1108. if (resCode != "0000") {
  1109. alert("저장에 실패하였습니다.");
  1110. return;
  1111. }
  1112. }
  1113. $(".modal").modal("hide");
  1114. $(".modal-backdrop").modal("hide");
  1115. getPocPatientInfo($("#txtTransFusionSearch").val(), false);
  1116. }
  1117. }
  1118. }
  1119. }
  1120. /**
  1121. * successArr 데이터를 호출하여 상세정보 API Call
  1122. *
  1123. * @param {*} prescriptionNo
  1124. * @param {*} bloodNo
  1125. * @param {*} bloodSeq
  1126. * @param {*} bloodProduct
  1127. * @param {*} index certToNative 호출을 한 번만 하기위한 index 값
  1128. */
  1129. function getCertDetailInfo(prescriptionNo, bloodNo, bloodSeq, bloodProduct, index) {
  1130. console.log("----------Start DetailApiCall----------");
  1131. var detailParam = {
  1132. hospitalCd: localStorage.getItem("hospitalCd"),
  1133. userId: gLoginUserId,
  1134. patientId: patientArr[0].patientId,
  1135. prescriptionNo: prescriptionNo,
  1136. bloodNo: bloodNo,
  1137. bloodSeq: bloodSeq,
  1138. bloodProduct: bloodProduct
  1139. }
  1140. self.safety.getBloodDetailInfo(detailParam, index, certTempDetailInfo);
  1141. }
  1142. /**
  1143. *
  1144. *
  1145. * @param {*} index getCertDetailInfo 에서 받아온 파라미터
  1146. * @param {*} lists getBloodDetailInfo 리턴 데이터
  1147. */
  1148. function certTempDetailInfo(index, lists) {
  1149. console.log("----------Second DetailCallback----------" + JSON.stringify(lists));
  1150. var checkIndex = index + 1; // successArr 과 비교하여 네이티브를 한번만 호출 (checkIndex == successArr.length)
  1151. doctorInfo = []; // doctorInfo 호출하기 전에 기존에 있는 데이터 초기화 필요, 아니면 3, 4로 쌓임
  1152. getDoctorId(lists[0].transCheckupId1, "cert"); // 시작간호사 호출
  1153. getDoctorId(lists[0].transCheckupId2, "cert"); // 확인간호사 호출
  1154. if (index == 0) {
  1155. certXml += certXmlItem(lists);
  1156. } else {
  1157. certXml += "|%POC%|" + certXmlItem(lists); // 인증해야할 데이터가 여러개일 경우 단일 String -> Native(split)
  1158. }
  1159. // Callback 이 오기전에 상위 for loop 가 계속 돌아감
  1160. // 최상위 for문 i + 1 값과 successArr.length 가 같을 때 한 번만 호출
  1161. if (checkIndex == successArr.length) {
  1162. certDataToNative(certXml);
  1163. }
  1164. }
  1165. /**
  1166. * xml 데이터와 Native 호출
  1167. *
  1168. * @param {*} data XmlData
  1169. */
  1170. function certDataToNative(data) {
  1171. var msg = {
  1172. type: "command", // 네이티브에서 Error, Command 구분
  1173. functionType: "certDataToNative", // 네이티브 함수 이름
  1174. value: {
  1175. userId: gLoginUserId, // userId
  1176. xmlData: data, // xmlData
  1177. callbackFn: "window.activeObj.certCallback" // callback 함수명
  1178. }
  1179. }
  1180. self.toNative(msg)
  1181. };
  1182. /**
  1183. * @param {*} returnCode ex) {"success" : "0000", "index" : "0"}
  1184. * @param {*} signData 사인데이터
  1185. * @param {*} xmlData XML 원본 데이터
  1186. */
  1187. this.certCallback = function(returnCode, signData, xmlData) {
  1188. // reutrnCode JSON Parse
  1189. var result = new Object();
  1190. if (typeof returnCode === "string") {
  1191. result = JSON.parse(returnCode);
  1192. } else {
  1193. result = returnCode;
  1194. }
  1195. console.log("first failedArr -- > " + JSON.stringify(failedArr));
  1196. var index = Number(result.index); // index를 String으로 받아오기 때문에 Number로 형변환 하여 사용함
  1197. console.log("index -- > " + index);
  1198. if (self.util.isEmpty(result)) {
  1199. alert("인증저장에 실패하였습니다 \n 다시 시도 해주세요.");
  1200. }
  1201. else {
  1202. if (result.success == "0000") { // 성공 했을 경우 사인데이터와 xml데이터를 전역 Arr에 담음
  1203. signDataArr.push(signData);
  1204. xmlDataArr.push(xmlData);
  1205. }
  1206. else {
  1207. failedArr.push(successArr[index]); // failedArr 에 추가함 (failedArr 은 순서 상관 없음)
  1208. console.log("second failedArr -- > " + JSON.stringify(failedArr));
  1209. successArr.splice(index, 1); // 실패 했을 경우 successArr 해당 인덱스를 제거
  1210. }
  1211. }
  1212. // 네이티브 for문 index 값과 로직이 돌기 전 successArr 길이가 같다면 아래 for loop 수행
  1213. if (index == maxIndex) {
  1214. for (var i = 0; i < successArr.length; i++) {
  1215. var param = {
  1216. hospitalCd: localStorage.getItem("hospitalCd"),
  1217. userId: gLoginUserId,
  1218. patientId: successArr[i].patientId,
  1219. prescriptionNo: successArr[i].prescriptionNo,
  1220. bloodNo: successArr[i].bloodNo,
  1221. bloodSeq: successArr[i].bloodSeq,
  1222. bloodProduct: successArr[i].bloodProduct,
  1223. // bloodXmlData: btoa(unescape(encodeURIComponent(xmlDataArr[i]))),
  1224. bloodXmlData: xmlDataArr[i],
  1225. bloodSignData: signDataArr[i]
  1226. // bloodXmlData: "TEST",
  1227. // bloodSignData: "TESTTEST"
  1228. }
  1229. self.safety.inputBloodSignData(param, successArr, inputBloodSignDataCallback);
  1230. }
  1231. }
  1232. };
  1233. /**
  1234. * 인증저장 Callback, 기본적인 구조는 inputBloodHealthCheck 와 같음
  1235. *
  1236. * @param {*} result returnCode ex) "0000,0001,0000,0001"
  1237. * @param {*} checkCnt API 가 호출된 횟수
  1238. * @param {*} itemCnt successArr.length
  1239. */
  1240. function inputBloodSignDataCallback(result, checkCnt, itemCnt) {
  1241. console.log("result -- > " + result);
  1242. if (checkCnt == itemCnt) {
  1243. if (result == undefined) {
  1244. alert("저장에 실패하였습니다.");
  1245. }
  1246. else {
  1247. result = result.slice(0,-1);
  1248. var resultAr = result.split(",");
  1249. // 실패한 코드가 내려오면 successArr index 값을 제거 후 failedArr 에 추가
  1250. for (var i = 0; i < resultAr.length; i++) {
  1251. var resCode = resultAr[i];
  1252. if (resCode != "0000") {
  1253. successArr.splice(i, 1);
  1254. failedArr.push(selectItem[i]);
  1255. }
  1256. }
  1257. if (failedArr.length > 0) {
  1258. for (var i = 0; i < failedArr.length; i++) {
  1259. if (self.util.isEmpty(failedArr[i])) {
  1260. failedArr.splice(i, 1);
  1261. }
  1262. }
  1263. }
  1264. console.log("real failedArr -- > " + JSON.stringify(failedArr));
  1265. var successMsg = "";
  1266. var failMsg = "";
  1267. console.log("successArr -- > " + JSON.stringify(successArr));
  1268. // Alert에 보여줄 Message 정의 (혈액번호가 리스트에 보여지므로 혈액번호로 정의함)
  1269. if (successArr.length != 0 || failedArr.length != 0) {
  1270. if (successArr.length != 0) {
  1271. for (var i = 0; i < successArr.length; i++) {
  1272. if (i == 0) {
  1273. successMsg += successArr[i].bloodNo;
  1274. }
  1275. else {
  1276. successMsg += ", " + successArr[i].bloodNo;
  1277. }
  1278. }
  1279. }
  1280. if (failedArr.length != 0) {
  1281. for (var i = 0; i < failedArr.length; i++) {
  1282. if (i == 0) {
  1283. failMsg += failedArr[i].bloodNo;
  1284. }
  1285. else {
  1286. failMsg += ", " + successArr[i].bloodNo;
  1287. }
  1288. }
  1289. }
  1290. alert("인증 성공(혈액번호) \n " + successMsg + "\n 인증 실패(혈액번호) \n" + failMsg);
  1291. $(".modal").modal("hide");
  1292. $(".modal-backdrop").modal("hide");
  1293. getPocPatientInfo($("#txtTransFusionSearch").val(), false);
  1294. }
  1295. }
  1296. }
  1297. }
  1298. /**
  1299. * @param {*} lists 호출된 상세정보 리스트
  1300. */
  1301. var certXmlItem = function(lists) {
  1302. var endDate = self.util.toDatetimeFatima2(new Date()); // YYYYMMddHHmm
  1303. var certXml = "";
  1304. certXml = "<SignData>"
  1305. + " <PatientInfo name=\"환자정보\">"
  1306. + " <pid name=\"환자번호\">" + self.util.isXmlEmpty(patientArr[0].patientId) + "</pid>"
  1307. + " <pname name=\"환자이름\">"+ self.util.isXmlEmpty(patientArr[0].patientNm) + "</pname>"
  1308. + " <age name=\"나이성별\"><![CDATA[" + self.util.isCdataCheck(patientArr[0].age) + "/" + self.util.isCdataCheck(patientArr[0].gender) + "]]></age>"
  1309. + " <body name=\"키몸무게\"><![CDATA[" + self.util.isCdataCheck(patientArr[0].body).slice(0, 3) + "/" + self.util.isCdataCheck(patientArr[0].body).slice(3) + "]]></body>"
  1310. + " <btype name=\"혈액형\"><![CDATA[" + self.util.isCdataCheck(patientArr[0].bloodType) + "]]></btype>"
  1311. + " <insukind name=\"보험유형\">" + self.util.isXmlEmpty(patientArr[0].insukind) + "</insukind>"
  1312. + " <orddept name=\"진료과\">" + self.util.isXmlEmpty(patientArr[0].deptNm) + "</orddept>"
  1313. + " <apntdr name=\"지정의\">" + self.util.isXmlEmpty(patientArr[0].doctorNm) + "</apntdr>"
  1314. + " <attndr name=\"주치의\"><![CDATA[" + self.util.isCdataCheck(patientArr[0].specialistNm) + "]]></attndr>"
  1315. + " </PatientInfo>"
  1316. + " <SignInfo name=\"인증정보\">"
  1317. + " <tnsnurserecgruplist>"
  1318. + " <blodno>" + self.util.isXmlEmpty(lists[0].bloodNo) + "</blodno>"
  1319. + " <prcpnm><![CDATA[" + self.util.isCdataCheck(lists[0].prcpNm) + "]]></prcpnm>"
  1320. + " <abo><![CDATA[" + self.util.isCdataCheck(lists[0].bloodType + lists[0].bloodRhType) +"]]></abo>"
  1321. + " <tnsstrdd>" + self.util.isXmlEmpty(lists[0].startDtTm.slice(0,8)) + "</tnsstrdd>"
  1322. + " <tnsstrtm>" + self.util.isXmlEmpty(lists[0].startDtTm.slice(8)) + "</tnsstrtm>"
  1323. + " <tnsenddd>" + endDate.slice(0, 8) + "</tnsenddd>"
  1324. + " <tnsendtm>" + endDate.slice(8) + "</tnsendtm>"
  1325. + " <tnsstrnursdeptnm>" + self.util.isXmlEmpty(doctorInfo[0].deptNm) + "</tnsstrnursdeptnm>"
  1326. + " <tnsstrnursnm>" + self.util.isXmlEmpty(doctorInfo[0].doctorNm) + "</tnsstrnursnm>"
  1327. + " <tnsendnursdeptnm>" + self.util.isXmlEmpty(doctorInfo[1].deptNm) +"</tnsendnursdeptnm>"
  1328. + " <tnsendnursnm>" + self.util.isXmlEmpty(doctorInfo[1].doctorNm) + "</tnsendnursnm>"
  1329. + " <discontinuyn>" + self.util.isXmlEmpty(lists[0].transStopYn) + " </discontinuyn>"
  1330. + " <drugqty>" + self.util.isXmlEmpty(lists[0].drugqty) + "</drugqty>"
  1331. + " <tnsrec><![CDATA[" + self.util.isCdataCheck(lists[0].tnsrec) + "]]></tnsrec>"
  1332. + " <tnsstrnursall>" + self.util.isXmlEmpty(doctorInfo[0].doctorId) + "," + self.util.isXmlEmpty(doctorInfo[0].doctorNm) + ",,," + self.util.isXmlEmpty(doctorInfo[0].deptNm) + "," + self.util.isXmlEmpty(doctorInfo[0].deptCd) + "</tnsstrnursall>"
  1333. + " <tnsendnursall>" + self.util.isXmlEmpty(doctorInfo[1].doctorId) + "," + self.util.isXmlEmpty(doctorInfo[1].doctorNm) + ",,," + self.util.isXmlEmpty(doctorInfo[1].deptNm) + "," + self.util.isXmlEmpty(doctorInfo[1].deptCd) + "</tnsendnursall>"
  1334. + " <tnssideeffect>" + self.util.isXmlEmpty(lists[0].sideEffectNms) + "</tnssideeffect> "
  1335. + " <instcd>" + self.util.isXmlEmpty(lists[0].instcd) + "</instcd> "
  1336. + " <signno><![CDATA[" + self.util.isCdataCheck(lists[0].signno) + "]]></signno> "
  1337. + " <prcpno>" + self.util.isXmlEmpty(lists[0].prcpno) + "</prcpno> "
  1338. + " <onepintqty>" + self.util.isXmlEmpty(lists[0].drugqty) + "</onepintqty> "
  1339. + " <tnscarerecseq>" + self.util.isXmlEmpty(lists[0].tnscarerecseq) + "</tnscarerecseq> "
  1340. + " <tnscnfmnursdeptnm>" + self.util.isXmlEmpty(doctorInfo[1].deptNm) +"</tnscnfmnursdeptnm> "
  1341. + " <tnscnfmnursall>" + self.util.isXmlEmpty(doctorInfo[1].doctorId) + "," + self.util.isXmlEmpty(doctorInfo[1].doctorNm) + ",,," + self.util.isXmlEmpty(doctorInfo[1].deptNm) + "," + self.util.isXmlEmpty(doctorInfo[1].deptCd) + "</tnscnfmnursall> "
  1342. + " <tnscnfmnursnm>" + self.util.isXmlEmpty(doctorInfo[1].doctorNm) + "</tnscnfmnursnm> "
  1343. + " </tnsnurserecgruplist>"
  1344. + " <vitalsigngrup>"
  1345. + " <vitalsigngruplist>"
  1346. + " <stat>u</stat> "
  1347. + " <recdd>" + self.util.isXmlEmpty(lists[0].startDtTm.slice(0,8)) + "</recdd> "
  1348. + " <rectm>" + self.util.isXmlEmpty(lists[0].startDtTm.slice(8)) + "</rectm> "
  1349. + " <flag>수혈시작</flag> "
  1350. + " <bp><![CDATA[" + self.util.isCdataCheck(lists[0].transBfSystolicBp) + "/" + self.util.isCdataCheck(lists[0].transBfDiastolicBp) + "]]></bp> "
  1351. + " <pulse>" + self.util.isXmlEmpty(lists[0].transBfPulse) + "</pulse> "
  1352. + " <breth>" + self.util.isXmlEmpty(lists[0].transBfRespiration) + "</breth> "
  1353. + " <bdtp><![CDATA[" + self.util.isCdataCheck(lists[0].transBfBodytemperature) + "]]></bdtp> "
  1354. + " <tnscarerecseq>" + self.util.isXmlEmpty(lists[0].tnscarerecseq) + "</tnscarerecseq> "
  1355. + " <tnscarerecvsseq>1</tnscarerecvsseq> "
  1356. + " <instcd>" + self.util.isXmlEmpty(lists[0].instcd) + "</instcd> "
  1357. + " <blodno>" + self.util.isXmlEmpty(lists[0].bloodNo) + "</blodno> "
  1358. + " <pid>" + self.util.isXmlEmpty(patientArr[0].patientId) + "</pid> "
  1359. + " <prcpcd>" + self.util.isXmlEmpty(lists[0].prcpCd) + "</prcpcd> "
  1360. + " </vitalsigngruplist>"
  1361. + " <vitalsigngruplist>"
  1362. + " <stat>u</stat> "
  1363. + " <recdd>" + self.util.isXmlEmpty(lists[0].trans15dttm.slice(0, 8)) + "</recdd> "
  1364. + " <rectm>" + self.util.isXmlEmpty(lists[0].trans15dttm.slice(8)) + "</rectm> "
  1365. + " <flag>수혈15분이내</flag> "
  1366. + " <bp><![CDATA[" + self.util.isCdataCheck(lists[0].trans15SystolicBp) + "/" + self.util.isCdataCheck(lists[0].trans15DiastolicBp) + "]]></bp> "
  1367. + " <pulse>" + self.util.isXmlEmpty(lists[0].trans15Pulse) + "</pulse> "
  1368. + " <breth>" + self.util.isXmlEmpty(lists[0].trans15Respiration) + "</breth> "
  1369. + " <bdtp><![CDATA[" + self.util.isCdataCheck(lists[0].trans15Bodytemperature) + "]]></bdtp> "
  1370. + " <tnscarerecseq>" + self.util.isXmlEmpty(lists[0].tnscarerecseq) + "</tnscarerecseq> "
  1371. + " <tnscarerecvsseq>2</tnscarerecvsseq> "
  1372. + " <instcd>" + self.util.isXmlEmpty(lists[0].instcd) + "</instcd> "
  1373. + " <blodno>" + self.util.isXmlEmpty(lists[0].bloodNo) + "</blodno> "
  1374. + " <pid>" + self.util.isXmlEmpty(patientArr[0].patientId) + "</pid> "
  1375. + " <prcpcd>" + self.util.isXmlEmpty(lists[0].prcpCd) + "</prcpcd> "
  1376. + " </vitalsigngruplist>"
  1377. + " <vitalsigngruplist>"
  1378. + " <stat>u</stat> "
  1379. + " <recdd>" + self.util.isXmlEmpty(lists[0].transafdttm.slice(0, 8)) + "</recdd> "
  1380. + " <rectm>" + self.util.isXmlEmpty(lists[0].transafdttm.slice(8)) + "</rectm> "
  1381. + " <flag>수혈종료</flag> "
  1382. + " <bp><![CDATA[" + self.util.isCdataCheck(lists[0].transAfSystolicBp) + "/" + self.util.isCdataCheck(lists[0].transAfDiastolicBp) + "]]></bp> "
  1383. + " <pulse>" + self.util.isXmlEmpty(lists[0].transAfPulse) + "</pulse> "
  1384. + " <breth>" + self.util.isXmlEmpty(lists[0].transAfRespiration) + "</breth> "
  1385. + " <bdtp><![CDATA[" + self.util.isCdataCheck(lists[0].transAfBodytemperature) + "]]></bdtp> "
  1386. + " <tnscarerecseq>" + self.util.isXmlEmpty(lists[0].tnscarerecseq) + "</tnscarerecseq> "
  1387. + " <tnscarerecvsseq>3</tnscarerecvsseq> "
  1388. + " <instcd>" + self.util.isXmlEmpty(lists[0].instcd) + "</instcd> "
  1389. + " <blodno>" + self.util.isXmlEmpty(lists[0].bloodNo) + "</blodno> "
  1390. + " <pid>" + self.util.isXmlEmpty(patientArr[0].patientId) + "</pid> "
  1391. + " <prcpcd>" + self.util.isXmlEmpty(lists[0].prcpCd) + "</prcpcd> "
  1392. + " </vitalsigngruplist>"
  1393. + " </vitalsigngrup>"
  1394. + " </SignInfo>"
  1395. + " <SessionInfo name=\"Session정보\">"
  1396. + " <userid name=\"사용자번호\">" + self.util.isXmlEmpty(localStorage.getItem("selectedUserId")) + "</userid>"
  1397. + " <usernm name=\"사용자이름\">" + self.util.isXmlEmpty(localStorage.getItem("selectedUserNm")) + "</usernm>"
  1398. + " <posinstnm name=\"소속기관명\">" + self.util.isXmlEmpty(localStorage.getItem("posinstnm")) + "</posinstnm>"
  1399. + " <posdeptnm name=\"소속부서명\">" + self.util.isXmlEmpty(localStorage.getItem("posdeptnm")) + "</posdeptnm>"
  1400. + " <dutplceinstnm name=\"근무지기관명\">" + self.util.isXmlEmpty(localStorage.getItem("dutplceinstnm")) + "</dutplceinstnm>"
  1401. + " <dutplcenm name=\"근무지부서명\">" + self.util.isXmlEmpty(localStorage.getItem("dutplcenm")) + "</dutplcenm>"
  1402. + " <jobkindnm name=\"직종명\">" + self.util.isXmlEmpty(localStorage.getItem("selectedJobKindNm")) + "</jobkindnm>"
  1403. + " <jobposnm name=\"직위명\">" + self.util.isXmlEmpty(localStorage.getItem("jobposnm")) + "</jobposnm>"
  1404. + " <jobrespnm name=\"직책명\">" + self.util.isXmlEmpty(localStorage.getItem("selectedUserId")) + "</jobrespnm>"
  1405. + " <prfshipflagnm name=\"교직구분명\">" + self.util.isXmlEmpty(localStorage.getItem("prfshipflagnm")) + "</prfshipflagnm>"
  1406. + " <deptabbr name=\"부서약어\">" + self.util.isXmlEmpty(localStorage.getItem("deptabbr")) + "</deptabbr>"
  1407. + " <systemnm name=\"시스템명칭\">" + self.util.isXmlEmpty(localStorage.getItem("systemnm")) + "</systemnm>"
  1408. + " <systeminstnm name=\"시스템소속기관명\">" + self.util.isXmlEmpty(localStorage.getItem("systeminstnm")) + "</systeminstnm>"
  1409. + " <logindt name=\"로그인시간\">" + self.util.isXmlEmpty(localStorage.getItem("initLoginDtTm")) + "</logindt>"
  1410. + " </SessionInfo>"
  1411. + "</SignData>";
  1412. return certXml;
  1413. }
  1414. function getSideFinishEffectList() {
  1415. var param = {
  1416. hospitalCd : localStorage.getItem("hospitalCd"),
  1417. userId : gLoginUserId
  1418. }
  1419. self.safety.getSideEffectList(param, getSideEffectListFinishCallback);
  1420. }
  1421. function getSideEffectListFinishCallback(output) {
  1422. $("#sideEffectFinish").children().remove();
  1423. for (var i = 0; i < output.length; i++) {
  1424. var sideEffectNm = output[i].sideEffectNm.trim();
  1425. var sideEffectCd = output[i].sideEffectCd.trim();
  1426. var div = "<div class=\"select_ico row mb-1\">"
  1427. + " <div class=\"col-xs-2 text-right\">"
  1428. + " <input type=\"checkbox\" name=\"sideEffectChk2\" autocomplete=\"off\" id=\"b" + (i+1) +"\"/>"
  1429. + " <div class=\"group\">"
  1430. + " <label class=\"btn btn-check icon mt-0\" for=\"b" + (i+1) + "\">"
  1431. + " <span class=\"glyphicon glyphicon-ok\" aria-hidden=\"true\"></span>"
  1432. + " </label>"
  1433. + " <label class=\"btn btn-outline-check icon mt-0\" for=\"b" + (i+1) + "\">"
  1434. + " <span class=\"glyphicon\" aria-hidden=\"true\"></span>"
  1435. + " </label>"
  1436. + " </div>"
  1437. + " </div>"
  1438. + " <div class=\"col-xs-10\">"
  1439. + sideEffectNm
  1440. + " <input type=\"hidden\" name=\"sideEffectCode2\" value=\"" + sideEffectCd + "\" />"
  1441. + " </div>"
  1442. + "</div>";
  1443. if (sideEffectNm == "기타") {
  1444. div = "<div class=\"select_ico row mb-1\">"
  1445. + " <div class=\"col-xs-2 text-right\">"
  1446. + " <input type=\"checkbox\" name=\"sideEffectChk2\" autocomplete=\"off\" id=\"sideEffectEtc2\"/>"
  1447. + " <div class=\"group\">"
  1448. + " <label class=\"btn btn-check icon mt-0\" for=\"sideEffectEtc2\">"
  1449. + " <span class=\"glyphicon glyphicon-ok\" aria-hidden=\"true\"></span>"
  1450. + " </label>"
  1451. + " <label class=\"btn btn-outline-check icon mt-0\" for=\"sideEffectEtc2\">"
  1452. + " <span class=\"glyphicon\" aria-hidden=\"true\"></span>"
  1453. + " </label>"
  1454. + " </div>"
  1455. + " </div>"
  1456. + " <div class=\"col-xs-10\">"
  1457. + sideEffectNm
  1458. + " <input id=\"inputFinishEtc\" type=\"text\" class=\"form-control w-75 etc_text\" disabled />"
  1459. + " <input type=\"hidden\" name=\"sideEffectCode2\" value=\"" + sideEffectCd + "\" />"
  1460. + " </div>"
  1461. + "</div>";
  1462. }
  1463. // $(".modal-body.pt-4.pb-4").append(div);
  1464. $("#sideEffectFinish").append(div);
  1465. }
  1466. var sideEffectCds = selectItem[0].sideEffectCds;
  1467. var realSideEffects = sideEffectCds.split("^");
  1468. // var sideEffectCds = "02^03^07";
  1469. // var realSideEffects = sideEffectCds.split("^");
  1470. if (realSideEffects.length > 0) {
  1471. for (var i = 0; i < realSideEffects.length; i++) {
  1472. for (var j = 0; j < output.length; j++) {
  1473. if (realSideEffects[i] == output[j].sideEffectCd) {
  1474. $("#b" + (j + 1)).prop("checked", true);
  1475. if (output[j].sideEffectCd == "07") {
  1476. $("#sideEffectEtc2").prop("checked", true);
  1477. $("#inputFinishEtc").attr("disabled", false);
  1478. $("#inputFinishEtc").val(output[j].sideEffectNm);
  1479. }
  1480. }
  1481. }
  1482. }
  1483. }
  1484. $("#sideEffectEtc2").off("click");
  1485. $("#sideEffectEtc2").on("click", function() {
  1486. if ($("#sideEffectEtc2").is(":checked") == true) {
  1487. $("#inputFinishEtc").attr("disabled", false);
  1488. } else {
  1489. $("#inputFinishEtc").attr("disabled", true);
  1490. }
  1491. });
  1492. $("#sideEffectButton2").off("click");
  1493. $("#sideEffectButton2").on("click", function() {
  1494. $("#sideEffect_pop2").modal("hide");
  1495. // $("#sideEffect_pop").attr("style", "display: none");
  1496. });
  1497. // $("#transfusionStop2").off("click");
  1498. // $("#transfusionStop2").on("click", function() {
  1499. // var checkCnt = 0;
  1500. // for (var i = 0; i < $("input[name=sideEffectChk2]").length; i++) {
  1501. // if ($("input[name=sideEffectChk2]").eq(i).is(":checked") == true) {
  1502. // checkCnt = checkCnt + 1;
  1503. // }
  1504. // }
  1505. // if ($("#inputPulse3").val() == "" || $("#inputRespiration3").val() == ""
  1506. // || $("#inputTemperature3").val() == "" || $("#inputTemperatureSub3").val() == ""
  1507. // || $("#inputSbp3").val() == "" || $("#inputDbp3").val() == "") {
  1508. // alert("미입력된 항목이 있습니다. \n입력 후, 진행이 가능합니다.");
  1509. // return;
  1510. // }
  1511. // if (checkCnt == 0) {
  1512. // alert("미입력된 항목이 있습니다. \n입력 후, 진행이 가능합니다.");
  1513. // } else {
  1514. // inputBloodHealthCheckFinishStep("Y", 0);
  1515. // // $("#sideEffect_pop").attr("style", "display: none");
  1516. // $("#sideEffect_pop2").modal("hide");
  1517. // $(".modal").modal("hide");
  1518. // $(".modal-backdrop").modal("hide");
  1519. // getPocPatientInfo($("#txtTransFusionSearch").val(), false);
  1520. // }
  1521. // });
  1522. }
  1523. function getTransStopReasonList(type) {
  1524. var param = {
  1525. hospitalCd : localStorage.getItem("hospitalCd"),
  1526. userId : gLoginUserId
  1527. }
  1528. self.safety.getTransStopReasonList(param, type ,getTransStopReasonListCallBack);
  1529. }
  1530. function getTransStopReasonListCallBack(type, output) {
  1531. if (type == "Step2") {
  1532. secondStepTransYn(output);
  1533. } else if (type == "Step3") {
  1534. thirdstepTransYn(output);
  1535. }
  1536. }
  1537. function secondStepTransYn(output) {
  1538. $("#reasonEtcDiv").attr("style", "display: none;");
  1539. $("#reasonBox").attr("disabled", true);
  1540. $("#raN1").prop('checked', true);
  1541. $("#reasonBox").empty();
  1542. $("#reasonEtc").val("");
  1543. var reason = "";
  1544. for (var i = 0; i < output.length; i++) {
  1545. var transStopReasonNm = output[i].transStopReasonNm;
  1546. var transStopReasonCd = output[i].transStopReasonCd;
  1547. reason += "<option text=\""+ transStopReasonNm +"\"id=\"reason_" + i + "\" value=\"" + transStopReasonCd + "\">"+ transStopReasonNm + "</option> ";
  1548. }
  1549. $("#reasonBox").append(reason);
  1550. $("#raY1").off("click");
  1551. $("#raY1").on("click", function() {
  1552. if ($("#raY1").is(":checked") == true) {
  1553. $("#reasonBox").attr("disabled", false);
  1554. if ($("#reasonBox option:selected").text().trim() == "기타") {
  1555. $("#reasonEtcDiv").attr("style", "display: ;");
  1556. }
  1557. } else {
  1558. $("#reasonBox").attr("disabled", true);
  1559. $("#reasonEtcDiv").attr("style", "display: none;");
  1560. }
  1561. });
  1562. $("#raN1").off("click");
  1563. $("#raN1").on("click", function() {
  1564. if ($("#raN1").is(":checked") == true) {
  1565. $("#reasonBox").attr("disabled", true);
  1566. $("#reasonEtcDiv").attr("style", "display: none;");
  1567. } else {
  1568. $("#reasonBox").attr("disabled", false);
  1569. if ($("#reasonBox option:selected").text().trim() == "기타") {
  1570. $("#reasonEtcDiv").attr("style", "display: ;");
  1571. }
  1572. }
  1573. });
  1574. $("#reasonBox").change(function() {
  1575. $("#reasonBox option:selected").each(function() {
  1576. var selectEtc = $("#reasonBox option:selected").text().trim();
  1577. if (selectEtc == "기타") {
  1578. $("#reasonEtcDiv").attr("style", "display: ;");
  1579. } else {
  1580. $("#reasonEtcDiv").attr("style", "display: none;");
  1581. }
  1582. });
  1583. });
  1584. }
  1585. function thirdstepTransYn(output) {
  1586. $("#reasonEtcDiv2").attr("style", "display: none;");
  1587. $("#reasonBox2").attr("disabled", true);
  1588. $("#raN2").prop('checked', true);
  1589. $("#reasonBox2").empty();
  1590. $("#reasonEtc2").val("");
  1591. var selectTransStopYn = selectItem[0].transStopYn;
  1592. var selectTransStopReasonEtc = selectItem[0].transStopReasonEtc;
  1593. var selectTransStopReasonCd = selectItem[0].transStopReasonCd;
  1594. var reason = "";
  1595. for (var i = 0; i < output.length; i++) {
  1596. var transStopReasonNm = output[i].transStopReasonNm;
  1597. var transStopReasonCd = output[i].transStopReasonCd;
  1598. reason += "<option text=\""+ transStopReasonNm + "\" value=\"" + transStopReasonCd + "\">"+ transStopReasonNm + "</option> ";
  1599. }
  1600. $("#reasonBox2").append(reason);
  1601. if (selectTransStopYn == "Y") {
  1602. $("#raY2").prop("checked", true);
  1603. $("#reasonBox2").attr("disabled", false);
  1604. for (var i = 0; i < output.length; i++) {
  1605. if (selectTransStopReasonCd == output[i].transStopReasonCd) {
  1606. // $("#reasonBox2").selectpicker('refresh');
  1607. // $("#reasonBox2").selectpicker("val", output[i].transStopReasonNm);
  1608. $("#reasonBox2 option:eq(" + i + ")").attr("selected", "selected");
  1609. if (output[i].transStopReasonCd.trim() == "12399") {
  1610. $("#reasonBox2 option:eq(" + i + ")").attr("selected", "selected");
  1611. $("#reasonEtc2").val(selectTransStopReasonEtc);
  1612. $("#reasonEtcDiv2").attr("style", "display: ;");
  1613. }
  1614. }
  1615. }
  1616. }
  1617. $("#raY2").off("click");
  1618. $("#raY2").on("click", function() {
  1619. if ($("#raY2").is(":checked") == true) {
  1620. $("#reasonBox2").attr("disabled", false);
  1621. if ($("#reasonBox2 option:selected").text().trim() == "기타") {
  1622. $("#reasonEtcDiv2").attr("style", "display: ;");
  1623. }
  1624. } else {
  1625. $("#reasonBox2").attr("disabled", true);
  1626. $("#reasonEtcDiv2").attr("style", "display: none;");
  1627. }
  1628. });
  1629. $("#raN2").off("click");
  1630. $("#raN2").on("click", function() {
  1631. if ($("#raN2").is(":checked") == true) {
  1632. $("#reasonBox2").attr("disabled", true);
  1633. $("#reasonEtcDiv2").attr("style", "display: none;");
  1634. } else {
  1635. $("#reasonBox2").attr("disabled", false);
  1636. if ($("#reasonBox2 option:selected").text().trim() == "기타") {
  1637. $("#reasonEtcDiv2").attr("style", "display: ;");
  1638. }
  1639. }
  1640. });
  1641. $("#reasonBox2").change(function() {
  1642. $("#reasonBox2 option:selected").each(function() {
  1643. var selectEtc = $("#reasonBox2 option:selected").text().trim();
  1644. if (selectEtc == "기타") {
  1645. $("#reasonEtcDiv2").attr("style", "display: ;");
  1646. } else {
  1647. $("#reasonEtcDiv2").attr("style", "display: none;");
  1648. }
  1649. });
  1650. });
  1651. }
  1652. function getSideEffectList() {
  1653. var param = {
  1654. hospitalCd : localStorage.getItem("hospitalCd"),
  1655. userId : gLoginUserId
  1656. }
  1657. self.safety.getSideEffectList(param, getSideEffectList15Callback);
  1658. }
  1659. function getSideEffectList15Callback(output) {
  1660. $("#sideEffectPop").children().remove();
  1661. for (var i = 0; i < output.length; i++) {
  1662. var sideEffectNm = output[i].sideEffectNm.trim();
  1663. var sideEffectCd = output[i].sideEffectCd.trim();
  1664. var div = "<div class=\"select_ico row mb-1\">"
  1665. + " <div class=\"col-xs-2 text-right\">"
  1666. + " <input type=\"checkbox\" name=\"sideEffectChk\" autocomplete=\"off\" id=\"p" + (i+1) +"\"/>"
  1667. + " <div class=\"group\">"
  1668. + " <label class=\"btn btn-check icon mt-0\" for=\"p" + (i+1) + "\">"
  1669. + " <span class=\"glyphicon glyphicon-ok\" aria-hidden=\"true\"></span>"
  1670. + " </label>"
  1671. + " <label class=\"btn btn-outline-check icon mt-0\" for=\"p" + (i+1) + "\">"
  1672. + " <span class=\"glyphicon\" aria-hidden=\"true\"></span>"
  1673. + " </label>"
  1674. + " </div>"
  1675. + " </div>"
  1676. + " <div class=\"col-xs-10\">"
  1677. + sideEffectNm
  1678. + " <input type=\"hidden\" name=\"sideEffectCode\" value=\"" + sideEffectCd + "\" />"
  1679. + " </div>"
  1680. + "</div>";
  1681. if (sideEffectNm == "기타") {
  1682. div = "<div class=\"select_ico row mb-1\">"
  1683. + " <div class=\"col-xs-2 text-right\">"
  1684. + " <input type=\"checkbox\" name=\"sideEffectChk\" autocomplete=\"off\" id=\"sideEffectEtc\"/>"
  1685. + " <div class=\"group\">"
  1686. + " <label class=\"btn btn-check icon mt-0\" for=\"sideEffectEtc\">"
  1687. + " <span class=\"glyphicon glyphicon-ok\" aria-hidden=\"true\"></span>"
  1688. + " </label>"
  1689. + " <label class=\"btn btn-outline-check icon mt-0\" for=\"sideEffectEtc\">"
  1690. + " <span class=\"glyphicon\" aria-hidden=\"true\"></span>"
  1691. + " </label>"
  1692. + " </div>"
  1693. + " </div>"
  1694. + " <div class=\"col-xs-10\">"
  1695. + sideEffectNm
  1696. + " <input id=\"inputEtc\" type=\"text\" class=\"form-control w-75 etc_text\" disabled />"
  1697. + " <input type=\"hidden\" name=\"sideEffectCode\" value=\"" + sideEffectCd + "\" />"
  1698. + " </div>"
  1699. + "</div>";
  1700. }
  1701. // $(".modal-body.pt-4.pb-4").append(div);
  1702. $("#sideEffectPop").append(div);
  1703. }
  1704. $("#sideEffectEtc").off("click");
  1705. $("#sideEffectEtc").on("click", function() {
  1706. if ($("#sideEffectEtc").is(":checked") == true) {
  1707. $("#inputEtc").attr("disabled", false);
  1708. } else {
  1709. $("#inputEtc").attr("disabled", true);
  1710. }
  1711. });
  1712. $("#sideEffectButton").off("click");
  1713. $("#sideEffectButton").on("click", function() {
  1714. $("#sideEffect_pop").modal("hide");
  1715. // $("#sideEffect_pop").attr("style", "display: none");
  1716. });
  1717. $("#transfusionStop").off("click");
  1718. $("#transfusionStop").on("click", function() {
  1719. var checkCnt = 0;
  1720. for (var i = 0; i < $("input[name=sideEffectChk]").length; i++) {
  1721. if ($("input[name=sideEffectChk]").eq(i).is(":checked") == true) {
  1722. checkCnt = checkCnt + 1;
  1723. }
  1724. }
  1725. if ($("#inputPulse2").val() == "" || $("#inputRespiration2").val() == ""
  1726. || $("#inputTemperature2").val() == "" || $("#inputTemperatureSub2").val() == ""
  1727. || $("#inputSbp2").val() == "" || $("#inputDbp2").val() == "") {
  1728. alert("미입력된 항목이 있습니다. \n입력 후, 진행이 가능합니다.");
  1729. return;
  1730. }
  1731. if (checkCnt == 0) {
  1732. alert("미입력된 항목이 있습니다. \n입력 후, 진행이 가능합니다.");
  1733. } else {
  1734. inputBloodHealthCheckStep4("Y");
  1735. // $("#sideEffect_pop").attr("style", "display: none");
  1736. $("#sideEffect_pop").modal("hide");
  1737. $(".modal").modal("hide");
  1738. $(".modal-backdrop").modal("hide");
  1739. getPocPatientInfo($("#txtTransFusionSearch").val(), false);
  1740. }
  1741. });
  1742. }
  1743. function inputBloodHealthCheckStep4(stopYn, convertStrDate) {
  1744. stopYn = stopYn == "Y" ? stopYn : "N";
  1745. var sideEffect = "N";
  1746. var sideEffectCode = "";
  1747. var sideEffectName = "";
  1748. for (var i = 0; i < $("input[name=sideEffectChk]").length; i++) {
  1749. if ($("input[name=sideEffectChk]").eq(i).is(":checked") == true) {
  1750. sideEffect = "Y";
  1751. var _sideEffectName = $("input[name=sideEffectChk]").eq(i).parent().parent().children().eq(1).text().trim();
  1752. var _sideEffectCode = $("input[name=sideEffectCode]").eq(i).val().trim();
  1753. // sideEffectCode += "CD:" + _sideEffectCode + "^";
  1754. sideEffectCode += _sideEffectCode + "^";
  1755. if (_sideEffectName == "기타") {
  1756. sideEffectName = $("#inputEtc").val();
  1757. }
  1758. }
  1759. }
  1760. var transStopReasonCd = "";
  1761. var transStopReasonEtc = "";
  1762. if (stopYn == "Y") {
  1763. if ($("#raY1").is(":checked") == true) {
  1764. transStopReasonCd = $("#reasonBox option:selected").val();
  1765. if ($("#reasonBox option:selected").text().trim() == "기타") {
  1766. transStopReasonEtc = $("#reasonEtc").val();
  1767. }
  1768. } else {
  1769. transStopReasonCd = "";
  1770. transStopReasonEtc = "";
  1771. }
  1772. } else {
  1773. transStopReasonCd = "";
  1774. transStopReasonEtc = "";
  1775. }
  1776. sideEffectCode = sideEffectCode.slice(0,-1);
  1777. executionDtTm = "";
  1778. var cnt = 0;
  1779. for (var i = 0; i < selectItem.length; i++) {
  1780. var hospitalCd = localStorage.getItem("hospitalCd");
  1781. var userId = gLoginUserId;
  1782. var userDeptCd = localStorage.getItem("selectedDeptCd");
  1783. var patientId = $("#txtTransFusionSearch").val();
  1784. var prescriptionNo = selectItem[i].prescriptionNo;
  1785. var bloodNo = selectItem[i].bloodNo;
  1786. var bloodSeq = selectItem[i].bloodSeq;
  1787. var bloodProduct = selectItem[i].bloodProduct;
  1788. var bloodCheckupStatus = "05";
  1789. var pulse = $("#inputPulse2").val();
  1790. var respiration = $("#inputRespiration2").val();
  1791. var bodytemperature = $("#inputTemperature2").val() + "." + $("#inputTemperatureSub2").val(); //체온
  1792. var systolicBp = $("#inputSbp2").val();
  1793. var diastolicBp = $("#inputDbp2").val();
  1794. var sideEffectYn = sideEffect;
  1795. var sideEffectCds = sideEffectCode;
  1796. var sideEffectNm = sideEffectName;
  1797. var transStopYn = stopYn;
  1798. console.log("stopYn -- > " + stopYn);
  1799. executionDtTm = moment(convertStrDate).format("YYYYMMDDHHmm");
  1800. console.log("executionDtTm -- > " + executionDtTm);
  1801. var bloodType = selectItem[i].bloodType;
  1802. var bloodRhType = selectItem[i].bloodRhType;
  1803. var prcpNm = selectItem[i].prcpNm;
  1804. var prcpCd = selectItem[i].prcpCd;
  1805. var prcpDd = selectItem[i].prcpDd;
  1806. var transCheckupId1 = "";
  1807. var transCheckupId2 = "";
  1808. transStopReasonCd = transStopReasonCd;
  1809. console.log("transStopReasonCd -- > " + transStopReasonCd);
  1810. transStopReasonEtc = transStopReasonEtc;
  1811. console.log("transStopReasonEtc -- > " + transStopReasonEtc);
  1812. var param = {
  1813. hospitalCd : hospitalCd ,
  1814. userId : userId ,
  1815. userDeptCd : userDeptCd ,
  1816. patientId : patientId ,
  1817. prescriptionNo : prescriptionNo ,
  1818. bloodNo : bloodNo ,
  1819. bloodSeq : bloodSeq ,
  1820. bloodProduct : bloodProduct ,
  1821. bloodCheckupStatus : bloodCheckupStatus,
  1822. pulse : pulse ,
  1823. respiration : respiration ,
  1824. bodytemperature : bodytemperature ,
  1825. systolicBp : systolicBp ,
  1826. diastolicBp : diastolicBp ,
  1827. sideEffectYn : sideEffectYn ,
  1828. sideEffectCds : sideEffectCds ,
  1829. sideEffectNm : sideEffectNm ,
  1830. transStopYn : transStopYn ,
  1831. executionDtTm : executionDtTm ,
  1832. bloodType : bloodType ,
  1833. bloodRhType : bloodRhType ,
  1834. prcpNm : prcpNm ,
  1835. prcpCd : prcpCd ,
  1836. prcpDd : prcpDd ,
  1837. transCheckupId1 : "" ,
  1838. transCheckupId2 : "" ,
  1839. transStopReasonCd : transStopReasonCd ,
  1840. transStopReasonEtc : transStopReasonEtc,
  1841. transCheckupNm1 : "",
  1842. transCheckupNm2 : ""
  1843. }
  1844. console.log("inputBloodHealthCheckStep4 param -- > " + JSON.stringify(param));
  1845. // self.safety.inputBloodHealthCheck(param, inputBloodHealthCheckCallback, selectItem);
  1846. self.safety.inputBloodHealthCheck(param, selectItem, inputBloodHealthCheckCallback, "step4");
  1847. };
  1848. }
  1849. // Step01 NFC 태그 이벤트
  1850. this.nfctagCallback = function(doctorId){
  1851. if(self.util.isEmpty(doctorId)){
  1852. $("#Modal01 .modal-body h4").text("NFC 정보가 없습니다");
  1853. $("#Modal01 .modal-body p").text("NFC 정보를 확인하여 주세요");
  1854. $("#Modal01").modal("show");
  1855. return;
  1856. } else {
  1857. var stringData = String(doctorId);
  1858. stringData = stringData.padStart(10, '0');
  1859. getNfcDoctorId(stringData);
  1860. console.log('NFC TAG READ: ' + stringData);
  1861. }
  1862. };
  1863. // Step01 NFC 태그 후 의료진 정보 API 호출
  1864. var getNfcDoctorId = function(doctorId) {
  1865. var param = {
  1866. hospitalCd: localStorage.getItem("hospitalCd"),
  1867. nfcId : doctorId
  1868. }
  1869. self.safety.getNfcDoctorId(param, processGetNfcDoctorId);
  1870. };
  1871. // 의료진 정보 API Callback
  1872. var processGetNfcDoctorId = function(result) {
  1873. var checkUpDoctorIdList = $("#inputDoctor input[name=checkUpDoctorId]");
  1874. if (checkUpDoctorIdList.length >= 2) {
  1875. alert("의료진은 최대 2명 까지 입력 가능합니다.");
  1876. } else {
  1877. for (var i = 0; i < checkUpDoctorIdList.length; i++) {
  1878. var _doctorId = checkUpDoctorIdList[i].value;
  1879. if (_doctorId.trim() == result[0].doctorId.trim()) {
  1880. alert("의료진 정보가 중복되었습니다.");
  1881. return;
  1882. }
  1883. }
  1884. }
  1885. if(result.length == 0) {
  1886. alert("조회된 의료진이 없습니다.");
  1887. } else {
  1888. if(result.length == 0){
  1889. alert("조회된 의료진이 없습니다.");
  1890. } else {
  1891. $("#doctorEmpty").attr("style", "display: none;");
  1892. if ($("#nfcDoctorId1").val() == "") {
  1893. $("#nfcDoctorId1").val("");
  1894. $("#nfcDoctorName1").text("");
  1895. $("#checkUpDoctorId1").remove();
  1896. $("#nfcDoctorName1").text(result[0].doctorNm.trim())
  1897. $("#nfcDoctorId1").val(result[0].doctorId.trim());
  1898. $("#nfcDoctorId1").parent().append("<input type=\"hidden\" id=\"checkUpDoctorId1\" name=\"checkUpDoctorId\" value=\"" + result[0].doctorId.trim() + "\" />");
  1899. } else if ($("#nfcDoctorId2").val() == "") {
  1900. $("#nfcDoctorId2").val("");
  1901. $("#nfcDoctorName2").text("");
  1902. $("#checkUpDoctorId2").remove();
  1903. $("#nfcDoctorName2").text(result[0].doctorNm.trim())
  1904. $("#nfcDoctorId2").val(result[0].doctorId.trim());
  1905. $("#nfcDoctorId2").parent().append("<input type=\"hidden\" id=\"checkUpDoctorId2\" name=\"checkUpDoctorId\" value=\"" + result[0].doctorId.trim() + "\" />");
  1906. }
  1907. $("#inputDoctor div button").on("click", function() {
  1908. $(this).parent().parent().children().eq(0).children().eq(0).val("");
  1909. $(this).parent().parent().children().eq(0).children().eq(1).remove();
  1910. $(this).parent().parent().children().eq(1).text("")
  1911. });
  1912. }
  1913. }
  1914. };
  1915. var getDoctorId = function (doctorId, type) {
  1916. var param = {
  1917. hospitalCd: localStorage.getItem("hospitalCd"),
  1918. userId: gLoginUserId,
  1919. doctorId: doctorId
  1920. }
  1921. self.schedule.getDoctorInfo(param, processGetDoctorId, type);
  1922. };
  1923. var processGetDoctorId = function(output, type) {
  1924. if (output.length == 0) {
  1925. alert("조회된 정보가 없습니다. 사번을 확인하여 주세요");
  1926. if (type == "first") {
  1927. $("#nfcDoctorId1").val("");
  1928. } else if (type == "second") {
  1929. $("#nfcDoctorId2").val("");
  1930. }
  1931. } else {
  1932. if (type == "first") {
  1933. $("#nfcDoctorName1").text(output[0].doctorNm);
  1934. } else if (type == "second") {
  1935. $("#nfcDoctorName2").text(output[0].doctorNm);
  1936. } else if (type == "cert") {
  1937. doctorInfo.push(output[0]);
  1938. console.log("----------Third DoctorInfo----------" + JSON.stringify(doctorInfo));
  1939. }
  1940. }
  1941. }
  1942. /**
  1943. * 문자열 일자 Date로 변환
  1944. * ex) 202002121430
  1945. */
  1946. function dateParse(str) {
  1947. if(!/^(\d){12}$/.test(str) || str == "") return "";
  1948. var y = str.substr(0, 4);
  1949. var m = str.substr(4, 2);
  1950. var d = str.substr(6, 2);
  1951. var h = str.substr(8, 2);
  1952. var mm = str.substr(10, 2);
  1953. return new Date(y,m-1,d,h,mm);
  1954. }
  1955. /**
  1956. * 문자열 일자 Date로 변환
  1957. * ex) 20200212143010
  1958. * YYYY-MM-DD HH:mm:ss
  1959. */
  1960. function fullDateParse(str) {
  1961. if(!/^(\d){14}$/.test(str) || str == "") return "";
  1962. var y = str.substr(0, 4);
  1963. var m = str.substr(4, 2) -1;
  1964. var d = str.substr(6, 2);
  1965. var h = str.substr(8, 2);
  1966. var mm = str.substr(10, 2);
  1967. var ss = str.substr(12, 2);
  1968. return new Date(y,m,d,h,mm,ss);
  1969. }
  1970. /**
  1971. * 문자열 일자 Date로 변환
  1972. * ex) 02 12 14 30
  1973. * MM-DD HH:mm
  1974. */
  1975. function dateParse2(str) {
  1976. if(!/^(\d){8}$/.test(str) || str == "") return "";
  1977. var m = str.substr(0, 2);
  1978. var d = str.substr(2, 2);
  1979. var h = str.substr(4, 2);
  1980. var mm = str.substr(6, 2);
  1981. return new Date(m, d, h, mm);
  1982. }
  1983. // 기본 클릭 이벤트 및 여러 이벤트 추가
  1984. var addEvent = function() {
  1985. eventCondition();
  1986. eventBackBlock();
  1987. };
  1988. //검색 페이지 뒤로가기 막기
  1989. var eventBackBlock = function() {
  1990. $(window).off("pageshow");
  1991. $(window).bind("pageshow", function(event) {
  1992. if (event.originalEvent.persisted) {
  1993. document.location.reload();
  1994. }
  1995. });
  1996. };
  1997. var eventCondition = function() {
  1998. /**
  1999. * 조회 버튼 클릭 이벤트
  2000. */
  2001. $("#btnTransFusionSearch").off("click");
  2002. $("#btnTransFusionSearch").on("click", function() {
  2003. $(this).blur();
  2004. var txtSearch = $("#txtTransFusionSearch").val();
  2005. if (txtSearch == "") {
  2006. $("#Modal01 .modal-body h4").text("입력된 환자번호가 없습니다.");
  2007. $("#Modal01 .modal-body p").text("환자번호를 입력해주세요.");
  2008. $("#Modal01").modal("show");
  2009. } else {
  2010. $("#btnTransFusionSearch").removeClass("btn-secondary").addClass("btn-primary");
  2011. getPocPatientInfo($("#txtTransFusionSearch").val(), false);
  2012. }
  2013. });
  2014. // Enter 입력시 검색
  2015. $("#txtTransFusionSearch").off("keydown");
  2016. $("#txtTransFusionSearch").on("keydown", function(e) {
  2017. if (e.keyCode == 13 && $("#txtTransFusionSearch").val().length != 0) {
  2018. $("#btnTransFusionSearch").removeClass("btn-secondary").addClass("btn-primary");
  2019. initPatientInfo();
  2020. getPocPatientInfo($("#txtTransFusionSearch").val(), false);
  2021. } else if (e.keyCode == 13 && $("#txtTransFusionSearch").val().length == 0) {
  2022. $("#Modal01 .modal-body h4").text("입력된 환자번호가 없습니다.");
  2023. $("#Modal01 .modal-body p").text("환자번호를 입력해주세요.");
  2024. $("#Modal01").modal("show");
  2025. $("#txtTransFusionSearch").focus();
  2026. }
  2027. });
  2028. $(".btn_close.float-right").off("click");
  2029. $(".btn_close.float-right").on("click", function() {
  2030. $(".modal").modal("hide");
  2031. $(".modal-backdrop").modal("hide");
  2032. getPocPatientInfo($("#txtTransFusionSearch").val(), false);
  2033. });
  2034. /**
  2035. * 활력징후 삭제 버튼 이벤트 시작
  2036. */
  2037. $("#bfPulseDel").off("click");
  2038. $("#bfPulseDel").on("click", function() {
  2039. $("#inputPulse").val("");
  2040. });
  2041. $("#bfRespirationDel").off("click");
  2042. $("#bfRespirationDel").on("click", function() {
  2043. $("#inputRespiration").val("");
  2044. });
  2045. $("#bfTempDel").off("click");
  2046. $("#bfTempDel").on("click", function() {
  2047. $("#inputTemperature").val("");
  2048. $("#inputTemperatureSub").val("");
  2049. });
  2050. $("#bfSbpDel").off("click");
  2051. $("#bfSbpDel").on("click", function() {
  2052. $("#inputSbp").val("");
  2053. });
  2054. $("#bfDbpDel").off("click");
  2055. $("#bfDbpDel").on("click", function() {
  2056. $("#inputDbp").val("");
  2057. });
  2058. $("#15PulseDel").off("click");
  2059. $("#15PulseDel").on("click", function() {
  2060. $("#inputPulse2").val("");
  2061. });
  2062. $("#15RespirationDel").off("click");
  2063. $("#15RespirationDel").on("click", function() {
  2064. $("#inputRespiration2").val("");
  2065. });
  2066. $("#15TempDel").off("click");
  2067. $("#15TempDel").on("click", function() {
  2068. $("#inputTemperature2").val("");
  2069. $("#inputTemperatureSub2").val("");
  2070. });
  2071. $("#15SbpDel").off("click");
  2072. $("#15SbpDel").on("click", function() {
  2073. $("#inputSbp2").val("");
  2074. });
  2075. $("#15DbpDel").off("click");
  2076. $("#15DbpDel").on("click", function() {
  2077. $("#inputDbp2").val("");
  2078. });
  2079. $("#afPulseDel").off("click");
  2080. $("#afPulseDel").on("click", function() {
  2081. $("#inputPulse3").val("");
  2082. });
  2083. $("#afRespirationDel").off("click");
  2084. $("#afRespirationDel").on("click", function() {
  2085. $("#inputRespiration3").val("");
  2086. });
  2087. $("#afTempDel").off("click");
  2088. $("#afTempDel").on("click", function() {
  2089. $("#inputTemperature3").val("");
  2090. $("#inputTemperatureSub3").val("");
  2091. });
  2092. $("#afSbpDel").off("click");
  2093. $("#afSbpDel").on("click", function() {
  2094. $("#inputSbp3").val("");
  2095. });
  2096. $("#afDbpDel").off("click");
  2097. $("#afDbpDel").on("click", function() {
  2098. $("#inputDbp3").val("");
  2099. });
  2100. /**
  2101. * 활력징후 삭제 버튼 이벤트 끝
  2102. */
  2103. /**
  2104. * Step1 의료진 수동 입력 삭제버튼
  2105. */
  2106. $("#delFirstDoctor").off("click");
  2107. $("#delFirstDoctor").on("click", function() {
  2108. $("#nfcDoctorId1").val("");
  2109. $("#nfcDoctorName1").text("");
  2110. });
  2111. $("#delSecondDoctor").off("click");
  2112. $("#delSecondDoctor").on("click", function() {
  2113. $("#nfcDoctorId2").val("");
  2114. $("#nfcDoctorName2").text("");
  2115. });
  2116. /**
  2117. * Step1 의료진 수동 입력 삭제버튼 끝
  2118. */
  2119. };
  2120. };