Beispiel #1
0
 //public ReferralTupleDto[] GetReferralList(string guid, string idLpu, byte idReferralType, DateTime startDate, DateTime endDate)
 //{
 //    List<TestReferralTuple> list = new List<TestReferralTuple>();
 //    var a = client.GetReferralList(guid, idLpu, idReferralType, startDate, endDate);
 //    if (a != null)
 //    {
 //        foreach (var i in a)
 //        {
 //            list.Add(new TestReferralTuple(i));
 //        }
 //    }
 //    Global.IsEqual(a, TestReferralTuple.BuildTestReferralTuple(idReferralType, startDate, endDate));
 //    return a;
 //}
 public void CancelCase(string guid, string idLpu, string idPatientMis, string idCaseMis)
 {
     try
     {
         client.CancelCase(guid, idLpu, idPatientMis, idCaseMis);
         TestCaseBase cb = TestCaseBase.BuildBaseCaseFromDataBaseData(guid, idLpu, idCaseMis, TestPerson.GetPersonId(guid, idLpu, idPatientMis));
         if (!cb.isCanceld)
         {
             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);
     }
 }
Beispiel #2
0
        static public TestAmbStep BuildAmbTestStepsFromDataBase(string guid, string patientMis, string idLpu, string caseMis, string stepMis)
        {
            string patientId = TestPerson.GetPersonId(guid, idLpu, patientMis);

            if (patientId != null)
            {
                string caseId = TestCaseBase.GetCaseId(guid, idLpu, caseMis, patientId);
                return(BuildAmbTestStepsFromDataBase(caseId, idLpu).Last(st => st.step.step.IdStepMis == stepMis));
            }
            return(null);
        }
Beispiel #3
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);
            }
        }
Beispiel #4
0
 private void FindMismatch(TestCaseBase cb)
 {
     if (this.caseBase.CloseDate != cb.caseBase.CloseDate)
     {
         Global.errors3.Add("несовпадение CloseDate TestCaseBase");
     }
     if (this.caseBase.Comment != cb.caseBase.Comment)
     {
         Global.errors3.Add("несовпадение Comment TestCaseBase");
     }
     if (this.caseBase.Confidentiality != cb.caseBase.Confidentiality)
     {
         Global.errors3.Add("несовпадение Confidentiality TestCaseBase");
     }
     if (this.caseBase.CuratorConfidentiality != cb.caseBase.CuratorConfidentiality)
     {
         Global.errors3.Add("несовпадение CuratorConfidentiality TestCaseBase");
     }
     if (this.caseBase.DoctorConfidentiality != cb.caseBase.DoctorConfidentiality)
     {
         Global.errors3.Add("несовпадение DoctorConfidentiality TestCaseBase");
     }
     if (this.caseBase.HistoryNumber != cb.caseBase.HistoryNumber)
     {
         Global.errors3.Add("несовпадение HistoryNumber TestCaseBase");
     }
     if (this.caseBase.IdCaseAidType != cb.caseBase.IdCaseAidType)
     {
         Global.errors3.Add("несовпадение IdCaseAidType TestCaseBase");
     }
     if (this.caseBase.IdCaseMis != cb.caseBase.IdCaseMis)
     {
         Global.errors3.Add("несовпадение IdCaseMis TestCaseBase");
     }
     if (this.caseBase.IdCaseResult != cb.caseBase.IdCaseResult)
     {
         Global.errors3.Add("несовпадение IdCaseResult TestCaseBase");
     }
     if (this.caseBase.IdLpu != cb.caseBase.IdLpu)
     {
         Global.errors3.Add("несовпадение IdLpu TestCaseBase");
     }
     if (this.caseBase.IdPaymentType != cb.caseBase.IdPaymentType)
     {
         Global.errors3.Add("несовпадение IdPaymentType TestCaseBase");
     }
     if (this.caseBase.OpenDate != cb.caseBase.OpenDate)
     {
         Global.errors3.Add("несовпадение OpenDate TestCaseBase");
     }
     if (Global.GetLength(this.guardian) != Global.GetLength(cb.guardian))
     {
         Global.errors3.Add("несовпадение длины guardian TestCaseBase");
     }
     if (Global.GetLength(this.patient) != Global.GetLength(cb.patient))
     {
         Global.errors3.Add("несовпадение длины patient TestCaseBase");
     }
     if (Global.GetLength(this.autor) != Global.GetLength(cb.autor))
     {
         Global.errors3.Add("несовпадение длины autor TestCaseBase");
     }
     if (Global.GetLength(this.authenticator) != Global.GetLength(cb.authenticator))
     {
         Global.errors3.Add("несовпадение длины authenticator TestCaseBase");
     }
     if (Global.GetLength(this.legalAuthenticator) != Global.GetLength(cb.legalAuthenticator))
     {
         Global.errors3.Add("несовпадение длины legalAuthenticator TestCaseBase");
     }
 }
