#region Copyright © 2015 CLIPSOFT Co.,Ltd. All Rights Reserved.
//
// All rights are reserved. Reproduction or transmission in whole or in part, 
// in any form or by any means, electronic, mechanical or otherwise, is 
// prohibited without the prior written consent of the copyright owner.
//
// Filename:Common.cs
//
#endregion
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Text;

namespace CLIP.eForm.Consent.UI {
    /// <summary>
    /// Global Parameter를 생성하기 위한 클래스
    /// </summary>
    /// <remarks>
    /// <p>[설계자]</p>
    /// <p>  클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
    /// <p>[원본 작성자]</p>
    /// <p>  클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
    /// <p>[수정 작성자]</p>
    /// <p>  클립소프트 기술부 이인희</p>
    /// <p>----------------------------------------------------------------------------------------</p>
    /// <p>[HISTORY]</p>
    /// <p> 2015-08-06 : 최초작성</p>
    /// <p>----------------------------------------------------------------------------------------</p>
    /// </remarks>  
    public class Common {
        public static Dictionary<FOSParameter, string> CreateGlobalParamsDictionary(string instcd) {
            Dictionary<FOSParameter, string> dic = new Dictionary<FOSParameter, string>();

            foreach (string s in Enum.GetNames(typeof(FOSParameter))) {
                dic.Add((FOSParameter)Enum.Parse(typeof(FOSParameter), s), string.Empty);
            }

            // 전자동의서 팝업창에서 연결 할 주소 파라미터를 매핑
            dic[FOSParameter.PopupPath] = instcd == "031" ? "https://ema031.knuh.kr:9091/" : "https://ema032.knuh.kr:8091/";
            dic[FOSParameter.Instcd] = instcd;

            return dic;
        }

        /// <summary>
        /// param, guid값을 넘겨받아 그를 포함하는 fos를 리턴한다.
        /// </summary>
        /// <param name="guid"></param>
        /// <param name="fosParams"></param>
        /// <returns></returns>
        public static string GetFosString(List<string> guids, string formServiceUrl, Dictionary<FOSParameter, string> fosGlobalParams, Dictionary<string, Dictionary<FOSParameter, string>> fosFormParams, string pInstCd) {
            StringBuilder fos = new StringBuilder();
            fos.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            fos.Append("<fos version=\"1.0\">");
            fos.Append("<global>");
            fos.Append(GetParamsString(fosGlobalParams, pInstCd));
            fos.Append(string.Format("<page-template path=\"{0}\" request-encode=\"utf-8\" response-encode=\"utf-8\">", formServiceUrl));
            fos.Append("<template-get-parameters>");
            fos.Append("<post-param key=\"OP\"><![CDATA[PAGE_TEMPLATE]]></post-param>");
            fos.Append("<post-param key=\"PD\"><![CDATA[<data>");
            fos.Append("<action>GET_LIST</action>");
            fos.Append("<params>");
            fos.Append("<param name='adaptername'>defaultadapter</param>");
            fos.Append("</params>");
            fos.Append("</data>]]></post-param>");
            fos.Append("</template-get-parameters>");
            fos.Append("</page-template>");
            fos.Append("</global>");
            fos.Append("<form-list>");

            int openSeq = 1;
            foreach (string guid in guids) {
                fos.Append(string.Format("<form name=\"noname\" open-sequence=\"{0}\" path=\"{1}\" request-encode=\"utf-8\" response-encode=\"utf-8\">", openSeq, formServiceUrl));
                fos.Append("<parameters>");

                if (fosFormParams != null) {
                    if (fosFormParams.ContainsKey(guid)) {
                        Dictionary<FOSParameter, string> fosFormParamsByGuid = fosFormParams[guid];
                        foreach (FOSParameter paramKey in fosFormParamsByGuid.Keys) {
                            fos.Append(string.Format("<param name='{0}'><![CDATA[{1}]]></param>", GetFOSName(paramKey, pInstCd), fosFormParamsByGuid[paramKey]));
                        }
                    }
                }

                fos.Append("</parameters>");
                fos.Append("<form-get-parameters>");
                fos.Append("<post-param key=\"OP\"><![CDATA[VIEWER_FORM]]></post-param>");
                fos.Append("<post-param key=\"PD\"><![CDATA[<data>");
                fos.Append("<action>GET</action>");
                fos.Append("<params>");
                fos.Append("<param name='adaptername'>defaultadapter</param>");
                fos.Append("<param name='type'>guid</param>");
                fos.Append(string.Format("<param name='guid'>{0}</param>", guid));
                fos.Append("<param name='version'>-1</param>");
                fos.Append("</params>");
                fos.Append("</data>]]></post-param>");
                fos.Append("</form-get-parameters>");
                fos.Append("</form>");

                openSeq++;
            }

            fos.Append("</form-list>");
            fos.Append(" </fos>");

            return fos.ToString();
        }

