Ejemplo n.º 1
0
        public override bool Equals(Object obj)
        {
            TestRecommendation p = obj as TestRecommendation;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.recommendation == p.recommendation)
            {
                return(true);
            }
            if ((this.recommendation == null) || (p.recommendation == null))
            {
                return(false);
            }
            if ((this.recommendation.Date == p.recommendation.Date) &&
                (this.recommendation.Text == p.recommendation.Text) &&
                Global.IsEqual(this.doctor, p.doctor))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestRecommendation");
                return(false);
            }
        }
Ejemplo n.º 2
0
        public override bool Equals(Object obj)
        {
            TestStatCase p = obj as TestStatCase;

            if ((object)p == null)
            {
                return(false);
            }
            if (Global.IsEqual(this.caseBase, p.caseBase) &&
                (Global.IsEqual(this.medRecords, p.medRecords)) &&
                (Global.IsEqual(this.steps, p.steps)) &&
                (this.caseStat.DeliveryCode == p.caseStat.DeliveryCode) &&
                (this.caseStat.IdIntoxicationType == p.caseStat.IdIntoxicationType) &&
                (this.caseStat.IdPatientConditionOnAdmission == p.caseStat.IdPatientConditionOnAdmission) &&
                (this.caseStat.IdTypeFromDiseaseStart == p.caseStat.IdTypeFromDiseaseStart) &&
                (this.caseStat.IdTransportIntern == p.caseStat.IdTransportIntern) &&
                (this.caseStat.IdHospChannel == p.caseStat.IdHospChannel) &&
                (this.caseStat.RW1Mark == p.caseStat.RW1Mark) &&
                (this.caseStat.AIDSMark == p.caseStat.AIDSMark))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors2.Add("несовпадение TestStatCase");
                return(false);
            }
        }
Ejemplo n.º 3
0
 public void AddMedRecord(string guid, string idLpu, string idPatientMis, MedRecord mr, string idCaseMis = "")
 {
     try
     {
         client.AddMedRecord(guid, idLpu, idPatientMis, idCaseMis, mr);
         TestMasterCase tmc = TestMasterCase.BuildTestMasterCase(guid, idLpu, idPatientMis, idCaseMis);
         if (Global.IsEqual(tmc, null))
         {
             Global.errors1.Add("Case " + idCaseMis + " не найден в базе данных");
         }
         else
         if (!tmc.CheckDocumentInCase(mr, idLpu))
         {
             Global.errors1.Add("Не добавлен");
         }
     }
     catch (System.ServiceModel.FaultException <List <PixServiseTests.EMKServise.RequestFault> > e)
     {
         getErrors(e.Detail);
     }
     catch (System.ServiceModel.FaultException <PixServiseTests.EMKServise.RequestFault[]> e)
     {
         getErrors(e.Detail);
     }
     catch (System.ServiceModel.FaultException <PixServiseTests.EMKServise.RequestFault> e)
     {
         Global.errors1.Add(e.Detail.PropertyName + " - " + e.Detail.Message);
         getErrors(e.Detail.Errors);
     }
 }
Ejemplo n.º 4
0
        public override bool Equals(Object obj)
        {
            TestLaboratoryReport p = obj as TestLaboratoryReport;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.laboratoryReport == p.laboratoryReport)
            {
                return(true);
            }
            if ((this.laboratoryReport == null) || (p.laboratoryReport == null))
            {
                return(false);
            }
            if ((this.laboratoryReport.CreationDate == p.laboratoryReport.CreationDate) &&
                (this.laboratoryReport.Header == p.laboratoryReport.Header) &&
                Global.IsEqual(this.doctor, p.doctor) &&
                Global.IsEqual(this.attachment, p.attachment))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestLaboratoryReport");
                return(false);
            }
        }
Ejemplo n.º 5
0
        public override bool Equals(Object obj)
        {
            TestDiagnosis p = obj as TestDiagnosis;

            if ((object)p == null)
            {
                return(false);
            }
            if ((this.info == p.info) &&
                (Global.IsEqual(this.doctor, p.doctor)))
            {
                return(true);
            }
            if ((this.info == null) || (p.info == null))
            {
                return(false);
            }
            if (Global.IsEqual(this.info, p.info) &&
                Global.IsEqual(this.doctor, p.doctor))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestDiagnosis");
                return(false);
            }
        }
Ejemplo n.º 6
0
        public override bool Equals(Object obj)
        {
            TestConsultNote p = obj as TestConsultNote;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.consultNote == p.consultNote)
            {
                return(true);
            }
            if ((this.consultNote == null) || (p.consultNote == null))
            {
                return(false);
            }
            if ((this.consultNote.CreationDate == p.consultNote.CreationDate) &&
                (this.consultNote.Header == p.consultNote.Header) &&
                Global.IsEqual(this.doctor, p.doctor) &&
                Global.IsEqual(this.attachment, p.attachment))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestConsultNote");
                return(false);
            }
        }
Ejemplo n.º 7
0
        public override bool Equals(Object obj)
        {
            TestGuardian p = obj as TestGuardian;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.guardian == p.guardian)
            {
                return(true);
            }
            if ((this.guardian == null) || (p.guardian == null))
            {
                return(false);
            }
            if ((this.guardian.IdRelationType == p.guardian.IdRelationType) &&
                (this.guardian.UnderlyingDocument == p.guardian.UnderlyingDocument) &&
                Global.IsEqual(this.person, p.person))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestGuardian");
                return(false);
            }
        }
Ejemplo n.º 8
0
        public override bool Equals(Object obj)
        {
            TestParticipant p = obj as TestParticipant;

            if ((object)p == null)
            {
                return(false);
            }
            if ((this.participant.IdRole == p.participant.IdRole) &&
                (Global.IsEqual(this.doctor, p.doctor)))
            {
                return(true);
            }
            if ((this.participant == null) || (p.participant == null))
            {
                return(false);
            }
            if (Global.IsEqual(this.doctor, p.doctor) &&
                (this.participant.IdRole != p.participant.IdRole))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestParticipant");
                return(false);
            }
        }
Ejemplo n.º 9
0
        public override bool Equals(Object obj)
        {
            TestAmbStep p = obj as TestAmbStep;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.ambStep == p.ambStep)
            {
                return(true);
            }
            if ((this.ambStep == null) || (p.ambStep == null))
            {
                return(false);
            }
            if ((this.ambStep.IdVisitPlace == p.ambStep.IdVisitPlace) &&
                (this.ambStep.IdVisitPurpose == p.ambStep.IdVisitPurpose) &&
                Global.IsEqual(this.step, p.step) &&
                Global.IsEqual(this.medRecords, p.medRecords))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestAmbStep");
                return(false);
            }
        }
