protected void btnSAVE_Click(object sender, EventArgs e)
    {
        AdmissionTypeData data = new AdmissionTypeData();

        data.AdmissionType_Code = txtADMISSIONTYPE_CODE.Text;
        data.AdmissionType_Thai = txtADMISSIONTYPE_THAI.Text;
        data.AdmissionType_Eng  = txtADMISSIONTYPE_ENG.Text;

        string result = "";

        try
        {
            result = new AdmissionType().updateAdmissionType(data);

            if (result == "OK")
            {
                Response.Redirect("list_Admission_Type.aspx");
            }
            else
            {
                Response.Redirect("list_Admission_Type.aspx");
            }
        }
        catch (Exception E)
        {
            //string response = E.Message.ToString();
            //HttpContext.Current.Session["response"] = "Unit Test: " + response;
            //HttpContext.Current.Response.Redirect("err_response.aspx");
        }
    }
        public void Initialize(Patient_cu patient, AdmissionType admissionType)
        {
            ActivePatient     = patient;
            readyInvoicesList = MerkDBBusinessLogicEngine.ReadyInvoicesForAction(admissionType, null, null, true, true, false, null,
                                                                                 null, ActivePatient);

            gridControl1.DataSource = readyInvoicesList.Count > 0 ? readyInvoicesList : null;
        }
 private long AddAdmissionType(DTO.LABURNUM.COM.AdmissionTypeModel model)
 {
     API.LABURNUM.COM.AdmissionType admissionType = new AdmissionType()
     {
         Name      = model.Name,
         CreatedOn = System.DateTime.Now,
         IsActive  = true
     };
     this._laburnum.AdmissionTypes.Add(admissionType);
     this._laburnum.SaveChanges();
     return(admissionType.AdmissionTypeId);
 }
Exemple #4
0
 private long AddAdmissionType(DTO.LABURNUM.COM.AdmissionTypeModel model)
 {
     API.LABURNUM.COM.AdmissionType admissionType = new AdmissionType()
     {
         Name      = model.Name,
         CreatedOn = new Component.Utility().GetISTDateTime(),
         IsActive  = true
     };
     this._laburnum.AdmissionTypes.Add(admissionType);
     this._laburnum.SaveChanges();
     return(admissionType.AdmissionTypeId);
 }
