Exemple #1
0
        private void CreateMergeInfos(
            ObjectType objectType,
            string patientFio,
            string nosology,
            string parameterName,
            string ownValue,
            string foreignValue,
            CVisit diffVisit,
            out CMergeInfo ownPatientMergeInfo,
            out CMergeInfo foreignPatientMergeInfo)
        {
            const string differenceStr = "Пациент: '{0}'. Нозология: '{1}'. Дата консультации: '{2}'.\r\nНазвание параметра: '{3}'. Значение: '{4}'";

            ownPatientMergeInfo = new CMergeInfo
            {
                IdOwnPatient = PatientId,
                IdOwnVisit   = Id,
                TypeOfObject = objectType,
                Value        = ownValue,
                Difference   = string.Format(differenceStr, patientFio, nosology, CConvertEngine.DateTimeToString(VisitDate, true), parameterName, ownValue)
            };

            foreignPatientMergeInfo = new CMergeInfo
            {
                IdForeignPatient = diffVisit.PatientId,
                IdForeignVisit   = diffVisit.Id,
                TypeOfObject     = objectType,
                Value            = foreignValue,
                Difference       = string.Format(differenceStr, patientFio, nosology, CConvertEngine.DateTimeToString(diffVisit.VisitDate, true), parameterName, foreignValue)
            };
        }
Exemple #2
0
 public CVisit(CVisit visit)
 {
     Id             = visit.Id;
     PatientId      = visit.PatientId;
     Diagnose       = visit.Diagnose;
     Evenly         = visit.Evenly;
     Recommendation = visit.Recommendation;
     Comments       = visit.Comments;
     VisitDate      = CConvertEngine.CopyDateTime(visit.VisitDate);
     IsLastParagraphForCertificateNeeded     = visit.IsLastParagraphForCertificateNeeded;
     IsLastOdkbParagraphForCertificateNeeded = visit.IsLastOdkbParagraphForCertificateNeeded;
     Doctor = visit.Doctor;
     Header = visit.Header;
 }
Exemple #3
0
        /// <summary>
        /// Получить строку с описанием разницы в полях между текущей и переданной консультацией
        /// </summary>
        /// <param name="diffVisit">Импортируемая консультация</param>
        /// <param name="patientFio">ФИО импортируемого пациента</param>
        /// <param name="nosology">Нозология</param>
        /// <param name="databasesMerger">Указатель на класс для мержа объектов</param>
        /// <returns></returns>
        public void GetDifference(CVisit diffVisit, string patientFio, string nosology, CDatabasesMerger databasesMerger)
        {
            CMergeInfo ownPatientMergeInfo;
            CMergeInfo foreignPatientMergeInfo;

            if (Diagnose != diffVisit.Diagnose)
            {
                CreateMergeInfos(
                    ObjectType.VisitDiagnose,
                    patientFio,
                    nosology,
                    "Диагноз",
                    Diagnose,
                    diffVisit.Diagnose,
                    diffVisit,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (Evenly != diffVisit.Evenly)
            {
                CreateMergeInfos(
                    ObjectType.VisitEvenly,
                    patientFio,
                    nosology,
                    "Объективно",
                    Evenly,
                    diffVisit.Evenly,
                    diffVisit,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (Comments != diffVisit.Comments)
            {
                CreateMergeInfos(
                    ObjectType.VisitComments,
                    patientFio,
                    nosology,
                    "Комментарии",
                    Comments,
                    diffVisit.Comments,
                    diffVisit,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (Recommendation != diffVisit.Recommendation)
            {
                CreateMergeInfos(
                    ObjectType.VisitRecommendation,
                    patientFio,
                    nosology,
                    "Рекомендации",
                    Recommendation,
                    diffVisit.Recommendation,
                    diffVisit,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }

            if (Doctor != diffVisit.Doctor)
            {
                CreateMergeInfos(
                    ObjectType.VisitDoctor,
                    patientFio,
                    nosology,
                    "Врач",
                    Doctor,
                    diffVisit.Doctor,
                    diffVisit,
                    out ownPatientMergeInfo,
                    out foreignPatientMergeInfo);
                databasesMerger.AddMergeInfo(ownPatientMergeInfo, foreignPatientMergeInfo);
            }
        }
Exemple #4
0
 public static int Compare(CVisit visit1, CVisit visit2)
 {
     return(CCompareEngine.CompareDateTime(visit1.VisitDate, visit2.VisitDate));
 }
Exemple #5
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;
            }
        }