Exemplo n.º 1
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="OperatorEVSEDataXName">The OperatorEVSEData XML name to use.</param>
        /// <param name="CustomOperatorEVSEDataSerializer">A delegate to serialize custom OperatorEVSEData XML elements.</param>
        /// <param name="EVSEDataRecordXName">The EVSEDataRecord XML name to use.</param>
        /// <param name="IncludeEVSEDataRecordMetadata">Include EVSEDataRecord deltaType and lastUpdate meta data.</param>
        /// <param name="CustomEVSEDataRecordSerializer">A delegate to serialize custom EVSEDataRecord XML elements.</param>
        /// <param name="CustomAddressSerializer">A delegate to serialize custom Address XML elements.</param>
        /// <param name="CustomChargingFacilitySerializer">A delegate to serialize custom ChargingFacility XML elements.</param>
        public XElement ToXML(XName OperatorEVSEDataXName = null,
                              CustomXMLSerializerDelegate <OperatorEVSEData> CustomOperatorEVSEDataSerializer = null,
                              XName EVSEDataRecordXName             = null,
                              Boolean IncludeEVSEDataRecordMetadata = true,
                              CustomXMLSerializerDelegate <EVSEDataRecord> CustomEVSEDataRecordSerializer = null,
                              CustomXMLSerializerDelegate <Address> CustomAddressSerializer = null,
                              CustomXMLSerializerDelegate <ChargingFacility> CustomChargingFacilitySerializer = null)

        {
            var xml = new XElement(OperatorEVSEDataXName ?? OICPNS.EVSEData + "OperatorEvseData",

                                   new XElement(OICPNS.EVSEData + "OperatorID", OperatorId.ToString()),

                                   OperatorName.IsNotNullOrEmpty()
                               ? new XElement(OICPNS.EVSEData + "OperatorName", OperatorName)
                               : null,

                                   EVSEDataRecords.Any()
                               ? EVSEDataRecords.SafeSelect(evsedatarecord => evsedatarecord.ToXML(EVSEDataRecordXName,
                                                                                                   IncludeEVSEDataRecordMetadata,
                                                                                                   CustomEVSEDataRecordSerializer,
                                                                                                   CustomAddressSerializer,
                                                                                                   CustomChargingFacilitySerializer))
                               : null

                                   );

            return(CustomOperatorEVSEDataSerializer != null
                       ? CustomOperatorEVSEDataSerializer(this, xml)
                       : xml);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomAuthorizeStopRequestSerializer">A delegate to customize the serialization of AuthorizeStop requests.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <AuthorizeStopRequest> CustomAuthorizeStopRequestSerializer = null,
                              CustomXMLSerializerDelegate <Identification> CustomIdentificationSerializer             = null)

        {
            var XML = new XElement(OICPNS.Authorization + "eRoamingAuthorizeStop",

                                   new XElement(OICPNS.Authorization + "SessionID", SessionId.ToString()),

                                   CPOPartnerSessionId.HasValue
                                          ? new XElement(OICPNS.Authorization + "CPOPartnerSessionID", CPOPartnerSessionId.ToString())
                                          : null,

                                   EMPPartnerSessionId.HasValue
                                          ? new XElement(OICPNS.Authorization + "EMPPartnerSessionID", EMPPartnerSessionId.ToString())
                                          : null,

                                   new XElement(OICPNS.Authorization + "OperatorID", OperatorId.ToString()),

                                   EVSEId.HasValue
                                          ? new XElement(OICPNS.Authorization + "EvseID", EVSEId.ToString())
                                          : null,

                                   Identification.ToXML(CustomIdentificationSerializer: CustomIdentificationSerializer)

                                   );

            return(CustomAuthorizeStopRequestSerializer != null
                       ? CustomAuthorizeStopRequestSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomSetSessionEventReportRequestSerializer">A delegate to serialize custom set EVSE busy status request XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <SetSessionEventReportRequest> CustomSetSessionEventReportRequestSerializer = null)
        {
            var XML = new XElement(eMIPNS.Authorisation + "eMIP_ToIOP_SetSessionEventReportRequest",

                                   TransactionId.HasValue
                              ? new XElement("transactionId", TransactionId.ToString())
                              : null,

                                   new XElement("partnerIdType", PartnerId.Format.AsText()),
                                   new XElement("partnerId", PartnerId.ToString()),

                                   new XElement("operatorIdType", OperatorId.Format.AsText()),
                                   new XElement("operatorId", OperatorId.ToString()),

                                   new XElement("serviceSessionId", ServiceSessionId.ToString()),

                                   SessionEvent.ToXML(),

                                   ExecPartnerSessionId.HasValue
                              ? new XElement("execPartnerSessionId", ExecPartnerSessionId.ToString())
                              : null

                                   );


            return(CustomSetSessionEventReportRequestSerializer != null
                       ? CustomSetSessionEventReportRequestSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomSetChargingStationAvailabilityStatusRequestSerializer">A delegate to serialize custom set ChargingStation availability status request XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <SetChargingStationAvailabilityStatusRequest> CustomSetChargingStationAvailabilityStatusRequestSerializer = null)
        {
            var XML = new XElement(eMIPNS.EVCIDynamic + "eMIP_ToIOP_SetChargingStationAvailabilityStatusRequest",

                                   TransactionId.HasValue
                              ? new XElement(eMIPNS.EVCIDynamic + "transactionId", TransactionId.ToString())
                              : null,

                                   new XElement(eMIPNS.EVCIDynamic + "partnerIdType", PartnerId.Format.ToString()),
                                   new XElement(eMIPNS.EVCIDynamic + "partnerId", PartnerId.ToString()),

                                   new XElement(eMIPNS.EVCIDynamic + "operatorIdType", OperatorId.Format.ToString()),
                                   new XElement(eMIPNS.EVCIDynamic + "operatorId", OperatorId.ToString()),

                                   new XElement(eMIPNS.EVCIDynamic + "ChargingStationIdType", ChargingStationId.Format.ToString()),
                                   new XElement(eMIPNS.EVCIDynamic + "ChargingStationId", ChargingStationId.ToString()),

                                   new XElement(eMIPNS.EVCIDynamic + "statusEventDate", StatusEventDate.ToIso8601(false)),
                                   new XElement(eMIPNS.EVCIDynamic + "availabilityStatus", AvailabilityStatus.AsNumber()),

                                   AvailabilityStatusUntil.HasValue
                              ? new XElement(eMIPNS.EVCIDynamic + "availabilityStatusUntil", AvailabilityStatusUntil.Value.ToIso8601(false))
                              : null,

                                   AvailabilityStatusComment.IsNeitherNullNorEmpty()
                              ? new XElement(eMIPNS.EVCIDynamic + "availabilityStatusComment", AvailabilityStatusComment)
                              : null

                                   );


            return(CustomSetChargingStationAvailabilityStatusRequestSerializer != null
                       ? CustomSetChargingStationAvailabilityStatusRequestSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomSetEVSEBusyStatusRequestSerializer">A delegate to serialize custom set EVSE busy status request XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <SetEVSEBusyStatusRequest> CustomSetEVSEBusyStatusRequestSerializer = null)
        {
            var XML = new XElement(eMIPNS.EVCIDynamic + "eMIP_ToIOP_SetEVSEBusyStatusRequest",

                                   TransactionId.HasValue
                              ? new XElement("transactionId", TransactionId.ToString())
                              : null,

                                   new XElement("partnerIdType", PartnerId.Format.AsText()),
                                   new XElement("partnerId", PartnerId.ToString()),

                                   new XElement("operatorIdType", OperatorId.Format.AsText()),
                                   new XElement("operatorId", OperatorId.ToString()),

                                   new XElement("EVSEIdType", EVSEId.Format.AsText()),
                                   new XElement("EVSEId", EVSEId.ToString()),

                                   new XElement("statusEventDate", StatusEventDate.ToIso8601(false).Replace("Z", "")),
                                   new XElement("busyStatus", BusyStatus.AsNumber()),

                                   BusyStatusUntil.HasValue
                              ? new XElement("busyStatusUntil", BusyStatusUntil.Value.ToIso8601(false).Replace("Z", ""))
                              : null,

                                   BusyStatusComment.IsNeitherNullNorEmpty()
                              ? new XElement("busyStatusComment", BusyStatusComment)
                              : null

                                   );


            return(CustomSetEVSEBusyStatusRequestSerializer != null
                       ? CustomSetEVSEBusyStatusRequestSerializer(this, XML)
                       : XML);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomOperatorEVSEDataSerializer">A delegate to serialize custom operator EVSE data JSON objects.</param>
        /// <param name="CustomEVSEDataRecordSerializer">A delegate to serialize custom EVSE data record JSON objects.</param>
        /// <param name="CustomAddressSerializer">A delegate to serialize custom address JSON objects.</param>
        /// <param name="CustomChargingFacilitySerializer">A delegate to serialize custom charging facility JSON objects.</param>
        /// <param name="CustomGeoCoordinatesSerializer">A delegate to serialize custom geo coordinates JSON objects.</param>
        /// <param name="CustomEnergySourceSerializer">A delegate to serialize custom time period JSON objects.</param>
        /// <param name="CustomEnvironmentalImpactSerializer">A delegate to serialize custom time period JSON objects.</param>
        /// <param name="CustomOpeningTimesSerializer">A delegate to serialize custom opening time JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <OperatorEVSEData> CustomOperatorEVSEDataSerializer = null,
                              CustomJObjectSerializerDelegate <EVSEDataRecord> CustomEVSEDataRecordSerializer     = null,
                              CustomJObjectSerializerDelegate <Address> CustomAddressSerializer = null,
                              CustomJObjectSerializerDelegate <ChargingFacility> CustomChargingFacilitySerializer       = null,
                              CustomJObjectSerializerDelegate <GeoCoordinates> CustomGeoCoordinatesSerializer           = null,
                              CustomJObjectSerializerDelegate <EnergySource> CustomEnergySourceSerializer               = null,
                              CustomJObjectSerializerDelegate <EnvironmentalImpact> CustomEnvironmentalImpactSerializer = null,
                              CustomJObjectSerializerDelegate <OpeningTime> CustomOpeningTimesSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("EvseDataRecord", new JArray(EVSEDataRecords.Select(evseDataRecord => evseDataRecord.ToJSON(CustomEVSEDataRecordSerializer,
                                                                                                                          CustomAddressSerializer,
                                                                                                                          CustomChargingFacilitySerializer,
                                                                                                                          CustomGeoCoordinatesSerializer,
                                                                                                                          CustomEnergySourceSerializer,
                                                                                                                          CustomEnvironmentalImpactSerializer,
                                                                                                                          CustomOpeningTimesSerializer)))),
                new JProperty("OperatorID", OperatorId.ToString()),
                new JProperty("OperatorName", OperatorName),

                CustomData?.HasValues == true
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomOperatorEVSEDataSerializer != null
                       ? CustomOperatorEVSEDataSerializer(this, JSON)
                       : JSON);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomSetChargeDetailRecordRequestSerializer">A delegate to serialize custom SetChargeDetailRecord request XML elements.</param>
        /// <param name="CustomChargeDetailRecordSerializer">A delegate to serialize custom ChargeDetailRecord XML elements.</param>
        /// <param name="CustomMeterReportSerializer">A delegate to serialize custom MeterReport XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <SetChargeDetailRecordRequest> CustomSetChargeDetailRecordRequestSerializer = null,
                              CustomXMLSerializerDelegate <ChargeDetailRecord> CustomChargeDetailRecordSerializer = null,
                              CustomXMLSerializerDelegate <MeterReport> CustomMeterReportSerializer = null)
        {
            var XML = new XElement(eMIPNS.Authorisation + "eMIP_ToIOP_SetChargeDetailRecordRequest",

                                   TransactionId.HasValue
                              ? new XElement("transactionId", TransactionId.ToString())
                              : null,

                                   new XElement("partnerIdType", PartnerId.Format.AsText()),
                                   new XElement("partnerId", PartnerId.ToString()),

                                   new XElement("operatorIdType", OperatorId.Format.AsText()),
                                   new XElement("operatorId", OperatorId.ToString()),

                                   ChargeDetailRecord.ToXML(CustomChargeDetailRecordSerializer: CustomChargeDetailRecordSerializer,
                                                            CustomMeterReportSerializer:        CustomMeterReportSerializer)

                                   );


            return(CustomSetChargeDetailRecordRequestSerializer != null
                       ? CustomSetChargeDetailRecordRequestSerializer(this, XML)
                       : XML);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomGetServiceAuthorisationRequestSerializer">A delegate to serialize custom set EVSE busy status request XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <GetServiceAuthorisationRequest> CustomGetServiceAuthorisationRequestSerializer = null)
        {
            var XML = new XElement(eMIPNS.Authorisation + "eMIP_ToIOP_GetServiceAuthorisationRequest",

                                   TransactionId.HasValue
                              ? new XElement("transactionId", TransactionId.ToString())
                              : null,

                                   new XElement("partnerIdType", PartnerId.Format.AsText()),
                                   new XElement("partnerId", PartnerId.ToString()),

                                   new XElement("operatorIdType", OperatorId.Format.AsText()),
                                   new XElement("operatorId", OperatorId.ToString()),

                                   new XElement("EVSEIdType", EVSEId.Format.AsText()),
                                   new XElement("EVSEId", EVSEId.ToString()),

                                   new XElement("userIdType", UserId.Format.AsText()),
                                   new XElement("userId", UserId.ToString()),

                                   new XElement("requestedServiceId", RequestedServiceId.ToString()),

                                   PartnerServiceSessionId.HasValue
                              ? new XElement("partnerServiceSessionId", PartnerServiceSessionId.Value.ToString())
                              : null

                                   );


            return(CustomGetServiceAuthorisationRequestSerializer != null
                       ? CustomGetServiceAuthorisationRequestSerializer(this, XML)
                       : XML);
        }
        /// <summary>
        /// Return a JSON-representation of this object.
        /// </summary>
        /// <param name="CustomAuthorizeStopRequestSerializer">A delegate to customize the serialization of AuthorizeStopRequest responses.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <AuthorizeStopRequest> CustomAuthorizeStopRequestSerializer = null,
                              CustomJObjectSerializerDelegate <Identification> CustomIdentificationSerializer             = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("OperatorID", OperatorId.ToString()),
                new JProperty("SessionID", SessionId.ToString()),
                new JProperty("Identification", Identification.ToJSON(CustomIdentificationSerializer)),

                EVSEId.HasValue
                               ? new JProperty("EvseID", EVSEId.Value.ToString())
                               : null,

                CPOPartnerSessionId.HasValue
                               ? new JProperty("CPOPartnerSessionID", CPOPartnerSessionId.Value.ToString())
                               : null,

                EMPPartnerSessionId.HasValue
                               ? new JProperty("EMPPartnerSessionID", EMPPartnerSessionId.Value.ToString())
                               : null,

                CustomData != null
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomAuthorizeStopRequestSerializer != null
                       ? CustomAuthorizeStopRequestSerializer(this, JSON)
                       : JSON);
        }
        public void _setLogInfo()
        {
            EncryptDecrypt ENC = new EncryptDecrypt();

            Response.Cookies.Add(new HttpCookie("ELOG_PAR1", ENC.Encrypt(OperatorId.ToString(), true)));
            Response.Cookies.Add(new HttpCookie("ELOG_PAR2", ENC.Encrypt(LocalIPAddress().ToString(), true)));
            Response.Cookies.Add(new HttpCookie("ELOG_PAR3", ENC.Encrypt(StationId.ToString(), true)));
        }
Exemplo n.º 11
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        public JObject ToJSON()

        => JSONObject.Create(
            new JProperty("operatorId", OperatorId.ToString()),
            new JProperty("operatorName", OperatorName),
            new JProperty("chargingPools", JSONArray.Create(
                              ChargingPools.Select(chargingPool => chargingPool.ToJSON()))
                          )
            );
Exemplo n.º 12
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="CustomSetServiceAuthorisationRequestSerializer">A delegate to serialize custom set EVSE busy status request XML elements.</param>
        /// <param name="CustomMeterReportSerializer">A delegate to serialize custom MeterReport XML elements.</param>
        public XElement ToXML(CustomXMLSerializerDelegate <SetServiceAuthorisationRequest> CustomSetServiceAuthorisationRequestSerializer = null,
                              CustomXMLSerializerDelegate <MeterReport> CustomMeterReportSerializer = null)
        {
            var XML = new XElement(eMIPNS.Authorisation + "eMIP_ToIOP_SetServiceAuthorisationRequest",

                                   TransactionId.HasValue
                              ? new XElement("transactionId", TransactionId.ToString())
                              : null,

                                   new XElement("partnerIdType", PartnerId.Format.AsText()),
                                   new XElement("partnerId", PartnerId.ToString()),

                                   new XElement("operatorIdType", OperatorId.Format.AsText()),
                                   new XElement("operatorId", OperatorId.ToString()),

                                   new XElement("EVSEIdType", EVSEId.Format.AsText()),
                                   new XElement("EVSEId", EVSEId.ToString()),

                                   new XElement("userIdType", UserId.Format.AsText()),
                                   new XElement("userId", UserId.ToString()),

                                   new XElement("requestedServiceId", RequestedServiceId.ToString()),
                                   new XElement("authorisationValue", AuthorisationValue.ToString()),
                                   new XElement("intermediateCDRRequested", IntermediateCDRRequested ? "1" : "0"),

                                   PartnerServiceSessionId.HasValue
                              ? new XElement("serviceSessionId", PartnerServiceSessionId.ToString())
                              : null,

                                   UserContractIdAlias.HasValue
                              ? new XElement("userContractIdAlias", UserContractIdAlias.ToString())
                              : null,

                                   MeterLimits.SafeAny()
                              ? new XElement("meterLimitList", MeterLimits.Select(meterreport => meterreport.ToXML(CustomMeterReportSerializer: CustomMeterReportSerializer)))
                              : null,

                                   Parameter.IsNotNullOrEmpty()
                              ? new XElement("parameter", Parameter)
                              : null,

                                   BookingId.HasValue
                              ? new XElement("bookingId", BookingId.ToString())
                              : null,

                                   SalePartnerBookingId.HasValue
                              ? new XElement("salePartnerBookingId", SalePartnerBookingId.ToString())
                              : null

                                   );


            return(CustomSetServiceAuthorisationRequestSerializer != null
                       ? CustomSetServiceAuthorisationRequestSerializer(this, XML)
                       : XML);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 挂号正式结算
        /// </summary>
        /// <param name="Patient"></param>
        /// <param name="budgetInfo"></param>
        /// <returns></returns>
        public override bool Register(RegPatient Patient, ChargeInfo budgetInfo)
        {
            try
            {
                //更新病人门诊号
                BindEntity <Model.MZ_PatList> .CreateInstanceDAL(oleDb).Update(Tables.mz_patlist.PATLISTID + "=" + Patient.PatListID,
                                                                               Tables.mz_patlist.VISITNO + "='" + Patient.VisitNo + "'");

                OPDBillKind invoiceType = OPDBillKind.门诊挂号发票;
                if (Convert.ToInt32(OPDParamter.Parameters["012"]) == 1)
                {
                    invoiceType = OPDBillKind.门诊收费发票;
                }

                string perfChar  = "";
                string invoiceNo = InvoiceManager.GetBillNumber(invoiceType, OperatorId, false, out perfChar);

                Model.MZ_PresMaster mz_presmaster = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetModel(budgetInfo.PrescriptionID);

                mz_presmaster.Record_Flag = 0;        //改为正常状态
                mz_presmaster.Charge_Flag = 1;        //置为收费状态
                mz_presmaster.TicketNum   = invoiceNo;
                mz_presmaster.TicketCode  = perfChar; //前缀
                mz_presmaster.ChargeCode  = OperatorId.ToString( );
                BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Update(mz_presmaster);

                Model.MZ_CostMaster mz_costmaster = BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).GetModel(budgetInfo.ChargeID);

                mz_costmaster.Record_Flag = 0;
                mz_costmaster.ChargeCode  = OperatorId.ToString( );
                mz_costmaster.ChargeName  = OperatorName;
                mz_costmaster.TicketNum   = invoiceNo;
                mz_costmaster.TicketCode  = perfChar;//发票前缀
                mz_costmaster.Favor_Fee   = budgetInfo.FavorFee;
                mz_costmaster.Money_Fee   = budgetInfo.CashFee;
                mz_costmaster.Pos_Fee     = budgetInfo.PosFee;
                mz_costmaster.Self_Fee    = budgetInfo.SelfFee;
                mz_costmaster.Village_Fee = budgetInfo.VillageFee;
                BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Update(mz_costmaster);

                return(true);
            }
            catch (OperatorException operr)
            {
                throw operr;
            }
            catch (Exception err)
            {
                throw err;
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 保存结算头表
        /// </summary>
        /// <param name="Patient"></param>
        /// <param name="mz_presmaster"></param>
        /// <returns></returns>
        private Model.MZ_CostMaster SaveCostMaster(RegPatient Patient, Model.MZ_PresMaster mz_presmaster)
        {
            Model.MZ_CostMaster mz_costmaster = new HIS.Model.MZ_CostMaster();
            mz_costmaster.ChargeCode   = OperatorId.ToString();
            mz_costmaster.ChargeName   = OperatorName;
            mz_costmaster.CostDate     = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
            mz_costmaster.Hang_Flag    = (int)OPDOperationType.门诊挂号;
            mz_costmaster.PatID        = Patient.PatID;
            mz_costmaster.PatListID    = Patient.PatListID;
            mz_costmaster.PresMasterID = mz_presmaster.PresMasterID;
            mz_costmaster.Record_Flag  = 9;
            mz_costmaster.Total_Fee    = mz_presmaster.Total_Fee;
            BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Add(mz_costmaster);

            return(mz_costmaster);
        }
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomOperatorEVSEStatusSerializer">A delegate to serialize custom operator EVSE status JSON objects.</param>
        /// <param name="CustomEVSEStatusRecordSerializer">A delegate to serialize custom EVSE status record JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <OperatorEVSEStatus> CustomOperatorEVSEStatusSerializer = null,
                              CustomJObjectSerializerDelegate <EVSEStatusRecord> CustomEVSEStatusRecordSerializer     = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("EvseStatusRecord", new JArray(EVSEStatusRecords.Select(evseStatusRecord => evseStatusRecord.ToJSON(CustomEVSEStatusRecordSerializer)))),
                new JProperty("OperatorID", OperatorId.ToString()),
                new JProperty("OperatorName", OperatorName),

                CustomData?.HasValues == true
                               ? new JProperty("CustomData", CustomData)
                               : null

                );

            return(CustomOperatorEVSEStatusSerializer != null
                       ? CustomOperatorEVSEStatusSerializer(this, JSON)
                       : JSON);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 保存处方头表
        /// </summary>
        /// <param name="Patient"></param>
        /// <returns></returns>
        private Model.MZ_PresMaster SavePresMaster(RegPatient Patient)
        {
            Model.MZ_PresMaster mz_presmaster = new HIS.Model.MZ_PresMaster();
            mz_presmaster.Charge_Flag  = 0;
            mz_presmaster.ExecDeptCode = Patient.RegDeptCode;
            mz_presmaster.ExecDocCode  = Patient.RegDoctorCode;
            mz_presmaster.Hand_Flag    = (int)OPDOperationType.门诊挂号;
            mz_presmaster.PatID        = Patient.PatID;
            mz_presmaster.PatListID    = Patient.PatListID;
            mz_presmaster.PresAmount   = 1;
            mz_presmaster.PresCostCode = OperatorId.ToString();
            mz_presmaster.PresDate     = Patient.RegDate;
            mz_presmaster.PresDeptCode = Patient.RegDeptCode;
            mz_presmaster.PresDocCode  = Patient.RegDoctorCode;
            mz_presmaster.PresType     = "-1";
            mz_presmaster.Record_Flag  = 9; //预算状态为9
            mz_presmaster.PresDate     = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
            BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Add(mz_presmaster);

            return(mz_presmaster);
        }
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="OperatorEVSEStatusXName">The OperatorEVSEStatus XML name to use.</param>
        /// <param name="CustomOperatorEVSEStatusSerializer">A delegate to serialize custom OperatorEVSEStatus XML elements.</param>
        /// <param name="EVSEStatusRecordXName">The EVSEStatusRecord XML name to use.</param>
        /// <param name="CustomEVSEStatusRecordSerializer">A delegate to serialize custom EVSEStatusRecord XML elements.</param>
        public XElement ToXML(XName OperatorEVSEStatusXName = null,
                              CustomXMLSerializerDelegate <OperatorEVSEStatus> CustomOperatorEVSEStatusSerializer = null,
                              XName EVSEStatusRecordXName = null,
                              CustomXMLSerializerDelegate <EVSEStatusRecord> CustomEVSEStatusRecordSerializer = null)

        {
            var xml = new XElement(OperatorEVSEStatusXName ?? OICPNS.EVSEStatus + "OperatorEvseStatus",

                                   new XElement(OICPNS.EVSEStatus + "OperatorID", OperatorId.ToString()),

                                   OperatorName.IsNotNullOrEmpty()
                              ? new XElement(OICPNS.EVSEStatus + "OperatorName", OperatorName)
                              : null,

                                   EVSEStatusRecords.Any()
                              ? EVSEStatusRecords.SafeSelect(evsestatusrecord => evsestatusrecord.ToXML(EVSEStatusRecordXName,
                                                                                                        CustomEVSEStatusRecordSerializer))
                              : null);

            return(CustomOperatorEVSEStatusSerializer != null
                       ? CustomOperatorEVSEStatusSerializer(this, xml)
                       : xml);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Return a text representation of this object.
        /// </summary>
        public override String ToString()

        => String.Concat(OperatorName, " (", OperatorId.ToString(), ") ", " => ",
                         _ChargingPools.Values.Count(), " charging pools, ",
                         _ChargingPools.Values.SelectMany(pool => pool.ChargingStations).Count(), " charging stations, ",
                         _ChargingPools.Values.SelectMany(pool => pool.ChargingStations.SelectMany(stations => stations.EVSEDataRecords)).Count(), " EVSEs.");
Exemplo n.º 19
0
        /// <summary>
        /// Return the identification in the given format.
        /// </summary>
        /// <param name="IdFormat">The format.</param>
        public String ToFormat(OperatorIdFormats IdFormat)

        => IdFormat == OperatorIdFormats.ISO
                   ? String.Concat(OperatorId.ToString(IdFormat), "*E", Suffix)
                   : String.Concat(OperatorId.ToString(IdFormat), "*", Suffix);
Exemplo n.º 20
0
        /// <summary>
        /// 取消挂号
        /// </summary>
        /// <param name="RegInvoiceNo">挂号发票号</param>
        /// <returns></returns>
        public override bool CancelRegister(string RegInvoiceNo, string PerfChar)
        {
            try
            {
                //取得原记录
                string strWhere1_1 = Tables.mz_costmaster.TICKETCODE + oleDb.EuqalTo( ) + "'" + PerfChar + "'" + oleDb.And() + Tables.mz_costmaster.TICKETNUM + oleDb.EuqalTo( ) + "'" + RegInvoiceNo + "' " + oleDb.And( ) + Tables.mz_costmaster.RECORD_FLAG + oleDb.EuqalTo( ) + "0";
                Model.MZ_CostMaster mz_costmaster = BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).GetModel(strWhere1_1);

                string strWhere1_2 = Tables.mz_costorder.COSTID + oleDb.EuqalTo( ) + mz_costmaster.CostMasterID;
                List <Model.MZ_CostOrder> list_mz_costorder = BindEntity <Model.MZ_CostOrder> .CreateInstanceDAL(oleDb).GetListArray(strWhere1_2);

                string strWhere2_1 = Tables.mz_presmaster.COSTMASTERID + oleDb.EuqalTo( ) + mz_costmaster.CostMasterID;
                Model.MZ_PresMaster mz_presmaster = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetModel(strWhere2_1);

                string strWhere2_2 = Tables.mz_presorder.PRESMASTERID + oleDb.EuqalTo( ) + mz_presmaster.PresMasterID;
                List <Model.MZ_PresOrder> list_mz_presorder = BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).GetListArray(strWhere2_2);

                //挂号处方头退费
                BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Update(strWhere2_1, Tables.mz_presmaster.RECORD_FLAG + oleDb.EuqalTo( ) + "1");

                //加入冲正的处方头
                mz_presmaster.Record_Flag = 2;
                mz_presmaster.Total_Fee   = mz_presmaster.Total_Fee * -1;
                mz_presmaster.PresDate    = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
                mz_presmaster.ChargeCode  = OperatorId.ToString( );
                mz_presmaster.OldID       = mz_presmaster.PresMasterID;
                BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Add(mz_presmaster);

                //加入明细
                foreach (Model.MZ_PresOrder mz_presorder in list_mz_presorder)
                {
                    mz_presorder.PresMasterID = mz_presmaster.PresMasterID;
                    mz_presorder.Tolal_Fee    = mz_presorder.Tolal_Fee * -1;
                    mz_presorder.Amount       = mz_presorder.Amount * -1;
                    BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).Add(mz_presorder);
                }
                //原记录置为退费状态
                BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Update(strWhere1_1, Tables.mz_costmaster.RECORD_FLAG + oleDb.EuqalTo( ) + "1");

                //加入冲正记录
                mz_costmaster.Record_Flag = 2;
                mz_costmaster.Total_Fee   = mz_costmaster.Total_Fee * -1;
                mz_costmaster.Favor_Fee   = mz_costmaster.Favor_Fee * -1;
                mz_costmaster.Money_Fee   = mz_costmaster.Money_Fee * -1;
                mz_costmaster.Pos_Fee     = mz_costmaster.Pos_Fee * -1;
                mz_costmaster.Self_Fee    = mz_costmaster.Self_Fee * -1;
                mz_costmaster.Village_Fee = mz_costmaster.Village_Fee * -1;
                mz_costmaster.AccountID   = 0;

                mz_costmaster.PresMasterID = mz_presmaster.PresMasterID;
                mz_costmaster.OldID        = mz_costmaster.CostMasterID;
                mz_costmaster.ChargeCode   = OperatorId.ToString( );
                mz_costmaster.ChargeName   = OperatorName;
                BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Add(mz_costmaster);

                //明细
                foreach (Model.MZ_CostOrder mz_costorder in list_mz_costorder)
                {
                    mz_costorder.CostID    = mz_costmaster.CostMasterID;
                    mz_costorder.Total_Fee = mz_costorder.Total_Fee * -1;
                    BindEntity <Model.MZ_CostOrder> .CreateInstanceDAL(oleDb).Add(mz_costorder);
                }
                //回写处方的结算号
                BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Update(Tables.mz_presmaster.PRESMASTERID + oleDb.EuqalTo( ) + mz_presmaster.PresMasterID,
                                                                                  Tables.mz_presmaster.COSTMASTERID + oleDb.EuqalTo( ) + mz_costmaster.CostMasterID);

                return(true);
            }
            catch (OperatorException operr)
            {
                throw operr;
            }
            catch (Exception err)
            {
                throw err;
            }
        }
Exemplo n.º 21
0
        protected bool _refundment(Invoice invoice, Prescription[] ReblancePrescriptions)
        {
            try
            {
                int temp_costmasterid = MSAccessDb.GetMaxID("MZ_COSTMASTER", Tables.mz_costmaster.COSTMASTERID);
                int temp_costorderid  = MSAccessDb.GetMaxID("MZ_COSTORDER", Tables.mz_costorder.COSTORDERID);
                int temp_presmasterid = MSAccessDb.GetMaxID("MZ_PRESMASTER", Tables.mz_presmaster.PRESMASTERID);
                int temp_presorderid  = MSAccessDb.GetMaxID("MZ_PRESORDER", Tables.mz_presorder.PRESORDERID);

                //List<HIS.Model.MZ_CostMaster> lstCostMaster = BindEntity<HIS.Model.MZ_CostMaster>.CreateInstanceDAL( oleDb ).GetListArray( Tables.mz_costmaster.COSTMASTERID + oleDb.EuqalTo( ) + invoice.ChargeID );
                List <HIS.Model.MZ_CostMaster> lstCostMaster = MSAccessDb.GetListArray <MZ_CostMaster>("MZ_COSTMASTER", Tables.mz_costmaster.COSTMASTERID + "=" + invoice.ChargeID);
                foreach (HIS.Model.MZ_CostMaster mz_costmaster in lstCostMaster)
                {
                    int oldCostMasterId = mz_costmaster.CostMasterID;
                    //置结算记录退费
                    MSAccessDb.Execute("update mz_costmaster set RECORD_FLAG = 1 where COSTMASTERID = " + oldCostMasterId);
                    //冲正
                    mz_costmaster.ChargeCode   = OperatorId.ToString( );
                    mz_costmaster.ChargeName   = DataReader.GetEmployeeNameById(OperatorId);
                    mz_costmaster.CostDate     = DateTime.Now;
                    mz_costmaster.Favor_Fee    = mz_costmaster.Favor_Fee * -1;
                    mz_costmaster.Money_Fee    = mz_costmaster.Money_Fee * -1;
                    mz_costmaster.OldID        = mz_costmaster.CostMasterID;
                    mz_costmaster.PresMasterID = mz_costmaster.PresMasterID;
                    mz_costmaster.Pos_Fee      = mz_costmaster.Pos_Fee * -1;
                    mz_costmaster.Record_Flag  = 2; //红冲标识
                    mz_costmaster.Self_Fee     = mz_costmaster.Self_Fee * -1;
                    mz_costmaster.Total_Fee    = mz_costmaster.Total_Fee * -1;
                    mz_costmaster.Village_Fee  = mz_costmaster.Village_Fee * -1;
                    mz_costmaster.AccountID    = 0;
                    mz_costmaster.Hang_Flag    = (int)OPDOperationType.门诊收费;
                    mz_costmaster.CostMasterID = temp_costorderid;

                    MSAccessDb.InsertRecord(mz_costmaster, Tables.mz_costmaster.COSTMASTERID);
                    temp_costmasterid++;
                    //红冲明细
                    List <HIS.Model.MZ_CostOrder> lstCostOrder = MSAccessDb.GetListArray <HIS.Model.MZ_CostOrder>("MZ_COSTORDER", Tables.mz_costorder.COSTID + "=" + oldCostMasterId);
                    foreach (HIS.Model.MZ_CostOrder mz_costorder in lstCostOrder)
                    {
                        mz_costorder.CostID      = mz_costmaster.CostMasterID;
                        mz_costorder.Total_Fee   = mz_costorder.Total_Fee * -1;
                        mz_costorder.CostOrderID = temp_costorderid;
                        MSAccessDb.InsertRecord(mz_costorder, Tables.mz_costorder.COSTORDERID);
                        temp_costorderid++;
                    }

                    //更新对应的处方部分
                    List <HIS.Model.MZ_PresMaster> lstPresMaster = MSAccessDb.GetListArray <MZ_PresMaster>("MZ_PRESMASTER", Tables.mz_presmaster.COSTMASTERID + "=" + oldCostMasterId);
                    foreach (HIS.Model.MZ_PresMaster mz_presmaster in lstPresMaster)
                    {
                        int oldPresMasterId = mz_presmaster.PresMasterID;
                        //置退费标志
                        MSAccessDb.UpdateRecord(new string[] { Tables.mz_presmaster.RECORD_FLAG + " = 1" },
                                                Tables.mz_presmaster.PRESMASTERID + " = " + oldPresMasterId,
                                                typeof(MZ_PresMaster));
                        //红冲
                        mz_presmaster.ChargeCode   = OperatorId.ToString( );
                        mz_presmaster.OldID        = mz_presmaster.PresMasterID;
                        mz_presmaster.Record_Flag  = 2;
                        mz_presmaster.Total_Fee    = mz_presmaster.Total_Fee * -1;
                        mz_presmaster.PresMasterID = 0;
                        mz_presmaster.Hand_Flag    = (int)OPDOperationType.门诊收费;
                        mz_presmaster.CostMasterID = mz_costmaster.CostMasterID; //记录冲正的结算ID
                        mz_presmaster.PresMasterID = temp_presmasterid;
                        MSAccessDb.InsertRecord(mz_presmaster, Tables.mz_presmaster.PRESMASTERID);
                        temp_presmasterid++;
                        //明细
                        List <MZ_PresOrder> lstPresOrder = MSAccessDb.GetListArray <MZ_PresOrder>("MZ_PRESORDER", Tables.mz_presorder.PRESMASTERID + " = " + oldPresMasterId);
                        foreach (MZ_PresOrder mz_presorder in lstPresOrder)
                        {
                            mz_presorder.PresMasterID = mz_presmaster.PresMasterID;
                            mz_presorder.Amount       = mz_presorder.Amount * -1;
                            mz_presorder.Tolal_Fee    = mz_presorder.Tolal_Fee * -1;
                            mz_presorder.PresOrderID  = temp_presorderid;
                            MSAccessDb.InsertRecord(mz_presorder, Tables.mz_presorder.PRESORDERID);
                            temp_presorderid++;
                        }
                    }
                }

                return(true);
            }
            catch (Exception err)
            {
                throw err;
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// 退费
        /// </summary>
        /// <param name="invoice">要退费的发票对象</param>
        /// <param name="ReblancePrescriptions">需要重新补收的处方对象,主要是部分退费时会产生需要补收的处方</param>
        /// <returns></returns>
        protected bool _refundment(Invoice invoice, Prescription[] ReblancePrescriptions)
        {
            try
            {
                List <Model.MZ_CostMaster> lstCostMaster = BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).GetListArray(Tables.mz_costmaster.COSTMASTERID + oleDb.EuqalTo( ) + invoice.ChargeID);

                foreach (Model.MZ_CostMaster mz_costmaster in lstCostMaster)
                {
                    int oldCostMasterId = mz_costmaster.CostMasterID;
                    //置结算记录退费
                    BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Update(Tables.mz_costmaster.COSTMASTERID + oleDb.EuqalTo( ) + oldCostMasterId,
                                                                                      Tables.mz_costmaster.RECORD_FLAG + oleDb.EuqalTo( ) + "1");

                    //冲正
                    mz_costmaster.ChargeCode = OperatorId.ToString( );
                    //mz_costmaster.ChargeName = PublicDataReader.GetEmployeeNameById( OperatorId );
                    mz_costmaster.ChargeName   = BaseDataController.GetName(BaseDataCatalog.人员列表, OperatorId);
                    mz_costmaster.CostDate     = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
                    mz_costmaster.Favor_Fee    = mz_costmaster.Favor_Fee * -1;
                    mz_costmaster.Money_Fee    = mz_costmaster.Money_Fee * -1;
                    mz_costmaster.OldID        = mz_costmaster.CostMasterID;
                    mz_costmaster.PresMasterID = mz_costmaster.PresMasterID;
                    mz_costmaster.Pos_Fee      = mz_costmaster.Pos_Fee * -1;
                    mz_costmaster.Record_Flag  = 2; //红冲标识
                    mz_costmaster.Self_Fee     = mz_costmaster.Self_Fee * -1;
                    mz_costmaster.Total_Fee    = mz_costmaster.Total_Fee * -1;
                    mz_costmaster.Village_Fee  = mz_costmaster.Village_Fee * -1;
                    mz_costmaster.Self_Tally   = mz_costmaster.Self_Tally * -1;
                    mz_costmaster.AccountID    = 0;
                    mz_costmaster.Hang_Flag    = (int)OPDOperationType.门诊收费;
                    BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Add(mz_costmaster);

                    //红冲明细
                    List <Model.MZ_CostOrder> lstCostOrder = BindEntity <Model.MZ_CostOrder> .CreateInstanceDAL(oleDb).GetListArray(Tables.mz_costorder.COSTID + oleDb.EuqalTo( ) + oldCostMasterId);

                    foreach (Model.MZ_CostOrder mz_costorder in lstCostOrder)
                    {
                        mz_costorder.CostID    = mz_costmaster.CostMasterID;
                        mz_costorder.Total_Fee = mz_costorder.Total_Fee * -1;
                        BindEntity <Model.MZ_CostOrder> .CreateInstanceDAL(oleDb).Add(mz_costorder);
                    }

                    //更新对应的处方部分
                    List <Model.MZ_PresMaster> lstPresMaster = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetListArray(Tables.mz_presmaster.COSTMASTERID + oleDb.EuqalTo( ) + oldCostMasterId);

                    foreach (Model.MZ_PresMaster mz_presmaster in lstPresMaster)
                    {
                        int oldPresMasterId = mz_presmaster.PresMasterID;
                        //置退费标志
                        BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Update(Tables.mz_presmaster.PRESMASTERID + oleDb.EuqalTo( ) + oldPresMasterId,
                                                                                          Tables.mz_presmaster.RECORD_FLAG + oleDb.EuqalTo( ) + "1");

                        //红冲
                        mz_presmaster.ChargeCode   = OperatorId.ToString( );
                        mz_presmaster.OldID        = mz_presmaster.PresMasterID;
                        mz_presmaster.Record_Flag  = 2;
                        mz_presmaster.Total_Fee    = mz_presmaster.Total_Fee * -1;
                        mz_presmaster.PresMasterID = 0;
                        mz_presmaster.Hand_Flag    = (int)OPDOperationType.门诊收费;
                        mz_presmaster.CostMasterID = mz_costmaster.CostMasterID; //记录冲正的结算ID
                        BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Add(mz_presmaster);

                        //明细
                        List <Model.MZ_PresOrder> lstPresOrder = BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).GetListArray(Tables.mz_presorder.PRESMASTERID + oleDb.EuqalTo( ) + oldPresMasterId);

                        foreach (Model.MZ_PresOrder mz_presorder in lstPresOrder)
                        {
                            mz_presorder.PresMasterID = mz_presmaster.PresMasterID;
                            mz_presorder.Amount       = mz_presorder.Amount * -1;
                            mz_presorder.Tolal_Fee    = mz_presorder.Tolal_Fee * -1;
                            BindEntity <Model.MZ_PresOrder> .CreateInstanceDAL(oleDb).Add(mz_presorder);
                        }
                    }
                }

                return(true);
            }
            catch (Exception err)
            {
                throw err;
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// 预算
        /// </summary>
        /// <param name="prescriptions">要预算的处方</param>
        /// <returns>预算信息,供正式结算用</returns>
        public override ChargeInfo[] Budget(Prescription[] prescriptions)
        {
            //单张处方明细转化为大项目明细合并后累加在取舍。

            //保存每张处方的大项目明细
            List <List <Item> > lstStatItems = new List <List <Item> >( );
            //本次结算总金额(等于每张处方舍入后的金额的合计)
            decimal chargeTotalCost = 0;

            #region 合并大类并计算舍入金额
            try
            {
                for (int i = 0; i < prescriptions.Length; i++)
                {
                    List <Item> lstTemp = new List <Item>( );
                    lstTemp         = MergePrescriptionByStatItemCode(ref prescriptions[i]);
                    chargeTotalCost = chargeTotalCost + prescriptions[i].Total_Fee;
                    lstStatItems.Add(lstTemp);
                }
            }
            catch (Exception err)
            {
                throw new Exception("合并项目发生错误!");
            }
            #endregion
            //保存合并后的所有大项目明细,类型MZ_CostOrder
            Hashtable htCostOrder = new Hashtable();
            #region 合并所有结算明细(不需要再舍入)
            try
            {
                foreach (List <Item> lstTemp in lstStatItems)
                {
                    foreach (object obj in lstTemp)
                    {
                        if (htCostOrder.ContainsKey(((Item)obj).Text.Trim( )))
                        {
                            Item         item         = (Item)obj;
                            MZ_CostOrder mz_costorder = (MZ_CostOrder)htCostOrder[item.Text.Trim( )];
                            mz_costorder.Total_Fee = mz_costorder.Total_Fee + Convert.ToDecimal(item.Value);
                        }
                        else
                        {
                            MZ_CostOrder mz_costorder = new HIS.Model.MZ_CostOrder( );
                            mz_costorder.ItemType  = ((Item)obj).Text.Trim( );
                            mz_costorder.Total_Fee = Convert.ToDecimal(((Item)obj).Value);
                            htCostOrder.Add(mz_costorder.ItemType, mz_costorder);
                        }
                    }
                }
            }
            catch (Exception err)
            {
                throw new Exception("合并明细大类发生错误!");
            }
            #endregion
            int costmasterid = MSAccessDb.GetMaxID("MZ_COSTMASTER", Tables.mz_costmaster.COSTMASTERID);
            #region 数据库操作,得到结算号
            try
            {
                MSAccessDb.BeginTrans();

                #region 赋值结算头表并保存
                HIS.Model.MZ_CostMaster mz_costmaster = new HIS.Model.MZ_CostMaster( );
                mz_costmaster.PatID        = Patient.PatID;
                mz_costmaster.PatListID    = Patient.PatListID;
                mz_costmaster.PresMasterID = 0;
                mz_costmaster.TicketNum    = "";
                mz_costmaster.TicketCode   = "";
                mz_costmaster.ChargeCode   = OperatorId.ToString( );
                mz_costmaster.ChargeName   = DataReader.GetEmployeeNameById(OperatorId);
                mz_costmaster.Total_Fee    = chargeTotalCost;//结算表的总金额
                mz_costmaster.Self_Fee     = 0;
                mz_costmaster.Village_Fee  = 0;
                mz_costmaster.Favor_Fee    = 0;
                mz_costmaster.Pos_Fee      = 0;
                mz_costmaster.Money_Fee    = 0;
                mz_costmaster.Ticket_Flag  = 0;
                mz_costmaster.Record_Flag  = 9;//预结算记录状态置为9
                mz_costmaster.OldID        = 0;
                mz_costmaster.AccountID    = 0;
                mz_costmaster.Hang_Flag    = (int)OPDOperationType.门诊收费;
                mz_costmaster.Hurried_Flag = Patient.IsEmergency ? 1 : 0;
                mz_costmaster.CostMasterID = costmasterid;

                MSAccessDb.InsertRecord(mz_costmaster, Tables.mz_costorder.COSTORDERID);
                #endregion

                #region 更新处方表的结算号和总金额,舍入金额
                for (int prescCount = 0; prescCount < prescriptions.Length; prescCount++)
                {
                    string        strWhere      = Tables.mz_presmaster.PRESMASTERID + " = " + prescriptions[prescCount].PrescriptionID;
                    MZ_PresMaster mz_presmaster = (MZ_PresMaster)MSAccessDb.GetModel("MZ_PRESMASTER", strWhere, typeof(MZ_PresMaster));
                    if (mz_presmaster.Charge_Flag == 1)
                    {
                        throw new Exception("处方已被别的收费员收费,请确认!");
                    }
                    //更新处方表的结算号和总金额,舍入金额
                    //BindEntity<MZ_PresMaster>.CreateInstanceDAL( oleDb ).Update( strWhere ,
                    //                      Tables.mz_presmaster.COSTMASTERID + " = " + mz_costmaster.CostMasterID ,
                    //                      Tables.mz_presmaster.TOTAL_FEE + " = " + prescriptions[prescCount].Total_Fee ,
                    //                      Tables.mz_presmaster.ROUNGINGMONEY + " = " + prescriptions[prescCount].RoundingMoney );
                    MSAccessDb.UpdateRecord(new string[] { Tables.mz_presmaster.COSTMASTERID + " = " + mz_costmaster.CostMasterID,
                                                           Tables.mz_presmaster.TOTAL_FEE + " = " + prescriptions[prescCount].Total_Fee,
                                                           Tables.mz_presmaster.ROUNGINGMONEY + " = " + prescriptions[prescCount].RoundingMoney },
                                            strWhere, typeof(MZ_PresMaster));
                }
                #endregion

                #region 保存结算明细到数据库(按大项目保存)
                int costorderid = MSAccessDb.GetMaxID("MZ_COSTORDER", Tables.mz_costorder.COSTORDERID);
                foreach (object obj in htCostOrder)
                {
                    HIS.Model.MZ_CostOrder mz_costorder = (HIS.Model.MZ_CostOrder)((System.Collections.DictionaryEntry)obj).Value;
                    mz_costorder.CostID      = mz_costmaster.CostMasterID;
                    mz_costorder.CostOrderID = costorderid;
                    //保存到数据库
                    //mz_costorder.CostOrderID = BindEntity<MZ_CostOrder>.CreateInstanceDAL( oleDb ).Add( mz_costorder );
                    MSAccessDb.InsertRecord(mz_costorder, Tables.mz_costorder.COSTORDERID);
                    costorderid++;
                }
                #endregion

                MSAccessDb.CommitTrans( );
            }

            catch (Exception err)
            {
                MSAccessDb.RollbackTrans( );
                throw new Exception("保存预算结果到数据库发生错误!");
            }
            #endregion
            //回填处方的结算号
            for (int prescCount = 0; prescCount < prescriptions.Length; prescCount++)
            {
                prescriptions[prescCount].ChargeID = costmasterid;
            }

            #region 返回预算结果
            try
            {
                Hashtable htInvoiceItem = new Hashtable( );
                foreach (object obj in htCostOrder)
                {
                    HIS.Model.MZ_CostOrder mz_costorder = (HIS.Model.MZ_CostOrder)((System.Collections.DictionaryEntry)obj).Value;
                    InvoiceItem            invoice      = GetInvoiceByStatCode(mz_costorder.ItemType.Trim( ));
                    invoice.Cost = mz_costorder.Total_Fee;
                    if (htInvoiceItem.ContainsKey(invoice.ItemCode.Trim( )))
                    {
                        InvoiceItem _invoice = (InvoiceItem)htInvoiceItem[invoice.ItemCode];
                        _invoice.Cost = _invoice.Cost + invoice.Cost;
                        htInvoiceItem.Remove(invoice.ItemCode);
                        htInvoiceItem.Add(_invoice.ItemCode, _invoice);
                    }
                    else
                    {
                        htInvoiceItem.Add(invoice.ItemCode, invoice);
                    }
                }
                List <InvoiceItem> chargeItems = new List <InvoiceItem>( );
                foreach (object item in htInvoiceItem)
                {
                    chargeItems.Add((InvoiceItem)((DictionaryEntry)item).Value);
                }

                ChargeInfo chargeInfos = new ChargeInfo( );
                chargeInfos.Items    = chargeItems.ToArray( );
                chargeInfos.ChargeID = costmasterid;
                chargeInfos.TotalFee = chargeTotalCost;

                ChargeInfo[] chargeInfo = new ChargeInfo[1];
                chargeInfo[0].TotalFee = chargeTotalCost;
                chargeInfo[0]          = chargeInfos;
                //计算本次的优惠金额
                chargeInfo[0].FavorFee = GetFavorCost(Patient.MediType, chargeInfo[0], prescriptions);
                return(chargeInfo);
            }
            catch (Exception err)
            {
                throw new Exception("返回预算结果发生错误!");
            }
            #endregion
        }
Exemplo n.º 24
0
        /// <summary>
        /// 正式结算
        /// </summary>
        /// <param name="BudgetaryChargeInfos">预算信息</param>
        /// <param name="prescriptions">要结算的处方,该处方对象经过预算方法处理</param>
        /// <returns>true:结算成功,false:结算失败</returns>
        public override bool Charge(ChargeInfo[] BudgetaryChargeInfos, Prescription[] prescriptions, out BaseInvoice[] ChargeInvoicies)
        {
            MZClinicInterface clinicInterface = new MZClinicInterface();

            oleDb.BeginTransaction();

            try
            {
                for (int presindex = 0; presindex < prescriptions.Length; presindex++)
                {
                    if (prescriptions[presindex].DocPresId > 0)
                    {
                        decimal mzdocfee = clinicInterface.GetDocPresMoney(prescriptions[presindex].DocPresId);
                        if (mzdocfee != prescriptions[presindex].Total_Fee)
                        {
                            throw new Exception("门诊医生站已对该收费处方进行修改,请重新刷新处方再点收银!");
                        }
                    }
                }
                for (int chargeCount = 0; chargeCount < BudgetaryChargeInfos.Length; chargeCount++)
                {
                    if (BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Exists(BudgetaryChargeInfos[chargeCount].ChargeID))
                    {
                        HIS.Model.MZ_CostMaster chargeBill = new HIS.Model.MZ_CostMaster();
                        chargeBill = BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).GetModel(BudgetaryChargeInfos[chargeCount].ChargeID);

                        chargeBill.Self_Fee    = BudgetaryChargeInfos[chargeCount].SelfFee;
                        chargeBill.Village_Fee = BudgetaryChargeInfos[chargeCount].VillageFee;
                        chargeBill.Favor_Fee   = BudgetaryChargeInfos[chargeCount].FavorFee;
                        chargeBill.Pos_Fee     = BudgetaryChargeInfos[chargeCount].PosFee;
                        chargeBill.Money_Fee   = BudgetaryChargeInfos[chargeCount].CashFee;
                        chargeBill.Self_Tally  = BudgetaryChargeInfos[chargeCount].SelfTally;
                        chargeBill.Ticket_Flag = 0;
                        chargeBill.CostDate    = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
                        chargeBill.Record_Flag = 0;
                        string perfCode = "";
                        chargeBill.TicketNum  = InvoiceManager.GetBillNumber(OPDBillKind.门诊收费发票, OperatorId, false, out perfCode);
                        chargeBill.TicketCode = perfCode;    //前缀 BudgetaryChargeInfos[chargeCount].InvoiceNO;

                        BudgetaryChargeInfos[chargeCount].InvoiceSerialNO = Convert.ToInt32(chargeBill.TicketNum);
                        BudgetaryChargeInfos[chargeCount].InvoiceNO       = chargeBill.TicketNum;
                        BudgetaryChargeInfos[chargeCount].PerfChar        = perfCode;
                        BudgetaryChargeInfos[chargeCount].ChargeDate      = chargeBill.CostDate;

                        BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Update(chargeBill);  //更新结算表


                        //更新处方表收费标识
                        List <Model.MZ_PresMaster> lstPresMaster = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetListArray(HIS.BLL.Tables.mz_presmaster.COSTMASTERID + oleDb.EuqalTo() + BudgetaryChargeInfos[chargeCount].ChargeID);

                        if (lstPresMaster.Count == 0)
                        {
                            throw new OperatorException("没有找到要结算的处方,请确认是否已被人收费");
                        }
                        foreach (Model.MZ_PresMaster mz_presmaster in lstPresMaster)
                        {
                            if (mz_presmaster.Charge_Flag == 0)
                            {
                                mz_presmaster.Charge_Flag = 1;
                                mz_presmaster.TicketCode  = perfCode;   //前缀     BudgetaryChargeInfos[chargeCount].InvoiceNO;
                                mz_presmaster.TicketNum   = chargeBill.TicketNum;
                                mz_presmaster.ChargeCode  = OperatorId.ToString();
                                BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Update(mz_presmaster);
                            }
                            else
                            {
                                throw new OperatorException("该处方已被其他收费员收费!");
                            }
                        }
                    }
                    else
                    {
                        throw new OperatorException("没有找到结算号的记录!");
                    }
                }

                for (int i = 0; i < prescriptions.Length; i++)
                {
                    clinicInterface.ChangePresStatus(prescriptions[i].DocPresId, 1);
                }

                oleDb.CommitTransaction( );
            }
            catch (OperatorException operr)
            {
                oleDb.RollbackTransaction( );
                throw operr;
            }
            catch (Exception err)
            {
                oleDb.RollbackTransaction( );
                ErrorWriter.WriteLog(err.Message);
                throw new Exception("正式结算发生错误!");
            }
            //发票对象
            try
            {
                ChargeInvoicies = new Invoice[BudgetaryChargeInfos.Length];
                for (int i = 0; i < BudgetaryChargeInfos.Length; i++)
                {
                    ChargeInvoicies[i] = new Invoice(BudgetaryChargeInfos[i].PerfChar, BudgetaryChargeInfos[i].InvoiceNO, OPDBillKind.门诊收费发票);
                }
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                throw new OperatorException("收费成功,但生成发票对象失败!");
            }
            return(true);
        }
Exemplo n.º 25
0
        /// <summary>
        /// 正式结算
        /// </summary>
        /// <param name="BudgetaryChargeInfos">预算信息</param>
        /// <param name="prescriptions">要结算的处方,该处方对象经过预算方法处理</param>
        /// <returns>true:结算成功,false:结算失败</returns>
        public override bool Charge(ChargeInfo[] BudgetaryChargeInfos, Prescription[] prescriptions, out BaseInvoice[] ChargeInvoicies)
        {
            MSAccessDb.BeginTrans( );

            try
            {
                for (int chargeCount = 0; chargeCount < BudgetaryChargeInfos.Length; chargeCount++)
                {
                    //if ( BindEntity<MZ_CostMaster>.CreateInstanceDAL( oleDb ).Exists( BudgetaryChargeInfos[chargeCount].ChargeID ) )
                    if (MSAccessDb.Exists("MZ_COSTMASTER", Tables.mz_costmaster.COSTMASTERID + "=" + BudgetaryChargeInfos[chargeCount].ChargeID))
                    {
                        HIS.Model.MZ_CostMaster chargeBill = new HIS.Model.MZ_CostMaster( );
                        //chargeBill = BindEntity<MZ_CostMaster>.CreateInstanceDAL( oleDb ).GetModel( BudgetaryChargeInfos[chargeCount].ChargeID );
                        chargeBill             = (MZ_CostMaster)MSAccessDb.GetModel("MZ_COSTMASTER", Tables.mz_costmaster.COSTMASTERID + "=" + BudgetaryChargeInfos[chargeCount].ChargeID, typeof(MZ_CostMaster));
                        chargeBill.Self_Fee    = BudgetaryChargeInfos[chargeCount].SelfFee;
                        chargeBill.Village_Fee = BudgetaryChargeInfos[chargeCount].VillageFee;
                        chargeBill.Favor_Fee   = BudgetaryChargeInfos[chargeCount].FavorFee;
                        chargeBill.Pos_Fee     = BudgetaryChargeInfos[chargeCount].PosFee;
                        chargeBill.Money_Fee   = BudgetaryChargeInfos[chargeCount].CashFee;
                        chargeBill.Self_Tally  = BudgetaryChargeInfos[chargeCount].SelfTally;
                        chargeBill.Ticket_Flag = 0;
                        chargeBill.CostDate    = DateTime.Now;
                        chargeBill.Record_Flag = 0;
                        string perfCode = "";
                        chargeBill.TicketNum  = InvoiceManager.GetBillNumber(OPDBillKind.门诊收费发票, OperatorId, false, out perfCode);
                        chargeBill.TicketCode = perfCode;//BudgetaryChargeInfos[chargeCount].InvoiceNO;

                        BudgetaryChargeInfos[chargeCount].InvoiceSerialNO = Convert.ToInt32(chargeBill.TicketNum);
                        BudgetaryChargeInfos[chargeCount].InvoiceNO       = chargeBill.TicketNum;
                        BudgetaryChargeInfos[chargeCount].PerfChar        = perfCode;
                        BudgetaryChargeInfos[chargeCount].ChargeDate      = chargeBill.CostDate;

                        MSAccessDb.UpdateRecord(chargeBill);

                        //更新处方表收费标识
                        //List<MZ_PresMaster> lstPresMaster = BindEntity<MZ_PresMaster>.CreateInstanceDAL( oleDb ).GetListArray( HIS.BLL.Tables.mz_presmaster.COSTMASTERID + " = " + BudgetaryChargeInfos[chargeCount].ChargeID );
                        List <MZ_PresMaster> lstPresMaster = MSAccessDb.GetListArray <MZ_PresMaster>("MZ_PRESMASTER", Tables.mz_presmaster.COSTMASTERID + " = " + BudgetaryChargeInfos[chargeCount].ChargeID);
                        if (lstPresMaster.Count == 0)
                        {
                            throw new Exception("没有找到要结算的处方,请确认是否已被人收费");
                        }
                        foreach (MZ_PresMaster mz_presmaster in lstPresMaster)
                        {
                            if (mz_presmaster.Charge_Flag == 0)
                            {
                                mz_presmaster.Charge_Flag = 1;
                                mz_presmaster.TicketCode  = perfCode;
                                mz_presmaster.TicketNum   = chargeBill.TicketNum;
                                mz_presmaster.ChargeCode  = OperatorId.ToString( );
                                //BindEntity<MZ_PresMaster>.CreateInstanceDAL( oleDb ).Update( mz_presmaster );
                                MSAccessDb.UpdateRecord(mz_presmaster);
                            }
                            else
                            {
                                throw new Exception("该处方已被其他收费员收费!");
                            }
                        }
                    }
                    else
                    {
                        throw new Exception("没有找到结算号的记录!");
                    }
                }
                MSAccessDb.CommitTrans( );
            }
            catch (Exception err)
            {
                MSAccessDb.RollbackTrans( );
                throw new Exception("正式结算发生错误!");
            }
            //发票对象
            try
            {
                ChargeInvoicies = new Invoice[BudgetaryChargeInfos.Length];
                for (int i = 0; i < BudgetaryChargeInfos.Length; i++)
                {
                    ChargeInvoicies[i] = new Invoice(BudgetaryChargeInfos[i].PerfChar, BudgetaryChargeInfos[i].InvoiceNO, OPDBillKind.门诊收费发票);
                }
            }
            catch (Exception err)
            {
                throw new Exception("收费成功,但生成发票对象失败!");
            }
            return(true);
        }
Exemplo n.º 26
0
        public void Add(WWCPCPOAdapter CPOAdapter)
        {
            _CPOAdapters.Add(CPOAdapter);

            #region OnGetServiceAuthorisationRequest/-Response

            CPOAdapter.CPOClient.OnGetServiceAuthorisationRequest += async(LogTimestamp,
                                                                           RequestTimestamp,
                                                                           Sender,
                                                                           SenderId,
                                                                           EventTrackingId,
                                                                           PartnerId,
                                                                           OperatorId,
                                                                           EVSEId,
                                                                           UserId,
                                                                           ServiceId,
                                                                           TransactionId,
                                                                           PartnerServiceSessionId,
                                                                           RequestTimeout) => await DebugLog.SubmitEvent("GetServiceAuthorisationRequest",
                                                                                                                         JSONObject.Create(
                                                                                                                             new JProperty("timestamp", RequestTimestamp.ToIso8601()),
                                                                                                                             new JProperty("eventTrackingId", EventTrackingId.ToString()),
                                                                                                                             //new JProperty("roamingNetworkId",               RoamingNetworkId.    ToString()),
                                                                                                                             //EMPRoamingProviderId.HasValue
                                                                                                                             //    ? new JProperty("EMPRoamingProviderId",  EMPRoamingProviderId.ToString())
                                                                                                                             //    : null,
                                                                                                                             //CSORoamingProviderId.HasValue
                                                                                                                             //    ? new JProperty("CSORoamingProviderId",  CSORoamingProviderId.ToString())
                                                                                                                             //    : null,
                                                                                                                             new JProperty("partnerId", PartnerId.ToString()),
                                                                                                                             new JProperty("operatorId", OperatorId.ToString()),
                                                                                                                             new JProperty("EVSEId", EVSEId.ToString()),
                                                                                                                             new JProperty("userId", UserId.ToString()),
                                                                                                                             new JProperty("serviceId", ServiceId.ToString()),
                                                                                                                             TransactionId.HasValue
                                                                                                                                   ? new JProperty("transactionId", TransactionId.ToString())
                                                                                                                                   : null,
                                                                                                                             PartnerServiceSessionId.HasValue
                                                                                                                                   ? new JProperty("partnerServiceSessionId", PartnerServiceSessionId.ToString())
                                                                                                                                   : null,
                                                                                                                             new JProperty("requestTimeout", Math.Round(RequestTimeout.TotalSeconds, 0))
                                                                                                                             ));

            CPOAdapter.CPOClient.OnGetServiceAuthorisationResponse += async(LogTimestamp,
                                                                            RequestTimestamp,
                                                                            Sender,
                                                                            SenderId,
                                                                            EventTrackingId,
                                                                            PartnerId,
                                                                            OperatorId,
                                                                            EVSEId,
                                                                            UserId,
                                                                            ServiceId,
                                                                            TransactionId,
                                                                            PartnerServiceSessionId,
                                                                            RequestTimeout,
                                                                            Result,
                                                                            Runtime) => await DebugLog.SubmitEvent("GetServiceAuthorisationResponse",
                                                                                                                   JSONObject.Create(
                                                                                                                       new JProperty("timestamp", RequestTimestamp.ToIso8601()),
                                                                                                                       new JProperty("eventTrackingId", EventTrackingId.ToString()),
                                                                                                                       //new JProperty("roamingNetworkId",            RoamingNetwork.Id.   ToString()),
                                                                                                                       //EMPRoamingProviderId.HasValue
                                                                                                                       //    ? new JProperty("EMPRoamingProviderId",  EMPRoamingProviderId.ToString())
                                                                                                                       //    : null,
                                                                                                                       //CSORoamingProviderId.HasValue
                                                                                                                       //    ? new JProperty("CSORoamingProviderId",  CSORoamingProviderId.ToString())
                                                                                                                       //    : null,
                                                                                                                       new JProperty("partnerId", PartnerId.ToString()),
                                                                                                                       new JProperty("operatorId", OperatorId.ToString()),
                                                                                                                       new JProperty("EVSEId", EVSEId.ToString()),
                                                                                                                       new JProperty("userId", UserId.ToString()),
                                                                                                                       new JProperty("serviceId", ServiceId.ToString()),
                                                                                                                       TransactionId.HasValue
                                                                                                                            ? new JProperty("transactionId", TransactionId.ToString())
                                                                                                                            : null,
                                                                                                                       PartnerServiceSessionId.HasValue
                                                                                                                            ? new JProperty("partnerServiceSessionId", PartnerServiceSessionId.ToString())
                                                                                                                            : null,
                                                                                                                       new JProperty("requestTimeout", Math.Round(RequestTimeout.TotalSeconds, 0)),
                                                                                                                       new JProperty("result", Result.ToJSON()),
                                                                                                                       new JProperty("runtime", Math.Round(Runtime.TotalMilliseconds, 0))

                                                                                                                       ));

            #endregion
        }
Exemplo n.º 27
0
        private ChargeInfo[] _budget(Prescription[] prescriptions)
        {
            int temp_costmasterid = MSAccessDb.GetMaxID("MZ_COSTMASTER", Tables.mz_costmaster.COSTMASTERID);
            int temp_costorderid  = MSAccessDb.GetMaxID("MZ_COSTORDER", Tables.mz_costorder.COSTORDERID);

            ChargeInfo[] chargeInfos = new ChargeInfo[prescriptions.Length];
            try
            {
                for (int prescCount = 0; prescCount < prescriptions.Length; prescCount++)
                {
                    List <Item> lstStatItems = MergePrescriptionByStatItemCode(ref prescriptions[prescCount]);

                    Prescription prescription = prescriptions[prescCount];
                    chargeInfos[prescCount] = new ChargeInfo( );
                    //保存结算头
                    HIS.Model.MZ_CostMaster chargeBill = new HIS.Model.MZ_CostMaster( );
                    #region ....
                    chargeBill.PatID        = Patient.PatID;
                    chargeBill.PatListID    = Patient.PatListID;
                    chargeBill.PresMasterID = prescription.PrescriptionID;
                    chargeBill.TicketNum    = "";
                    chargeBill.TicketCode   = "";
                    chargeBill.ChargeCode   = OperatorId.ToString( );
                    chargeBill.ChargeName   = DataReader.GetEmployeeNameById(OperatorId); //BindEntity<HIS.Model.BASE_EMPLOYEE_PROPERTY>.CreateInstanceDAL(oleDb).GetModel(OperatorId).NAME ;
                    chargeBill.Total_Fee    = prescription.Total_Fee;
                    chargeBill.Self_Fee     = 0;
                    chargeBill.Village_Fee  = 0;
                    chargeBill.Favor_Fee    = 0;
                    chargeBill.Pos_Fee      = 0;
                    chargeBill.Money_Fee    = 0;
                    chargeBill.Ticket_Flag  = 0;
                    //chargeBill.CostDate;//预结算不写结算时间
                    chargeBill.Record_Flag  = 9;//预结算记录状态置为9
                    chargeBill.OldID        = 0;
                    chargeBill.AccountID    = 0;
                    chargeBill.Hang_Flag    = (int)OPDOperationType.门诊收费;
                    chargeBill.Hurried_Flag = Patient.IsEmergency ? 1 : 0;
                    #endregion
                    //int ret1 = BindEntity<HIS.Model.MZ_CostMaster>.CreateInstanceDAL( oleDb ).Add( chargeBill );
                    chargeBill.CostMasterID = temp_costmasterid;
                    int ret1 = MSAccessDb.InsertRecord(chargeBill, Tables.mz_costmaster.COSTMASTERID);
                    temp_costmasterid++;

                    chargeBill.CostMasterID            = temp_costmasterid;
                    prescriptions[prescCount].ChargeID = temp_costmasterid;
                    //累加每张处方结算信息
                    chargeInfos[prescCount].ChargeID       = chargeBill.CostMasterID;
                    chargeInfos[prescCount].PrescriptionID = chargeBill.PresMasterID;
                    chargeInfos[prescCount].TotalFee       = chargeBill.Total_Fee;
                    chargeInfos[prescCount].SelfFee        = chargeBill.Self_Fee;
                    chargeInfos[prescCount].VillageFee     = chargeBill.Village_Fee;
                    chargeInfos[prescCount].FavorFee       = chargeBill.Favor_Fee;
                    if (ret1 > 0)
                    {
                        List <InvoiceItem> chargeItems = new List <InvoiceItem>( );
                        #region  大项目保存结算明细
                        foreach (object obj in lstStatItems)
                        {
                            Item item = (Item)obj;
                            HIS.Model.MZ_CostOrder chargeDetail = new HIS.Model.MZ_CostOrder( );
                            chargeDetail.CostID      = chargeBill.CostMasterID;
                            chargeDetail.ItemType    = item.Text;
                            chargeDetail.Total_Fee   = Convert.ToDecimal(item.Value);
                            chargeDetail.CostOrderID = temp_costorderid;
                            int ret2 = MSAccessDb.InsertRecord(chargeDetail, Tables.mz_costorder.COSTORDERID);
                            temp_costorderid++;
                            if (ret2 > 0)
                            {
                                InvoiceItem invoice = GetInvoiceByStatCode(chargeDetail.ItemType);
                                invoice.Cost = chargeDetail.Total_Fee;
                                chargeItems.Add(invoice);
                            }
                        }
                        #endregion
                        chargeInfos[prescCount].Items = chargeItems.ToArray( );
                    }
                }
            }
            catch (Exception err)
            {
                throw err;
            }
            //计算每张处方的打折金额
            for (int i = 0; i < chargeInfos.Length; i++)
            {
                chargeInfos[i].FavorFee = GetFavorCost(Patient.MediType, chargeInfos[i], prescriptions[i]);
            }
            return(chargeInfos);
        }
Exemplo n.º 28
0
        private bool _charge(ChargeInfo[] BudgetaryChargeInfos, Prescription[] prescriptions, out BaseInvoice[] ChargeInvoicies)
        {
            try
            {
                for (int chargeCount = 0; chargeCount < BudgetaryChargeInfos.Length; chargeCount++)
                {
                    if (MSAccessDb.Exists("MZ_COSTMASTER", Tables.mz_costmaster.COSTMASTERID + "=" + BudgetaryChargeInfos[chargeCount].ChargeID))
                    {
                        HIS.Model.MZ_CostMaster chargeBill = new HIS.Model.MZ_CostMaster( );
                        chargeBill             = (MZ_CostMaster)MSAccessDb.GetModel("MZ_COSTMASTER", Tables.mz_costmaster.COSTMASTERID + "=" + BudgetaryChargeInfos[chargeCount].ChargeID, typeof(MZ_CostMaster));
                        chargeBill.Self_Fee    = BudgetaryChargeInfos[chargeCount].SelfFee;
                        chargeBill.Village_Fee = BudgetaryChargeInfos[chargeCount].VillageFee;
                        chargeBill.Favor_Fee   = BudgetaryChargeInfos[chargeCount].FavorFee;
                        chargeBill.Pos_Fee     = BudgetaryChargeInfos[chargeCount].PosFee;
                        chargeBill.Money_Fee   = BudgetaryChargeInfos[chargeCount].CashFee;
                        chargeBill.Ticket_Flag = 0;
                        chargeBill.CostDate    = DateTime.Now;
                        chargeBill.Record_Flag = 0;
                        string perfCode = "";
                        chargeBill.TicketNum  = InvoiceManager.GetBillNumber(OPDBillKind.门诊收费发票, OperatorId, false, out perfCode);
                        chargeBill.TicketCode = perfCode;

                        BudgetaryChargeInfos[chargeCount].InvoiceSerialNO = Convert.ToInt32(chargeBill.TicketNum);
                        BudgetaryChargeInfos[chargeCount].ChargeDate      = chargeBill.CostDate;
                        MSAccessDb.UpdateRecord(chargeBill);  //更新结算表
                        //更新处方表收费标识
                        HIS.Model.MZ_PresMaster presMaster = new HIS.Model.MZ_PresMaster( );

                        //presMaster = BindEntity<HIS.Model.MZ_PresMaster>.CreateInstanceDAL( oleDb ).GetModel( BudgetaryChargeInfos[chargeCount].PrescriptionID );
                        presMaster = (MZ_PresMaster)MSAccessDb.GetModel("MZ_PRESMASTER",
                                                                        Tables.mz_presmaster.PRESMASTERID + "=" + BudgetaryChargeInfos[chargeCount].PrescriptionID,
                                                                        typeof(MZ_PresMaster));
                        if (presMaster.Charge_Flag == 0)
                        {
                            presMaster.Charge_Flag   = 1;
                            presMaster.RoungingMoney = presMaster.Total_Fee - BudgetaryChargeInfos[chargeCount].TotalFee;
                            presMaster.Total_Fee     = BudgetaryChargeInfos[chargeCount].TotalFee;
                            presMaster.TicketCode    = BudgetaryChargeInfos[chargeCount].InvoiceNO;
                            presMaster.TicketNum     = chargeBill.TicketNum;
                            presMaster.CostMasterID  = BudgetaryChargeInfos[chargeCount].ChargeID;
                            presMaster.ChargeCode    = OperatorId.ToString( );
                            //BindEntity<HIS.Model.MZ_PresMaster>.CreateInstanceDAL( oleDb ).Update( presMaster );
                            MSAccessDb.UpdateRecord(presMaster);
                        }
                        else
                        {
                            throw new Exception("该处方已被其他收费员收费!");
                        }
                    }
                    else
                    {
                        throw new Exception("没有找到结算号的记录!");
                    }
                }

                //生成发票
                ChargeInvoicies = new BaseInvoice[BudgetaryChargeInfos.Length];
                for (int i = 0; i < BudgetaryChargeInfos.Length; i++)
                {
                    ChargeInvoicies[i] = new Invoice(BudgetaryChargeInfos[i].PerfChar, BudgetaryChargeInfos[i].InvoiceNO, OPDBillKind.门诊收费发票);
                }
                return(true);
            }

            catch (Exception err)
            {
                throw err;
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// 预算
        /// </summary>
        /// <param name="prescriptions">要预算的处方</param>
        /// <returns>预算信息,供正式结算用</returns>
        public override ChargeInfo[] Budget(Prescription[] prescriptions)
        {
            //单张处方明细转化为大项目明细合并后累加在取舍。
            //保存每张处方的大项目明细
            List <List <Item> > lstStatItems = new List <List <Item> >( );
            //本次结算总金额(等于每张处方舍入后的金额的合计)
            decimal chargeTotalCost = 0;

            #region 合并大类并计算舍入金额
            try
            {
                for (int i = 0; i < prescriptions.Length; i++)
                {
                    List <Item> lstTemp = new List <Item>( );
                    lstTemp         = MergePrescriptionByStatItemCode(ref prescriptions[i]);
                    chargeTotalCost = chargeTotalCost + prescriptions[i].Total_Fee;
                    lstStatItems.Add(lstTemp);
                }
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message + "\r\n" + err.StackTrace);
                throw new OperatorException("合并项目发生错误!");
            }
            #endregion
            //保存合并后的所有大项目明细,类型MZ_CostOrder
            Hashtable htCostOrder = new Hashtable();
            #region 合并所有结算明细(不需要再舍入)
            try
            {
                foreach (List <Item> lstTemp in lstStatItems)
                {
                    foreach (object obj in lstTemp)
                    {
                        if (htCostOrder.ContainsKey(((Item)obj).Text.Trim( )))
                        {
                            Item item = (Item)obj;
                            Model.MZ_CostOrder mz_costorder = (Model.MZ_CostOrder)htCostOrder[item.Text.Trim( )];
                            mz_costorder.Total_Fee = mz_costorder.Total_Fee + Convert.ToDecimal(item.Value);
                        }
                        else
                        {
                            Model.MZ_CostOrder mz_costorder = new HIS.Model.MZ_CostOrder( );
                            mz_costorder.ItemType  = ((Item)obj).Text.Trim( );
                            mz_costorder.Total_Fee = Convert.ToDecimal(((Item)obj).Value);
                            htCostOrder.Add(mz_costorder.ItemType, mz_costorder);
                        }
                    }
                }
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                throw new OperatorException("合并明细大类发生错误!");
            }
            #endregion
            int costmasterid = 0; //本次结算ID
            #region 数据库操作,得到结算号
            try
            {
                oleDb.BeginTransaction( );

                #region 赋值结算头表并保存
                HIS.Model.MZ_CostMaster mz_costmaster = new HIS.Model.MZ_CostMaster( );
                mz_costmaster.PatID        = Patient.PatID;
                mz_costmaster.PatListID    = Patient.PatListID;
                mz_costmaster.PresMasterID = 0;
                mz_costmaster.TicketNum    = "";
                mz_costmaster.TicketCode   = "";
                mz_costmaster.ChargeCode   = OperatorId.ToString( );
                //mz_costmaster.ChargeName = PublicDataReader.GetEmployeeNameById( OperatorId );
                mz_costmaster.ChargeName   = BaseDataController.GetName(BaseDataCatalog.人员列表, OperatorId);
                mz_costmaster.Total_Fee    = chargeTotalCost;//结算表的总金额
                mz_costmaster.Self_Fee     = 0;
                mz_costmaster.Village_Fee  = 0;
                mz_costmaster.Favor_Fee    = 0;
                mz_costmaster.Pos_Fee      = 0;
                mz_costmaster.Money_Fee    = 0;
                mz_costmaster.Ticket_Flag  = 0;
                mz_costmaster.Record_Flag  = 9;//预结算记录状态置为9
                mz_costmaster.OldID        = 0;
                mz_costmaster.AccountID    = 0;
                mz_costmaster.Hang_Flag    = (int)OPDOperationType.门诊收费;
                mz_costmaster.Hurried_Flag = Patient.IsEmergency ? 1 : 0;
                mz_costmaster.CostMasterID = BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Add(mz_costmaster);

                #endregion
                costmasterid = mz_costmaster.CostMasterID;
                #region 更新处方表的结算号和总金额,舍入金额
                for (int prescCount = 0; prescCount < prescriptions.Length; prescCount++)
                {
                    string strWhere = Tables.mz_presmaster.PRESMASTERID + oleDb.EuqalTo( ) + prescriptions[prescCount].PrescriptionID;
                    Model.MZ_PresMaster mz_presmaster = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetModel(strWhere);

                    if (mz_presmaster.Charge_Flag == 1)
                    {
                        throw new OperatorException("处方已被别的收费员收费,请确认!");
                    }
                    if (prescriptions[prescCount].DocPresId != 0)
                    {
                        if (HIS.Interface.InstanceFactory.CreatMZ_ClinicDataInstance().CheckPresStatus(prescriptions[prescCount].DocPresId) == false)
                        {
                            throw new OperatorException("处方已经收费,请重新刷新病人信息以获取最新未收费处方!\r\n(建议不要同时打开多个收费界面)");
                        }
                    }
                    //更新处方表的结算号和总金额,舍入金额
                    BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Update(strWhere,
                                                                                      Tables.mz_presmaster.COSTMASTERID + oleDb.EuqalTo( ) + mz_costmaster.CostMasterID,
                                                                                      Tables.mz_presmaster.TOTAL_FEE + oleDb.EuqalTo( ) + prescriptions[prescCount].Total_Fee,
                                                                                      Tables.mz_presmaster.ROUNGINGMONEY + oleDb.EuqalTo( ) + prescriptions[prescCount].RoundingMoney);
                }
                #endregion

                #region 保存结算明细到数据库(按大项目保存)
                foreach (object obj in htCostOrder)
                {
                    HIS.Model.MZ_CostOrder mz_costorder = (HIS.Model.MZ_CostOrder)((System.Collections.DictionaryEntry)obj).Value;
                    mz_costorder.CostID = mz_costmaster.CostMasterID;
                    //保存到数据库
                    mz_costorder.CostOrderID = BindEntity <Model.MZ_CostOrder> .CreateInstanceDAL(oleDb).Add(mz_costorder);
                }
                #endregion

                oleDb.CommitTransaction( );
            }
            catch (OperatorException oe)
            {
                oleDb.RollbackTransaction( );
                throw oe;
            }
            catch (Exception err)
            {
                oleDb.RollbackTransaction( );
                ErrorWriter.WriteLog(err.Message + "\r\n" + err.StackTrace);
                throw new OperatorException("保存预算结果到数据库发生错误!");
            }
            #endregion
            //回填处方的结算号
            for (int prescCount = 0; prescCount < prescriptions.Length; prescCount++)
            {
                prescriptions[prescCount].ChargeID = costmasterid;
            }

            #region 返回预算结果
            try
            {
                Hashtable htInvoiceItem = new Hashtable( );
                foreach (object obj in htCostOrder)
                {
                    HIS.Model.MZ_CostOrder mz_costorder = (HIS.Model.MZ_CostOrder)((System.Collections.DictionaryEntry)obj).Value;
                    InvoiceItem            invoice      = GetInvoiceByStatCode(mz_costorder.ItemType.Trim( ));
                    invoice.Cost = mz_costorder.Total_Fee;
                    if (htInvoiceItem.ContainsKey(invoice.ItemCode.Trim( )))
                    {
                        InvoiceItem _invoice = (InvoiceItem)htInvoiceItem[invoice.ItemCode];
                        _invoice.Cost = _invoice.Cost + invoice.Cost;
                        htInvoiceItem.Remove(invoice.ItemCode);
                        htInvoiceItem.Add(_invoice.ItemCode, _invoice);
                    }
                    else
                    {
                        htInvoiceItem.Add(invoice.ItemCode, invoice);
                    }
                }
                List <InvoiceItem> chargeItems = new List <InvoiceItem>( );
                foreach (object item in htInvoiceItem)
                {
                    chargeItems.Add((InvoiceItem)((DictionaryEntry)item).Value);
                }

                ChargeInfo chargeInfos = new ChargeInfo( );
                chargeInfos.Items    = chargeItems.ToArray( );
                chargeInfos.ChargeID = costmasterid;
                chargeInfos.TotalFee = chargeTotalCost;

                ChargeInfo[] chargeInfo = new ChargeInfo[1];
                chargeInfo[0].TotalFee = chargeTotalCost;
                chargeInfo[0]          = chargeInfos;
                //计算本次的优惠金额
                chargeInfo[0].FavorFee = GetFavorCost(Patient.MediType, chargeInfo[0], prescriptions);
                return(chargeInfo);
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err);
                throw new OperatorException("返回预算结果发生错误!");
            }
            #endregion
        }
Exemplo n.º 30
0
        /// <summary>
        /// 结算
        /// </summary>
        /// <param name="BudgetaryChargeInfos">预算后产生的计算信息</param>
        /// <param name="prescriptions">要收费的处方</param>
        /// <param name="ChargeInvoicies">结算成功后返回的发票结果,数组对象</param>
        /// <returns></returns>
        private bool _charge(ChargeInfo[] BudgetaryChargeInfos, Prescription[] prescriptions, out BaseInvoice[] ChargeInvoicies)
        {
            try
            {
                MZClinicInterface clinicInterface = new MZClinicInterface();
                for (int presindex = 0; presindex < prescriptions.Length; presindex++)
                {
                    if (prescriptions[presindex].DocPresId > 0)
                    {
                        decimal mzdocfee = clinicInterface.GetDocPresMoney(prescriptions[presindex].DocPresId);
                        if (mzdocfee != prescriptions[presindex].Total_Fee)
                        {
                            throw new Exception("门诊医生站已对该收费处方进行修改,请重新刷新处方再点收银!");
                        }
                    }
                }
                for (int chargeCount = 0; chargeCount < BudgetaryChargeInfos.Length; chargeCount++)
                {
                    if (BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Exists(BudgetaryChargeInfos[chargeCount].ChargeID))
                    {
                        HIS.Model.MZ_CostMaster chargeBill = new HIS.Model.MZ_CostMaster( );
                        chargeBill = BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).GetModel(BudgetaryChargeInfos[chargeCount].ChargeID);

                        chargeBill.Self_Fee    = BudgetaryChargeInfos[chargeCount].SelfFee;
                        chargeBill.Village_Fee = BudgetaryChargeInfos[chargeCount].VillageFee;
                        chargeBill.Favor_Fee   = BudgetaryChargeInfos[chargeCount].FavorFee;
                        chargeBill.Pos_Fee     = BudgetaryChargeInfos[chargeCount].PosFee;
                        chargeBill.Money_Fee   = BudgetaryChargeInfos[chargeCount].CashFee;
                        chargeBill.Self_Tally  = BudgetaryChargeInfos[chargeCount].SelfTally;
                        chargeBill.Ticket_Flag = 0;
                        chargeBill.CostDate    = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
                        chargeBill.Record_Flag = 0;
                        string perfCode = "";
                        chargeBill.TicketNum  = InvoiceManager.GetBillNumber(OPDBillKind.门诊收费发票, OperatorId, false, out perfCode);
                        chargeBill.TicketCode = perfCode; //前缀

                        //BudgetaryChargeInfos[chargeCount].InvoiceSerialNO = Convert.ToInt32( chargeBill.TicketNum );
                        //BudgetaryChargeInfos[chargeCount].PerfChar = perfCode;
                        //BudgetaryChargeInfos[chargeCount].ChargeDate = chargeBill.CostDate;

                        BudgetaryChargeInfos[chargeCount].InvoiceSerialNO = Convert.ToInt32(chargeBill.TicketNum);
                        BudgetaryChargeInfos[chargeCount].InvoiceNO       = chargeBill.TicketNum;
                        BudgetaryChargeInfos[chargeCount].PerfChar        = perfCode;
                        BudgetaryChargeInfos[chargeCount].ChargeDate      = chargeBill.CostDate;

                        BindEntity <Model.MZ_CostMaster> .CreateInstanceDAL(oleDb).Update(chargeBill);  //更新结算表

                        //更新处方表收费标识
                        HIS.Model.MZ_PresMaster presMaster = new HIS.Model.MZ_PresMaster( );

                        presMaster = BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).GetModel(BudgetaryChargeInfos[chargeCount].PrescriptionID);

                        if (presMaster.Charge_Flag == 0)
                        {
                            presMaster.Charge_Flag   = 1;
                            presMaster.RoungingMoney = presMaster.Total_Fee - BudgetaryChargeInfos[chargeCount].TotalFee;
                            presMaster.Total_Fee     = BudgetaryChargeInfos[chargeCount].TotalFee;
                            presMaster.TicketCode    = perfCode;//前缀//BudgetaryChargeInfos[chargeCount].InvoiceNO;
                            presMaster.TicketNum     = chargeBill.TicketNum;
                            presMaster.CostMasterID  = BudgetaryChargeInfos[chargeCount].ChargeID;
                            presMaster.ChargeCode    = OperatorId.ToString( );
                            BindEntity <Model.MZ_PresMaster> .CreateInstanceDAL(oleDb).Update(presMaster);
                        }
                        else
                        {
                            throw new OperatorException("该处方已被其他收费员收费!");
                        }
                    }
                    else
                    {
                        throw new OperatorException("没有找到结算号的记录!");
                    }
                }
                for (int i = 0; i < prescriptions.Length; i++)
                {
                    clinicInterface.ChangePresStatus(prescriptions[i].DocPresId, 1);
                }
                //生成发票
                ChargeInvoicies = new BaseInvoice[BudgetaryChargeInfos.Length];
                for (int i = 0; i < BudgetaryChargeInfos.Length; i++)
                {
                    ChargeInvoicies[i] = new Invoice(BudgetaryChargeInfos[i].PerfChar, BudgetaryChargeInfos[i].InvoiceNO, OPDBillKind.门诊收费发票);
                }
                return(true);
            }
            catch (OperatorException operr)
            {
                throw operr;
            }
            catch (Exception err)
            {
                throw err;
            }
        }