Exemple #1
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);
            }
        }
Exemple #2
0
        public bool CheckCaseInDataBase()
        {
            string       patientId = TestPerson.GetPersonId(GUID, caseBase.caseBase.IdLpu, caseBase.patient.patient.IdPatientMIS);
            TestStatCase ac        = TestStatCase.BuildAmbCaseFromDataBaseData(GUID, caseBase.caseBase.IdLpu, caseBase.caseBase.IdCaseMis, patientId);

            this.Equals(ac);
            return(this == ac);
        }
Exemple #3
0
 private void FindMismatch(TestStatCase cs)
 {
     if (this.caseStat.DeliveryCode != cs.caseStat.DeliveryCode)
     {
         Global.errors2.Add("несовпадение DeliveryCode caseStat");
     }
     if (this.caseStat.IdIntoxicationType != cs.caseStat.IdIntoxicationType)
     {
         Global.errors2.Add("несовпадение IdIntoxicationType caseStat");
     }
     if (this.caseStat.IdPatientConditionOnAdmission != cs.caseStat.IdPatientConditionOnAdmission)
     {
         Global.errors2.Add("несовпадение IdPatientConditionOnAdmission caseStat");
     }
     if (this.caseStat.IdTypeFromDiseaseStart != cs.caseStat.IdTypeFromDiseaseStart)
     {
         Global.errors2.Add("несовпадение IdTypeFromDiseaseStart caseStat");
     }
     if (this.caseStat.IdTransportIntern != cs.caseStat.IdTransportIntern)
     {
         Global.errors2.Add("несовпадение IdTransportIntern caseStat");
     }
     if (this.caseStat.IdHospChannel != cs.caseStat.IdHospChannel)
     {
         Global.errors2.Add("несовпадение IdHospChannel caseStat");
     }
     if (this.caseStat.RW1Mark != cs.caseStat.RW1Mark)
     {
         Global.errors2.Add("несовпадение RW1Mark caseStat");
     }
     if (this.caseStat.AIDSMark != cs.caseStat.AIDSMark)
     {
         Global.errors2.Add("несовпадение AIDSMark caseStat");
     }
     if (Global.GetLength(this.medRecords) != Global.GetLength(cs.medRecords))
     {
         Global.errors2.Add("несовпадение длины medRecords caseStat");
     }
     if (Global.GetLength(this.steps) != Global.GetLength(cs.steps))
     {
         Global.errors2.Add("несовпадение длины statSteps caseStat");
     }
     if (Global.GetLength(this.caseBase) != Global.GetLength(cs.caseBase))
     {
         Global.errors2.Add("несовпадение длины caseBase caseStat");
     }
 }
Exemple #4
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);
     }
 }
Exemple #5
0
 private void FindMismatch(TestStatCase cs)
 {
     if (this.caseStat.DeliveryCode != cs.caseStat.DeliveryCode)
         Global.errors2.Add("несовпадение DeliveryCode caseStat");
     if (this.caseStat.IdIntoxicationType != cs.caseStat.IdIntoxicationType)
         Global.errors2.Add("несовпадение IdIntoxicationType caseStat");
     if (this.caseStat.IdPatientConditionOnAdmission != cs.caseStat.IdPatientConditionOnAdmission)
         Global.errors2.Add("несовпадение IdPatientConditionOnAdmission caseStat");
     if (this.caseStat.IdTypeFromDiseaseStart != cs.caseStat.IdTypeFromDiseaseStart)
         Global.errors2.Add("несовпадение IdTypeFromDiseaseStart caseStat");
     if (this.caseStat.IdTransportIntern != cs.caseStat.IdTransportIntern)
         Global.errors2.Add("несовпадение IdTransportIntern caseStat");
     if (this.caseStat.IdHospChannel != cs.caseStat.IdHospChannel)
         Global.errors2.Add("несовпадение IdHospChannel caseStat");
     if (this.caseStat.RW1Mark != cs.caseStat.RW1Mark)
         Global.errors2.Add("несовпадение RW1Mark caseStat");
     if (this.caseStat.AIDSMark != cs.caseStat.AIDSMark)
         Global.errors2.Add("несовпадение AIDSMark caseStat");
     if (Global.GetLength(this.medRecords) != Global.GetLength(cs.medRecords))
         Global.errors2.Add("несовпадение длины medRecords caseStat");
     if (Global.GetLength(this.steps) != Global.GetLength(cs.steps))
         Global.errors2.Add("несовпадение длины statSteps caseStat");
     if (Global.GetLength(this.caseBase) != Global.GetLength(cs.caseBase))
         Global.errors2.Add("несовпадение длины caseBase caseStat");
 }
Exemple #6
0
        public static 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;
        }