        /// <summary>
        /// param, guid값을 넘겨받아 그를 포함하는 fos를 리턴한다.
        /// </summary>
        /// <param name="guid"></param>
        /// <param name="fosParams"></param>
        /// <returns></returns>
        public static string GetMultiFosString(string[] guids, string formServiceUrl, Dictionary<FOSParameter, string> fosGlobalParams, Dictionary<string, Dictionary<FOSParameter, string>> fosFormParams, string pInstCd) {
            StringBuilder fos = new StringBuilder();
            fos.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            fos.Append("<fos version=\"1.0\">");
            fos.Append("<global>");
            fos.Append("<parameters>");
            if (fosGlobalParams != null) { fos.Append(GetParamsString(fosGlobalParams, pInstCd)); }
            fos.Append("</parameters>");
            fos.Append(string.Format("<page-template path=\"{0}\" request-encode=\"utf-8\" response-encode=\"utf-8\">", formServiceUrl));
            fos.Append("<template-get-parameters>");
            fos.Append("<post-param key=\"OP\"><![CDATA[PAGE_TEMPLATE]]></post-param>");
            fos.Append("<post-param key=\"PD\"><![CDATA[<data>");
            fos.Append("<action>GET_LIST</action>");
            fos.Append("<params>");
            fos.Append("<param name='adaptername'>defaultadapter</param>");
            fos.Append("</params>");
            fos.Append("</data>]]></post-param>");
            fos.Append("</template-get-parameters>");
            fos.Append("</page-template>");
            fos.Append("</global>");
            fos.Append("<form-list>");

            int openSeq = 1;
            foreach (string guid in guids) {
                fos.Append(string.Format("<form name=\"noname\" open-sequence=\"{0}\" path=\"{1}\" request-encode=\"utf-8\" response-encode=\"utf-8\">", openSeq, formServiceUrl));
                fos.Append("<parameters>");

                if (fosFormParams != null) {
                    if (fosFormParams.ContainsKey(openSeq.ToString())) {
                        Dictionary<FOSParameter, string> fosFormParamsByGuid = fosFormParams[openSeq.ToString()];
                        foreach (FOSParameter paramKey in fosFormParamsByGuid.Keys) {
                            fos.Append(string.Format("<param key='{0}'><![CDATA[{1}]]></param>", GetFOSName(paramKey, pInstCd), fosFormParamsByGuid[paramKey]));
                        }
                    }
                }

                fos.Append("</parameters>");
                fos.Append("<form-get-parameters>");
                fos.Append("<post-param key=\"OP\"><![CDATA[VIEWER_FORM]]></post-param>");
                fos.Append("<post-param key=\"PD\"><![CDATA[<data>");
                fos.Append("<action>GET</action>");
                fos.Append("<params>");
                fos.Append("<param name='adaptername'>defaultadapter</param>");
                fos.Append("<param name='type'>guid</param>");
                fos.Append(string.Format("<param name='guid'>{0}</param>", guid));
                fos.Append("<param name='version'>-1</param>");
                fos.Append("</params>");
                fos.Append("</data>]]></post-param>");
                fos.Append("</form-get-parameters>");
                fos.Append("</form>");

                openSeq++;
            }

            fos.Append("</form-list>");
            fos.Append(" </fos>");

            return fos.ToString();
        }
        public static string GetMultiFosString(string[] guids, string formServiceUrl, Dictionary<FOSParameter, string> fosGlobalParams, Dictionary<string, Dictionary<FOSParameter, string>> fosFormParams, string pInstCd, out string ocrtag)
        {
            ocrtag = string.Empty;
            StringBuilder fos = new StringBuilder();
            fos.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            fos.Append("<fos version=\"1.0\">");
            fos.Append("<global>");
            fos.Append("<parameters>");
            if (fosGlobalParams != null) { fos.Append(GetParamsString(fosGlobalParams, pInstCd)); }
            fos.Append("</parameters>");
            fos.Append(string.Format("<page-template path=\"{0}\" request-encode=\"utf-8\" response-encode=\"utf-8\">", formServiceUrl));
            fos.Append("<template-get-parameters>");
            fos.Append("<post-param key=\"OP\"><![CDATA[PAGE_TEMPLATE]]></post-param>");
            fos.Append("<post-param key=\"PD\"><![CDATA[<data>");
            fos.Append("<action>GET_LIST</action>");
            fos.Append("<params>");
            fos.Append("<param name='adaptername'>defaultadapter</param>");
            fos.Append("</params>");
            fos.Append("</data>]]></post-param>");
            fos.Append("</template-get-parameters>");
            fos.Append("</page-template>");
            fos.Append("</global>");
            fos.Append("<form-list>");

            int openSeq = 1;
            foreach (string guid in guids)
            {
                fos.Append(string.Format("<form name=\"noname\" open-sequence=\"{0}\" path=\"{1}\" request-encode=\"utf-8\" response-encode=\"utf-8\">", openSeq, formServiceUrl));
                fos.Append("<parameters>");

                if (fosFormParams != null)
                {
                    if (fosFormParams.ContainsKey(openSeq.ToString()))
                    {
                        Dictionary<FOSParameter, string> fosFormParamsByGuid = fosFormParams[openSeq.ToString()];
                        foreach (FOSParameter paramKey in fosFormParamsByGuid.Keys)
                        {
                            fos.Append(string.Format("<param key='{0}'><![CDATA[{1}]]></param>", GetFOSName(paramKey, pInstCd), fosFormParamsByGuid[paramKey]));
                            if (string.IsNullOrEmpty(ocrtag) && GetFOSName(paramKey, pInstCd).Equals("parCMSGBD_ocr_cd"))
                            {
                                ocrtag = fosFormParamsByGuid[paramKey];
                            }
                        }
                    }
                }

                fos.Append("</parameters>");
                fos.Append("<form-get-parameters>");
                fos.Append("<post-param key=\"OP\"><![CDATA[VIEWER_FORM]]></post-param>");
                fos.Append("<post-param key=\"PD\"><![CDATA[<data>");
                fos.Append("<action>GET</action>");
                fos.Append("<params>");
                fos.Append("<param name='adaptername'>defaultadapter</param>");
                fos.Append("<param name='type'>guid</param>");
                fos.Append(string.Format("<param name='guid'>{0}</param>", guid));
                fos.Append("<param name='version'>-1</param>");
                fos.Append("</params>");
                fos.Append("</data>]]></post-param>");
                fos.Append("</form-get-parameters>");
                fos.Append("</form>");

                openSeq++;
            }

            fos.Append("</form-list>");
            fos.Append(" </fos>");

            return fos.ToString();
        }