Beispiel #5
0
        static public TestCaseBase BuildBaseCaseFromDataBaseData(string guid, string idlpu, string mis, string idPerson)
        {
            //idPerson = TestPerson.GetPersonId(guid, idlpu, idPerson);
            string caseId = GetCaseId(guid, idlpu, mis, idPerson);

            if (caseId != null)
            {
                using (SqlConnection connection = Global.GetSqlConnection())
                {
                    string     IdDoctor    = "";
                    string     IdGuardian  = "";
                    int        idCaseT     = 0;
                    bool       isCanceld   = false;
                    CaseBase   p           = new CaseBase();
                    string     findCase    = "SELECT TOP(1) * FROM \"Case\" WHERE IdCase = '" + caseId + "'";
                    SqlCommand caseCommand = new SqlCommand(findCase, connection);
                    using (SqlDataReader caseReader = caseCommand.ExecuteReader())
                    {
                        while (caseReader.Read())
                        {
                            if (caseReader["CloseDate"].ToString() != "")
                            {
                                p.CloseDate = Convert.ToDateTime(caseReader["CloseDate"]);
                            }
                            else
                            {
                                p.CloseDate = DateTime.MinValue;
                            }
                            if (caseReader["Comment"].ToString() != "")
                            {
                                p.Comment = Convert.ToString(caseReader["Comment"]);
                            }
                            else
                            {
                                p.Comment = null;
                            }
                            if (caseReader["HistoryNumber"].ToString() != "")
                            {
                                p.HistoryNumber = Convert.ToString(caseReader["HistoryNumber"]);
                            }
                            else
                            {
                                p.HistoryNumber = null;
                            }
                            if (caseReader["IdCaseAidType"].ToString() != "")
                            {
                                p.IdCaseAidType = Convert.ToByte(caseReader["IdCaseAidType"]);
                            }
                            else
                            {
                                p.IdCaseAidType = 0;
                            }
                            if (caseReader["IdCaseMis"].ToString() != "")
                            {
                                p.IdCaseMis = Convert.ToString(caseReader["IdCaseMis"]);
                            }
                            else
                            {
                                p.IdCaseMis = null;
                            }
                            if (caseReader["IdCaseResult"].ToString() != "")
                            {
                                p.IdCaseResult = Convert.ToByte(caseReader["IdCaseResult"]);
                            }
                            else
                            {
                                p.IdCaseResult = 0;
                            }
                            if (caseReader["IdCasePaymentType"].ToString() != "")
                            {
                                p.IdPaymentType = Convert.ToByte(caseReader["IdCasePaymentType"]);
                            }
                            else
                            {
                                p.IdPaymentType = 0;
                            }
                            if (caseReader["OpenDate"].ToString() != "")
                            {
                                p.OpenDate = Convert.ToDateTime(caseReader["OpenDate"]);
                            }
                            else
                            {
                                p.OpenDate = DateTime.MinValue;
                            }
                            if (caseReader["IDDoctor"].ToString() != "")
                            {
                                IdDoctor = Convert.ToString(caseReader["IDDoctor"]);
                            }
                            if (caseReader["IdGuardian"].ToString() != "")
                            {
                                IdGuardian = Convert.ToString(caseReader["IDGuardian"]);
                            }
                            if (caseReader["IdCaseType"].ToString() != "")
                            {
                                idCaseT = Convert.ToInt32(caseReader["IdCaseType"]);
                            }
                            isCanceld = Convert.ToBoolean(caseReader["IsCancelled"]);
                        }
                    }
                    findCase    = "SELECT * FROM mm_AccessRole2Case WHERE IdCase = '" + caseId + "'";
                    caseCommand = new SqlCommand(findCase, connection);
                    using (SqlDataReader caseReader = caseCommand.ExecuteReader())
                    {
                        while (caseReader.Read())
                        {
                            switch (caseReader["IdAccessRole"].ToString())
                            {
                            case "1":
                                p.Confidentiality = Convert.ToByte(caseReader["IdPrivacyLevel"]);
                                break;

                            case "2":
                                p.DoctorConfidentiality = Convert.ToByte(caseReader["IdPrivacyLevel"]);
                                break;

                            case "3":
                                p.CuratorConfidentiality = Convert.ToByte(caseReader["IdPrivacyLevel"]);
                                break;
                            }
                        }
                    }
                    p.IdCaseMis = mis;
                    p.IdLpu     = idlpu;
                    TestCaseBase cb = new TestCaseBase(guid, p);
                    cb.idCaseType = idCaseT;
                    cb.isCanceld  = isCanceld;
                    if (IdDoctor != "")
                    {
                        cb.doctorInCharge = TestDoctor.BuildTestDoctorFromDataBase(IdDoctor);
                    }
                    else
                    {
                        cb.doctorInCharge = null;
                    }
                    if (IdGuardian != "")
                    {
                        cb.guardian = TestGuardian.BuildTestGuardianFromDataBase(IdGuardian, idPerson);
                    }
                    else
                    {
                        cb.guardian = null;
                    }
                    if (idPerson != "")
                    {
                        cb.patient = TestPatient.BuildPatientFromDataBaseData(patientId: idPerson);
                    }
                    else
                    {
                        cb.patient = null;
                    }
                    findCase    = "SELECT * FROM mm_Author2Case WHERE IdCase = '" + caseId + "'";
                    caseCommand = new SqlCommand(findCase, connection);
                    using (SqlDataReader caseReader = caseCommand.ExecuteReader())
                    {
                        while (caseReader.Read())
                        {
                            switch (caseReader["IdAuthorshipType"].ToString())
                            {
                            case "1":
                                cb.autor = TestParticipant.BuildTestParticipantFromDataBase(caseId, Convert.ToString(caseReader["IdDoctor"]), 1);
                                break;

                            case "3":
                                cb.authenticator = TestParticipant.BuildTestParticipantFromDataBase(caseId, Convert.ToString(caseReader["IdDoctor"]), 3);
                                break;

                            case "4":
                                cb.legalAuthenticator = TestParticipant.BuildTestParticipantFromDataBase(caseId, Convert.ToString(caseReader["IdDoctor"]), 4);
                                break;
                            }
                        }
                    }
                    return(cb);
                }
            }
            return(null);
        }