Exemple #5
0
    protected void btnSAVE_Click(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.admin_university) || autro_obj.CheckGroupUser(login_data, group_var.admin_faculty))
            {
                /*=============================*/
                string sql = "Select * From ADMISSION_TYPE Where ADMISSIONTYPE_CODE='" + txtADMISSIONTYPE_CODE.Text + "'";
                List <AdmissionTypeData> chkDup = new AdmissionType().getAdmissionTypeManual(sql);

                if (chkDup.Count > 0)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowBox", "alert('รหัสวิธีการรับเข้าซ้ำ!');", true);
                }
                else
                {
                    AdmissionTypeData data = new AdmissionTypeData();

                    data.AdmissionType_Code = txtADMISSIONTYPE_CODE.Text;
                    data.AdmissionType_Thai = txtADMISSIONTYPE_THAI.Text;
                    data.AdmissionType_Eng  = txtADMISSIONTYPE_ENG.Text;

                    string result = "";

                    result = new AdmissionType().insertAdmissionType(data);

                    if (result == "OK")
                    {
                        Response.Redirect("list_Admission_Type.aspx");
                    }
                }
                /*=============================*/
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        try
        {
            string result = new AdmissionType().deleteAdmissionType(code);

            if (result == "OK")
            {
                Response.Redirect("list_Admission_Type.aspx");
            }
            else
            {
                Response.Redirect("list_Admission_Type.aspx");
            }
        }
        catch
        {
            Response.Redirect("list_Admission_Type.aspx");
        }
    }
        public static List <ReadyInvoicesForAction> ReadyInvoicesForAction(AdmissionType admissionType,
                                                                           DateTime?InvoiceCreationDateStart,
                                                                           DateTime?InvoiceCreationDateEnd, bool?InvoiceIsOnDuty, bool?InvoiceIsFinanciallyReviewed,
                                                                           bool?InvoiceIsPrinted, bool?InvoiceIsPaymentEnough, int?DoctorID, Patient_cu Patient)
        {
            List <ReadyInvoicesForAction>         readyInvoiceFormPaymentsList = new List <ReadyInvoicesForAction>();
            List <GetInvoiceForAddmission_Result> result = new List <GetInvoiceForAddmission_Result>();

            using (DBCommon.DBContext_External)
            {
                switch (admissionType)
                {
                case AdmissionType.ClinicAdmission:
                    result =
                        DBCommon.DBContext_External.GetInvoiceForAddmission(InvoiceCreationDateStart, InvoiceCreationDateEnd,
                                                                            (int)DB_InvoiceType.OutPatientPrivate, InvoiceIsOnDuty, InvoiceIsFinanciallyReviewed, InvoiceIsPrinted,
                                                                            InvoiceIsPaymentEnough, DoctorID, Patient != null ? Patient.Person_CU_ID : (int?)null)
                        .OrderByDescending(item => item.InvoiceCreationDate)
                        .ToList();
                    result.AddRange(
                        DBCommon.DBContext_External.GetInvoiceForAddmission(InvoiceCreationDateStart, InvoiceCreationDateEnd,
                                                                            (int)DB_InvoiceType.OutPatientNotPrivate, InvoiceIsOnDuty, InvoiceIsFinanciallyReviewed, InvoiceIsPrinted,
                                                                            InvoiceIsPaymentEnough, DoctorID, Patient != null ? Patient.Person_CU_ID : (int?)null)
                        .OrderByDescending(item => item.InvoiceCreationDate)
                        .ToList());
                    break;

                case AdmissionType.InPatientAdmission:
                    result =
                        DBCommon.DBContext_External.GetInvoiceForAddmission(InvoiceCreationDateStart, InvoiceCreationDateEnd,
                                                                            (int)DB_InvoiceType.InPatientPrivate, InvoiceIsOnDuty, InvoiceIsFinanciallyReviewed, InvoiceIsPrinted,
                                                                            InvoiceIsPaymentEnough, DoctorID, Patient != null ? Patient.Person_CU_ID : (int?)null)
                        .OrderByDescending(item => item.InvoiceCreationDate)
                        .ToList();
                    result.AddRange(
                        DBCommon.DBContext_External.GetInvoiceForAddmission(InvoiceCreationDateStart, InvoiceCreationDateEnd,
                                                                            (int)DB_InvoiceType.InPatientNotPrivate, InvoiceIsOnDuty, InvoiceIsFinanciallyReviewed, InvoiceIsPrinted,
                                                                            InvoiceIsPaymentEnough, DoctorID, Patient != null ? Patient.Person_CU_ID : (int?)null)
                        .OrderByDescending(item => item.InvoiceCreationDate)
                        .ToList());
                    break;
                }

                List <Invoice> invoicesList = new List <Invoice>();
                foreach (GetInvoiceForAddmission_Result getInvoiceForAddmissionResult in result)
                {
                    Invoice invoice = DBCommon.GetEntity <Invoice>(getInvoiceForAddmissionResult.InvoiceID);
                    if (invoice == null)
                    {
                        continue;
                    }
                    invoicesList.Add(invoice);
                    ReadyInvoicesForAction readyInvoicesForPayments = new ReadyInvoicesForAction()
                    {
                        PatientID           = getInvoiceForAddmissionResult.PatientID,
                        PatientFullName     = getInvoiceForAddmissionResult.PatientFullName,
                        InvoiceID           = getInvoiceForAddmissionResult.InvoiceID,
                        InvoiceType         = (DB_InvoiceType)invoice.InvoiceType_P_ID,
                        InvoiceCreationDate = getInvoiceForAddmissionResult.InvoiceCreationDate,
                        InvoiceSerial       = getInvoiceForAddmissionResult.InvoiceSerial,
                        DoctorID            = getInvoiceForAddmissionResult.DoctorID,
                        DoctorName          = getInvoiceForAddmissionResult.DoctorName,
                        IsPaymentEnough     = getInvoiceForAddmissionResult.IsPaymentEnough,
                        TotalRequired       = invoice.PatientShare_BeforeAddsOn_InvoiceItem,
                        TotalPayments       = invoice.CalculatedTotal_Payments,
                        ActiveInvoice       = invoice,
                        ActivePatient       = Patient
                    };

                    readyInvoiceFormPaymentsList.Add(readyInvoicesForPayments);
                }
            }

            return(readyInvoiceFormPaymentsList);
        }
