Пример #1
0
 public TestGuardian(Guardian g)
 {
     if (g != null)
     {
         guardian = g;
         if (g.Person != null)
             person = new TestPerson(g.Person);
     }
 }
Пример #2
0
 public TestDoctor(MedicalStaff d, string idLpu = "")
 {
     if (d != null)
     {
         doctor = d;
         if (d.IdLpu == null)
             d.IdLpu = idLpu;
         if (d.Person != null)
             person = new TestPerson(d.Person);
     }
 }
Пример #3
0
 public TestDoctor(MedicalStaff d, string idLpu = "")
 {
     if (d != null)
     {
         doctor = d;
         if (d.IdLpu == null)
         {
             d.IdLpu = idLpu;
         }
         if (d.Person != null)
         {
             person = new TestPerson(d.Person);
         }
     }
 }
Пример #4
0
 static public TestDoctor BuildTestDoctorFromDataBase(string doctorId)
 {
     if (doctorId != null)
     {
         using (SqlConnection connection = Global.GetSqlConnection())
         {
             string     findDoctor = "SELECT TOP(1) * FROM Doctor, nsi.DoctorSpec WHERE Doctor.IdDoctor = '" + doctorId + "' AND Doctor.IdSpeciality = nsi.DoctorSpec.IdSpeciality";
             SqlCommand doc        = new SqlCommand(findDoctor, connection);
             using (SqlDataReader doctorReader = doc.ExecuteReader())
             {
                 while (doctorReader.Read())
                 {
                     string       IdPerson = Convert.ToString(doctorReader["IdPerson"]);
                     MedicalStaff ms       = new MedicalStaff();
                     ms.IdPosition   = Convert.ToUInt16(doctorReader["IdPosition"]);
                     ms.IdSpeciality = Convert.ToUInt16(doctorReader["Code"]);
                     ms.IdLpu        = Convert.ToString(doctorReader["IdLpu"]);
                     if (Data.type == Type.oid)
                     {
                         string findIdInstitutionalString =
                             "SELECT TOP(1) * FROM Institution WHERE IdInstitution = '" + ms.IdLpu + "'";
                         using (SqlConnection connection2 = Global.GetSqlConnection())
                         {
                             SqlCommand IdInstitution = new SqlCommand(findIdInstitutionalString, connection2);
                             using (SqlDataReader IdInstitutional = IdInstitution.ExecuteReader())
                             {
                                 while (IdInstitutional.Read())
                                 {
                                     ms.IdLpu = IdInstitutional["IdFedNsi"].ToString();
                                 }
                             }
                         }
                     }
                     TestDoctor p = new TestDoctor(ms);
                     p.person = TestPerson.BuildPersonFromDataBaseData(IdPerson);
                     return(p);
                 }
             }
         }
     }
     return(null);
 }
Пример #5
0
        public override bool Equals(Object obj)
        {
            TestPerson p = obj as TestPerson;

            if ((object)p == null)
            {
                return(false);
            }
            if ((this.person.Birthdate == p.person.Birthdate) &&
                (this.person.IdPersonMis == p.person.IdPersonMis) &&
                (Global.IsEqual(this.docs, p.docs)) &&
                (this.person.Sex == p.person.Sex) &&
                (Global.IsEqual(this.name, p.name)))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestPerson");
                return(false);
            }
        }
Пример #6
0
 private void FindMismatch(TestPerson b)
 {
     if (this.person.Birthdate != b.person.Birthdate)
     {
         Global.errors3.Add("Несовпадение Birthdate TestPerson");
     }
     if (this.person.Sex != b.person.Sex)
     {
         Global.errors3.Add("Несовпадение Sex TestPerson");
     }
     if (this.person.IdPersonMis != b.person.IdPersonMis)
     {
         Global.errors3.Add("Несовпадение IdPersonMis TestPerson");
     }
     if (Global.GetLength(this.docs) != Global.GetLength(b.docs))
     {
         Global.errors3.Add("Несовпадение длины Documents TestPerson");
     }
     if (Global.GetLength(this.name) != Global.GetLength(b.name))
     {
         Global.errors3.Add("Несовпадение длины name TestPerson");
     }
 }
Пример #7
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);
        }
Пример #8
0
 public static TestPerson BuildPersonFromDataBaseData(string personId)
 {
     string mis = GetIDMIS(personId);
     if (personId != null)
     {
         using (SqlConnection connection = Global.GetSqlConnection())
         {
             string findPatient = "SELECT TOP(1) * FROM Person WHERE IdPerson = '" + personId + "'";
             SqlCommand person = new SqlCommand(findPatient, connection);
             using (SqlDataReader personFromDataBase = person.ExecuteReader())
             {
                 PersonWithIdentity p = new PersonWithIdentity();
                 while (personFromDataBase.Read())
                 {
                     if (personFromDataBase["BirthDate"].ToString() != "")
                         p.Birthdate = Convert.ToDateTime(personFromDataBase["BirthDate"]);
                     p.Sex = Convert.ToByte(personFromDataBase["IdSex"]);
                 }
                 p.IdPersonMis = mis;
                 TestPerson pers = new TestPerson(p);
                 pers.name = TestHumanName.BuildHumanNameFromDataBaseData(personId);
                 pers.documents = TestIdentityDocument.BuildDocumentsFromDataBaseData(personId);
                 return pers;
             }
         }
     }
     return null;
 }
Пример #9
0
 private void FindMismatch(TestPerson b)
 {
     if (this.person.Birthdate != b.person.Birthdate)
         Global.errors3.Add("Несовпадение Birthdate TestPerson");
     if (this.person.Sex != b.person.Sex)
         Global.errors3.Add("Несовпадение Sex TestPerson");
     if (this.person.IdPersonMis != b.person.IdPersonMis)
         Global.errors3.Add("Несовпадение IdPersonMis TestPerson");
     if (Global.GetLength(this.docs) != Global.GetLength(b.docs))
         Global.errors3.Add("Несовпадение длины Documents TestPerson");
     if (Global.GetLength(this.name) != Global.GetLength(b.name))
         Global.errors3.Add("Несовпадение длины name TestPerson");
 }
Пример #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;
                     }
                 }
             }
         }
     }
 }
Пример #11
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)
            //{

            //}
        }
Пример #12
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);
     }
 }
Пример #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;
                            }
                        }
                    }
                }
            }
        }