Beispiel #6
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);
        }
Beispiel #7
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;
                     }
                 }
             }
         }
     }
 }
Beispiel #8
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);
 }
Beispiel #9
0
        public TestStatCase(string guid, CaseStat cs)
        {
            GUID = guid.ToLower();
            if (cs != null)
            {
                caseStat = cs;
                caseBase = new TestCaseBase(guid, cs);
                if (cs.Steps != null)
                {
                    statSteps = new List<TestStatStep>();
                    foreach (StepStat i in cs.Steps)
                    {
                        statSteps.Add(new TestStatStep(i, cs.IdLpu));
                    }
                }
                if (cs.MedRecords != null)
                {
                    records = new List<TestMedRecord>();
                    foreach (object i in cs.MedRecords)
                    {
                        Service ser = i as Service;
                        if (ser != null) records.Add(new TestService(ser, cs.IdLpu));

                        TfomsInfo tfi = i as TfomsInfo;
                        if (tfi != null) records.Add(new TestTfomsInfo(tfi));

                        DeathInfo di = i as DeathInfo;
                        if (di != null) records.Add(new TestDeathInfo(di));

                        ClinicMainDiagnosis cmd = i as ClinicMainDiagnosis;
                        if ((cmd != null) && (cs.HospResult != IdDeath) && (cmd.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                            records.Add(new TestClinicMainDiagnosis(cmd, cs.IdLpu));

                        AnatomopathologicalClinicMainDiagnosis acmd = i as AnatomopathologicalClinicMainDiagnosis;
                        if ((acmd != null) && (cs.HospResult == IdDeath) && (cmd.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                            records.Add(new TestClinicMainDiagnosis(acmd, cs.IdLpu));
                        if ((cmd == null) && (acmd == null))
                        {
                            Diagnosis diag = i as Diagnosis;
                            if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType != TestDiagnosis.IdClinicMainDiagnosis))
                                records.Add(new TestDiagnosis(diag, cs.IdLpu));
                            if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                                records.Add(new TestClinicMainDiagnosis(diag, cs.IdLpu));
                        }

                        Referral r = i as Referral;
                        if (r != null) records.Add(new TestReferral(r, cs.IdLpu));

                        SickList sl = i as SickList;
                        if (sl != null) records.Add(new TestSickList(sl, cs.IdLpu));

                        DischargeSummary ds = i as DischargeSummary;
                        if (ds != null) records.Add(new TestDischargeSummary(ds, cs.IdLpu));

                        LaboratoryReport lr = i as LaboratoryReport;
                        if (lr != null) records.Add(new TestLaboratoryReport(lr, cs.IdLpu));

                        ConsultNote cn = i as ConsultNote;
                        if (cn != null) records.Add(new TestConsultNote(cn, cs.IdLpu));

                        AppointedMedication ap = i as AppointedMedication;
                        if (ap != null) records.Add(new TestAppointedMedication(ap, cs.IdLpu));

                        Form027U form = i as Form027U;
                        if (form != null) records.Add(new TestForm027U(form, cs.IdLpu));
                    }
                }
                if ((cs.IdLpu != null) && (cs.IdPatientMis != null))
                {
                    List<TestStepBase> st = TestStepBase.BuildTestStepsFromDataBase(TestCaseBase.GetCaseId(guid, cs.IdLpu, cs.IdCaseMis, TestPerson.GetPersonId(guid, cs.IdLpu, cs.IdPatientMis)), cs.IdLpu);
                    if (st != null)
                    {
                        foreach (TestStepBase i in st)
                        {
                            if (Global.IsEqual(i.doctor, null))
                                defaultStep = i;
                        }
                    }
                }
            }
        }
Beispiel #10
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;
                 }
             }
         }
     }
 }
