/// <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;
            }
        }
        /// <summary>
        /// 退费
        /// </summary>
        /// <param name="OrgPrescription">原始处方</param>
        /// <param name="DisChargePrescription">冲正的处方</param>
        /// <returns></returns>
        public bool CancelCharge(Prescription OrgPrescription, Prescription DisChargePrescription)
        {
            CanceDetail hisData = new CanceDetail();

            hisData.hos_class    = hospitalInfo.hos_class;
            hisData.hos_level    = hospitalInfo.hos_level;
            hisData.medorg_level = hospitalInfo.org_id;
            hisData.uploadorg    = MED_ORG_CODE;
            hisData.uploadPerson = hospitalInfo.userCode;
            hisData.uploadTime   = DateTime.Now.ToString("yyyy-MM-dd");

            hisData.joinArea      = new JoinArea();
            hisData.joinArea.code = JOIN_AREA_CODE;
            hisData.joinArea.name = JOIN_AREA_NAME;

            hisData.dataClass = new DataClass();
            hisData.dataClass.dataClassName  = "新农合数据";
            hisData.dataClass.dataClassValue = "1";

            hisData.dataType = new DataType();
            hisData.dataType.dataTypeName  = "门诊数据";
            hisData.dataType.dataTypeValue = "1";

            hisData.operType = new OperType();
            hisData.operType.operTypeName  = "冲正";
            hisData.operType.operTypeValue = "2";
            //病人基本信息
            hisData.baseData             = new PatBaseData();
            hisData.baseData.age         = hisOutPatient.InsurInfo.Age.ToString();
            hisData.baseData.area_id     = JOIN_AREA_CODE;
            hisData.baseData.birthdate   = hisOutPatient.InsurInfo.BirthDate.ToString("yyyy-MM-dd");
            hisData.baseData.family_code = hisOutPatient.InsurInfo.Family_Code;
            hisData.baseData.hisID       = hisOutPatient.PatListID.ToString();
            hisData.baseData.idCard      = hisOutPatient.InsurInfo.IdCard;
            hisData.baseData.medcard_id  = hisOutPatient.InsurInfo.Medcard_Id;
            hisData.baseData.name        = hisOutPatient.InsurInfo.Name;
            hisData.baseData.person_code = hisOutPatient.InsurInfo.Person_Code;
            hisData.baseData.sex         = hisOutPatient.InsurInfo.Sex;

            hisData.baseData.visit_type = "1";
            //指定需要退费的明细(负记录)数量和金额是负数
            List <FeeDetail> feeList = new List <FeeDetail>();

            for (int i = 0; i < DisChargePrescription.PresDetails.Length; i++)
            {
                try
                {
                    FeeDetail detail = new FeeDetail( );
                    detail.his_billno = DisChargePrescription.ChargeID.ToString( );                                                                                                                //*
                    detail.item_sn    = DisChargePrescription.PrescriptionID.ToString( ) + DisChargePrescription.PresDetails[i].DetailId.ToString( ) + DisChargePrescription.ChargeID.ToString( ); //*
                    detail.item_code  = DisChargePrescription.PresDetails[i].ItemId.ToString( );                                                                                                   //*
                    if (DisChargePrescription.PresDetails[i].ItemType == "01" || DisChargePrescription.PresDetails[i].ItemType == "02" || DisChargePrescription.PresDetails[i].ItemType == "03")
                    {
                        detail.item_class = "1";
                    }
                    else
                    {
                        detail.item_class = "2";
                    }

                    detail.item_equal       = "0";                                                                                                                                     //
                    detail.item_name        = DisChargePrescription.PresDetails[i].Itemname;                                                                                           //*
                    detail.item_use_time    = DisChargePrescription.PresDate.ToString("yyyy-MM-dd");                                                                                   //*
                    detail.amount           = Convert.ToDouble(DisChargePrescription.PresDetails[i].Amount);                                                                           //*
                    detail.drugform         = "";                                                                                                                                      //
                    detail.doctorTitle      = "";                                                                                                                                      //
                    detail.doctor           = DisChargePrescription.PresDocCode;                                                                                                       //
                    detail.money            = Convert.ToDouble(DisChargePrescription.PresDetails[i].Tolal_Fee);                                                                        //*
                    detail.price            = Convert.ToDouble(DisChargePrescription.PresDetails[i].Sell_price);                                                                       //*
                    detail.center_item_code = GetNcmsCenterCode(detail.item_code, detail.item_class);                                                                                  //
                    detail.specs            = "";                                                                                                                                      //
                    detail.unit             = DisChargePrescription.PresDetails[i].Unit;                                                                                               //
                    detail.reverse_date     = DateTime.Now.ToString("yyyy-MM-dd");                                                                                                     //* 冲正日期
                    detail.reverse_person   = hisData.uploadPerson;                                                                                                                    //* 冲正人
                    detail.reverse_sn       = OrgPrescription.PrescriptionID.ToString( ) + OrgPrescription.PresDetails[i].DetailId.ToString( ) + OrgPrescription.ChargeID.ToString( ); //* 冲正对应的正记录的ID

                    feeList.Add(detail);
                }
                catch (OperatorException operr)
                {
                    throw operr;
                }
                catch (Exception err)
                {
                    ErrorWriter.WriteLog(err.Message);
                    throw new Exception("数据上传期间发生错误!");
                }
            }
            hisData.cancelData = feeList.ToArray();
            try
            {
                object obj = NccmInterfaces.OutPatientCancelCharge(hisData);
                return(true);
            }
            catch (OperatorException operr)
            {
                throw operr;
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Source + "\r\n" + err.Message);
                throw new Exception("农合接口退费发生错误!");
            }
        }