Example #1
0
        private void CreateMergeInfos(
            ObjectType objectType,
            string parameterName,
            string ownValue,
            string foreignValue,
            CPatient diffPatient,
            out CMergeInfo ownPatientMergeInfo,
            out CMergeInfo foreignPatientMergeInfo)
        {
            const string differenceStr = "Пациент: '{0}'. Нозология:'{1}'.\r\nНазвание параметра: '{2}'. Значение: '{3}'";

            ownPatientMergeInfo = new CMergeInfo
            {
                IdOwnPatient = Id,
                TypeOfObject = objectType,
                Value        = ownValue,
                Difference   = string.Format(differenceStr, GetFullName(), Nosology, parameterName, ownValue)
            };

            foreignPatientMergeInfo = new CMergeInfo
            {
                IdForeignPatient = diffPatient.Id,
                TypeOfObject     = objectType,
                Value            = foreignValue,
                Difference       = string.Format(differenceStr, diffPatient.GetFullName(), diffPatient.Nosology, parameterName, foreignValue)
            };
        }
Example #2
0
        public CPatient(CPatient patientInfo)
        {
            Id         = patientInfo.Id;
            LastName   = patientInfo.LastName;
            Name       = patientInfo.Name;
            Patronymic = patientInfo.Patronymic;
            Birthday   = CConvertEngine.CopyDateTime(patientInfo.Birthday);

            BuildingNumber          = patientInfo.BuildingNumber;
            CityName                = patientInfo.CityName;
            FlatNumber              = patientInfo.FlatNumber;
            Phone                   = patientInfo.Phone;
            HomeNumber              = patientInfo.HomeNumber;
            Nosology                = patientInfo.Nosology;
            NosologyList            = new List <string>(patientInfo.NosologyList);
            StreetName              = patientInfo.StreetName;
            PrivateFolder           = patientInfo.PrivateFolder;
            Relatives               = patientInfo.Relatives;
            IsSpecifyLegalRepresent = patientInfo.IsSpecifyLegalRepresent;
            LegalRepresent          = patientInfo.LegalRepresent;
            WorkPlace               = patientInfo.WorkPlace;
            EMail                   = patientInfo.EMail;
            PassInformation         = new CPassportInformation(patientInfo.PassInformation);
            InsuranceSeries         = patientInfo.InsuranceSeries;
            InsuranceNumber         = patientInfo.InsuranceNumber;
            InsuranceName           = patientInfo.InsuranceName;
            InsuranceType           = patientInfo.InsuranceType;
        }
Example #3
0
        public CPatientView(CPatient patientInfo, CWorkersKeeper workersKeeper)
        {
            Id                 = patientInfo.Id.ToString(CultureInfo.InvariantCulture);
            Nosology           = patientInfo.Nosology;
            FullName           = patientInfo.GetFullName();
            HospitalizationCnt = workersKeeper.HospitalizationWorker.GetCountByPatientId(patientInfo.Id).ToString(CultureInfo.InvariantCulture);
            VisitCnt           = workersKeeper.VisitWorker.GetCountByPatientId(patientInfo.Id).ToString(CultureInfo.InvariantCulture);
            COperation[] operations = workersKeeper.OperationWorker.GetListByPatientId(patientInfo.Id);
            OperationCnt = operations.Length.ToString(CultureInfo.InvariantCulture);
            Age          = CConvertEngine.GetAge(patientInfo.Birthday);

            var operationTypeSB = new StringBuilder();

            foreach (COperation operation in operations)
            {
                foreach (string operationType in operation.OperationTypes)
                {
                    if (!operationTypeSB.ToString().Contains(operationType))
                    {
                        operationTypeSB.Append(operationType + ", ");
                    }
                }
            }

            OperationTypes = operationTypeSB.Length > 0
                ? operationTypeSB.ToString().Substring(0, operationTypeSB.Length - 2)
                : operationTypeSB.ToString();

            int    hospitalizationCnt = Convert.ToInt32(HospitalizationCnt);
            int    visitCnt           = Convert.ToInt32(VisitCnt);
            CVisit lastVisit          = null;

            if (visitCnt > 0)
            {
                lastVisit = workersKeeper.VisitWorker.GetListByPatientId(patientInfo.Id)[visitCnt - 1];
            }

            CHospitalization lastHospitalization = null;

            if (hospitalizationCnt > 0)
            {
                lastHospitalization = workersKeeper.HospitalizationWorker.GetListByPatientId(patientInfo.Id)[hospitalizationCnt - 1];
            }

            if (lastHospitalization != null)
            {
                DeliveryDateString = CConvertEngine.DateTimeToString(lastHospitalization.DeliveryDate, true);

                ReleaseDateString = CConvertEngine.DateTimeToString(lastHospitalization.ReleaseDate, false);

                KD = lastHospitalization.KD;

                if (lastVisit == null)
                {
                    Diagnose = lastHospitalization.DiagnoseOneLine;
                }
            }

            if (lastVisit != null)
            {
                VisitDateString = CConvertEngine.DateTimeToString(lastVisit.VisitDate, true);
            }

            if (lastHospitalization == null && lastVisit != null)
            {
                Diagnose = lastVisit.DiagnoseOneLine;
            }
            else if (lastHospitalization != null && lastVisit != null)
            {
                int dateCompareResult = CCompareEngine.CompareDateTime(lastHospitalization.DeliveryDate, lastVisit.VisitDate);
                Diagnose = dateCompareResult >= 0
                    ? lastHospitalization.DiagnoseOneLine
                    : lastVisit.DiagnoseOneLine;
            }
        }