Ejemplo n.º 10
0
        public override bool Equals(Object obj)
        {
            TestDischargeSummary p = obj as TestDischargeSummary;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.dischargeSummary == p.dischargeSummary)
            {
                return(true);
            }
            if ((this.dischargeSummary == null) || (p.dischargeSummary == null))
            {
                return(false);
            }
            if ((this.dischargeSummary.CreationDate == p.dischargeSummary.CreationDate) &&
                (this.dischargeSummary.Header == p.dischargeSummary.Header) &&
                Global.IsEqual(this.doctor, p.doctor) &&
                Global.IsEqual(this.attachment, p.attachment))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestDischargeSummary");
                return(false);
            }
        }
Ejemplo n.º 11
0
        public override bool Equals(Object obj)
        {
            TestStatStep p = obj as TestStatStep;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.statStep == p.statStep)
            {
                return(true);
            }
            if ((this.statStep == null) || (p.statStep == null))
            {
                return(false);
            }
            if ((this.statStep.BedNumber == p.statStep.BedNumber) &&
                (this.statStep.BedProfile == p.statStep.BedProfile) &&
                (this.statStep.DaySpend == p.statStep.DaySpend) &&
                (this.statStep.HospitalDepartmentName == p.statStep.HospitalDepartmentName) &&
                (this.statStep.IdHospitalDepartment == p.statStep.IdHospitalDepartment) &&
                (this.statStep.IdRegimen == p.statStep.IdRegimen) &&
                (this.statStep.WardNumber == p.statStep.WardNumber) &&
                Global.IsEqual(this.step, p.step) &&
                Global.IsEqual(this.medRecords, p.medRecords))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestStatStep");
                return(false);
            }
        }
Ejemplo n.º 12
0
        public override bool Equals(Object obj)
        {
            TestStepBase p = obj as TestStepBase;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.step == p.step)
            {
                return(true);
            }
            if ((this.step == null) || (p.step == null))
            {
                return(false);
            }
            if ((this.step.Comment == p.step.Comment) &&
                (this.step.DateEnd == p.step.DateEnd) &&
                (this.step.DateStart == p.step.DateStart) &&
                (this.step.IdPaymentType == p.step.IdPaymentType) &&
                (this.step.IdStepMis == p.step.IdStepMis) &&
                Global.IsEqual(this.doctor, p.doctor))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestStepBase");
                return(false);
            }
        }
Ejemplo n.º 13
0
        public override bool Equals(Object obj)
        {
            TestDoctor p = obj as TestDoctor;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.doctor == p.doctor)
            {
                return(true);
            }
            if ((this.doctor == null) || (p.doctor == null))
            {
                return(false);
            }
            if ((this.doctor.IdLpu == p.doctor.IdLpu) &&
                (this.doctor.IdPosition == p.doctor.IdPosition) &&
                (this.doctor.IdSpeciality == p.doctor.IdSpeciality) &&
                Global.IsEqual(person, p.person))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestDoctor");
                return(false);
            }
        }
Ejemplo n.º 14
0
        public override bool Equals(Object obj)
        {
            TestDispensaryOne p = obj as TestDispensaryOne;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.dispansaryOne == p.dispansaryOne)
            {
                return(true);
            }
            if ((this.dispansaryOne == null) || (p.dispansaryOne == null))
            {
                return(false);
            }
            if ((this.dispansaryOne.CreationDate == p.dispansaryOne.CreationDate) &&
                (this.dispansaryOne.HasExpertCareRefferal == p.dispansaryOne.HasExpertCareRefferal) &&
                (this.dispansaryOne.HasExtraResearchRefferal == p.dispansaryOne.HasExtraResearchRefferal) &&
                (this.dispansaryOne.HasHealthResortRefferal == p.dispansaryOne.HasHealthResortRefferal) &&
                (this.dispansaryOne.HasPrescribeCure == p.dispansaryOne.HasPrescribeCure) &&
                (this.dispansaryOne.HasSecondStageRefferal == p.dispansaryOne.HasSecondStageRefferal) &&
                (this.dispansaryOne.Header == p.dispansaryOne.Header) &&
                (this.dispansaryOne.IsGuested == p.dispansaryOne.IsGuested) &&
                (this.dispansaryOne.IsUnderObservation == p.dispansaryOne.IsUnderObservation) &&
                (this.dispansaryOne.HealthGroup.HealthGroupInfo.Date == p.dispansaryOne.HealthGroup.HealthGroupInfo.Date) &&
                (this.dispansaryOne.HealthGroup.HealthGroupInfo.IdHealthGroup == p.dispansaryOne.HealthGroup.HealthGroupInfo.IdHealthGroup) &&
                (Global.IsEqual(this.attachment, p.attachment)) &&
                (Global.IsEqual(this.doctor, p.doctor)) &&
                (Global.IsEqual(this.hdDoctor, p.hdDoctor)) &&
                (Global.IsEqual(this.recommendation, p.recommendation)))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestDispensaryOne");
                return(false);
            }
        }
Ejemplo n.º 15
0
        public override bool Equals(Object obj)
        {
            TestReferral p = obj as TestReferral;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.referral == p.referral)
            {
                return(true);
            }
            if ((this.referral == null) || (p.referral == null))
            {
                return(false);
            }
            if ((this.referral.CreationDate == p.referral.CreationDate) &&
                (this.referral.Header == p.referral.Header) &&
                (this.referral.IdSourceLpu == p.referral.IdSourceLpu) &&
                (this.referral.IdTargetLpu == p.referral.IdTargetLpu) &&
                (this.referral.ReferralID == p.referral.ReferralID) &&
                (this.referral.ReferralInfo.HospitalizationOrder == p.referral.ReferralInfo.HospitalizationOrder) &&
                (this.referral.ReferralInfo.IdReferralMis == p.referral.ReferralInfo.IdReferralMis) &&
                (this.referral.ReferralInfo.IdReferralType == p.referral.ReferralInfo.IdReferralType) &&
                (this.referral.ReferralInfo.IssuedDateTime == p.referral.ReferralInfo.IssuedDateTime) &&
                (this.referral.ReferralInfo.MkbCode == p.referral.ReferralInfo.MkbCode) &&
                (this.referral.ReferralInfo.Reason == p.referral.ReferralInfo.Reason) &&
                Global.IsEqual(this.departmentHead, p.departmentHead) &&
                Global.IsEqual(this.doctor, p.doctor) &&
                Global.IsEqual(this.attachment, p.attachment))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestReferral");
                return(false);
            }
        }
