123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960 |
- <?xml version="1.0" encoding="utf-8"?>
- <Script type="xscript4.0"><![CDATA[
- /**
- 제작일 : 2007-10-04 3:30오후
- 제작자 : 현대정보기술 의료기술팀, 꿈꾸는 프로그래머 이제관 (je2kwan2@naver.com)
- 설명 : 간호인증 공통 모듈 (version TF4 Default)
- */
-
- var Sign = new ENRSign;
- Sign.init();
- //
- function ENRSign(){
- this.version = "TF4"; // CMC Framework based on TrustForm 4.0 RAD Tool
- this.certreload = false;
- this.debug = false;
-
- this.kmi_name = "";
- this.smm_name = "";
- this.kmi_ip = "";
- this.kmi_port = "";
-
- this.CERT_YEAR = 1970;
- this.CERT_MONTH = 1;
- this.CERT_DATE = 1;
- this.CERT_UID = "";
- this.CERT_DN = "";
- this.errmsg = "[전자서명 에러]";
- this.errcode = new Array;
-
- // this.xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
- // this.xmlDoc.async = false;
- // this.xmlDoc.resolveExternals = false;
- this.certchkflag = "Y";
- this.tempstr = "";
- this.signedInfos = new Array; // 외부용
- this.signData = ""; // 내부용
- this.signedData = ""; // 내부용
- this.emptyattname = "xml:"; // XML Text 변환시 Attribute 빈값에 대한 prefix name
- this.nulldatastring = "-"; // Topinfo 및 Session 데이터가 null 일때 인증데이터에 표기할 String
- // this.XPATH_MAINNODE = "/root/main";
- // this.XPATH_SIGNBASE = "/root/temp/SignData";
- // this.XPATH_BASICINFO = this.XPATH_SIGNBASE + "/PatientInfo";
- // this.XPATH_SIGNINFO = this.XPATH_SIGNBASE + "/SignInfo";
- // this.XPATH_SESSIONINFO = this.XPATH_SIGNBASE + "/SessionInfo";
- dsf_createDs("ds_temp_SignData_PatientInfo");
- dsf_createDs("ds_temp_SignData_SignInfo");
- dsf_createDs("ds_temp_SignData_SesstionInfo");
-
- // Sign KMI Communication & Verify Function
- this.init = enrfSign_Init;
- this.tfcheck = enrfSign_Check;
- // this.chk_mm = enrfSign_ActiveXCheck;
- this.loadkeyandcert = enrfSign_LoadKeyAndCert;
- this.certcheck = enrfSign_CertCheck;
- this.makesigndata = enrfSign_MakeSignData;
- this.verifysign = enrfSign_VerifySign;
-
- // ENR Sign Create Funtion
- this.findnode = enrfSign_FindNode;
- this.makenode = enrfSign_MakeNode;
- //this.setattnode = enrfSign_SetAttNode;
- this.getcommoninfo = enrfSign_GetCommonInfo;
- this.settaginfos = enrfSign_SetTagInfos;
- this.setsigninstance = enrfSign_SetSignInstance;
- this.removenochild = enrfSign_RemoveNoChild;
- this.makemainattnode = enrfSign_MakeMainAttNode;
- this.makeuserattnode = enrfSign_MakeUserAttNode;
- this.addnode = enrfSign_AddCopyNode;
-
- this.getsigndatatostr = enrfSign_GetSignDataToStr;
- this.getsigndataArray = enrfSign_GetSignDataArray;
- this.getnodenamestrvalue = enrfSign_GetNodeNameStrValue;
-
- this.signprocess = enrfSign_SignProcess; // core
- this.view_signprocess = enrfSign_ViewSignProcess; // core
- }
- //
- function enrfSign_Check(){
- var m_check = false;
- if (this.version == "TF4"){
- this.smm_name = "SKCOMMAX.SKCommAXCtrl.1"; // SKCommAX 객체 설치 여부 확인
- this.kmi_name = "KMCLIENTAX.KMClientAXCtrl.1"; // KMI 모듈 설치 여부확인
- this.kmi_ip = sysf_getUserInfo( "kmiip" );
- this.kmi_port = parseInt(sysf_getUserInfo( "kmiport" ));
- this.CERT_UID = sysf_getUserId();
-
- //2009-11-05 오후 1:28:31 taebum 확산병원 공통 계정 사용으로 주석처리 함.
- //if(this.CERT_UID == "ENR"){
- // this.CERT_UID = "00000001";
- //}
-
-
- m_check = true;
- }
-
- return m_check;
- }
- //
- function enrfSign_ActiveXCheck(pModule_name){
- var m_ClientAX;
- try {
- m_ClientAX = new ActiveXObject(pModule_name);
- }
- catch( ex ) {
- m_ClientAX = null;
- }
-
- return m_ClientAX;
- }
- var zes_objKMClient = null;
- var zes_objSKComm = null;
- function enrfSign_Init(){
- var m_return = true;
-
- if (this.tfcheck()){
- // zesfInitSign
- try {
- zes_objKMClient = this.components["axKMClient"]; // 객체를 찾음
- if (zes_objKMClient == null)
- {
- sysf_trace("zes_objKMClient is Null");
- // KMI 클라이언트 동적생성
- zes_objKMClient = new ActiveX("axKMClient", 0,0,0,0);
- zes_objKMClient.progid = "{D3C608B5-B664-4962-91B7-289DA892953A}";
- this.addChild("axKMClient", zes_objKMClient);
- zes_objKMClient.show();
- }
- } catch(e) {
- sysf_messageBox( "KMI 모듈이 설치되지", "E007" );
- m_return = false;
- }
-
- try {
- zes_objSKComm = this.components["axSKComm"]; // 객체를 찾음
- if (zes_objSKComm == null)
- {
- // 전자인증 관련 객체를 동적생성
- sysf_trace("zes_objSKComm is Null");
- zes_objSKComm = new ActiveX("axKMClient", 0,0,0,0);
- zes_objSKComm.progid = "{EC5D5118-9FDE-4A3E-84F3-C2B711740E70}";
- this.addChild("axSKComm", zes_objSKComm);
- zes_objSKComm.show();
- }
- } catch(e) {
- sysf_messageBox( "전자서명 모듈이 설치되지", "E007" );
- m_return = false;
- }
-
-
- // body.createChild("xforms:object", "id:KMClientAX; clsid:{d3c608b5-b664-4962-91b7-289da892953a}; visibility:hidden; left:0px; top:0px; width:0px; height:0px; ");
- // body.createChild("xforms:object", "id:CertManX; clsid:{ec5d5118-9fde-4a3e-84f3-c2b711740e70}; visibility:hidden; left:0px; top:0px; width:0px; height:0px; ");
-
- // if((this.chk_mm(this.kmi_name) == null) || (this.chk_mm(this.kmi_name) == null)) {
- // sysf_messageBox( "KMI / 전자서명 모듈이 설치되지", "E007" );
- // m_return = false;
- // }
- }
-
- return m_return;
- }
- // 인증서 Reload 여부 점검 Process
- function enrfSign_CertCheck(pUid, pReload){
- var dn = "";
- var msg = "";
- var m_return = "";
- var today = new Date();
- var m_Reload = false;
-
- this.errcode[3] = 362;
- if (pUid == null && pUid == "") pUid = getUserId();
-
- if (pReload == true) m_Reload = true;
- if (this.CERT_UID != pUid) m_Reload = true;
- if (this.CERT_YEAR != today.getFullYear()) m_Reload = true;
- if (this.CERT_MONTH != today.getMonth() + 1) m_Reload = true;
- if (this.CERT_DATE != today.getDate()) m_Reload = true;
-
- this.errcode[3] = 363;
- if (this.version == "TF4"){
- if (m_Reload) {
- this.errcode[3] = 364;
- CertManX.UnsetMatchedContext();
-
- this.errcode[3] = 365;
- dn = this.loadkeyandcert(pUid);
- this.CERT_DN = dn;
- } else {
- dn = this.CERT_DN;
- }
- }
-
- return dn;
- }
- //
- function enrfSign_LoadKeyAndCert(pUid) {
- var dn = "";
- var msg = "";
-
- this.errcode[4] = 365.00;
- if( !KMClientAX.kmsConnect(this.kmi_ip, this.kmi_port) ) {
- msg = "KMI 서버( IP:" + this.kmi_ip + ",포트:" + this.kmi_port + ") 연결에";
- messageBox( msg, "E009", getKMIErrMsg() );
- return dn;
- }
- if( this.debug == true ) {
- alert( "KMI 서버가 연결되었습니다." );
- }
-
- this.errcode[4] = 365.01;
- var envelop = KMClientAX.kmsInit();
- if( envelop == "" ) {
- msg = "KMI 모듈의 초기화에";
- messageBox( msg, "E009", getKMIErrMsg() );
- KMClientAX.kmsDisconnect();
- return dn;
- }
- if( this.debug == true ) {
- alert( "KMI 모듈이 초기화되었습니다. \nENVELOP : " + envelop );
- }
-
- this.errcode[4] = 365.02;
- dn = KMClientAX.GetKeyAndCert( pUid );
- if( dn == "" ) {
- msg = "KMI 서버에서 인증서( " + pUid + " )를 가져오는 데.";
- messageBox( msg, "E009", getKMIErrMsg() );
- KMClientAX.kmsDisconnect();
- return dn;
- }
- if( this.debug == true ) {
- alert( "인증서를 다운로드하였습니다.\n다운로드 인증서 DN : " + dn );
- }
-
- this.errcode[4] = 365.03;
- switch( KMClientAX.IsCertNew(pUid, dn) ) {
- case 0 : // 현재 인증서가 유효함
- if( this.debug == true ) {
- alert( "현재 인증서가 유효합니다." );
- }
- break;
- case 1 : // 인증서가 갱신되어 KMI에 재등록됨
- msg = "인증서의 갱신이";
- messageBox( msg, "I002");
- break;
- case 2 : // 인증서 갱신 실패 ( 에러코드와 메시지가 리턴됨 )
- msg = "인증서 갱신에";
- messageBox( msg, "E009", getKMIErrMsg());
- KMClientAX.LocalDelKeyAndCert(dn);
- KMClientAX.kmsDisconnect();
- return dn;
- case 3 : // 인증서 갱신은 성공 하였으나 KMI 서버 등록 실패 (인증서 백업 성공)
- case 4 : // 인증서 갱신은 성공 하였으나 KMI 서버 등록 실패 (인증서 백업 실패)
- msg = "갱신된 인증서의 KMI 등록에";
- messageBox( msg, "E009", "관리자에게 문의하시기 바랍니다.");
- KMClientAX.LocalDelKeyAndCert(dn);
- KMClientAX.kmsDisconnect();
- return dn;
- case 5 : // 이미 만료 되었거나 폐지된 인증서
- msg = "인증서가 만료되어 사용";
- messageBox( msg, "E001", "인증서를 재발급 받으시기 바랍니다.");
- KMClientAX.LocalDelKeyAndCert(dn);
- KMClientAX.kmsDisconnect();
- return dn;
- case 6 : // 인증서의 갱신을 사용자가 취소
- break;
- case 7 :
- msg = "인증서 화일에 문제가 있어 인증서 읽기에.";
- messageBox( msg, "E009", "관리자에게 문의하시기 바랍니다.");
- KMClientAX.LocalDelKeyAndCert(dn);
- KMClientAX.kmsDisconnect();
- return dn;
- }
- this.errcode[4] = 365.04;
- // 0 * 256 : SignKorea의 인증서만 선택
- // 0 * 16 : 비밀번호 입력 받음
- // 1 : 현재의 ActiveX 인스턴스가 유효할 동안 선택한 정보 유지
- // dn = CertManX.SetMatchedContextExt( dn, "", "", 0 * 256 + 0 * 16 + 1 );
- var matched_dn = CertManX.SetMatchedContextExt(dn, "", "", 0 * 256 + 0 * 16 + 1 );
- if( matched_dn == "" ) {
- msg = "인증서의 메모리 로드에";
- messageBox( msg, "E009", this.errmsg + CertManX.GetLastErrorMsg());
- KMClientAX.LocalDelKeyAndCert(dn);
- KMClientAX.kmsDisconnect();
- return matched_dn;
- }
- this.errcode[4] = 365.05;
- var today = new Date(); // Client Time 사용, But ServerTime Check 필요
- this.CERT_YEAR = today.getFullYear();
- this.CERT_MONTH = today.getMonth() + 1;
- this.CERT_DATE = today.getDate();
- this.CERT_UID = pUid;
- this.errcode[4] = 365.06;
- KMClientAX.LocalDelKeyAndCert(dn);
- this.errcode[4] = 365.07;
- KMClientAX.kmsDisconnect();
- return dn;
- }
- //
- function enrfSign_MakeSignData(pOrgData, pUid, pReload) {
- var m_signedData = "";
-
- if (this.version == "TF4"){
- this.errcode[2] = 361;
- if (this.certcheck(pUid, pReload) != ""){
- this.errcode[2] = 366;
- m_signedData = CertManX.SignDataB64( "", pOrgData, 0 );
-
- this.errcode[2] = 367;
- if (m_signedData == ""){
- var msg = "전자서명 생성에"
- messageBox( msg, "E009", this.errmsg + CertManX.GetLastErrorMsg());
- }
- }
- }
-
- this.signData = pOrgData;
- this.signedData = m_signedData;
-
- return m_signedData;
- }
- // 전자서명된 데이터 복원검증 Process
- function enrfSign_VerifySign(pSignedData){
- var orgData = "";
-
- if (this.version == "TF4"){
- if (pSignedData == null) pSignedData = this.signedData;
-
- if (pSignedData != ""){
- orgData = CertManX.VerifyDataB64(pSignedData, 0 );
-
- if( orgData == "" ) {
- var msg = "전자서명 검증에";
- messageBox( msg, "E009", this.errmsg + CertManX.GetLastErrorMsg());
- }
- }
- }
-
- return orgData;
- }
- //
- function enrfSign_FindNode(pXPath){
- var m_node = null;
-
- switch (this.version){
- case "TF4" :
- m_node = model.instances(0).selectSingleNode(pXPath);
- break;
- default : // TF3
- m_node = model.instance.selectSingleNode(pXPath);
- break;
- }
-
- return m_node;
- }
- //
- function enrfSign_MakeNode(pXPath)
- {
- var mNode = this.findnode(pXPath);
-
- if (mNode== null){
- model.makenode(pXPath); // TF3,4
- mNode = this.findnode(pXPath);
- }
-
- return mNode;
- }
- //
- function enrfSign_SetAttNode(pXPath, pAttrName, pValue)
- {
- var m_node = this.makenode(pXPath);
- m_node.setAttribute("name", pAttrName);
-
- var bHasCheck = this.findnode(pXPath).hasChildNodes();
-
- if (pValue != null){
- if (bHasCheck == false){ // 자식노드가 없으면
- model.setValue(pXPath, pValue); // TF3.4
- } else {
- var sErr = "[Debug Mode] : 인증구조 생성중 SetAttNode함수 수행시 상위노드에 값을 Setting 할수 없습니다."
- sErr += "\n\n[xPath] " + pXPath;
- sErr += "\n\n[Value] " + pValue;
- alert(sErr);
-
- return null;
- }
- }
-
- return m_node;
- }
- //
- function enrfSign_SetSignInstance()
- {
-
- ds_temp_SignData_PatientInfo.addColumn("pid", "string");
- ds_temp_SignData_PatientInfo.addColumn("pname", "string");
- ds_temp_SignData_PatientInfo.addColumn("age", "string");
- ds_temp_SignData_PatientInfo.addColumn("body", "string");
- ds_temp_SignData_PatientInfo.addColumn("btype", "string");
- ds_temp_SignData_PatientInfo.addColumn("insukind", "string");
- ds_temp_SignData_PatientInfo.addColumn("orddept", "string");
- ds_temp_SignData_PatientInfo.addColumn("apntdr", "string");
- ds_temp_SignData_PatientInfo.addColumn("attndr", "string");
-
- ds_temp_SignData_SesstionInfo.addColumn("userid", "string");
- ds_temp_SignData_SesstionInfo.addColumn("usernm", "string");
- ds_temp_SignData_SesstionInfo.addColumn("posinstnm", "string");
- ds_temp_SignData_SesstionInfo.addColumn("posdeptnm", "string");
- ds_temp_SignData_SesstionInfo.addColumn("dutplceinstnm", "string");
- ds_temp_SignData_SesstionInfo.addColumn("dutplcenm", "string");
- ds_temp_SignData_SesstionInfo.addColumn("jobkindnm", "string");
- ds_temp_SignData_SesstionInfo.addColumn("jobposnm", "string");
- ds_temp_SignData_SesstionInfo.addColumn("jobrespnm", "string");
- ds_temp_SignData_SesstionInfo.addColumn("prfshipflagnm", "string");
- ds_temp_SignData_SesstionInfo.addColumn("deptabbr", "string");
- ds_temp_SignData_SesstionInfo.addColumn("systemnm", "string");
- ds_temp_SignData_SesstionInfo.addColumn("systeminstnm", "string");
- ds_temp_SignData_SesstionInfo.addColumn("logindt", "string");
-
- this.settaginfos(ds_temp_SignData_PatientInfo, "TopInfo", false); // TopInfo 정보
- this.settaginfos(ds_temp_SignData_SesstionInfo, "SessionInfo", false); // Session 정보
-
- if (this.debug == true){
- alert("enrfSign_SetSignInstance XML View\n\n----------------------\n" + ds_temp_SignData_PatientInfo.saveXML());
- alert("enrfSign_SetSignInstance XML View\n\n----------------------\n" + ds_temp_SignData_SesstionInfo.saveXML());
- }
- }
- function enrfSign_SetTagInfos(oDs:DataSet, pMode, pClear){
- for( var iCnt = 0; iCnt < oDs.getColCount(); iCnt++){
- oDs.setColumn(0, iCnt, this.getcommoninfo(pMode, oDs.getColID(iCnt));
- }
- if (pClear == true){
-
- // this.removenochild(this.findnode(pPath));
- }
- }
- //
- /*
- function enrfSign_SetTagInfos(pParStr, pPath, pMode, pClear)
- {
- var m_SessionInfo = "";
- var m_KeyName = "";
-
- m_SessionInfo = pParStr;
- m_SessionInfo = m_SessionInfo.split("▩");
-
- for (var iCnt =0; iCnt < m_SessionInfo.length; iCnt++){
- m_KeyName = m_SessionInfo[iCnt].split("▦");
- if (m_KeyName != ""){
- this.setattnode(pPath + "/" + m_KeyName[0],
- m_KeyName[1],
- this.getcommoninfo(pMode, m_KeyName[0]));
- }
- }
-
- if (pClear == true){
- this.removenochild(this.findnode(pPath));
- }
- }
- */
- //
- function enrfSign_GetCommonInfo(pMode, pKeyInfo){
- var m_return = "";
-
- if (pMode == "TopInfo"){
- switch (this.version){
- case "TF4" :
- m_return = appf_getPatientInfo(pKeyInfo);
- if (m_return == "null") m_return = this.nulldatastring;
- break;
- case "TF3" : break;
- }
-
- return m_return;
- } else if (pMode == "SessionInfo"){
- switch (this.version){
- case "TF4" :
- m_return = sysf_getUserInfo(pKeyInfo);
- if (m_return == "null") m_return = this.nulldatastring;
- break;
- case "TF3" : break;
- }
-
- return m_return;
- }
-
- }
- // TF4에서만 확인해봄 : 노드에 값이 없으면 제거하는 함수
- function enrfSign_RemoveNoChild(pNode, pDebug) {
- //if (pNode == null) return;
- var pCnt = 0;
- var iCnt = 0;
- var iCntLoop = 0;
- while (1){
- iCntLoop++;
- iCnt = f_removechecker(pNode, iCnt);
-
- if (pCnt != iCnt){
- pCnt = iCnt;
- } else {
- break;
- }
- }
- //
- if (pDebug == true){
- alert("[Debug] RemoveNoChild 함수 진행, 반복횟수 iCntLoop:" + iCntLoop + " 총 삭제노드건수 iCnt : " + pCnt );
- }
- }
- // TF4에서만 확인해봄 :
- function f_removechecker(pNode, iCnt){
- if (pNode == null ) return iCnt;
-
- var nodes = pNode.childNodes;
- if (nodes.length > 0){ // exist
- var m_node = nodes.nextNode();
-
- while (m_node != null){
- iCnt = f_removechecker(m_node, iCnt);
-
- m_node = nodes.nextNode();
- }
- } else {
- var prNode = pNode.parentNode;
- if (pNode.nodeTypedValue == "" || pNode.nodeValue == ""){
- prNode.removeChild(pNode);
- iCnt++;
- }
- }
-
- return iCnt;
- }
- /**
- [MainData가 기준인 함수]
-
- - pXPath : 화면에 구현된 /root/MainData/... 경로 path(MainData PATH는 자동으로 SignData로 변경)
- - pAttrName : 해당 노드에 추가될 속성 name 의 값
- - pNodeValue : 추가될 노드에 설정할 Value 값
- - pAddNodeName : pXPath에 추가될 추가노드
-
- - 사용예)
- Sign.makemainattnode("/root/MainData/condition/datas", "조건들", "없음", "check");
-
- 사용예 결과)
- <root>
- <SignData>
- <condtion>
- <datas>
- <check name="조건들">없음</check>
- <datas>
- </condtion>
- </SignData>
- </root>
- */
- function enrfSign_MakeMainAttNode(pXPath, pAttrName, pNodeValue, pAddNodeName)
- {
- var m_PathNode = this.XPATH_SIGNINFO;
- if (pAddNodeName != null){
- m_PathNode += "/" + pAddNodeName;
- }
-
- var re = new RegExp(this.XPATH_MAINNODE, ["gi"]);
- var m_Path = pXPath.replace(re, m_PathNode);
- var m_node = null;
-
- m_node = this.setattnode(m_Path, pAttrName, pNodeValue);
-
- if (m_node == null){
- throw "MakeMainAttNode return Value : Null";
- }
-
- return m_node;
- }
- /**
- 사용자가 지정한 경로(pSignPath)에 노드를 만드는 함수
-
- - 사용예)
- Sign.makeuserattnode("/root/SignData/emrdata", "기본", "영양별");
-
- 사용예 결과)
- <root>
- <SignData>
- <emrdata name="기본">영양별</emrdata>
- </SignData>
- </root>
- */
- function enrfSign_MakeUserAttNode(pSignPath, pAttrName, pNodeValue) {
- var m_node = null;
- if (pSignPath == null) return m_node;
-
- m_node = this.setattnode(pSignPath, pAttrName, pNodeValue);
-
- if (m_node == null){
- throw "MakeUserAttNode return Value : Null";
- }
-
- return m_node;
- }
- //
- function enrfSign_AddCopyNode(pCopyNodePath){
- var m_RootNode = this.findnode(pCopyNodePath);
- if (m_RootNode != null){
- if (pCopyNodePath != "" && pCopyNodePath != null){
- var m_temppath = this.XPATH_SIGNINFO + "/" + m_RootNode.nodeName;
-
- this.makenode(m_temppath);
- model.copynode(m_temppath, pCopyNodePath);
- }
- }
- }
- // 선택 node를 String 데이터로 돌려주는 함수
- function enrfSign_GetSignDataToStr(pXPath){
- this.tempstr = "";
- var m_RootNode = this.findnode(pXPath);
- var m_NowNode = m_RootNode.firstChild;
-
- if (m_NowNode == null) return;
-
- var m_txt = "";
- while ((m_NowNode.nodeName != m_RootNode.nodeName) &&
- (m_NowNode.parentNode.nodeName != m_RootNode.parentNode.nodeName)) {
-
- if (m_NowNode.getAttribute("name") != null && m_NowNode.getAttribute("name") != ""){
- m_txt = m_txt + "\n" + this.tempstr + m_NowNode.getAttribute("name");
- } else {
- m_txt = m_txt + "\n" + this.tempstr + this.emptyattname + m_NowNode.nodeName;
- }
-
- if (m_NowNode.nodeValue != null && m_NowNode.nodeValue != "") {
- m_txt = m_txt + ": " + m_NowNode.nodeValue;
- }
-
- m_NowNode = this.getnodenamestrvalue(m_NowNode, m_RootNode);
-
- if (m_NowNode == null) {
- break;
- }
- }
-
- return m_txt;
- }
- // GetSignDataToStr 에서 사용하는 재귀함수
- function enrfSign_GetNodeNameStrValue(pNowNode, pRootNode){
- var m_tempPath = "/root";
- var m_refPath = m_tempPath + "/" + pNowNode.nodeName;
-
- var m_childnode = pNowNode.firstChild;
- if (m_childnode != null){
- m_tempPath = m_refPath;
- this.tempstr = this.tempstr + " ";
-
- return m_childnode;
- }
- var m_sibling = pNowNode.nextSibling;
- if (m_sibling != null) {
- m_tempPath = m_refPath;
-
- return m_sibling;
- } else { // m_sibling == null
- var m_nodePT = pNowNode;
- while(1) {
- m_nodePT = m_nodePT.parentNode;
-
- this.tempstr = this.tempstr.substring(0, this.tempstr.length-2);
-
- if (m_nodePT == null) {
- return null;
- }
-
- if ((m_nodePT.nodeName == pRootNode.nodeName) && (m_nodePT.getAttribute("name") == pRootNode.getAttribute("name"))) {
- return m_nodePT;
- }
-
- if (m_nodePT.nextSibling == null){
- continue;
- } else {
- return m_nodePT.nextSibling;
- }
- }
- }
- }
- //
- function enrfSign_SignProcess(pClearNode){
- //
- this.errcode[0] = 0;
- this.errcode[1] = 0;
- this.errcode[2] = 0;
- this.errcode[3] = 0;
- this.errcode[4] = 0;
-
- var bCheck = true;
- var bResultArr = null;
-
- // 인증결과 Clear Setting
- this.signedInfos[0] = false;
- this.signedInfos[1] = "";
- this.signedInfos[2] = "";
- this.signedInfos[3] = "";
- this.signedInfos[4] = "";
- this.signedInfos[5] = "";
-
-
- ds_temp_SignData_PatientInfo.clearData();
- ds_temp_SignData_SignInfo.clearData();
- ds_temp_SignData_SesstionInfo.clearData();
-
- ds_temp_SignData_PatientInfo.addRow();
- ds_temp_SignData_SesstionInfo.addRow();
- // model.removeNodeset(this.XPATH_SIGNBASE); // TF3,4
- this.setsigninstance();
-
- try{
- // 인증 Process "fMake_SignData" CallBack 함수 : 사용자정의
- fMake_SignData();
- } catch(E){
- bCheck = false;
- alert("[Debug Mode] : ENR 인증데이터 생성함수(fMake_SignData)에 문제가 있습니다.");
- }
-
- this.errcode[0] = 300;
- if (bCheck == true){
- bCheck = this.getsigndataArray(this.CERT_UID, this.certreload); // Array 구조로 생성된 데이터를 돌려줌 : this.signedInfos
- }
-
- if (pClearNode == true){
- // 3. 인증을 위해 생성된 데이터 삭제
- model.removeNodeset(this.XPATH_SIGNBASE);
- }
- return bCheck;
- }
- function enrfSign_ViewSignProcess(pClearNode){
-
- //
- this.errcode[0] = 0;
- this.errcode[1] = 0;
- this.errcode[2] = 0;
- this.errcode[3] = 0;
- this.errcode[4] = 0;
-
- var bCheck = true;
- var bResultArr = null;
-
- // 인증결과 Clear Setting
- this.signedInfos[0] = false;
- this.signedInfos[1] = "";
- this.signedInfos[2] = "";
- this.signedInfos[3] = "";
- this.signedInfos[4] = "";
- this.signedInfos[5] = "";
-
- //this.errcode[0] = 100;
- model.removeNodeset(this.XPATH_SIGNBASE); // TF3,4
- this.setsigninstance();
-
- //this.errcode[0] = 200;
- try{
- // 인증 Process "fMake_SignData" CallBack 함수 : 사용자정의
- fMake_ViewSignData();
- } catch(E){
- bCheck = false;
- alert("[Debug Mode] : ENR 인증데이터 생성함수(fMake_SignData)에 문제가 있습니다.");
- }
-
- this.errcode[0] = 300;
- if (bCheck == true){
- bCheck = this.getsigndataArray(this.CERT_UID, this.certreload); // Array 구조로 생성된 데이터를 돌려줌 : this.signedInfos
- }
-
- if (pClearNode == true){
- // 3. 인증을 위해 생성된 데이터 삭제
- model.removeNodeset(this.XPATH_SIGNBASE);
- }
- return bCheck;
- }
- //
- function enrfSign_GetSignDataArray(pUid, pReload) {
- var ls_enrinptsavetime = fGetEMRHardCDList("Y", 450, 3); // 진료하드코딩 조회 CareCom.js
- var ll_enrinptsavetime = ls_enrinptsavetime == "" ? 0 : parseInt(ls_enrinptsavetime) * -1;
-
- var mstatecheck = false;
- var mSignData1 = "";
- var mSignedData = "";
- var mSignData3 = "";
- var mViewData4 = "";
- var mViewData5 = "";
-
- this.errcode[1] = 300;
- try {
- this.errcode[1] = 310;
- mSignData3 = this.findnode(this.XPATH_SIGNBASE).xml; // 변경 xml 데이터저장패턴으로...
-
- this.errcode[1] = 320;
- mViewData4 = this.getsigndatatostr(this.XPATH_SIGNBASE); // 전자서명할 원문 데이터
-
- // 값이 없는것들은 제거함 (Attribute만 있는것도 날림)
- this.errcode[1] = 330;
- this.removenochild(this.findnode(this.XPATH_SIGNBASE));
-
- this.errcode[1] = 340;
- mSignData1 = this.findnode(this.XPATH_SIGNBASE).xml; // 변경 xml 데이터저장패턴으로...
-
- this.errcode[1] = 350;
- mViewData5 = this.getsigndatatostr(this.XPATH_SIGNBASE); // 전자서명할 원문 데이터
-
- this.errcode[1] = 360;
- // -----------------------(2010.08.18 센터)start--------------------
- //운영서버는 인증모듈 타고 그외서버는 인증모듈제외
- //if (htmlwindow.DEVSystem != "true") {
-
- if(this.certchkflag == "Y") {
- if(ll_enrinptsavetime < 0 && getGlobalVariable("enrinptsavetime") >= getCurrentDateTime().toDate("YYYYMMDD hhmmss").getAddDate(ll_enrinptsavetime, "m").getDateFormat("YYYYMMDD hhmmss")){
- mSignedData = this.findnode(this.XPATH_SIGNBASE).xml //전자서명 없이 저장처리할 경우 설정 부분
- }else{
- mSignedData = this.makesigndata(mSignData1, pUid, pReload, true) //전자서명 popup호출
- }
- } else {
- mSignedData = this.findnode(this.XPATH_SIGNBASE).xml //전자서명 없이 저장처리할 경우 설정 부분
- }
- //} else {
- // mSignedData = this.findnode(this.XPATH_SIGNBASE).xml //전자서명 없이 저장처리할 경우 설정 부분
- //}
- // -----------------------(2010.08.18 센터)start--------------------
- this.errcode[1] = 370;
- if (mSignedData == "" || mSignedData == null) {
- this.signedInfos[0] = mstatecheck;
- this.signedInfos[1] = mSignData1; // 인증할 데이터 정보
- this.signedInfos[2] = mSignedData;
- this.signedInfos[3] = mSignData3;
- this.signedInfos[4] = mViewData4;
- this.signedInfos[5] = mViewData5;
-
- return false;
- }
-
- this.errcode[1] = 0;
- mstatecheck = true;
- } catch(E){
- alert("ENR 인증모듈 작업에 문제가 있습니다. 관리자에게 문의하세요 Code(" + this.errcode + ")...\n\n" + E);
- return mstatecheck;
- }
-
- this.signedInfos[0] = mstatecheck; // [0] : 인증성공여부
- this.signedInfos[1] = mSignData1; // [1] : 인증할 데이터 정보 (미기록 노드 제거된 정보)
- this.signedInfos[2] = mSignedData; // [2] : 공인인증 처리후 데이터
- this.signedInfos[3] = mSignData3; // [3] : 인증할 데이터 정보 (미기록 노드 제거전 원본 노드)
- this.signedInfos[4] = mViewData4; // [4] : [3]데이터(없는 노드 포함된)를 text 형태로 추출보기
- this.signedInfos[5] = mViewData5; // [5] : [1]데이터(없는 노드 제거된)를 text 형태로 추출보기
-
- if(mstatecheck == true){
- if(ll_enrinptsavetime < 0 && getGlobalVariable("enrinptsavetime") >= getCurrentDateTime().toDate("YYYYMMDD hhmmss").getAddDate(ll_enrinptsavetime, "m").getDateFormat("YYYYMMDD hhmmss")){
-
- }else{
- setGlobalVariable("enrinptsavetime", getCurrentDateTime());
- }
- }
-
- return mstatecheck;
- }
- // 진료 하드코딩 조회
- function fGetEMRHardCDList(option, hardcdno, rtnValue , rslt_ref_list) {
- model.makeNode(rslt_ref_list);
- var destNode = model.instances(0).selectSingleNode(rslt_ref_list);
- var sysMessageobj = getViewer("sysMessage");
- if (sysMessageobj != null) {
- if (option == "Y") {
- try {
- var hardcdno = sysMessageobj.window.instance1.selectSingleNode("/root/properties/orderbasicinfo/hardcdlist/hardcd[hardcdno='" + hardcdno + "']/hardcdno").text;
- var hardcodenm = sysMessageobj.window.instance1.selectSingleNode("/root/properties/orderbasicinfo/hardcdlist/hardcd[hardcdno='" + hardcdno + "']/hardcodenm").text;
- var hardcd = sysMessageobj.window.instance1.selectSingleNode("/root/properties/orderbasicinfo/hardcdlist/hardcd[hardcdno='" + hardcdno + "']/hardcd").text;
- var hardcdnm = sysMessageobj.window.instance1.selectSingleNode("/root/properties/orderbasicinfo/hardcdlist/hardcd[hardcdno='" + hardcdno + "']/hardcdnm").text;
- var cdseqno = sysMessageobj.window.instance1.selectSingleNode("/root/properties/orderbasicinfo/hardcdlist/hardcd[hardcdno='" + hardcdno + "']/cdseqno").text;
- } catch(err) {
- model.makeValue("/root/enrtemp/hardcd", hardcdno);
- mmbfGetHardCodeInfo("/root/send/reqdata", "/root/enrtemp/hardcd", hardcdno); //
- var hardcd = model.getValue("/root/enrtemp/hardcd/hardcd");
- var hardcdnm = model.getValue("/root/enrtemp/hardcd/hardcdnm");
- var cdseqno = model.getValue("/root/enrtemp/hardcd/cdseqno");
- }
-
- if (rtnValue == 1) {
- return hardcdno;
- } else if (rtnValue == 1) {
- return hardcodenm;
- } else if (rtnValue == 2) {
- return hardcdno;
- } else if (rtnValue == 3) {
- return hardcd;
- } else if (rtnValue == 4) {
- return hardcdnm;
- } else if (rtnValue == 5) {
- return cdseqno;
- } else if (rtnValue == 9) {
- return hardcd+ "|" + hardcdnm + "|" + cdseqno;
- }
- } else {
-
- var destListLen = destNode.childNodes.length;
- if (destListLen < 1 ) { // 한번이라도 복사된 내용이 있으면 다시 안하도록 수정 2011. 01.20 김영학
- var destNode = instance1.selectSingleNode(rslt_ref_list);
- var nodes = sysMessageobj.window.instance1.selectNodes("/root/properties/orderbasicinfo/hardcdlist/hardcd[hardcdno='"+hardcdno+"']");
- for(i=1; i<= nodes.length; i++) {
- destNode.appendChild(nodes.item(i-1).cloneNode(true));
- }
- }
- }
- }
- }
- function mmbfGetHardCodeInfo(ref, rsltref, hardcd){
- fGetEMRHardCDList("N", hardcd, 0, rsltref);
- model.refresh();
- }
- ]]></Script>
|