Exemple #7
0
        private void CaseWork(string guid, CaseBase c, string method)
        {
            try
            {
                CaseAmb ca = c as CaseAmb;
                if ((object)ca != null)
                {
                    TestAmbCase example = null;
                    switch (method)
                    {
                    case "AddCase":
                        client.AddCase(guid, ca);
                        example = new TestAmbCase(guid, ca);
                        break;

                    case "CreateCase":
                        client.CreateCase(guid, ca);
                        example = new TestAmbCase(guid, ca);
                        break;

                    case "CloseCase":
                        string patientId = TestPerson.GetPersonId(guid, ca.IdLpu, ca.IdPatientMis);
                        example = TestAmbCase.BuildAmbCaseFromDataBaseData(guid, ca.IdLpu, ca.IdCaseMis, patientId);
                        client.CloseCase(guid, ca);
                        example.ChangeUpdateAmbCase(guid, ca);
                        break;

                    case "UpdateCase":
                        client.UpdateCase(guid, ca);
                        example = new TestAmbCase(guid, ca);
                        break;
                    }
                    if (!example.CheckCaseInDataBase())
                    {
                        Global.errors1.AddRange(Global.errors2);
                        Global.errors1.Add("Несовпадение");
                    }
                }
                CaseStat cs = c as CaseStat;
                if ((object)cs != null)
                {
                    TestStatCase example = null;
                    switch (method)
                    {
                    case "AddCase":
                        client.AddCase(guid, cs);
                        example = new TestStatCase(guid, cs);
                        break;

                    case "CreateCase":
                        client.CreateCase(guid, cs);
                        example = new TestStatCase(guid, cs);
                        break;

                    case "CloseCase":
                        string patientId = TestPerson.GetPersonId(guid, cs.IdLpu, cs.IdPatientMis);
                        example = TestStatCase.BuildAmbCaseFromDataBaseData(guid, cs.IdLpu, cs.IdCaseMis, patientId);
                        client.CloseCase(guid, cs);
                        example.ChangeUpdateStatCase(guid, cs);
                        break;

                    case "UpdateCase":
                        client.UpdateCase(guid, cs);
                        example = new TestStatCase(guid, cs);
                        break;
                    }
                    if (!example.CheckCaseInDataBase())
                    {
                        Global.errors1.AddRange(Global.errors2);
                        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);
            }
            //catch (Exception e)
            //{

            //}
        }
Exemple #8
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);
                }
            }
        }
Exemple #9
0
        private void CaseWork(string guid, CaseBase c, string method)
        {
            try
            {
                CaseAmb ca = c as CaseAmb;
                if ((object)ca != null)
                {
                    TestAmbCase example = null;
                    switch (method)
                    {
                        case "AddCase":
                            client.AddCase(guid, ca);
                            example = new TestAmbCase(guid, ca);
                            break;
                        case "CreateCase":
                            client.CreateCase(guid, ca);
                            example = new TestAmbCase(guid, ca);
                            break;
                        case "CloseCase":
                            string patientId = TestPerson.GetPersonId(guid, ca.IdLpu, ca.IdPatientMis);
                            example = TestAmbCase.BuildAmbCaseFromDataBaseData(guid, ca.IdLpu, ca.IdCaseMis, patientId);
                            client.CloseCase(guid, ca);
                            example.ChangeUpdateAmbCase(guid, ca);
                            break;
                        case "UpdateCase":
                            client.UpdateCase(guid, ca);
                            example = new TestAmbCase(guid, ca);
                            break;
                    }
                    if (!example.CheckCaseInDataBase())
                    {
                        Global.errors1.AddRange(Global.errors2);
                        Global.errors1.Add("Несовпадение");
                    }
                }
                CaseStat cs = c as CaseStat;
                if ((object)cs != null)
                {
                    TestStatCase example = null;
                    switch (method)
                    {
                        case "AddCase":
                            client.AddCase(guid, cs);
                            example = new TestStatCase(guid, cs);
                            break;
                        case "CreateCase":
                            client.CreateCase(guid, cs);
                            example = new TestStatCase(guid, cs);
                            break;
                        case "CloseCase":
                            string patientId = TestPerson.GetPersonId(guid, cs.IdLpu, cs.IdPatientMis);
                            example = TestStatCase.BuildAmbCaseFromDataBaseData(guid, cs.IdLpu, cs.IdCaseMis, patientId);
                            client.CloseCase(guid, cs);
                            example.ChangeUpdateStatCase(guid, cs);
                            break;
                        case "UpdateCase":
                            client.UpdateCase(guid, cs);
                            example = new TestStatCase(guid, cs);
                            break;
                    }
                    if (!example.CheckCaseInDataBase())
                    {
                        Global.errors1.AddRange(Global.errors2);
                        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);
            }
            //catch (Exception e)
            //{

            //}
        }
Exemple #10
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);
        }