/// <summary>
        /// 住院病人取消入院(不包括已结算的病人)
        /// </summary>
        public static NcmsResult CanInpatientRegister(PatBaseInfo hisData)
        {
            string strParameter = Newtonsoft.Json.JavaScriptConvert.SerializeObject(hisData);

            Message recieveMsg = new Message();

            recieveMsg.DES          = false;
            recieveMsg.GZipCompress = false;
            recieveMsg.dataContent  = strParameter;

            Message retMsg = new Message();

            try
            {
                retMsg = ncmsInterface.cancePatientSign(recieveMsg);
                if (retMsg.DES)
                {
                    retMsg.dataContent = NccmFunction.decrypt(retMsg.dataContent, sKey);
                }
                if (retMsg.GZipCompress)
                {
                    retMsg.dataContent = NccmFunction.gZipDeCompress(retMsg.dataContent);
                }
                Type       type   = typeof(NcmsResult);
                NcmsResult result = (NcmsResult)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(retMsg.dataContent, type);
                return(result);
            }
            catch
            {
                throw new Exception(retMsg.errMsg);
            }
        }
        /// <summary>
        /// 取消出院结算(中途结算)
        /// </summary>
        public static NcmsResult CanOutPatZYCharge(BudgetFee hisData)
        {
            string strParameter = Newtonsoft.Json.JavaScriptConvert.SerializeObject(hisData);

            Message recieveMsg = new Message();

            recieveMsg.DES          = false;
            recieveMsg.GZipCompress = false;
            recieveMsg.dataContent  = strParameter;

            Message retMsg = new Message();

            try
            {
                retMsg = ncmsInterface.canceInPatientComp(recieveMsg);
                if (retMsg.DES)
                {
                    retMsg.dataContent = NccmFunction.decrypt(retMsg.dataContent, sKey);
                }
                if (retMsg.GZipCompress)
                {
                    retMsg.dataContent = NccmFunction.gZipDeCompress(retMsg.dataContent);
                }
                Type       type   = typeof(NcmsResult);
                NcmsResult result = (NcmsResult)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(retMsg.dataContent, type);
                return(result);
            }
            catch (Exception err)
            {
                throw err;
            }
        }
        /// <summary>
        /// 下载药品目录
        /// </summary>
        /// <returns></returns>
        public static DownLoadCenterItemResult DownLoadDrugListInfo(DownLoadItem hisData)
        {
            string strParameter = Newtonsoft.Json.JavaScriptConvert.SerializeObject(hisData);

            Message recieveMsg = new Message();

            recieveMsg.DES          = false;
            recieveMsg.GZipCompress = false;
            recieveMsg.dataContent  = strParameter;

            Message retMsg = new Message();

            try
            {
                retMsg = ncmsInterface.downLoadCenterItem(recieveMsg);
                if (retMsg.DES)
                {
                    retMsg.dataContent = NccmFunction.decrypt(retMsg.dataContent, sKey);
                }
                if (retMsg.GZipCompress)
                {
                    retMsg.dataContent = NccmFunction.gZipDeCompress(retMsg.dataContent);
                }

                Type type = typeof(DownLoadCenterItemResult);
                DownLoadCenterItemResult result = (DownLoadCenterItemResult)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(retMsg.dataContent, type);

                return(result);
            }
            catch (Exception err)
            {
                throw err;
            }
        }
        /// <summary>
        /// 上传匹配信息
        /// </summary>
        /// <param name="hisData"></param>
        /// <param name="upLoadfaildItems">返回的上传失败的记录</param>
        /// <param name="strMsg">返回的消息</param>
        /// <returns></returns>
        public static bool UploadMatchInfo(RecieveHospitalMatchInfo hisData, out ItemMatchInfo[] upLoadfaildItems, out string strMsg)
        {
            upLoadfaildItems = null;
            strMsg           = "";
            string strParameter = Newtonsoft.Json.JavaScriptConvert.SerializeObject(hisData);

            Message recieveMsg = new Message();

            recieveMsg.DES          = false;
            recieveMsg.GZipCompress = false;
            recieveMsg.dataContent  = strParameter;

            Message retMsg = new Message();

            try
            {
                retMsg = ncmsInterface.recieveHospitalMatchInfo(recieveMsg);
                if (retMsg.DES)
                {
                    retMsg.dataContent = NccmFunction.decrypt(retMsg.dataContent, sKey);
                }
                if (retMsg.GZipCompress)
                {
                    retMsg.dataContent = NccmFunction.gZipDeCompress(retMsg.dataContent);
                }

                Type type = typeof(RecieveHospitalMatchInfoResult);
                RecieveHospitalMatchInfoResult result = (RecieveHospitalMatchInfoResult)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(retMsg.dataContent, type);
                if (result.resultId)
                {
                    upLoadfaildItems = result.itemMatchInfo;
                    strMsg           = result.resultString;
                    return(true);
                }
                else
                {
                    throw new Exception(result.resultString);
                }
            }
            catch (Exception err)
            {
                throw err;
            }
        }
        /// <summary>
        /// 下载医院信息
        /// </summary>
        /// <returns></returns>
        public static HospitalInfo DownLoadHospitalInfo(HisData hisData)
        {
            string strParameter = Newtonsoft.Json.JavaScriptConvert.SerializeObject(hisData);

            Message recieveMsg = new Message();

            recieveMsg.DES          = false;
            recieveMsg.GZipCompress = false;
            recieveMsg.dataContent  = strParameter;

            Message retMsg = new Message();

            try
            {
                retMsg = ncmsInterface.downLoadHospitalInfo(recieveMsg);
                //先解密
                if (retMsg.DES == true)
                {
                    retMsg.dataContent = NccmFunction.decrypt(retMsg.dataContent, sKey);
                }
                //再解压
                if (retMsg.GZipCompress == true)
                {
                    retMsg.dataContent = NccmFunction.gZipDeCompress(retMsg.dataContent);
                }

                Type type = typeof(DownLoadHospitalInfoResult);
                //反序列化对象
                DownLoadHospitalInfoResult info = (DownLoadHospitalInfoResult)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(retMsg.dataContent, type);
                if (info.resultId == false)
                {
                    throw new Exception(info.resultString);
                }

                HospitalInfo hsInfo = info.hospitalInfo;

                return(hsInfo);
            }
            catch (Exception err)
            {
                throw err;
            }
        }
        /// <summary>
        /// 上传病人费用明细(住院和门诊)
        /// </summary>
        /// <param name="hisData"></param>
        /// <returns></returns>
        public static FeeDetail[] UploadPatientFeeDetail(BudgetFee hisData)
        {
            string strParameter = Newtonsoft.Json.JavaScriptConvert.SerializeObject(hisData);

            Message recieveMsg = new Message();

            recieveMsg.DES          = false;
            recieveMsg.GZipCompress = false;
            recieveMsg.dataContent  = strParameter;

            Message retMsg = new Message();

            try
            {
                retMsg = ncmsInterface.recieveDetailFee(recieveMsg);
                if (retMsg.DES)
                {
                    retMsg.dataContent = NccmFunction.decrypt(retMsg.dataContent, sKey);
                }
                if (retMsg.GZipCompress)
                {
                    retMsg.dataContent = NccmFunction.gZipDeCompress(retMsg.dataContent);
                }

                Type type = typeof(RecieveDetailFeeResult);
                RecieveDetailFeeResult result = (RecieveDetailFeeResult)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(retMsg.dataContent, type);
                if (result.resultId)
                {
                    return(result.feeDetail);
                }
                else
                {
                    throw new Exception(result.resultString);
                }
            }
            catch (Exception err)
            {
                throw err;
            }
            throw new Exception("");
        }
        /// <summary>
        /// 正式结算
        /// </summary>
        /// <returns></returns>
        public static CompData[] OutPatientCharge(PatientComp hisData)
        {
            string strParameter = Newtonsoft.Json.JavaScriptConvert.SerializeObject(hisData);

            Message recieveMsg = new Message();

            recieveMsg.DES          = false;
            recieveMsg.GZipCompress = false;
            recieveMsg.dataContent  = strParameter;

            Message retMsg = new Message();

            try
            {
                retMsg = ncmsInterface.patientComp(recieveMsg);
                if (retMsg.DES)
                {
                    retMsg.dataContent = NccmFunction.decrypt(retMsg.dataContent, sKey);
                }
                if (retMsg.GZipCompress)
                {
                    retMsg.dataContent = NccmFunction.gZipDeCompress(retMsg.dataContent);
                }

                Type       type   = typeof(CompResult);
                CompResult result = (CompResult)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(retMsg.dataContent, type);
                if (result.resultId)
                {
                    return(result.compData);
                }
                else
                {
                    throw new Exception(result.resultString);
                }
            }
            catch (Exception err)
            {
                throw err;
            }
        }
        /// <summary>
        /// 门诊退费
        /// </summary>
        /// <param name="hisData"></param>
        /// <returns></returns>
        public static bool OutPatientCancelCharge(CanceDetail hisData)
        {
            string strParameter = Newtonsoft.Json.JavaScriptConvert.SerializeObject(hisData);

            Message recieveMsg = new Message();

            recieveMsg.DES          = false;
            recieveMsg.GZipCompress = false;
            recieveMsg.dataContent  = strParameter;

            Message retMsg = new Message();

            try
            {
                retMsg = ncmsInterface.canceDetailFee(recieveMsg);
                if (retMsg.DES)
                {
                    retMsg.dataContent = NccmFunction.decrypt(retMsg.dataContent, sKey);
                }
                if (retMsg.GZipCompress)
                {
                    retMsg.dataContent = NccmFunction.gZipDeCompress(retMsg.dataContent);
                }
                return(retMsg.success);
                //Type type = typeof( NcmsResult );
                //NcmsResult result = (NcmsResult)Newtonsoft.Json.JavaScriptConvert.DeserializeObject( retMsg.dataContent, type );
                //if ( result.resultId )
                //    return result;
                //else
                //    throw new Exception( result.resultString );
            }
            catch (Exception err)
            {
                throw err;
            }
        }