        /// <summary>
        /// param, guid값을 넘겨받아 그를 포함하는 fos를 리턴한다.
        /// </summary>
        /// <param name="actionParams"></param>
        /// <param name="formServiceUrl"></param>
        /// <returns></returns>
        public static string GetFosStringForEpt(Dictionary<string, string> actionParams, string formServiceUrl, Dictionary<FOSParameter, string> fosGlobalParams, string pInstCd) {

            StringBuilder fos = new StringBuilder();
            fos.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            fos.Append("<fos version=\"1.0\">");
            fos.Append("<global>");
            fos.Append(GetParamsString(fosGlobalParams, pInstCd));
            fos.Append(string.Format("<page-template path=\"{0}\" request-encode=\"utf-8\" response-encode=\"utf-8\">", formServiceUrl));
            fos.Append("<template-get-parameters>");
            fos.Append("<post-param key=\"OP\"><![CDATA[PAGE_TEMPLATE]]></post-param>");
            fos.Append("<post-param key=\"PD\"><![CDATA[<data>");
            fos.Append("<action>GET_LIST</action>");
            fos.Append("<params>");
            fos.Append("<param name='adaptername'>defaultadapter</param>");
            fos.Append("</params>");
            fos.Append("</data>]]></post-param>");
            fos.Append("</template-get-parameters>");
            fos.Append("</page-template>");
            fos.Append("</global>");
            fos.Append("<form-list>");
            fos.Append(string.Format("<form name=\"noname\" open-sequence=\"1\" path=\"{0}\" request-encode=\"utf-8\" response-encode=\"utf-8\">", formServiceUrl));
            fos.Append("<parameters />");
            fos.Append("<form-get-parameters>");
            fos.Append("<post-param key=\"OP\"><![CDATA[VIEWER_DATA]]></post-param>");
            fos.Append("<post-param key=\"PD\"><![CDATA[<data>");
            fos.Append("<action>GET_DATA</action>");
            fos.Append("<params>");
            fos.Append("<param name='adaptername'>defaultadapter</param>");
            foreach (string paramKey in actionParams.Keys) {
                fos.Append(string.Format("<param name='{0}'>{1}</param>", paramKey, actionParams[paramKey]));
            }
            fos.Append("</params>");
            fos.Append("</data>]]></post-param>");
            fos.Append("</form-get-parameters>");
            fos.Append("</form>");
            fos.Append("</form-list>");
            fos.Append("</fos>");

            return fos.ToString();
        }