Ejemplo n.º 16
0
        public override bool Equals(Object obj)
        {
            TestAppointedMedication p = obj as TestAppointedMedication;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.document == p.document)
            {
                return(true);
            }
            if ((this.document == null) || (p.document == null))
            {
                return(false);
            }
            if ((this.document.AnatomicTherapeuticChemicalClassification == p.document.AnatomicTherapeuticChemicalClassification) &&
                (Global.IsEqual(this.courseDose, p.courseDose)) &&
                (Global.IsEqual(this.dayDose, p.dayDose)) &&
                (this.document.DaysCount == p.document.DaysCount) &&
                (this.document.IssuedDate == p.document.IssuedDate) &&
                (this.document.MedicineIssueType == p.document.MedicineIssueType) &&
                (this.document.MedicineName == p.document.MedicineName) &&
                (this.document.MedicineType == p.document.MedicineType) &&
                (this.document.MedicineUseWay == p.document.MedicineUseWay) &&
                (this.document.Number == p.document.Number) &&
                (Global.IsEqual(this.oneTimeDose, p.oneTimeDose)) &&
                (this.document.Seria == p.document.Seria) &&
                Global.IsEqual(this.doctor, p.doctor))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestAppointedMedication");
                return(false);
            }
        }
Ejemplo n.º 17
0
        public override bool Equals(Object obj)
        {
            TestPerson p = obj as TestPerson;

            if ((object)p == null)
            {
                return(false);
            }
            if ((this.person.Birthdate == p.person.Birthdate) &&
                (this.person.IdPersonMis == p.person.IdPersonMis) &&
                (Global.IsEqual(this.docs, p.docs)) &&
                (this.person.Sex == p.person.Sex) &&
                (Global.IsEqual(this.name, p.name)))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestPerson");
                return(false);
            }
        }
Ejemplo n.º 18
0
        public override bool Equals(Object obj)
        {
            TestCaseBase p = obj as TestCaseBase;

            if ((object)p == null)
            {
                return(false);
            }
            if ((Global.IsEqual(this.doctorInCharge, p.doctorInCharge)) &&
                (this.caseBase.CloseDate == p.caseBase.CloseDate) &&
                (Global.IsEqual(this.guardian, p.guardian)) &&
                (Global.IsEqual(this.patient, p.patient)) &&
                (Global.IsEqual(this.authenticator, p.authenticator)) &&
                (Global.IsEqual(this.autor, p.autor)) &&
                (Global.IsEqual(this.legalAuthenticator, p.legalAuthenticator)) &&
                (this.caseBase.Comment == p.caseBase.Comment) &&
                (this.caseBase.Confidentiality == p.caseBase.Confidentiality) &&
                (this.caseBase.CuratorConfidentiality == p.caseBase.CuratorConfidentiality) &&
                (this.caseBase.DoctorConfidentiality == p.caseBase.DoctorConfidentiality) &&
                (this.caseBase.HistoryNumber == p.caseBase.HistoryNumber) &&
                (this.caseBase.IdCaseAidType == p.caseBase.IdCaseAidType) &&
                //(this.caseBase.IdPatientMIS == p.caseBase.IdPatientMIS) &&
                (this.caseBase.IdCaseMis == p.caseBase.IdCaseMis) &&
                (this.caseBase.IdCaseResult == p.caseBase.IdCaseResult) &&
                (this.caseBase.IdLpu == p.caseBase.IdLpu) &&
                (this.caseBase.IdPaymentType == p.caseBase.IdPaymentType) &&
                (this.caseBase.OpenDate == p.caseBase.OpenDate))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestCaseBase");
                return(false);
            }
        }
Ejemplo n.º 19
0
        public override bool Equals(Object obj)
        {
            TestSickList p = obj as TestSickList;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.sickList == p.sickList)
            {
                return(true);
            }
            if ((this.sickList == null) || (p.sickList == null))
            {
                return(false);
            }
            if ((this.sickList.CreationDate == p.sickList.CreationDate) &&
                (this.sickList.Header == p.sickList.Header) &&
                (this.sickList.SickListInfo.DateEnd == p.sickList.SickListInfo.DateEnd) &&
                (this.sickList.SickListInfo.DateStart == p.sickList.SickListInfo.DateStart) &&
                (this.sickList.SickListInfo.DisabilityDocReason == p.sickList.SickListInfo.DisabilityDocReason) &&
                (this.sickList.SickListInfo.DisabilityDocState == p.sickList.SickListInfo.DisabilityDocState) &&
                (this.sickList.SickListInfo.IsPatientTaker == p.sickList.SickListInfo.IsPatientTaker) &&
                (this.sickList.SickListInfo.Number == p.sickList.SickListInfo.Number) &&
                Global.IsEqual(this.guardian, p.guardian) &&
                Global.IsEqual(this.doctor, p.doctor) &&
                Global.IsEqual(this.attachment, p.attachment))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestSickList");
                return(false);
            }
        }
Ejemplo n.º 20
0
        public override bool Equals(Object obj)
        {
            TestService p = obj as TestService;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.document == p.document)
            {
                return(true);
            }
            if ((this.document == null) || (p.document == null))
            {
                return(false);
            }
            if ((this.document.DateEnd == p.document.DateEnd) &&
                (this.document.DateStart == p.document.DateStart) &&
                (this.document.IdServiceType == p.document.IdServiceType) &&
                (this.document.PaymentInfo.HealthCareUnit == p.document.PaymentInfo.HealthCareUnit) &&
                (this.document.PaymentInfo.IdPaymentType == p.document.PaymentInfo.IdPaymentType) &&
                (this.document.PaymentInfo.PaymentState == p.document.PaymentInfo.PaymentState) &&
                (this.document.PaymentInfo.Quantity == p.document.PaymentInfo.Quantity) &&
                (this.document.PaymentInfo.Tariff == p.document.PaymentInfo.Tariff) &&
                (this.document.ServiceName == p.document.ServiceName) &&
                Global.IsEqual(this.doctor, p.doctor))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestService");
                return(false);
            }
        }
Ejemplo n.º 21
0
        public override bool Equals(Object obj)
        {
            TestPatient p = obj as TestPatient;

            if ((object)p == null)
            {
                return(false);
            }
            if ((Global.IsEqual(this.adds, p.adds)) &&
                (this.patient.BirthDate == p.patient.BirthDate) &&
                (Global.IsEqual(this.conts, p.conts)) &&
                (this.patient.DeathTime == p.patient.DeathTime) &&
                (Global.IsEqual(this.docs, p.docs)) &&
                (this.patient.FamilyName == p.patient.FamilyName) &&
                (this.patient.GivenName == p.patient.GivenName) &&
                (this.patient.IdBloodType == p.patient.IdBloodType) &&
                (this.patient.IdGlobal == p.patient.IdGlobal) &&
                (this.patient.IdLivingAreaType == p.patient.IdLivingAreaType) &&
                (this.patient.IsVip == p.patient.IsVip) &&
                (Global.IsEqual(this.job, p.job)) &&
                (this.patient.MiddleName == p.patient.MiddleName) &&
                (Global.IsEqual(this.privilege, p.privilege)) &&
                (this.patient.Sex == p.patient.Sex) &&
                (this.patient.SocialGroup == p.patient.SocialGroup) &&
                (this.patient.SocialStatus == p.patient.SocialStatus) &&
                Global.IsEqual(this.birthplace, p.birthplace))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestPatient");
                return(false);
            }
        }