Beispiel #11
0
 public static TestCaseBase BuildBaseCaseFromDataBaseData(string guid, string idlpu, string mis, string idPerson)
 {
     //idPerson = TestPerson.GetPersonId(guid, idlpu, idPerson);
     string caseId = GetCaseId(guid, idlpu, mis, idPerson);
     if (caseId != null)
     {
         using (SqlConnection connection = Global.GetSqlConnection())
         {
             string IdDoctor = "";
             string IdGuardian = "";
             int idCaseT = 0;
             bool isCanceld = false;
             CaseBase p = new CaseBase();
             string findCase = "SELECT TOP(1) * FROM \"Case\" WHERE IdCase = '" + caseId + "'";
             SqlCommand caseCommand = new SqlCommand(findCase, connection);
             using (SqlDataReader caseReader = caseCommand.ExecuteReader())
             {
                 while (caseReader.Read())
                 {
                     if (caseReader["CloseDate"].ToString() != "")
                         p.CloseDate = Convert.ToDateTime(caseReader["CloseDate"]);
                     else
                         p.CloseDate = DateTime.MinValue;
                     if (caseReader["Comment"].ToString() != "")
                         p.Comment = Convert.ToString(caseReader["Comment"]);
                     else
                         p.Comment = null;
                     if (caseReader["HistoryNumber"].ToString() != "")
                         p.HistoryNumber = Convert.ToString(caseReader["HistoryNumber"]);
                     else
                         p.HistoryNumber = null;
                     if (caseReader["IdCaseAidType"].ToString() != "")
                         p.IdCaseAidType = Convert.ToByte(caseReader["IdCaseAidType"]);
                     else
                         p.IdCaseAidType = 0;
                     if (caseReader["IdCaseMis"].ToString() != "")
                         p.IdCaseMis = Convert.ToString(caseReader["IdCaseMis"]);
                     else
                         p.IdCaseMis = null;
                     if (caseReader["IdCaseResult"].ToString() != "")
                         p.IdCaseResult = Convert.ToByte(caseReader["IdCaseResult"]);
                     else
                         p.IdCaseResult = 0;
                     if (caseReader["IdCasePaymentType"].ToString() != "")
                         p.IdPaymentType = Convert.ToByte(caseReader["IdCasePaymentType"]);
                     else
                         p.IdPaymentType = 0;
                     if (caseReader["OpenDate"].ToString() != "")
                         p.OpenDate = Convert.ToDateTime(caseReader["OpenDate"]);
                     else
                         p.OpenDate = DateTime.MinValue;
                     if (caseReader["IDDoctor"].ToString() != "")
                         IdDoctor = Convert.ToString(caseReader["IDDoctor"]);
                     if (caseReader["IdGuardian"].ToString() != "")
                         IdGuardian = Convert.ToString(caseReader["IDGuardian"]);
                     if (caseReader["IdCaseType"].ToString() != "")
                         idCaseT = Convert.ToInt32(caseReader["IdCaseType"]);
                     isCanceld = Convert.ToBoolean(caseReader["IsCancelled"]);
                 }
             }
             findCase = "SELECT * FROM mm_AccessRole2Case WHERE IdCase = '" + caseId + "'";
             caseCommand = new SqlCommand(findCase, connection);
             using (SqlDataReader caseReader = caseCommand.ExecuteReader())
             {
                 while (caseReader.Read())
                 {
                     switch (caseReader["IdAccessRole"].ToString())
                     {
                         case "1":
                             p.Confidentiality = Convert.ToByte(caseReader["IdPrivacyLevel"]);
                             break;
                         case "2":
                             p.DoctorConfidentiality = Convert.ToByte(caseReader["IdPrivacyLevel"]);
                             break;
                         case "3":
                             p.CuratorConfidentiality = Convert.ToByte(caseReader["IdPrivacyLevel"]);
                             break;
                     }
                 }
             }
             p.IdCaseMis = mis;
             p.IdLpu = idlpu;
             TestCaseBase cb = new TestCaseBase(guid, p);
             cb.idCaseType = idCaseT;
             cb.isCanceld = isCanceld;
             if (IdDoctor != "")
                 cb.doctorInCharge = TestDoctor.BuildTestDoctorFromDataBase(IdDoctor);
             else
                 cb.doctorInCharge = null;
             if (IdGuardian != "")
                 cb.guardian = TestGuardian.BuildTestGuardianFromDataBase(IdGuardian, idPerson);
             else
                 cb.guardian = null;
             if (idPerson != "")
                 cb.patient = TestPatient.BuildPatientFromDataBaseData(patientId: idPerson);
             else
                 cb.patient = null;
             findCase = "SELECT * FROM mm_Author2Case WHERE IdCase = '" + caseId + "'";
             caseCommand = new SqlCommand(findCase, connection);
             using (SqlDataReader caseReader = caseCommand.ExecuteReader())
             {
                 while (caseReader.Read())
                 {
                     switch (caseReader["IdAuthorshipType"].ToString())
                     {
                         case "1":
                             cb.autor = TestParticipant.BuildTestParticipantFromDataBase(caseId, Convert.ToString(caseReader["IdDoctor"]), 1);
                             break;
                         case "3":
                             cb.authenticator = TestParticipant.BuildTestParticipantFromDataBase(caseId, Convert.ToString(caseReader["IdDoctor"]), 3);
                             break;
                         case "4":
                             cb.legalAuthenticator = TestParticipant.BuildTestParticipantFromDataBase(caseId, Convert.ToString(caseReader["IdDoctor"]), 4);
                             break;
                     }
                 }
             }
             return cb;
         }
     }
     return null;
 }