        public static string GetAllFOSParamString(string pInstCd) {

            Dictionary<FOSParameter, string> dic = new Dictionary<FOSParameter, string>();

            StringBuilder _sb = new StringBuilder();

            foreach (string s in Enum.GetNames(typeof(FOSParameter))) {
                _sb.AppendFormat("{0}:{1}{2}", GetFOSName((FOSParameter)Enum.Parse(typeof(FOSParameter), s), "org")
                                             , GetFOSName((FOSParameter)Enum.Parse(typeof(FOSParameter), s), pInstCd)
                                             , ";");
            }

            return _sb.ToString();
        }

        private static string GetParamsString(Dictionary<FOSParameter, string> fosParams, string pInstCd) {
            StringBuilder parametersOfFos = new StringBuilder();
            parametersOfFos.Append("<parameters>");

            foreach (FOSParameter paramKey in fosParams.Keys) {
                parametersOfFos.AppendFormat("<param key=\"{0}\"><![CDATA[{1}]]></param>", GetFOSName(paramKey, pInstCd), fosParams[paramKey]);
            }

            parametersOfFos.Append("</parameters>");

            return parametersOfFos.ToString();

        }

        private static string GetFOSName(FOSParameter pName, string pInstCd) {

            string _name = "";

            switch (pInstCd) {
                case "031":
                    _name = m_FOSParamArr_031[Array.IndexOf(Enum.GetValues(pName.GetType()), pName)];
                    break;
                case "032":
                    _name = m_FOSParamArr_032[Array.IndexOf(Enum.GetValues(pName.GetType()), pName)];
                    break;
                default:
                    _name = m_FOSParamArr_org[Array.IndexOf(Enum.GetValues(pName.GetType()), pName)];
                    break;
            }

            return _name;
        }

