Beispiel #1
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);
            }
        }
Beispiel #2
0
 private void FindMismatch(TestAmbStep astep)
 {
     if (this.ambStep.IdVisitPlace != astep.ambStep.IdVisitPlace)
     {
         Global.errors3.Add("несовпадение IdVisitPlace TestAmbStep");
     }
     if (this.ambStep.IdVisitPurpose != astep.ambStep.IdVisitPurpose)
     {
         Global.errors3.Add("несовпадение IdVisitPurpose TestAmbStep");
     }
     if (Global.GetLength(this.medRecords) != Global.GetLength(astep.medRecords))
     {
         Global.errors3.Add("несовпадение длинны medRecords TestAmbStep");
     }
     if (Global.GetLength(this.step) != Global.GetLength(astep.step))
     {
         Global.errors3.Add("несовпадение длинны step TestAmbStep");
     }
 }
Beispiel #3
0
 public void AddStepToCase(string guid, string idLpu, string idPatientMis, string idCaseMis, StepBase s)
 {
     try
     {
         StepAmb sa = s as StepAmb;
         if ((object)sa != null)
         {
             client.AddStepToCase(guid, idLpu, idPatientMis, idCaseMis, s);
             TestAmbStep example = new TestAmbStep(sa, idLpu);
             if (!example.CheckStepInDataBase(guid, idPatientMis, idLpu, idCaseMis))
             {
                 Global.errors1.AddRange(Global.errors2);
             }
         }
         StepStat ss = s as StepStat;
         if ((object)ss != null)
         {
             client.AddStepToCase(guid, idLpu, idPatientMis, idCaseMis, s);
             TestStatStep example = new TestStatStep(ss, idLpu);
             if (!example.CheckStepInDataBase(guid, idPatientMis, idLpu, idCaseMis))
             {
                 Global.errors1.AddRange(Global.errors2);
             }
         }
     }
     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 #4
0
 public void AddStepToCase(string guid, string idLpu, string idPatientMis, string idCaseMis, StepBase s)
 {
     try
     {
         StepAmb sa = s as StepAmb;
         if ((object)sa != null)
         {
             client.AddStepToCase(guid, idLpu, idPatientMis, idCaseMis ,s);
             TestAmbStep example = new TestAmbStep(sa, idLpu);
             if (!example.CheckStepInDataBase(guid, idPatientMis, idLpu, idCaseMis))
             {
                 Global.errors1.AddRange(Global.errors2);
             }
         }
         StepStat ss = s as StepStat;
         if ((object)ss != null)
         {
             client.AddStepToCase(guid, idLpu, idPatientMis, idCaseMis, s);
             TestStatStep example = new TestStatStep(ss, idLpu);
             if (!example.CheckStepInDataBase(guid, idPatientMis, idLpu, idCaseMis))
                 Global.errors1.AddRange(Global.errors2);
         }
     }
     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 #5
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 #6
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);
            }
        }
Beispiel #7
0
        public bool CheckStepInDataBase(string guid, string patientMis, string idLpu, string caseMis)
        {
            TestAmbStep tas = TestAmbStep.BuildAmbTestStepsFromDataBase(guid, patientMis, idLpu, caseMis, this.step.step.IdStepMis);

            return(this == tas);
        }
Beispiel #8
0
 public static 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;
 }
Beispiel #9
0
 private void FindMismatch(TestAmbStep astep)
 {
     if (this.ambStep.IdVisitPlace != astep.ambStep.IdVisitPlace)
         Global.errors3.Add("несовпадение IdVisitPlace TestAmbStep");
     if (this.ambStep.IdVisitPurpose != astep.ambStep.IdVisitPurpose)
         Global.errors3.Add("несовпадение IdVisitPurpose TestAmbStep");
     if (Global.GetLength(this.medRecords) != Global.GetLength(astep.medRecords))
         Global.errors3.Add("несовпадение длинны medRecords TestAmbStep");
     if (Global.GetLength(this.step) != Global.GetLength(astep.step))
         Global.errors3.Add("несовпадение длинны step TestAmbStep");
 }