Beispiel #12
0
 private void FindMismatch(TestCaseBase cb)
 {
     if (this.caseBase.CloseDate != cb.caseBase.CloseDate)
         Global.errors3.Add("несовпадение CloseDate TestCaseBase");
     if (this.caseBase.Comment != cb.caseBase.Comment)
         Global.errors3.Add("несовпадение Comment TestCaseBase");
     if (this.caseBase.Confidentiality != cb.caseBase.Confidentiality)
         Global.errors3.Add("несовпадение Confidentiality TestCaseBase");
     if (this.caseBase.CuratorConfidentiality != cb.caseBase.CuratorConfidentiality)
         Global.errors3.Add("несовпадение CuratorConfidentiality TestCaseBase");
     if (this.caseBase.DoctorConfidentiality != cb.caseBase.DoctorConfidentiality)
         Global.errors3.Add("несовпадение DoctorConfidentiality TestCaseBase");
     if (this.caseBase.HistoryNumber != cb.caseBase.HistoryNumber)
         Global.errors3.Add("несовпадение HistoryNumber TestCaseBase");
     if (this.caseBase.IdCaseAidType != cb.caseBase.IdCaseAidType)
         Global.errors3.Add("несовпадение IdCaseAidType TestCaseBase");
     if (this.caseBase.IdCaseMis != cb.caseBase.IdCaseMis)
         Global.errors3.Add("несовпадение IdCaseMis TestCaseBase");
     if (this.caseBase.IdCaseResult != cb.caseBase.IdCaseResult)
         Global.errors3.Add("несовпадение IdCaseResult TestCaseBase");
     if (this.caseBase.IdLpu != cb.caseBase.IdLpu)
         Global.errors3.Add("несовпадение IdLpu TestCaseBase");
     if (this.caseBase.IdPaymentType != cb.caseBase.IdPaymentType)
         Global.errors3.Add("несовпадение IdPaymentType TestCaseBase");
     if (this.caseBase.OpenDate != cb.caseBase.OpenDate)
         Global.errors3.Add("несовпадение OpenDate TestCaseBase");
     if (Global.GetLength(this.guardian) != Global.GetLength(cb.guardian))
         Global.errors3.Add("несовпадение длины guardian TestCaseBase");
     if (Global.GetLength(this.patient) != Global.GetLength(cb.patient))
         Global.errors3.Add("несовпадение длины patient TestCaseBase");
     if (Global.GetLength(this.autor) != Global.GetLength(cb.autor))
         Global.errors3.Add("несовпадение длины autor TestCaseBase");
     if (Global.GetLength(this.authenticator) != Global.GetLength(cb.authenticator))
         Global.errors3.Add("несовпадение длины authenticator TestCaseBase");
     if (Global.GetLength(this.legalAuthenticator) != Global.GetLength(cb.legalAuthenticator))
         Global.errors3.Add("несовпадение длины legalAuthenticator TestCaseBase");
 }