        private static string[] m_FOSParamArr_031 = { "parCMDCFT_device"
                                                    , "parCMDCFT_1PrintIP"
                                                    , "parCMDCHD_1PatientNo"
                                                    , "parCMDCHD_1SexAge"
                                                    , "parCMDCHD_1PatientNm"
                                                    , "parCMDCHD_1SocialSecuNo"
                                                    , "parNUR_Fast_HospitalroomNo"
                                                    , "parCMDCHD_1VisitDt"
                                                    , "parCMDCHD_1DepartmentNm"
                                                    , "parCMDCFT_1PrintNm"
                                                    , "parCMDCBD_PopupV1_SurgeryDepartment"
                                                    , "parCMDCBD_PopupV1_SurgeryDoctor"
                                                    , "parCMDCBD_PopupV1_DxNm"
                                                    , "parCMDCBD_DiseaseBox_bp"
                                                    , "parCMDCBD_DiseaseBox_dm"
                                                    , "parCMDCBD_DiseaseBox_1CardioVascular"
                                                    , "parCMDCBD_DiseaseBox_3Metabolic"
                                                    , "parCMDCBD_DiseaseBox_2Respiratory"
                                                    , "parCMDCBD_DiseaseBox_9History1"
                                                    , "parCMDCBD_DiseaseBox_4UnusualConstitution2"
                                                    , "parCMDCBD_DiseaseBox_6Medicine"
                                                    , "parCMDCBD_DiseaseBox_8HabitSmoking"
                                                    , "parCMDCBD_DiseaseBox_4UnusualConstitution1"
                                                    , "parCMDCBD_DiseaseBox_9History2"
                                                    , "parCMDCBD_DiseaseBox_7Airway"
                                                    , "parCMDCBD_DiseaseBox_5Blood"
                                                    , "parCMDCBD_status_etc"
                                                    , "parCMDCBD_signdate"
                                                    , "parCMDCBD_signtime"
                                                    , "parCMDCFT_1PrintDt"
                                                    , "parCMDCBD_Doctor_Doctor1Nm"
                                                    , "parCMSGBD_ocr_cd"
                                                    , "parCMSGBD_INPUTNm"
                                                    , "parCMSGBD_INPUTSignature"
                                                    , "parCMDCHD_1DepartmentCd"
                                                    , "UrlParam"
                                                    , "parCMSGBD_PT_address"
                                                    , "parCMSGBD_PT_tel"
                                                    , "parCMSGBD_Insukind"
                                                    , "parCMSGBD_PT_birthday"
                                                    , "IO_print_comment"
                                                    , "parCMDCBD_PopupV1_OPNm"
                                                    , "parCMSGBD_INPUTTelNo"
                                                    , "parDEFAULT_DUTINSTCD"
                                                    , "parDEFAULT_POPUP_PATH"
                                                    , "parCMDCBD_PopupV1_SurgeryCommonDepartment"
                                                    , "parCMDCBD_Anst1DrNm"
                                                    , "parCMDCBD_Anst1DeptNm"
                                                    , "parCMDCBD_Anst1CommonDeptNm"
                                                    , "parCMDCBD_Anst2DrNm"
                                                    , "parCMDCBD_Anst2DeptNm"
                                                    , "parCMDCBD_Anst2CommonDeptNm"
                                                    , "parCMDCBD_Anst3DrNm"
                                                    , "parCMDCBD_Anst3DeptNm"
                                                    , "parCMDCBD_Anst3CommonDeptNm"
                                                    , "parCMSGBD_INPUTDeptcd"
                                                    , "parCMSGBD_Cretno"
                                                    , "parCMSGBD_ExplDrNm"
                                                    , "parCMSGBD_ExplDrSignature"
                                                    , "parCMSGBD_ExplDrTelNo"
                                                    , "parCMDCBD_OpRsrvNo"
                                                    , "parCMDCHD_1PatientNmFix"
                                                    , "parCMSGBD_PT_birthdayFix"
                                                    , "parCMSGBD_PT_telFix"
                                                    , "parCMDCBD_SpDrYN"
                                                    , "parCMDCBD_ContStartDate"
                                                    , "parCMDCBD_ContEndDate"
                                                    , "parCMDCBD_RoomCapa"
                                                    , "parCMDCBD_ContTelNo"
                                                    , "parCMDCBD_ContStaff1Name"
                                                    , "parCMDCBD_ContStaff2Name"
                                                    , "parCMDCBD_ContStaff3Name"
                                                    // 경대병원 태그 추가
                                                    , "tag1"
                                                    , "tag2"
                                                    , "tag3"
                                                    , "tag4"
                                                    , "tag5"
                                                    , "tag6"
                                                    , "tag7"
                                                    , "tag8"
                                                    , "tag9"
                                                    , "tag10"
                                                    , "parCMDCBD_CardNo"
                                                    , "parCMSGBD_ExplDrNm_P"
                                                    , "parCMSGBD_ExplDrTelNo_P"
                                                    , "parCMSGBD_ExplDrSignature_P"
                                                    , "parCMDCHD_1SocialSecuNo_org" };