Ejemplo n.º 22
0
        public override bool Equals(Object obj)
        {
            TestAmbCase p = obj as TestAmbCase;

            if ((object)p == null)
            {
                return(false);
            }
            if (Global.IsEqual(this.caseBase, p.caseBase) &&
                Global.IsEqual(this.medRecords, p.medRecords) &&
                Global.IsEqual(this.steps, p.steps) &&
                (this.caseAmb.IsActive == p.caseAmb.IsActive) &&
                (this.caseAmb.IdAmbResult == p.caseAmb.IdAmbResult) &&
                (this.caseAmb.IdCasePurpose == p.caseAmb.IdCasePurpose))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors2.Add("несовпадение TestAmbCase");
                return(false);
            }
        }
Ejemplo n.º 23
0
 static public TestAmbCase BuildAmbCaseFromDataBaseData(string guid, string idlpu, string mis, string patientId)
 {
     if ((guid != string.Empty) && (idlpu != string.Empty) && (mis != string.Empty) && (patientId != string.Empty))
     {
         string caseId = TestCaseBase.GetCaseId(guid, idlpu, mis, patientId);
         if (caseId != null)
         {
             CaseAmb ca = new CaseAmb();
             using (SqlConnection connection = Global.GetSqlConnection())
             {
                 string     findCase    = "SELECT TOP(1) * FROM AmbCase WHERE IdCase = '" + caseId + "'";
                 SqlCommand caseCommand = new SqlCommand(findCase, connection);
                 using (SqlDataReader caseReader = caseCommand.ExecuteReader())
                 {
                     while (caseReader.Read())
                     {
                         if (caseReader["IdCasePurpose"].ToString() != "")
                         {
                             ca.IdCasePurpose = Convert.ToByte(caseReader["IdCasePurpose"]);
                         }
                         if (caseReader["IdAmbResult"].ToString() != "")
                         {
                             ca.IdAmbResult = Convert.ToByte(caseReader["IdAmbResult"]);
                         }
                         if (caseReader["IsActive"].ToString() != "")
                         {
                             ca.IsActive = Convert.ToBoolean(caseReader["IsActive"]);
                         }
                         TestAmbCase ambcase = new TestAmbCase(guid, ca);
                         ambcase.caseBase = TestCaseBase.BuildBaseCaseFromDataBaseData(guid, idlpu, mis, patientId);
                         ambcase.ambSteps = TestAmbStep.BuildAmbTestStepsFromDataBase(caseId, ca.IdLpu);
                         List <TestStepBase> st = TestStepBase.BuildTestStepsFromDataBase(caseId, ca.IdLpu);
                         if (st != null)
                         {
                             foreach (TestStepBase i in st)
                             {
                                 if (Global.IsEqual(i.step.IdStepMis, null))
                                 {
                                     ambcase.defaultStep = i;
                                 }
                             }
                             if (!Global.IsEqual(ambcase.defaultStep, null))
                             {
                                 ambcase.records = new List <TestMedRecord>();
                                 List <TestService> ser = TestService.BuildServiseFromDataBaseData(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(ser, null))
                                 {
                                     ambcase.records.AddRange(ser);
                                 }
                                 TestTfomsInfo forms = TestTfomsInfo.BuildTfomsInfoFromDataBaseDate(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(forms, null))
                                 {
                                     ambcase.records.Add(forms);
                                 }
                                 TestDeathInfo tdi = TestDeathInfo.BuildDeathInfoFromDataBaseDate(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(tdi, null))
                                 {
                                     ambcase.records.Add(tdi);
                                 }
                                 List <TestDiagnosis> td = TestDiagnosis.BuildDiagnosisFromDataBaseDate(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(td, null))
                                 {
                                     ambcase.records.AddRange(td);
                                 }
                                 TestClinicMainDiagnosis acdm = TestClinicMainDiagnosis.BuildTestClinicMainDiagnosisFromDataBaseDate(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(acdm, null))
                                 {
                                     ambcase.records.Add(acdm);
                                 }
                                 List <TestReferral> trl = TestReferral.BuildReferralFromDataBaseData(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(trl, null))
                                 {
                                     ambcase.records.AddRange(trl);
                                 }
                                 List <TestSickList> tsl = TestSickList.BuildSickListFromDataBaseData(ambcase.defaultStep.idStep, patientId);
                                 if (!Global.IsEqual(tsl, null))
                                 {
                                     ambcase.records.AddRange(tsl);
                                 }
                                 TestDischargeSummary tds = TestDischargeSummary.BuildSickListFromDataBaseData(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(tds, null))
                                 {
                                     ambcase.records.Add(tds);
                                 }
                                 List <TestLaboratoryReport> tlr = TestLaboratoryReport.BuildLaboratoryReportFromDataBaseData(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(tlr, null))
                                 {
                                     ambcase.records.AddRange(tlr);
                                 }
                                 TestConsultNote tcn = TestConsultNote.BuildSickListFromDataBaseData(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(tcn, null))
                                 {
                                     ambcase.records.Add(tcn);
                                 }
                                 TestDispensaryOne d1 = TestDispensaryOne.BuildSickListFromDataBaseData(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(d1, null))
                                 {
                                     ambcase.records.Add(d1);
                                 }
                                 List <TestAppointedMedication> ap = TestAppointedMedication.BuildAppointedMedicationFromDataBaseDate(ambcase.defaultStep.idStep);
                                 if (!Global.IsEqual(ap, null))
                                 {
                                     ambcase.records.AddRange(ap);
                                 }
                                 if (ambcase.records.Count == 0)
                                 {
                                     ambcase.records = null;
                                 }
                             }
                         }
                         return(ambcase);
                     }
                 }
             }
         }
     }
     return(null);
 }