Exemple #8
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 55, Configuration.FieldSeparator),
                       Id,
                       SetIdPv1.HasValue ? SetIdPv1.Value.ToString(culture) : null,
                       PatientClass?.ToDelimitedString(),
                       AssignedPatientLocation?.ToDelimitedString(),
                       AdmissionType?.ToDelimitedString(),
                       PreadmitNumber?.ToDelimitedString(),
                       PriorPatientLocation?.ToDelimitedString(),
                       AttendingDoctor != null ? string.Join(Configuration.FieldRepeatSeparator, AttendingDoctor.Select(x => x.ToDelimitedString())) : null,
                       ReferringDoctor != null ? string.Join(Configuration.FieldRepeatSeparator, ReferringDoctor.Select(x => x.ToDelimitedString())) : null,
                       ConsultingDoctor != null ? string.Join(Configuration.FieldRepeatSeparator, ConsultingDoctor.Select(x => x.ToDelimitedString())) : null,
                       HospitalService?.ToDelimitedString(),
                       TemporaryLocation?.ToDelimitedString(),
                       PreadmitTestIndicator?.ToDelimitedString(),
                       ReadmissionIndicator?.ToDelimitedString(),
                       AdmitSource?.ToDelimitedString(),
                       AmbulatoryStatus != null ? string.Join(Configuration.FieldRepeatSeparator, AmbulatoryStatus.Select(x => x.ToDelimitedString())) : null,
                       VipIndicator?.ToDelimitedString(),
                       AdmittingDoctor != null ? string.Join(Configuration.FieldRepeatSeparator, AdmittingDoctor.Select(x => x.ToDelimitedString())) : null,
                       PatientType?.ToDelimitedString(),
                       VisitNumber?.ToDelimitedString(),
                       FinancialClass != null ? string.Join(Configuration.FieldRepeatSeparator, FinancialClass.Select(x => x.ToDelimitedString())) : null,
                       ChargePriceIndicator?.ToDelimitedString(),
                       CourtesyCode?.ToDelimitedString(),
                       CreditRating?.ToDelimitedString(),
                       ContractCode != null ? string.Join(Configuration.FieldRepeatSeparator, ContractCode.Select(x => x.ToDelimitedString())) : null,
                       ContractEffectiveDate != null ? string.Join(Configuration.FieldRepeatSeparator, ContractEffectiveDate.Select(x => x.ToString(Consts.DateFormatPrecisionDay, culture))) : null,
                       ContractAmount != null ? string.Join(Configuration.FieldRepeatSeparator, ContractAmount.Select(x => x.ToString(Consts.NumericFormat, culture))) : null,
                       ContractPeriod != null ? string.Join(Configuration.FieldRepeatSeparator, ContractPeriod.Select(x => x.ToString(Consts.NumericFormat, culture))) : null,
                       InterestCode?.ToDelimitedString(),
                       TransferToBadDebtCode?.ToDelimitedString(),
                       TransferToBadDebtDate.HasValue ? TransferToBadDebtDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       BadDebtAgencyCode?.ToDelimitedString(),
                       BadDebtTransferAmount.HasValue ? BadDebtTransferAmount.Value.ToString(Consts.NumericFormat, culture) : null,
                       BadDebtRecoveryAmount.HasValue ? BadDebtRecoveryAmount.Value.ToString(Consts.NumericFormat, culture) : null,
                       DeleteAccountIndicator?.ToDelimitedString(),
                       DeleteAccountDate.HasValue ? DeleteAccountDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       DischargeDisposition?.ToDelimitedString(),
                       DischargedToLocation?.ToDelimitedString(),
                       DietType?.ToDelimitedString(),
                       ServicingFacility?.ToDelimitedString(),
                       BedStatus?.ToDelimitedString(),
                       AccountStatus?.ToDelimitedString(),
                       PendingLocation?.ToDelimitedString(),
                       PriorTemporaryLocation?.ToDelimitedString(),
                       AdmitDateTime.HasValue ? AdmitDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       DischargeDateTime.HasValue ? DischargeDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       CurrentPatientBalance.HasValue ? CurrentPatientBalance.Value.ToString(Consts.NumericFormat, culture) : null,
                       TotalCharges.HasValue ? TotalCharges.Value.ToString(Consts.NumericFormat, culture) : null,
                       TotalAdjustments.HasValue ? TotalAdjustments.Value.ToString(Consts.NumericFormat, culture) : null,
                       TotalPayments.HasValue ? TotalPayments.Value.ToString(Consts.NumericFormat, culture) : null,
                       AlternateVisitId != null ? string.Join(Configuration.FieldRepeatSeparator, AlternateVisitId.Select(x => x.ToDelimitedString())) : null,
                       VisitIndicator?.ToDelimitedString(),
                       OtherHealthcareProvider?.ToDelimitedString(),
                       ServiceEpisodeDescription,
                       ServiceEpisodeIdentifier?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Exemple #9