    private static string[] m_FOSParamArr_032 = { "parCMDCFT_device"
                                                    , "parCMDCFT_1PrintIP"
                                                    , "parCMDCHD_1PatientNo"
                                                    , "parCMDCHD_1SexAge"
                                                    , "parCMDCHD_1PatientNm"
                                                    , "parCMDCHD_1SocialSecuNo"
                                                    , "parNUR_Fast_HospitalroomNo"
                                                    , "parCMDCHD_1VisitDt"
                                                    , "parCMDCHD_1DepartmentNm"
                                                    , "parCMDCFT_1PrintNm"
                                                    , "parCMDCBD_PopupV1_SurgeryDepartment"
                                                    , "parCMDCBD_PopupV1_SurgeryDoctor"
                                                    , "parCMDCBD_PopupV1_DxNm"
                                                    , "parCMDCBD_DiseaseBox_bp"
                                                    , "parCMDCBD_DiseaseBox_dm"
                                                    , "parCMDCBD_DiseaseBox_1CardioVascular"
                                                    , "parCMDCBD_DiseaseBox_3Metabolic"
                                                    , "parCMDCBD_DiseaseBox_2Respiratory"
                                                    , "parCMDCBD_DiseaseBox_9History1"
                                                    , "parCMDCBD_DiseaseBox_4UnusualConstitution2"
                                                    , "parCMDCBD_DiseaseBox_6Medicine"
                                                    , "parCMDCBD_DiseaseBox_8HabitSmoking"
                                                    , "parCMDCBD_DiseaseBox_4UnusualConstitution1"
                                                    , "parCMDCBD_DiseaseBox_9History2"
                                                    , "parCMDCBD_DiseaseBox_7Airway"
                                                    , "parCMDCBD_DiseaseBox_5Blood"
                                                    , "parCMDCBD_status_etc"
                                                    , "parCMDCBD_signdate"
                                                    , "parCMDCBD_signtime"
                                                    , "parCMDCFT_1PrintDt"
                                                    , "parCMDCBD_Doctor_Doctor1Nm"
                                                    , "parCMSGBD_ocr_cd"
                                                    , "parCMSGBD_INPUTNm"
                                                    , "parCMSGBD_INPUTSignature"
                                                    , "parCMDCHD_1DepartmentCd"
                                                    , "UrlParam"
                                                    , "parCMSGBD_PT_address"
                                                    , "parCMSGBD_PT_tel"
                                                    , "parCMSGBD_Insukind"
                                                    , "parCMSGBD_PT_birthday"
                                                    , "IO_print_comment"
                                                    , "parCMDCBD_PopupV1_OPNm"
                                                    , "parCMSGBD_INPUTTelNo"
                                                    , "parDEFAULT_DUTINSTCD"
                                                    , "parDEFAULT_POPUP_PATH"
                                                    , "parCMDCBD_PopupV1_SurgeryCommonDepartment"
                                                    , "parCMDCBD_Anst1DrNm"
                                                    , "parCMDCBD_Anst1DeptNm"
                                                    , "parCMDCBD_Anst1CommonDeptNm"
                                                    , "parCMDCBD_Anst2DrNm"
                                                    , "parCMDCBD_Anst2DeptNm"
                                                    , "parCMDCBD_Anst2CommonDeptNm"
                                                    , "parCMDCBD_Anst3DrNm"
                                                    , "parCMDCBD_Anst3DeptNm"
                                                    , "parCMDCBD_Anst3CommonDeptNm"
                                                    , "parCMSGBD_INPUTDeptcd"
                                                    , "parCMSGBD_Cretno"
                                                    , "parCMSGBD_ExplDrNm"
                                                    , "parCMSGBD_ExplDrSignature"
                                                    , "parCMSGBD_ExplDrTelNo"
                                                    , "parCMDCBD_OpRsrvNo"
                                                    , "parCMDCHD_1PatientNmFix"
                                                    , "parCMSGBD_PT_birthdayFix"
                                                    , "parCMSGBD_PT_telFix"
                                                    , "parCMDCBD_SpDrYN"
                                                    , "parCMDCBD_ContStartDate"
                                                    , "parCMDCBD_ContEndDate"
                                                    , "parCMDCBD_RoomCapa"
                                                    , "parCMDCBD_ContTelNo"
                                                    , "parCMDCBD_ContStaff1Name"
                                                    , "parCMDCBD_ContStaff2Name"
                                                    , "parCMDCBD_ContStaff3Name"
                                                    // 경대병원 태그 추가
                                                    , "tag1"
                                                    , "tag2"
                                                    , "tag3"
                                                    , "tag4"
                                                    , "tag5"
                                                    , "tag6"
                                                    , "tag7"
                                                    , "tag8"
                                                    , "tag9"
                                                    , "tag10"
                                                    , "parCMDCBD_CardNo"
                                                    , "parCMSGBD_ExplDrNm_P"
                                                    , "parCMSGBD_ExplDrTelNo_P"
                                                    , "parCMSGBD_ExplDrSignature_P"
                                                    , "parCMDCHD_1SocialSecuNo_org" };