Beispiel #13
0
        public TestStatCase(string guid, CaseStat cs)
        {
            GUID = guid.ToLower();
            if (cs != null)
            {
                caseStat = cs;
                caseBase = new TestCaseBase(guid, cs);
                if (cs.Steps != null)
                {
                    statSteps = new List <TestStatStep>();
                    foreach (StepStat i in cs.Steps)
                    {
                        statSteps.Add(new TestStatStep(i, cs.IdLpu));
                    }
                }
                if (cs.MedRecords != null)
                {
                    records = new List <TestMedRecord>();
                    foreach (object i in cs.MedRecords)
                    {
                        Service ser = i as Service;
                        if (ser != null)
                        {
                            records.Add(new TestService(ser, cs.IdLpu));
                        }

                        TfomsInfo tfi = i as TfomsInfo;
                        if (tfi != null)
                        {
                            records.Add(new TestTfomsInfo(tfi));
                        }

                        DeathInfo di = i as DeathInfo;
                        if (di != null)
                        {
                            records.Add(new TestDeathInfo(di));
                        }

                        ClinicMainDiagnosis cmd = i as ClinicMainDiagnosis;
                        if ((cmd != null) && (cs.HospResult != IdDeath) && (cmd.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                        {
                            records.Add(new TestClinicMainDiagnosis(cmd, cs.IdLpu));
                        }

                        AnatomopathologicalClinicMainDiagnosis acmd = i as AnatomopathologicalClinicMainDiagnosis;
                        if ((acmd != null) && (cs.HospResult == IdDeath) && (cmd.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                        {
                            records.Add(new TestClinicMainDiagnosis(acmd, cs.IdLpu));
                        }
                        if ((cmd == null) && (acmd == null))
                        {
                            Diagnosis diag = i as Diagnosis;
                            if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType != TestDiagnosis.IdClinicMainDiagnosis))
                            {
                                records.Add(new TestDiagnosis(diag, cs.IdLpu));
                            }
                            if ((diag != null) && (diag.DiagnosisInfo.IdDiagnosisType == TestDiagnosis.IdClinicMainDiagnosis))
                            {
                                records.Add(new TestClinicMainDiagnosis(diag, cs.IdLpu));
                            }
                        }

                        Referral r = i as Referral;
                        if (r != null)
                        {
                            records.Add(new TestReferral(r, cs.IdLpu));
                        }

                        SickList sl = i as SickList;
                        if (sl != null)
                        {
                            records.Add(new TestSickList(sl, cs.IdLpu));
                        }

                        DischargeSummary ds = i as DischargeSummary;
                        if (ds != null)
                        {
                            records.Add(new TestDischargeSummary(ds, cs.IdLpu));
                        }

                        LaboratoryReport lr = i as LaboratoryReport;
                        if (lr != null)
                        {
                            records.Add(new TestLaboratoryReport(lr, cs.IdLpu));
                        }

                        ConsultNote cn = i as ConsultNote;
                        if (cn != null)
                        {
                            records.Add(new TestConsultNote(cn, cs.IdLpu));
                        }

                        AppointedMedication ap = i as AppointedMedication;
                        if (ap != null)
                        {
                            records.Add(new TestAppointedMedication(ap, cs.IdLpu));
                        }

                        Form027U form = i as Form027U;
                        if (form != null)
                        {
                            records.Add(new TestForm027U(form, cs.IdLpu));
                        }
                    }
                }
                if ((cs.IdLpu != null) && (cs.IdPatientMis != null))
                {
                    List <TestStepBase> st = TestStepBase.BuildTestStepsFromDataBase(TestCaseBase.GetCaseId(guid, cs.IdLpu, cs.IdCaseMis, TestPerson.GetPersonId(guid, cs.IdLpu, cs.IdPatientMis)), cs.IdLpu);
                    if (st != null)
                    {
                        foreach (TestStepBase i in st)
                        {
                            if (Global.IsEqual(i.doctor, null))
                            {
                                defaultStep = i;
                            }
                        }
                    }
                }
            }
        }
Beispiel #14
0
        static public TestStatCase BuildAmbCaseFromDataBaseData(string guid, string idlpu, string mis, string patientId)
        {
            if ((guid != string.Empty) && (idlpu != string.Empty) && (mis != string.Empty))
            {
                string caseId = TestCaseBase.GetCaseId(guid, idlpu, mis, patientId);
                if (caseId != null)
                {
                    CaseStat ca = new CaseStat();
                    using (SqlConnection connection = Global.GetSqlConnection())
                    {
                        string     findCase    = "SELECT TOP(1) * FROM HospCase WHERE IdCase = '" + caseId + "'";
                        SqlCommand caseCommand = new SqlCommand(findCase, connection);
                        using (SqlDataReader caseReader = caseCommand.ExecuteReader())
                        {
                            while (caseReader.Read())
                            {
                                if (caseReader["DeliveredCode"].ToString() != "")
                                {
                                    ca.DeliveryCode = Convert.ToString(caseReader["DeliveredCode"]);
                                }
                                if (caseReader["IdIntoxicationType"].ToString() != "")
                                {
                                    ca.IdIntoxicationType = Convert.ToByte(caseReader["IdIntoxicationType"]);
                                }
                                if (caseReader["IdPatientConditionOnAdmission"].ToString() != "")
                                {
                                    ca.IdPatientConditionOnAdmission = Convert.ToByte(caseReader["IdPatientConditionOnAdmission"]);
                                }
                                if (caseReader["IdTypeFromDiseaseStart"].ToString() != "")
                                {
                                    ca.IdTypeFromDiseaseStart = Convert.ToByte(caseReader["IdTypeFromDiseaseStart"]);
                                }
                                if (caseReader["IdTransportIntern"].ToString() != "")
                                {
                                    ca.IdTransportIntern = Convert.ToByte(caseReader["IdTransportIntern"]);
                                }
                                if (caseReader["IdHospChannel"].ToString() != "")
                                {
                                    ca.IdHospChannel = Convert.ToByte(caseReader["IdHospChannel"]);
                                }
                                if (caseReader["RW1Mark"].ToString() != "")
                                {
                                    ca.RW1Mark = Convert.ToBoolean(caseReader["RW1Mark"]);
                                }
                                if (caseReader["AIDSMark"].ToString() != "")
                                {
                                    ca.AIDSMark = Convert.ToBoolean(caseReader["AIDSMark"]);
                                }
                                TestStatCase statcase = new TestStatCase(guid, ca);
                                statcase.caseBase  = TestCaseBase.BuildBaseCaseFromDataBaseData(guid, idlpu, mis, patientId);
                                statcase.statSteps = TestStatStep.BuildStatStepsFromDataBase(caseId, ca.IdLpu);
                                List <TestStepBase> st = TestStepBase.BuildTestStepsFromDataBase(caseId, ca.IdLpu);
                                if (st != null)
                                {
                                    foreach (TestStepBase i in st)
                                    {
                                        if (Global.IsEqual(i.doctor, null))
                                        {
                                            statcase.defaultStep = i;
                                        }
                                    }
                                    if (!Global.IsEqual(statcase.defaultStep, null))
                                    {
                                        statcase.records = new List <TestMedRecord>();
                                        List <TestService> serv = TestService.BuildServiseFromDataBaseData(statcase.defaultStep.idStep);
                                        if (!Global.IsEqual(serv, null))
                                        {
                                            statcase.records.AddRange(serv);
                                        }

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

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

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

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

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

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

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

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

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

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

                                        List <TestForm027U> form = TestForm027U.BuildForm027UFromDataBaseData(statcase.defaultStep.idStep);
                                        if (!Global.IsEqual(form, null))
                                        {
                                            statcase.records.AddRange(form);
                                        }

                                        if (statcase.records.Count == 0)
                                        {
                                            statcase.records = null;
                                        }
                                    }
                                }
                                return(statcase);
                            }
                        }
                    }
                }
            }
            return(null);
        }