Ejemplo n.º 24
0
        static public List <TestStatStep> BuildStatStepsFromDataBase(string idCase, string caseLpu)
        {
            List <TestStatStep> statSteps = new List <TestStatStep>();

            if (idCase != string.Empty)
            {
                List <TestStepBase> steps = TestStepBase.BuildTestStepsFromDataBase(idCase, caseLpu);
                using (SqlConnection connection = Global.GetSqlConnection())
                {
                    foreach (TestStepBase i in steps)
                    {
                        string     findSteps    = "SELECT * FROM HospStep WHERE IdStep = '" + i.idStep + "'";
                        SqlCommand stepsCommand = new SqlCommand(findSteps, connection);
                        using (SqlDataReader stepsReader = stepsCommand.ExecuteReader())
                        {
                            while (stepsReader.Read())
                            {
                                StepStat sa = new StepStat();
                                if (stepsReader["BedNo"].ToString() != "")
                                {
                                    sa.BedNumber = Convert.ToString(stepsReader["BedNo"]);
                                }
                                else
                                {
                                    sa.BedNumber = null;
                                }
                                if (stepsReader["IdBedProfile"].ToString() != "")
                                {
                                    sa.BedProfile = Convert.ToByte(stepsReader["IdBedProfile"]);
                                }
                                else
                                {
                                    sa.BedProfile = 0;
                                }
                                if (stepsReader["DaySpend"].ToString() != "")
                                {
                                    sa.DaySpend = Convert.ToUInt16(stepsReader["DaySpend"]);
                                }
                                else
                                {
                                    sa.DaySpend = 0;
                                }
                                if (stepsReader["HospitalDepartment"].ToString() != "")
                                {
                                    sa.HospitalDepartmentName = Convert.ToString(stepsReader["HospitalDepartment"]);
                                }
                                else
                                {
                                    sa.HospitalDepartmentName = null;
                                }
                                if (stepsReader["IdHospitalDepartment"].ToString() != "")
                                {
                                    sa.IdHospitalDepartment = Convert.ToString(stepsReader["IdHospitalDepartment"]);
                                }
                                else
                                {
                                    sa.IdHospitalDepartment = null;
                                }
                                if (stepsReader["IdRegimenType"].ToString() != "")
                                {
                                    sa.IdRegimen = Convert.ToByte(stepsReader["IdRegimenType"]);
                                }
                                else
                                {
                                    sa.IdRegimen = 0;
                                }
                                if (stepsReader["WardNumber"].ToString() != "")
                                {
                                    sa.WardNumber = Convert.ToString(stepsReader["WardNumber"]);
                                }
                                else
                                {
                                    sa.WardNumber = null;
                                }
                                TestStatStep st = new TestStatStep(sa, caseLpu);
                                st.step    = i;
                                st.records = new List <TestMedRecord>();
                                List <TestService> s = TestService.BuildServiseFromDataBaseData(i.idStep);
                                if (!Global.IsEqual(s, null))
                                {
                                    st.records.AddRange(s);
                                }
                                List <TestAppointedMedication> am = TestAppointedMedication.BuildAppointedMedicationFromDataBaseDate(i.idStep);
                                if (!Global.IsEqual(am, null))
                                {
                                    st.records.AddRange(am);
                                }
                                List <TestDiagnosis> diag = TestDiagnosis.BuildDiagnosisFromDataBaseDate(i.idStep);
                                if (!Global.IsEqual(diag, null))
                                {
                                    st.records.AddRange(diag);
                                }
                                TestClinicMainDiagnosis acdm = TestClinicMainDiagnosis.BuildTestClinicMainDiagnosisFromDataBaseDate(i.idStep);
                                if (!Global.IsEqual(acdm, null))
                                {
                                    st.records.Add(acdm);
                                }
                                List <TestReferral> trl = TestReferral.BuildReferralFromDataBaseData(i.idStep);
                                if (!Global.IsEqual(trl, null))
                                {
                                    st.records.AddRange(trl);
                                }
                                List <TestLaboratoryReport> tlr = TestLaboratoryReport.BuildLaboratoryReportFromDataBaseData(i.idStep);
                                if (!Global.IsEqual(tlr, null))
                                {
                                    st.records.AddRange(tlr);
                                }
                                if (st.records.Count == 0)
                                {
                                    st.records = null;
                                }
                                statSteps.Add(st);
                            }
                        }
                    }
                }
            }
            if (statSteps.Count != 0)
            {
                return(statSteps);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 25
0
        public static TestMasterCase BuildTestMasterCase(string guid, string idlpu, string patientIdmis, string mis = "")
        {
            if ((guid != string.Empty) && (idlpu != string.Empty) && (patientIdmis != string.Empty))
            {
                string patientId = TestPerson.GetPersonId(guid, idlpu, patientIdmis);
                string caseId    = TestCaseBase.GetCaseId(guid, idlpu, mis, patientId);
                if (caseId != null)
                {
                    TestMasterCase mcase = new TestMasterCase();
                    mcase.caseBase = TestCaseBase.BuildBaseCaseFromDataBaseData(guid, idlpu, mis, patientId);
                    List <TestStepBase> st = TestStepBase.BuildTestStepsFromDataBase(caseId, idlpu);
                    if (st != null)
                    {
                        foreach (TestStepBase i in st)
                        {
                            if (Global.IsEqual(i.doctor, null))
                            {
                                mcase.defaultStep = i;
                            }
                        }
                        if (!Global.IsEqual(mcase.defaultStep, null))
                        {
                            mcase.records = new List <TestMedRecord>();
                            List <TestService> serv = TestService.BuildServiseFromDataBaseData(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(serv, null))
                            {
                                mcase.records.AddRange(serv);
                            }

                            TestTfomsInfo forms = TestTfomsInfo.BuildTfomsInfoFromDataBaseDate(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(forms, null))
                            {
                                mcase.records.Add(forms);
                            }

                            TestDeathInfo tdi = TestDeathInfo.BuildDeathInfoFromDataBaseDate(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(tdi, null))
                            {
                                mcase.records.Add(tdi);
                            }

                            List <TestDiagnosis> td = TestDiagnosis.BuildDiagnosisFromDataBaseDate(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(td, null))
                            {
                                mcase.records.AddRange(td);
                            }

                            TestClinicMainDiagnosis acdm = TestClinicMainDiagnosis.BuildTestClinicMainDiagnosisFromDataBaseDate(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(acdm, null))
                            {
                                mcase.records.Add(acdm);
                            }

                            List <TestReferral> trl = TestReferral.BuildReferralFromDataBaseData(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(trl, null))
                            {
                                mcase.records.AddRange(trl);
                            }

                            List <TestSickList> tsl = TestSickList.BuildSickListFromDataBaseData(mcase.defaultStep.idStep, patientId);
                            if (!Global.IsEqual(tsl, null))
                            {
                                mcase.records.AddRange(tsl);
                            }

                            TestDischargeSummary tds = TestDischargeSummary.BuildSickListFromDataBaseData(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(tds, null))
                            {
                                mcase.records.Add(tds);
                            }

                            List <TestLaboratoryReport> tlr = TestLaboratoryReport.BuildLaboratoryReportFromDataBaseData(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(tlr, null))
                            {
                                mcase.records.AddRange(tlr);
                            }

                            TestConsultNote tcn = TestConsultNote.BuildSickListFromDataBaseData(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(tcn, null))
                            {
                                mcase.records.Add(tcn);
                            }

                            TestDispensaryOne d1 = TestDispensaryOne.BuildSickListFromDataBaseData(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(d1, null))
                            {
                                mcase.records.Add(d1);
                            }

                            List <TestAppointedMedication> ap = TestAppointedMedication.BuildAppointedMedicationFromDataBaseDate(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(ap, null))
                            {
                                mcase.records.AddRange(ap);
                            }

                            List <TestForm027U> form = TestForm027U.BuildForm027UFromDataBaseData(mcase.defaultStep.idStep);
                            if (!Global.IsEqual(form, null))
                            {
                                mcase.records.AddRange(form);
                            }
                        }
                    }
                    return(mcase);
                }
            }
            return(null);
        }
Ejemplo n.º 26
0
        public bool CheckDocumentInCase(MedRecord i, string idLpu)
        {
            TestMedRecord doc = null;

            Service serv = i as Service;

            if (serv != null)
            {
                doc = new TestService(serv);
            }

            TfomsInfo tfi = i as TfomsInfo;

            if (tfi != null)
            {
                doc = new TestTfomsInfo(tfi);
            }

            DeathInfo di = i as DeathInfo;

            if (di != null)
            {
                doc = new TestDeathInfo(di);
            }

            Diagnosis diag = i as Diagnosis;

            if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType != TestDiagnosis.IdClinicMainDiagnosis))
            {
                doc = new TestDiagnosis(diag, idLpu);
            }

            ClinicMainDiagnosis cmd = i as ClinicMainDiagnosis;

            if ((cmd != null) && (cmd.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
            {
                doc = new TestClinicMainDiagnosis(cmd, idLpu);
            }

            AnatomopathologicalClinicMainDiagnosis acmd = i as AnatomopathologicalClinicMainDiagnosis;

            if ((acmd != null) && (cmd.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
            {
                doc = new TestClinicMainDiagnosis(acmd, idLpu);
            }

            Referral r = i as Referral;

            if (r != null)
            {
                doc = new TestReferral(r, idLpu);
            }

            SickList sl = i as SickList;

            if (sl != null)
            {
                doc = new TestSickList(sl, idLpu);
            }

            DischargeSummary ds = i as DischargeSummary;

            if (ds != null)
            {
                doc = new TestDischargeSummary(ds, idLpu);
            }

            LaboratoryReport lr = i as LaboratoryReport;

            if (lr != null)
            {
                doc = new TestLaboratoryReport(lr, idLpu);
            }

            ConsultNote cn = i as ConsultNote;

            if (cn != null)
            {
                doc = new TestConsultNote(cn, idLpu);
            }

            DispensaryOne d1 = i as DispensaryOne;

            if ((d1 != null) && (caseBase.idCaseType == dispensaryId))
            {
                doc = new TestDispensaryOne(d1, idLpu);
            }

            AppointedMedication ap = i as AppointedMedication;

            if (ap != null)
            {
                doc = new TestAppointedMedication(ap, idLpu);
            }

            Form027U form = i as Form027U;

            if (form != null)
            {
                doc = new TestForm027U(form, idLpu);
            }

            if (Global.IsEqual(doc, null))
            {
                Global.errors1.Add("Документ не найден");
                return(true);
            }

            foreach (TestMedRecord document in this.medRecords)
            {
                if (Global.IsEqual(doc, document))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 27
0
        static public List <TestAmbStep> BuildAmbTestStepsFromDataBase(string idCase, string caseLpu)
        {
            List <TestAmbStep> ambSteps = new List <TestAmbStep>();

            if (idCase != string.Empty)
            {
                List <TestStepBase> steps = TestStepBase.BuildTestStepsFromDataBase(idCase, caseLpu);
                using (SqlConnection connection = Global.GetSqlConnection())
                {
                    foreach (TestStepBase i in steps)
                    {
                        string     findSteps    = "SELECT * FROM AmbStep WHERE IdStep = '" + i.idStep + "'";
                        SqlCommand stepsCommand = new SqlCommand(findSteps, connection);
                        using (SqlDataReader stepsReader = stepsCommand.ExecuteReader())
                        {
                            while (stepsReader.Read())
                            {
                                StepAmb sa = new StepAmb();
                                if (stepsReader["IdVisitPlace"].ToString() != "")
                                {
                                    sa.IdVisitPlace = Convert.ToByte(stepsReader["IdVisitPlace"]);
                                }
                                else
                                {
                                    sa.IdVisitPlace = 0;
                                }
                                if (stepsReader["IdVisitPurpose"].ToString() != "")
                                {
                                    sa.IdVisitPurpose = Convert.ToByte(stepsReader["IdVisitPurpose"]);
                                }
                                else
                                {
                                    sa.IdVisitPurpose = 0;
                                }
                                TestAmbStep st = new TestAmbStep(sa, caseLpu);
                                st.step    = i;
                                st.records = new List <TestMedRecord>();
                                List <TestService> s = TestService.BuildServiseFromDataBaseData(i.idStep);
                                if (!Global.IsEqual(s, null))
                                {
                                    st.records.AddRange(s);
                                }
                                List <TestAppointedMedication> am = TestAppointedMedication.BuildAppointedMedicationFromDataBaseDate(i.idStep);
                                if (!Global.IsEqual(am, null))
                                {
                                    st.records.AddRange(am);
                                }
                                List <TestDiagnosis> diag = TestDiagnosis.BuildDiagnosisFromDataBaseDate(i.idStep);
                                if (!Global.IsEqual(diag, null))
                                {
                                    st.records.AddRange(diag);
                                }
                                TestClinicMainDiagnosis acdm = TestClinicMainDiagnosis.BuildTestClinicMainDiagnosisFromDataBaseDate(i.idStep);
                                if (!Global.IsEqual(acdm, null))
                                {
                                    st.records.Add(acdm);
                                }
                                List <TestReferral> trl = TestReferral.BuildReferralFromDataBaseData(i.idStep);
                                if (!Global.IsEqual(trl, null))
                                {
                                    st.records.AddRange(trl);
                                }
                                List <TestLaboratoryReport> tlr = TestLaboratoryReport.BuildLaboratoryReportFromDataBaseData(i.idStep);
                                if (!Global.IsEqual(tlr, null))
                                {
                                    st.records.AddRange(tlr);
                                }
                                if (st.records.Count == 0)
                                {
                                    st.records = null;
                                }
                                ambSteps.Add(st);
                            }
                        }
                    }
                }
            }
            if (ambSteps.Count != 0)
            {
                return(ambSteps);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 28
0
        public void GetCasesByPeriod(string GUID, DateTime datestart, DateTime dateend)
        {
            List <TestCaseBase> MyFindedCase = new List <TestCaseBase>();

            using (SqlConnection connection = Global.GetSqlConnection())
            {
                string findCaseString =
                    "SELECT * FROM \"Case\" WHERE OpenDate >= '" + datestart + "' AND OpenDate <= '" + dateend + "' AND CloseDate IS NOT NULL AND IsCancelled = 'False'";
                SqlCommand command = new SqlCommand(findCaseString, connection);
                using (SqlDataReader IdCaseReader = command.ExecuteReader())
                {
                    while (IdCaseReader.Read())
                    {
                        string      guid      = IdCaseReader["SystemGuid"].ToString();
                        string      idCaseMis = IdCaseReader["IdCaseMIS"].ToString();
                        string      idLpu     = Global.GetIdIdLpu(IdCaseReader["IdLpu"].ToString());
                        string      patientId = IdCaseReader["IdPerson"].ToString();
                        TestAmbCase ambCase   = TestAmbCase.BuildAmbCaseFromDataBaseData(guid, idLpu, idCaseMis, patientId);
                        if ((object)ambCase != null)
                        {
                            MyFindedCase.Add(ambCase);
                        }
                        TestStatCase statCase = TestStatCase.BuildAmbCaseFromDataBaseData(guid, idLpu, idCaseMis, patientId);
                        if ((object)statCase != null)
                        {
                            MyFindedCase.Add(statCase);
                        }
                        string idCase = IdCaseReader["IdCase"].ToString();
                    }
                }
            }
            CaseBase[]          cb = client.GetCasesByPeriod(GUID, datestart, dateend);
            List <TestCaseBase> FunctionFindedCase = new List <TestCaseBase>();

            foreach (CaseBase i in cb)
            {
                CaseAmb ca = i as CaseAmb;
                if ((object)ca != null)
                {
                    using (SqlConnection connection = Global.GetSqlConnection())
                    {
                        string findCaseString =
                            "SELECT TOP(1) [SystemGuid] FROM \"ExternalId\" WHERE IdLpu = '" + Global.GetIdInstitution(ca.IdLpu) + "' AND IdPersonMIS = '" + ca.IdPatientMis + "'";
                        SqlCommand command = new SqlCommand(findCaseString, connection);
                        using (SqlDataReader IdCaseReader = command.ExecuteReader())
                        {
                            while (IdCaseReader.Read())
                            {
                                GUID = IdCaseReader["SystemGuid"].ToString();
                            }
                        }
                    }
                    TestAmbCase tac = new TestAmbCase(GUID, (EMKServise.CaseAmb)ConvertCase(ca));
                    //if (!tac.CheckCaseInDataBase())
                    //    Global.errors1.Add("Что-то пошло не так");
                    FunctionFindedCase.Add(tac);
                }
                CaseStat cs = i as CaseStat;
                if ((object)cs != null)
                {
                    using (SqlConnection connection = Global.GetSqlConnection())
                    {
                        string findCaseString =
                            "SELECT TOP(1) [SystemGuid] FROM \"ExternalId\" WHERE IdLpu = '" + Global.GetIdInstitution(cs.IdLpu) + "' AND IdPersonMIS = '" + cs.IdPatientMis + "'";
                        SqlCommand command = new SqlCommand(findCaseString, connection);
                        using (SqlDataReader IdCaseReader = command.ExecuteReader())
                        {
                            while (IdCaseReader.Read())
                            {
                                GUID = IdCaseReader["SystemGuid"].ToString();
                            }
                        }
                    }
                    TestStatCase tsc = new TestStatCase(GUID, (EMKServise.CaseStat)ConvertCase(cs));
                    //if (!tsc.CheckCaseInDataBase())
                    //    Global.errors1.Add("Что-то пошло не так");
                    FunctionFindedCase.Add(tsc);
                }
            }
            if (Global.GetLength(MyFindedCase) > Global.GetLength(FunctionFindedCase))
            {
                Global.errors1.Add("Возвращено меньше, чем в базе");
            }
            if (Global.GetLength(MyFindedCase) < Global.GetLength(FunctionFindedCase))
            {
                Global.errors1.Add("Возвращено больше, чем в базе");
            }
            if (Global.GetLength(MyFindedCase) == Global.GetLength(FunctionFindedCase))
            {
                if (!Global.IsEqual(MyFindedCase.ToArray(), FunctionFindedCase.ToArray()))
                {
                    Global.errors1.AddRange(Global.errors2);
                }
            }
        }
Ejemplo n.º 29
0
 public void ChangeUpdateAmbCase(string guid, CaseAmb ca)
 {
     GUID = guid.ToLower();
     if (ca != null)
     {
         this.caseAmb.IsActive = ca.IsActive;
         if (ca.IdAmbResult != 0)
         {
             this.caseAmb.IdAmbResult = ca.IdAmbResult;
         }
         if (ca.IdCasePurpose != 0)
         {
             this.caseAmb.IdCasePurpose = ca.IdCasePurpose;
         }
         caseBase.UpdateCaseBase(guid, ca);
         if (ca.MedRecords != null)
         {
             List <TestMedRecord>    newMedRecords = new List <TestMedRecord>();
             TestTfomsInfo           tfi           = null;
             TestClinicMainDiagnosis cmd           = null;
             TestDischargeSummary    ds            = null;
             TestConsultNote         cn            = null;
             TestDispensaryOne       d1            = null;
             foreach (object i in ca.MedRecords)
             {
                 Service ser = i as Service;
                 if (ser != null)
                 {
                     newMedRecords.Add(new TestService(ser, ca.IdLpu));
                 }
                 TfomsInfo tf = i as TfomsInfo;
                 if (tf != null)
                 {
                     tfi = new TestTfomsInfo(tf);
                 }
                 Diagnosis diag = i as Diagnosis;
                 if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType != TestDiagnosis.IdClinicMainDiagnosis))
                 {
                     newMedRecords.Add(new TestDiagnosis(diag, ca.IdLpu));
                 }
                 ClinicMainDiagnosis cm = i as ClinicMainDiagnosis;
                 if ((cm != null) && (cm.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                 {
                     cmd = new TestClinicMainDiagnosis(cm, ca.IdLpu);
                 }
                 Referral r = i as Referral;
                 if (r != null)
                 {
                     newMedRecords.Add(new TestReferral(r, ca.IdLpu));
                 }
                 SickList sl = i as SickList;
                 if (sl != null)
                 {
                     newMedRecords.Add(new TestSickList(sl, ca.IdLpu));
                 }
                 DischargeSummary pds = i as DischargeSummary;
                 if (pds != null)
                 {
                     ds = new TestDischargeSummary(pds, ca.IdLpu);
                 }
                 LaboratoryReport lr = i as LaboratoryReport;
                 if (lr != null)
                 {
                     newMedRecords.Add(new TestLaboratoryReport(lr, ca.IdLpu));
                 }
                 ConsultNote pcn = i as ConsultNote;
                 if (pcn != null)
                 {
                     cn = new TestConsultNote(pcn, ca.IdLpu);
                 }
                 DispensaryOne d = i as DispensaryOne;
                 if (d != null)
                 {
                     d1 = new TestDispensaryOne(d, ca.IdLpu);
                 }
                 AppointedMedication ap = i as AppointedMedication;
                 if (ap != null)
                 {
                     newMedRecords.Add(new TestAppointedMedication(ap, ca.IdLpu));
                 }
             }
             if (Global.GetLength(this.medRecords) != 0)
             {
                 foreach (object i in this.medRecords)
                 {
                     TestService ser = i as TestService;
                     if (!Global.IsEqual(ser, null))
                     {
                         newMedRecords.Add(ser);
                     }
                     TestTfomsInfo tf = i as TestTfomsInfo;
                     if (!Global.IsEqual(tfi, null) && !Global.IsEqual(tf, null))
                     {
                         newMedRecords.Add(tf);
                     }
                     else
                     if (!Global.IsEqual(tfi, null))
                     {
                         newMedRecords.Add(tfi);
                     }
                     TestDiagnosis diag = i as TestDiagnosis;
                     if (!Global.IsEqual(diag, null))
                     {
                         newMedRecords.Add(diag);
                     }
                     TestClinicMainDiagnosis cm = i as TestClinicMainDiagnosis;
                     if (!Global.IsEqual(cmd, null))
                     {
                         newMedRecords.Add(cmd);
                     }
                     else
                     if (!Global.IsEqual(cm, null))
                     {
                         newMedRecords.Add(cm);
                     }
                     TestReferral r = i as TestReferral;
                     if (!Global.IsEqual(r, null))
                     {
                         newMedRecords.Add(r);
                     }
                     TestSickList sl = i as TestSickList;
                     if (!Global.IsEqual(sl, null))
                     {
                         newMedRecords.Add(sl);
                     }
                     TestDischargeSummary pds = i as TestDischargeSummary;
                     if (!Global.IsEqual(ds, null))
                     {
                         newMedRecords.Add(ds);
                     }
                     else
                     if (!Global.IsEqual(pds, null))
                     {
                         newMedRecords.Add(pds);
                     }
                     TestLaboratoryReport lr = i as TestLaboratoryReport;
                     if (!Global.IsEqual(lr, null))
                     {
                         newMedRecords.Add(lr);
                     }
                     TestConsultNote pcn = i as TestConsultNote;
                     if (!Global.IsEqual(cn, null))
                     {
                         newMedRecords.Add(cn);
                     }
                     else
                     if (!Global.IsEqual(pcn, null))
                     {
                         newMedRecords.Add(pcn);
                     }
                     TestDispensaryOne d = i as TestDispensaryOne;
                     if (!Global.IsEqual(d1, null))
                     {
                         newMedRecords.Add(d1);
                     }
                     else
                     if (!Global.IsEqual(d, null))
                     {
                         newMedRecords.Add(d);
                     }
                     TestAppointedMedication ap = i as TestAppointedMedication;
                     if (!Global.IsEqual(ap, null))
                     {
                         newMedRecords.Add(ap);
                     }
                 }
             }
             else
             {
                 if (!Global.IsEqual(tfi, null))
                 {
                     newMedRecords.Add(tfi);
                 }
                 if (!Global.IsEqual(cmd, null))
                 {
                     newMedRecords.Add(cmd);
                 }
                 if (!Global.IsEqual(ds, null))
                 {
                     newMedRecords.Add(ds);
                 }
                 if (!Global.IsEqual(cn, null))
                 {
                     newMedRecords.Add(cn);
                 }
             }
             this.records = newMedRecords;
         }
     }
 }
Ejemplo n.º 30
0
 public TestAmbCase(string guid, CaseAmb ca)
 {
     GUID = guid.ToLower();
     if (ca != null)
     {
         caseAmb  = ca;
         caseBase = new TestCaseBase(guid, ca);
         if (ca.Steps != null)
         {
             ambSteps = new List <TestAmbStep>();
             foreach (StepAmb i in ca.Steps)
             {
                 ambSteps.Add(new TestAmbStep(i, ca.IdLpu));
             }
         }
         if (ca.MedRecords != null)
         {
             records = new List <TestMedRecord>();
             foreach (object i in ca.MedRecords)
             {
                 Service ser = i as Service;
                 if (ser != null)
                 {
                     records.Add(new TestService(ser, ca.IdLpu));
                 }
                 TfomsInfo tfi = i as TfomsInfo;
                 if (tfi != null)
                 {
                     records.Add(new TestTfomsInfo(tfi));
                 }
                 ClinicMainDiagnosis cmd = i as ClinicMainDiagnosis;
                 if ((cmd != null) && (cmd.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                 {
                     records.Add(new TestClinicMainDiagnosis(cmd, ca.IdLpu));
                 }
                 if (cmd == null)
                 {
                     Diagnosis diag = i as Diagnosis;
                     if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                     {
                         records.Add(new TestClinicMainDiagnosis(diag, ca.IdLpu));
                     }
                     if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType != TestDiagnosis.IdClinicMainDiagnosis))
                     {
                         records.Add(new TestDiagnosis(diag, ca.IdLpu));
                     }
                 }
                 Referral r = i as Referral;
                 if (r != null)
                 {
                     records.Add(new TestReferral(r, ca.IdLpu));
                 }
                 SickList sl = i as SickList;
                 if (sl != null)
                 {
                     records.Add(new TestSickList(sl, ca.IdLpu));
                 }
                 DischargeSummary ds = i as DischargeSummary;
                 if (ds != null)
                 {
                     records.Add(new TestDischargeSummary(ds, ca.IdLpu));
                 }
                 LaboratoryReport lr = i as LaboratoryReport;
                 if (lr != null)
                 {
                     records.Add(new TestLaboratoryReport(lr, ca.IdLpu));
                 }
                 ConsultNote cn = i as ConsultNote;
                 if (cn != null)
                 {
                     records.Add(new TestConsultNote(cn, ca.IdLpu));
                 }
                 DispensaryOne d1 = i as DispensaryOne;
                 if ((d1 != null) && (ca.IdCaseType == TestAmbCase.dispanseryId))
                 {
                     records.Add(new TestDispensaryOne(d1, ca.IdLpu));
                 }
                 AppointedMedication ap = i as AppointedMedication;
                 if (ap != null)
                 {
                     records.Add(new TestAppointedMedication(ap, ca.IdLpu));
                 }
             }
         }
         if ((ca.IdLpu != null) && (ca.IdPatientMis != null))
         {
             List <TestStepBase> st = TestStepBase.BuildTestStepsFromDataBase(TestCaseBase.GetCaseId(guid, ca.IdLpu, ca.IdCaseMis, TestPerson.GetPersonId(guid, ca.IdLpu, ca.IdPatientMis)), ca.IdLpu);
             if (st != null)
             {
                 foreach (TestStepBase i in st)
                 {
                     if (Global.IsEqual(i.doctor, null))
                     {
                         defaultStep = i;
                     }
                 }
             }
         }
     }
 }