        private static string[] m_FOSParamArr_org = { "IO_device"   //동작코드(T: 임시 저장, C: 인증 저장, P: 출력, CP: 삭제)
                                                    , "PrintIp"
                                                    , "IO_Pt_ID"
                                                    , "IO_sex_age_y_m"
                                                    , "IO_Pt_name"
                                                    , "IO_JuminNo"
                                                    , "IO_roomNo"
                                                    , "IO_ADdate"
                                                    , "IO_Dept"
                                                    , "IO_formname"
                                                    , "IO_OPdept"
                                                    , "IO_Opdr"
                                                    , "IO_Dx"
                                                    , "IO_bp"
                                                    , "IO_dm"
                                                    , "IO_heart"
                                                    , "IO_kidney"
                                                    , "IO_respiration"
                                                    , "IO_hx"
                                                    , "IO_allergy"
                                                    , "IO_drug"
                                                    , "IO_smoking"
                                                    , "IO_idio"
                                                    , "IO_nacrotics"
                                                    , "IO_airway"
                                                    , "IO_hemorrhage"
                                                    , "IO_status_etc"
                                                    , "IO_signdate"
                                                    , "IO_signtime"
                                                    , "IO_printtime"
                                                    , "IO_maindr"
                                                    , "IO_ocr_cd"
                                                    , "IO_INPUTNM"
                                                    , "IO_SIGNIMG"
                                                    , "IO_DeptCd"
                                                    , "UrlParam"
                                                    , "IO_Pt_address"
                                                    , "IO_Pt_tel"
                                                    , "IO_Insukind"
                                                    , "IO_PT_birthday"
                                                    , "IO_print_comment"
                                                    , "OperationName"
                                                    , "UserTelNo"
                                                    , "Instcd"
                                                    , "PopupPath"
                                                    , "OpCommDeptName"
                                                    , "AnstDrName"
                                                    , "AnstDeptName1"
                                                    , "AnstCommDeptName1"
                                                    , "AnstDrName2"
                                                    , "AnstDeptName2"
                                                    , "AnstCommDeptName2"
                                                    , "AnstDrName3"
                                                    , "AnstDeptName3"
                                                    , "AnstCommDeptName3"
                                                    , "UserDeptCd"
                                                    , "CretNo"
                                                    , "parCMSGBD_ExplDrNm"
                                                    , "parCMSGBD_ExplDrSignature"
                                                    , "parCMSGBD_ExplDrTelNo"
                                                    , "parCMDCBD_OpRsrvNo"
                                                    , "PatientNameFix"
                                                    , "PatientBirthDayFix"
                                                    , "PatientTelNoFix"
                                                    , "SpecDoctorYN"
                                                    , "ContStartDate"
                                                    , "ContEndDate"
                                                    , "RoomCapa"
                                                    , "ContTelNo"
                                                    , "ContStaff1Name"
                                                    , "ContStaff2Name"
                                                    , "ContStaff3Name"
                                                    // 경대병원 태그 추가
                                                    , "tag1"
                                                    , "tag2"
                                                    , "tag3"
                                                    , "tag4"
                                                    , "tag5"
                                                    , "tag6"
                                                    , "tag7"
                                                    , "tag8"
                                                    , "tag9"
                                                    , "tag10"
                                                    , "CardNo"
                                                    , "parCMSGBD_ExplDrNm_P"
                                                    , "parCMSGBD_ExplDrTelNo_P"
                                                    , "parCMSGBD_ExplDrSignature_P"
                                                    , "parCMDCHD_1SocialSecuNo_org" };
    }