Example #4
0
        /// <summary>
        /// Получить строку с описанием разницы в полях между текущим и переданным пациентом
        /// </summary>
        /// <param name="diffPatient">Переданный (импортируемый) пациент</param>
        /// <param name="databasesMerger">Указатель на класс для мержа объектов</param>
        /// <returns></returns>
        public void GetDifference(CPatient diffPatient, CDatabasesMerger databasesMerger)
        {
            CMergeInfo ownPatientMergeInfo;
            CMergeInfo foreignPatientMergeInfo;

            if (CCompareEngine.CompareDate(Birthday, diffPatient.Birthday) != 0)
            {
                CreateMergeInfos(
                    ObjectType.PatientBirthday,
                    "День рождения",
                    CConvertEngine.DateTimeToString(Birthday),
                    CConvertEngine.DateTimeToString(diffPatient.Birthday),
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (CityName != diffPatient.CityName)
            {
                CreateMergeInfos(
                    ObjectType.PatientCityName,
                    "Город проживания",
                    CityName,
                    diffPatient.CityName,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (StreetName != diffPatient.StreetName)
            {
                CreateMergeInfos(
                    ObjectType.PatientStreetName,
                    "Улица проживания",
                    StreetName,
                    diffPatient.StreetName,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (HomeNumber != diffPatient.HomeNumber)
            {
                CreateMergeInfos(
                    ObjectType.PatientHomeNumber,
                    "Номер дома",
                    HomeNumber,
                    diffPatient.HomeNumber,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (BuildingNumber != diffPatient.BuildingNumber)
            {
                CreateMergeInfos(
                    ObjectType.PatientBuildingNumber,
                    "Номер корпуса",
                    BuildingNumber,
                    diffPatient.BuildingNumber,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (FlatNumber != diffPatient.FlatNumber)
            {
                CreateMergeInfos(
                    ObjectType.PatientFlatNumber,
                    "Номер квартиры",
                    FlatNumber,
                    diffPatient.FlatNumber,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (Phone != diffPatient.Phone)
            {
                CreateMergeInfos(
                    ObjectType.PatientPhone,
                    "Телефон",
                    Phone,
                    diffPatient.Phone,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (Relatives != diffPatient.Relatives)
            {
                CreateMergeInfos(
                    ObjectType.PatientRelatives,
                    "Родственники",
                    Relatives,
                    diffPatient.Relatives,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (IsSpecifyLegalRepresent != diffPatient.IsSpecifyLegalRepresent)
            {
                CreateMergeInfos(
                    ObjectType.PatientIsSpecifyLegalRepresent,
                    "Наличие легального представителя",
                    IsSpecifyLegalRepresent ? "Указан" : "Не указан",
                    diffPatient.IsSpecifyLegalRepresent ? "Указан" : "Не указан",
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (LegalRepresent != diffPatient.LegalRepresent)
            {
                CreateMergeInfos(
                    ObjectType.PatientLegalRepresent,
                    "Законный представитель",
                    LegalRepresent,
                    diffPatient.LegalRepresent,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (WorkPlace != diffPatient.WorkPlace)
            {
                CreateMergeInfos(
                    ObjectType.PatientWorkPlace,
                    "Место работы",
                    WorkPlace,
                    diffPatient.WorkPlace,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (EMail != diffPatient.EMail)
            {
                CreateMergeInfos(
                    ObjectType.PatientEMail,
                    "Адрес электронной почты",
                    EMail,
                    diffPatient.EMail,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (InsuranceSeries != diffPatient.InsuranceSeries)
            {
                CreateMergeInfos(
                    ObjectType.PatientInsuranceSeries,
                    "Серия страховой компании",
                    InsuranceSeries,
                    diffPatient.InsuranceSeries,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (InsuranceNumber != diffPatient.InsuranceNumber)
            {
                CreateMergeInfos(
                    ObjectType.PatientInsuranceNumber,
                    "Номер страховой компании",
                    InsuranceNumber,
                    diffPatient.InsuranceNumber,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (InsuranceName != diffPatient.InsuranceName)
            {
                CreateMergeInfos(
                    ObjectType.PatientInsuranceName,
                    "Название страховой компании",
                    InsuranceName,
                    diffPatient.InsuranceName,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (InsuranceType != diffPatient.InsuranceType)
            {
                CreateMergeInfos(
                    ObjectType.PatientInsuranceType,
                    "Вид страховой компании",
                    InsuranceType,
                    diffPatient.InsuranceType,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (PassInformation.Series != diffPatient.PassInformation.Series)
            {
                CreateMergeInfos(
                    ObjectType.PatientPassInformationSeries,
                    "Серия паспорта",
                    PassInformation.Series,
                    diffPatient.PassInformation.Series,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (PassInformation.Number != diffPatient.PassInformation.Number)
            {
                CreateMergeInfos(
                    ObjectType.PatientPassInformationNumber,
                    "Номер паспорта",
                    PassInformation.Number,
                    diffPatient.PassInformation.Number,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (PassInformation.SubdivisionCode != diffPatient.PassInformation.SubdivisionCode)
            {
                CreateMergeInfos(
                    ObjectType.PatientPassInformationSubdivisionCode,
                    "Код подразделения",
                    PassInformation.SubdivisionCode,
                    diffPatient.PassInformation.SubdivisionCode,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (PassInformation.Organization != diffPatient.PassInformation.Organization)
            {
                CreateMergeInfos(
                    ObjectType.PatientPassInformationOrganization,
                    "Организация, выдавшая паспорт",
                    PassInformation.Organization,
                    diffPatient.PassInformation.Organization,
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (PassInformation.DeliveryDate.HasValue && !diffPatient.PassInformation.DeliveryDate.HasValue)
            {
                CreateMergeInfos(
                    ObjectType.PatientPassInformationDeliveryDate,
                    "Дата выдачи паспотра",
                    CConvertEngine.DateTimeToString(PassInformation.DeliveryDate.Value, false),
                    "Нет значения",
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }
            else if (!PassInformation.DeliveryDate.HasValue && diffPatient.PassInformation.DeliveryDate.HasValue)
            {
                CreateMergeInfos(
                    ObjectType.PatientPassInformationDeliveryDate,
                    "Дата выдачи паспотра",
                    "Нет значения",
                    CConvertEngine.DateTimeToString(diffPatient.PassInformation.DeliveryDate.Value, false),
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }
            else if (PassInformation.DeliveryDate.HasValue && diffPatient.PassInformation.DeliveryDate.HasValue &&
                     CCompareEngine.CompareDate(PassInformation.DeliveryDate.Value, diffPatient.PassInformation.DeliveryDate.Value) != 0)
            {
                CreateMergeInfos(
                    ObjectType.PatientPassInformationDeliveryDate,
                    "Дата выдачи паспотра",
                    CConvertEngine.DateTimeToString(PassInformation.DeliveryDate.Value, false),
                    CConvertEngine.DateTimeToString(diffPatient.PassInformation.DeliveryDate.Value, false),
                    diffPatient,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }
        }
Example #5
0
 public static int Compare(CPatient patientInfo1, CPatient patientInfo2)
 {
     return(string.CompareOrdinal(patientInfo1.GetFullName(), patientInfo2.GetFullName()));
 }