0
        } // end of ParseEnumg

        #endregion

        #region GetCorePath

        /// <summary>
        /// Method to create the core of a patients path that does not differ over departments, Creates
        /// list of actions and inpatient or outpatient admissions
        /// </summary>
        /// <param name="patient">Patient the path is created for</param>
        /// <param name="admissionType">Admission type that might be the basis of path</param>
        /// <param name="actions">Out parameter for the list of actions of the final path</param>
        /// <param name="outpatientAdmission">Out parameter for the outpatient admission of the path</param>
        /// <param name="inpatientAdmission">Out parameter for the inpatient admission of the path</param>
        public void GetCorePath(EntityPatient patient,
                                AdmissionType admissionType,
                                out List <ActionTypeClass> actions,
                                out Admission outpatientAdmission,
                                out Admission inpatientAdmission)
        {
            XMLPatientClass selectedPatientClass = null;

            foreach (XMLPatientClass xmlPatientClass in PatientClassPerXmlPatientClass.Keys)
            {
                if ((admissionType == null ||
                     xmlPatientClass.AdmissionType == admissionType.Identifier ||
                     !ConsiderAdmissionForPath) &&
                    (patient.PatientClass.Equals(PatientClassPerXmlPatientClass[xmlPatientClass]) ||
                     !ConsiderPatietnClassForPath))
                {
                    selectedPatientClass = xmlPatientClass;
                    break;
                } // end if
            }     // end foreach

            if (selectedPatientClass == null)
            {
                throw new InvalidOperationException("Patient class and admission not found in XML-Patient Classes");
            }

            actions = new List <ActionTypeClass>();

            XMLPatientPath selectedPath = null;

            if (selectedPatientClass.SinglePath >= 0)
            {
                selectedPath = XMLPathsPerID[selectedPatientClass.SinglePath];
            }
            else
            {
                selectedPath = XMLPathsPerID[selectedPatientClass.PathDistribution.GetRandomValue()];
            } // end if

            foreach (XMLPatientPathStep pathStep in selectedPath.PathSteps)
            {
                if (pathStep.SingleAction != null)
                {
                    actions.Add(ActionTypes[pathStep.SingleAction]);
                }
                else
                {
                    bool   sampleFound;
                    string actionType = pathStep.StepDistribution.GetNullableRandomValue(out sampleFound);

                    if (!sampleFound)
                    {
                        continue;
                    }

                    actions.Add(ActionTypes[(string)actionType]);
                } // end if
            }     // end foreach

            outpatientAdmission = null;
            inpatientAdmission  = null;

            if (selectedPath.OutpatientAdmissions.Count > 0)
            {
                bool         sampleFound;
                XMLAdmission selectedAdmission = selectedPath.OutpatientAdmissionDistribution.GetNullableRandomValue(out sampleFound);

                if (sampleFound)
                {
                    outpatientAdmission = new Admission(patient,
                                                        new OutpatientAdmissionTypes(selectedAdmission.AdmissionType),
                                                        selectedAdmission.MinDays,
                                                        selectedAdmission.MaxDays,
                                                        false,
                                                        patient.CorrespondingDoctor);
                } // end if
            }     // end if

            if (selectedPath.InpatientAdmissions.Count > 0)
            {
                bool         sampledFound;
                XMLAdmission selectedAdmission = selectedPath.InpatientAdmissionDistribution.GetNullableRandomValue(out sampledFound);

                if (sampledFound)
                {
                    inpatientAdmission = new Admission(patient,
                                                       new InpatientAdmissionTypes(selectedAdmission.AdmissionType,
                                                                                   false),
                                                       selectedAdmission.MinDays,
                                                       selectedAdmission.MaxDays,
                                                       false,
                                                       patient.CorrespondingDoctor);
                } // end if
            }     // end if
        }         // end of GetCorePath