    public enum FOSParameter {
        Device,
        PrintIp,
        PatientCode,
        PatientSexAge,
        PatientName,
        PatientRRN,
        RoomNo,
        VisitDate,
        DeptName,
        FormName,
        OpDeptName,
        OpDoctorName,
        DiagName,
        BP,
        DM,
        Heart,
        Kidney,
        Respiration,
        MedicalHistory,
        Allergy,
        Drug,
        Smoking,
        Idiosyncrasy,
        Nacrotics,
        Airway,
        Hemorrhage,
        EtcStatus,
        SignDate,
        SignTime,
        PrintTime,
        MainDoctor,
        OCRCode,
        UserName,
        SignImage,
        DeptCode,
        ImageUploadPath,
        PatientAddress,
        PatientTelNo,
        Insukind,
        PatientBirthDay,
        PrintComment,
        OperationName,
        UserTelNo,
        Instcd,
        PopupPath,
        OpCommDeptName,
        AnstDrName1,
        AnstDeptName1,
        AnstCommDeptName1,
        AnstDrName2,
        AnstDeptName2,
        AnstCommDeptName2,
        AnstDrName3,
        AnstDeptName3,
        AnstCommDeptName3,
        UserDeptCd,
        CretNo,
        ExplDrName,     // 설명의사 이름
        ExplDrSign,     // 설명의사 사인 이미지
        ExplDrTelNo,    // 설명의사 전화번호
        OpRsrvNo,        // 수술 예약번호
        PatientNameFix,
        PatientBirthDayFix,
        PatientTelNoFix,
        SpecDoctorYN,
        ContStartDate,
        ContEndDate,
        RoomCapa,
        ContTelNo,
        ContStaff1Name,
        ContStaff2Name,
        ContStaff3Name,
        // 경대병원 태그 추가
        tag1,
        tag2,
        tag3,
        tag4,
        tag5,
        tag6,
        tag7,
        tag8,
        tag9,
        tag10,
    CardNo,
    ExplDrName_P,
    ExplDrTelNo_p,
    ExplDrSign_p,
    PatientRRNOrg
  }
}
