示例#1
0
 public void AddPatient(string guid, string idlpu, PatientDto patient)
 {
     TestPatient p = new TestPatient(guid, idlpu, patient);
     try
     {
         p.DeletePatient();
         client.AddPatient(guid, idlpu, patient);
         p = new TestPatient(guid, idlpu, patient);
         TestPatient a = TestPatient.BuildPatientFromDataBaseData(guid, idlpu, patient.IdPatientMIS);
         if (!p.CheckPatientInDataBase())
         {
             Global.errors1.AddRange(Global.errors2);
             Global.errors1.Add("Не совпадение значений объектов");
         }
     }
     catch (System.ServiceModel.FaultException<PixServiseTests.PixServise.RequestFault> we)
     {
         if (we.Detail.Message == reinclusionString)
         {
             TestPatient wwww = TestPatient.BuildPatientFromDataBaseData(guid ,idlpu, patient.IdPatientMIS);
             if (TestPatient.BuildPatientFromDataBaseData(guid ,idlpu, patient.IdPatientMIS) == null)
                 Global.errors1.Add("Ошибочное сообщение о попытке повторного добавления");
             else
                 Global.errors1.Add(we.Detail.Message);
         }
         else
         {
             Global.errors1.Add(we.Detail.Message);
         }
     }
 }
示例#2
0
        private bool CheckField(TestPatient returnedPatient, TestPatient examplePatient)
        {
            bool mark = true;

            if ((examplePatient.patient.FamilyName == null) || (examplePatient.patient.FamilyName == returnedPatient.patient.FamilyName))
            {
                ;
            }
            else
            {
                Global.errors1.Add("Не верная фамилия, возвращено: " + returnedPatient.patient.FamilyName.ToString());
                mark = false;
            }
            if ((examplePatient.patient.GivenName == null) || (examplePatient.patient.GivenName == returnedPatient.patient.GivenName))
            {
                ;
            }
            else
            {
                Global.errors1.Add("Не верное имя, возвращено: " + returnedPatient.patient.GivenName.ToString());
                mark = false;
            }
            if ((examplePatient.patient.BirthDate == DateTime.MinValue) || (examplePatient.patient.BirthDate == returnedPatient.patient.BirthDate))
            {
                ;
            }
            else
            {
                Global.errors1.Add("Не верная дата рождения, возвращено: " + returnedPatient.patient.BirthDate.ToString());
                mark = false;
            }
            if ((examplePatient.patient.Sex == 0) || (examplePatient.patient.Sex == returnedPatient.patient.Sex))
            {
                ;
            }
            else
            {
                Global.errors1.Add("Не верный пол, возвращено: " + returnedPatient.patient.Sex.ToString());
                mark = false;
            }
            if (examplePatient.documents != null)
            {
                foreach (TestDocument doc in returnedPatient.documents)
                {
                    TestDocument exampledoc = examplePatient.documents[0];
                    if ((exampledoc.document.DocN == doc.document.DocN) &&
                        (exampledoc.document.DocS == doc.document.DocS) &&
                        (exampledoc.document.IdDocumentType == doc.document.IdDocumentType))
                    {
                        ;
                    }
                    else
                    {
                        Global.errors1.Add("Несоответствие документов");
                        mark = false;
                    }
                }
            }
            return(mark);
        }
示例#3
0
        public bool CheckPatientInDataBase()
        {
            TestPatient p = TestPatient.BuildPatientFromDataBaseData(GUID, IDLPU, patient.IdPatientMIS);

            this.Equals(p);
            return(this == p);
        }
示例#4
0
 public TestCaseBase(string guid, CaseBase cb)
 {
     GUID = guid.ToLower();
     if (cb != null)
     {
         caseBase = cb;
         if (caseBase.OpenDate == null)
         {
             caseBase.OpenDate = DateTime.MinValue;
         }
         if (caseBase.CloseDate == null)
         {
             caseBase.CloseDate = DateTime.MinValue;
         }
     }
     if (cb.Author != null)
     {
         autor = new TestParticipant(cb.Author, cb.IdLpu);
         if (autor.doctor.doctor.IdLpu == null)
         {
             autor.doctor.doctor.IdLpu = cb.IdLpu;
         }
     }
     if (cb.Authenticator != null)
     {
         authenticator = new TestParticipant(cb.Authenticator, cb.IdLpu);
         if (authenticator.doctor.doctor.IdLpu == null)
         {
             authenticator.doctor.doctor.IdLpu = cb.IdLpu;
         }
     }
     if (cb.LegalAuthenticator != null)
     {
         legalAuthenticator = new TestParticipant(cb.LegalAuthenticator, cb.IdLpu);
         if (legalAuthenticator.doctor.doctor.IdLpu == null)
         {
             legalAuthenticator.doctor.doctor.IdLpu = cb.IdLpu;
         }
     }
     if (cb.DoctorInCharge != null)
     {
         doctorInCharge = new TestDoctor(cb.DoctorInCharge, cb.IdLpu);
         if (doctorInCharge.doctor.IdLpu == null)
         {
             doctorInCharge.doctor.IdLpu = cb.IdLpu;
         }
     }
     if (cb.Guardian != null)
     {
         guardian = new TestGuardian(cb.Guardian);
     }
     if (cb.IdPatientMis != null)
     {
         patient = TestPatient.BuildPatientFromDataBaseData(guid, cb.IdLpu, cb.IdPatientMis);
     }
 }
示例#5
0
        public void UpdatePatient(string guid, string idlpu, PatientDto patient)
        {
            TestPatient example = TestPatient.BuildPatientFromDataBaseData(guid, idlpu, patient.IdPatientMIS);

            example.ChangePatientField(patient);
            client.UpdatePatient(guid, idlpu, patient);
            if (!example.CheckPatientInDataBase())
            {
                Global.errors1.Add("Не совпадение значений объектов");
            }
        }
示例#6
0
        public PatientDto[] GetPatient(string guid, string idlpu, PatientDto patient, SourceType type)
        {
            TestPatient example = new TestPatient(guid, idlpu, patient);

            try
            {
                ArrayList patientsFromDB = new ArrayList();
                if (type == SourceType.Reg)
                {
                    patientsFromDB = Find(guid, idlpu, example);
                }
                PatientDto[] patients = client.GetPatient(guid, idlpu, patient, type);
                if (patients != null)
                {
                    foreach (PatientDto a in patients)
                    {
                        TestPatient getting = new TestPatient(guid, idlpu, a);
                        CheckField(getting, example);
                        if (type == SourceType.Reg)
                        {
                            bool mark = false;
                            foreach (TestPatient i in patientsFromDB)
                            {
                                if (i.Equals(getting))
                                {
                                    mark = true;
                                }
                            }
                            if (patients.Length != patientsFromDB.Count)
                            {
                                Global.errors1.Add("Не все пациенты из базы возвращены");
                            }
                            if (!mark)
                            {
                                Global.errors1.AddRange(Global.errors2);
                                Global.errors2.Clear();
                                Global.errors1.Add("Возвращенный пациент не соответствует ни одному из базы");
                            }
                        }
                    }
                }
                return(patients);
            }
            catch (System.ServiceModel.FaultException <PixServiseTests.PixServise.RequestFault> we)
            {
                Global.errors1.Add(we.Detail.Message);
                return(null);
            }
        }
示例#7
0
 public TestCaseBase(string guid, CaseBase cb)
 {
     GUID = guid.ToLower();
     if (cb != null)
     {
         caseBase = cb;
         if (caseBase.OpenDate == null)
             caseBase.OpenDate = DateTime.MinValue;
         if (caseBase.CloseDate == null)
             caseBase.CloseDate = DateTime.MinValue;
     }
     if (cb.Author != null)
     {
         autor = new TestParticipant(cb.Author, cb.IdLpu);
         if (autor.doctor.doctor.IdLpu == null)
             autor.doctor.doctor.IdLpu = cb.IdLpu;
     }
     if (cb.Authenticator != null)
     {
         authenticator = new TestParticipant(cb.Authenticator, cb.IdLpu);
         if (authenticator.doctor.doctor.IdLpu == null)
             authenticator.doctor.doctor.IdLpu = cb.IdLpu;
     }
     if (cb.LegalAuthenticator != null)
     {
         legalAuthenticator = new TestParticipant(cb.LegalAuthenticator, cb.IdLpu);
         if (legalAuthenticator.doctor.doctor.IdLpu == null)
             legalAuthenticator.doctor.doctor.IdLpu = cb.IdLpu;
     }
     if (cb.DoctorInCharge != null)
     {
         doctorInCharge = new TestDoctor(cb.DoctorInCharge, cb.IdLpu);
         if (doctorInCharge.doctor.IdLpu == null)
             doctorInCharge.doctor.IdLpu = cb.IdLpu;
     }
     if (cb.Guardian != null)
         guardian = new TestGuardian(cb.Guardian);
     if (cb.IdPatientMis != null)
         patient = TestPatient.BuildPatientFromDataBaseData(guid, cb.IdLpu, cb.IdPatientMis);
 }
示例#8
0
        public override bool Equals(Object obj)
        {
            TestPatient p = obj as TestPatient;

            if ((object)p == null)
            {
                return(false);
            }
            if ((Global.IsEqual(this.adds, p.adds)) &&
                (this.patient.BirthDate == p.patient.BirthDate) &&
                (Global.IsEqual(this.conts, p.conts)) &&
                (this.patient.DeathTime == p.patient.DeathTime) &&
                (Global.IsEqual(this.docs, p.docs)) &&
                (this.patient.FamilyName == p.patient.FamilyName) &&
                (this.patient.GivenName == p.patient.GivenName) &&
                (this.patient.IdBloodType == p.patient.IdBloodType) &&
                (this.patient.IdGlobal == p.patient.IdGlobal) &&
                (this.patient.IdLivingAreaType == p.patient.IdLivingAreaType) &&
                (this.patient.IsVip == p.patient.IsVip) &&
                (Global.IsEqual(this.job, p.job)) &&
                (this.patient.MiddleName == p.patient.MiddleName) &&
                (Global.IsEqual(this.privilege, p.privilege)) &&
                (this.patient.Sex == p.patient.Sex) &&
                (this.patient.SocialGroup == p.patient.SocialGroup) &&
                (this.patient.SocialStatus == p.patient.SocialStatus) &&
                Global.IsEqual(this.birthplace, p.birthplace))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestPatient");
                return(false);
            }
        }
示例#9
0
        public void AddPatient(string guid, string idlpu, PatientDto patient)
        {
            TestPatient p = new TestPatient(guid, idlpu, patient);

            try
            {
                p.DeletePatient();
                client.AddPatient(guid, idlpu, patient);
                p = new TestPatient(guid, idlpu, patient);
                TestPatient a = TestPatient.BuildPatientFromDataBaseData(guid, idlpu, patient.IdPatientMIS);
                if (!p.CheckPatientInDataBase())
                {
                    Global.errors1.AddRange(Global.errors2);
                    Global.errors1.Add("Не совпадение значений объектов");
                }
            }
            catch (System.ServiceModel.FaultException <PixServiseTests.PixServise.RequestFault> we)
            {
                if (we.Detail.Message == reinclusionString)
                {
                    TestPatient wwww = TestPatient.BuildPatientFromDataBaseData(guid, idlpu, patient.IdPatientMIS);
                    if (TestPatient.BuildPatientFromDataBaseData(guid, idlpu, patient.IdPatientMIS) == null)
                    {
                        Global.errors1.Add("Ошибочное сообщение о попытке повторного добавления");
                    }
                    else
                    {
                        Global.errors1.Add(we.Detail.Message);
                    }
                }
                else
                {
                    Global.errors1.Add(we.Detail.Message);
                }
            }
        }
示例#10
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);
        }
示例#11
0
 private void FindMismatch(TestPatient b)
 {
     if (this.patient.FamilyName != b.patient.FamilyName)
         Global.errors2.Add("несовпадение FamilyName TestPatient");
     if (this.patient.MiddleName != b.patient.MiddleName)
         Global.errors2.Add("несовпадение MiddleName TestPatient");
     if (this.patient.GivenName != b.patient.GivenName)
         Global.errors2.Add("несовпадение GivenName TestPatient");
     if (this.patient.BirthDate != b.patient.BirthDate)
         Global.errors2.Add("несовпадение BirthDate TestPatient");
     if (this.patient.Sex != b.patient.Sex)
         Global.errors2.Add("несовпадение Sex TestPatient");
     if (this.patient.IsVip != b.patient.IsVip)
         Global.errors2.Add("несовпадение IsVip TestPatient");
     if (this.patient.SocialStatus != b.patient.SocialStatus)
         Global.errors2.Add("несовпадение SocialStatus TestPatient");
     if (this.patient.SocialGroup != b.patient.SocialGroup)
         Global.errors2.Add("несовпадение SocialGroup TestPatient");
     if (this.patient.IdLivingAreaType != b.patient.IdLivingAreaType)
         Global.errors2.Add("несовпадение IdLivingAreaType TestPatient");
     if (this.patient.IdBloodType != b.patient.IdBloodType)
         Global.errors2.Add("несовпадение IdBloodType TestPatient");
     if (this.patient.DeathTime != b.patient.DeathTime)
         Global.errors2.Add("несовпадение DeathTime TestPatient");
     if (Global.GetLength(this.docs) != Global.GetLength(b.docs))
         Global.errors2.Add("несовпадение длины documents TestPatient");
     if (Global.GetLength(this.conts) != Global.GetLength(b.conts))
         Global.errors2.Add("несовпадение длины contacts TestPatient");
     if (Global.GetLength(this.adds) != Global.GetLength(b.adds))
         Global.errors2.Add("несовпадение длины addreses TestPatient");
     if (Global.GetLength(this.job) != Global.GetLength(b.job))
         Global.errors2.Add("несовпадение длины job TestPatient");
     if (Global.GetLength(this.privilege) != Global.GetLength(b.privilege))
         Global.errors2.Add("несовпадение длины privilege TestPatient");
     if (Global.GetLength(this.birthplace) != Global.GetLength(b.birthplace))
         Global.errors2.Add("несовпадение длины birthplace TestPatient");
 }
示例#12
0
 public static TestPatient BuildPatientFromDataBaseData(string guid = null, string idlpu = null, string mis = null, string patientId = null)
 {
     if (patientId == null)
         patientId = GetPatientId(guid, idlpu, mis);
     else
     {
         string[] s = GetGUIDandIDLPUandIDMIS(patientId);
         guid = s[0];
         idlpu = s[1];
         mis = s[2];
     }
     if (patientId != null)
     {
         using (SqlConnection connection = Global.GetSqlConnection())
         {
             string findPatient = "SELECT TOP(1) * FROM Person, PatientAdditionalInfo WHERE Person.IdPerson = '" + patientId + "' AND Person.IdPerson = PatientAdditionalInfo.IdPerson";
             SqlCommand person = new SqlCommand(findPatient, connection);
             using (SqlDataReader patientFromDataBase = person.ExecuteReader())
             {
                 while (patientFromDataBase.Read())
                 {
                     PatientDto p = new PatientDto();
                     if (patientFromDataBase["FamilyName"].ToString() != "")
                         p.FamilyName = Convert.ToString(patientFromDataBase["FamilyName"]);
                     else
                         p.FamilyName = null;
                     if (patientFromDataBase["MiddleName"].ToString() != "")
                         p.MiddleName = Convert.ToString(patientFromDataBase["MiddleName"]);
                     else
                         p.MiddleName = null;
                     if (patientFromDataBase["GivenName"].ToString() != "")
                         p.GivenName = Convert.ToString(patientFromDataBase["GivenName"]);
                     else
                         p.GivenName = null;
                     p.BirthDate = Convert.ToDateTime(patientFromDataBase["BirthDate"]);
                     p.Sex = Convert.ToByte(patientFromDataBase["IdSex"]);
                     p.IsVip = Convert.ToBoolean(patientFromDataBase["IsVip"]);
                     if (patientFromDataBase["IdSocialStatus"].ToString() != "")
                         p.SocialStatus = Convert.ToString(patientFromDataBase["IdSocialStatus"]);
                     else
                         p.SocialStatus = null;
                     if (patientFromDataBase["IdSocialGroup"].ToString() != "")
                         p.SocialGroup = Convert.ToByte(patientFromDataBase["IdSocialGroup"]);
                     else
                         p.SocialGroup = null;
                     if (patientFromDataBase["IdLivingAreaType"].ToString() != "")
                         p.IdLivingAreaType = Convert.ToByte(patientFromDataBase["IdLivingAreaType"]);
                     else
                         p.IdLivingAreaType = null;
                     if (patientFromDataBase["IdBloodType"].ToString() != "")
                         p.IdBloodType = Convert.ToByte(patientFromDataBase["IdBloodType"]);
                     else
                         p.IdBloodType = null;
                     if (patientFromDataBase["DeathTime"].ToString() != "")
                         p.DeathTime = Convert.ToDateTime(patientFromDataBase["DeathTime"]);
                     else
                         p.DeathTime = null;
                     p.IdPatientMIS = mis;
                     p.IdGlobal = patientId;
                     TestPatient patient = new TestPatient(guid, idlpu, p);
                     patient.documents = TestDocument.BuildDocumentsFromDataBaseData(patientId);
                     patient.addreses = TestAddress.BuildAdressesFromDataBaseData(patientId);
                     patient.contacts = TestContact.BuildContactsFromDataBaseData(patientId);
                     patient.job = TestJob.BuildTestJobFromDataBase(patientId);
                     patient.privilege = TestPrivilege.BuildTestPrivilegeFromDataBase(patientId);
                     patient.birthplace = TestBirthplace.BuildBirthplaceFromDataBaseData(patientId);
                     return patient;
                 }
             }
         }
     }
     return null;
 }
示例#13
0
 public ArrayList Find(string guid, string idlpu, TestPatient patient)
 {
     string findPatient = "";
     if (patient.patient.IdPatientMIS != null)
     {
         findPatient = "SELECT * FROM ExternalId WHERE IdPersonMIS = '" + patient.patient.IdPatientMIS + "' AND SystemGuid = '" + guid + "'";
     }
     else
     {
         if (patient.patient.Sex == 0)
         {
             findPatient = "SELECT * FROM Person WHERE FamilyName = '" + patient.patient.FamilyName + "' AND GivenName ='" + patient.patient.GivenName + "' AND BirthDate ='" + patient.patient.BirthDate + "'";
         }
         else
         {
             findPatient = "SELECT * FROM Person WHERE FamilyName = '" + patient.patient.FamilyName + "' AND GivenName ='" + patient.patient.GivenName + "' AND BirthDate ='" + patient.patient.BirthDate + "' AND IdSex ='" + patient.patient.Sex + "'";
         }
     }
     //            ContactPersonDto p = new ContactPersonDto();
     ArrayList patients = new ArrayList();
     string patientId = "";
     using (SqlConnection connection = Global.GetSqlConnection())
     {
         SqlCommand findPatients = new SqlCommand(findPatient, connection);
         using (SqlDataReader patientsReader = findPatients.ExecuteReader())
         {
             //int i = 0;
             while (patientsReader.Read())
             {
                 patientId = Convert.ToString(patientsReader["IdPerson"]);
                 if (patient.documents != null)
                 {
                     string findDoc = "";
                     if (patient.documents[0].document.DocS != null)
                         findDoc = "SELECT * FROM Document WHERE IdPerson = '" + patientId + "' AND DocS ='" + patient.documents[0].document.DocS + "' AND DocN ='" + patient.documents[0].document.DocN + "'";
                     else
                         findDoc = "SELECT * FROM Document WHERE IdPerson = '" + patientId + "' AND DocN ='" + patient.documents[0].document.DocN + "'";
                     using (SqlConnection connection2 = Global.GetSqlConnection())
                     {
                         SqlCommand findPatients2 = new SqlCommand(findDoc, connection2);
                         using (SqlDataReader patientsReader2 = findPatients2.ExecuteReader())
                         {
                             string addedId = "";
                             while (patientsReader2.Read())
                             {
                                 if (addedId != patientId)
                                 {
                                     TestPatient patientFromDb = TestPatient.BuildPatientFromDataBaseData(patientId: patientId);
                                     addedId = patientId;
                                     patientFromDb.GUID = guid;
                                     patientFromDb.IDLPU = idlpu;
                                     patients.Add(patientFromDb);
                                 }
                             }
                         }
                     }
                 }
                 else
                 {
                     TestPatient patientFromDb2 = TestPatient.BuildPatientFromDataBaseData(patientId: patientId);
                     patients.Add(patientFromDb2);
                 }
             }
         }
     }
     return patients;
 }
示例#14
0
 public void UpdateCaseBase(string guid, CaseBase cb)
 {
     if (guid != "")
         GUID = guid.ToLower();
     if (cb != null)
     {
         if (cb.CloseDate != DateTime.MinValue)
             this.caseBase.CloseDate = cb.CloseDate;
         if (cb.Comment != "")
             this.caseBase.Comment = cb.Comment;
         if (cb.Confidentiality != 0)
             this.caseBase.Confidentiality = cb.Confidentiality;
         if (cb.CuratorConfidentiality != 0)
             this.caseBase.CuratorConfidentiality = cb.CuratorConfidentiality;
         if (cb.DoctorConfidentiality != 0)
             this.caseBase.DoctorConfidentiality = cb.DoctorConfidentiality;
         if (cb.HistoryNumber != "")
             this.caseBase.HistoryNumber = cb.HistoryNumber;
         if (cb.IdCaseAidType != 0)
             this.caseBase.IdCaseAidType = cb.IdCaseAidType;
         if (cb.IdCaseMis != "")
             this.caseBase.IdCaseMis = cb.IdCaseMis;
         if (cb.IdCaseResult != 0)
             this.caseBase.IdCaseResult = cb.IdCaseResult;
         if (cb.IdLpu != "")
             this.caseBase.IdLpu = cb.IdLpu;
         if (cb.IdPaymentType != 0)
             this.caseBase.IdPaymentType = cb.IdPaymentType;
         if (cb.OpenDate != DateTime.MinValue)
             this.caseBase.OpenDate = cb.OpenDate;
         if (cb.Author != null)
         {
             autor = new TestParticipant(cb.Author, cb.IdLpu);
             if (autor.doctor.doctor.IdLpu == null)
                 autor.doctor.doctor.IdLpu = cb.IdLpu;
         }
         if (cb.Authenticator != null)
         {
             authenticator = new TestParticipant(cb.Authenticator, cb.IdLpu);
             if (authenticator.doctor.doctor.IdLpu == null)
                 authenticator.doctor.doctor.IdLpu = cb.IdLpu;
         }
         if (cb.LegalAuthenticator != null)
         {
             legalAuthenticator = new TestParticipant(cb.LegalAuthenticator, cb.IdLpu);
             if (legalAuthenticator.doctor.doctor.IdLpu == null)
                 legalAuthenticator.doctor.doctor.IdLpu = cb.IdLpu;
         }
         if (cb.DoctorInCharge != null)
         {
             doctorInCharge = new TestDoctor(cb.DoctorInCharge, cb.IdLpu);
             if (doctorInCharge.doctor.IdLpu == null)
                 doctorInCharge.doctor.IdLpu = cb.IdLpu;
         }
         if (cb.Guardian != null)
             guardian = new TestGuardian(cb.Guardian);
         if (cb.IdPatientMis != null)
             patient = TestPatient.BuildPatientFromDataBaseData(guid, cb.IdLpu, cb.IdPatientMis);
     }
 }
示例#15
0
 private bool CheckField(TestPatient returnedPatient, TestPatient examplePatient)
 {
     bool mark = true;
     if ((examplePatient.patient.FamilyName == null) || (examplePatient.patient.FamilyName == returnedPatient.patient.FamilyName)) ;
     else
     {
         Global.errors1.Add("Не верная фамилия, возвращено: " + returnedPatient.patient.FamilyName.ToString());
         mark = false;
     }
     if ((examplePatient.patient.GivenName == null) || (examplePatient.patient.GivenName == returnedPatient.patient.GivenName)) ;
     else
     {
         Global.errors1.Add("Не верное имя, возвращено: " + returnedPatient.patient.GivenName.ToString());
         mark = false;
     }
     if ((examplePatient.patient.BirthDate == DateTime.MinValue) || (examplePatient.patient.BirthDate == returnedPatient.patient.BirthDate)) ;
     else
     {
         Global.errors1.Add("Не верная дата рождения, возвращено: " + returnedPatient.patient.BirthDate.ToString());
         mark = false;
     }
     if ((examplePatient.patient.Sex == 0) || (examplePatient.patient.Sex == returnedPatient.patient.Sex)) ;
     else
     {
         Global.errors1.Add("Не верный пол, возвращено: " + returnedPatient.patient.Sex.ToString());
         mark = false;
     }
     if (examplePatient.documents != null)
     {
         foreach (TestDocument doc in returnedPatient.documents)
         {
             TestDocument exampledoc = examplePatient.documents[0];
             if ((exampledoc.document.DocN == doc.document.DocN) &&
                 (exampledoc.document.DocS == doc.document.DocS) &&
                 (exampledoc.document.IdDocumentType == doc.document.IdDocumentType)) ;
             else
             {
                 Global.errors1.Add("Несоответствие документов");
                 mark = false;
             }
         }
     }
     return mark;
 }
示例#16
0
 public PatientDto[] GetPatient(string guid, string idlpu, PatientDto patient, SourceType type)
 {
     TestPatient example = new TestPatient(guid, idlpu, patient);
     try
     {
         ArrayList patientsFromDB = new ArrayList();
         if (type == SourceType.Reg)
             patientsFromDB = Find(guid, idlpu, example);
         PatientDto[] patients = client.GetPatient(guid, idlpu, patient, type);
         if (patients != null)
             foreach (PatientDto a in patients)
             {
                 TestPatient getting = new TestPatient(guid, idlpu, a);
                 CheckField(getting, example);
                 if (type == SourceType.Reg)
                 {
                     bool mark = false;
                     foreach (TestPatient i in patientsFromDB)
                     {
                         if (i.Equals(getting))
                         {
                             mark = true;
                         }
                     }
                     if (patients.Length != patientsFromDB.Count)
                         Global.errors1.Add("Не все пациенты из базы возвращены");
                     if (!mark)
                     {
                         Global.errors1.AddRange(Global.errors2);
                         Global.errors2.Clear();
                         Global.errors1.Add("Возвращенный пациент не соответствует ни одному из базы");
                     }
                 }
             }
         return patients;
     }
     catch (System.ServiceModel.FaultException<PixServiseTests.PixServise.RequestFault> we)
     {
         Global.errors1.Add(we.Detail.Message);
         return null;
     }
 }
示例#17
0
 static public TestPatient BuildPatientFromDataBaseData(string guid = null, string idlpu = null, string mis = null, string patientId = null)
 {
     if (patientId == null)
     {
         patientId = GetPatientId(guid, idlpu, mis);
     }
     else
     {
         string[] s = GetGUIDandIDLPUandIDMIS(patientId);
         guid  = s[0];
         idlpu = s[1];
         mis   = s[2];
     }
     if (patientId != null)
     {
         using (SqlConnection connection = Global.GetSqlConnection())
         {
             string     findPatient = "SELECT TOP(1) * FROM Person, PatientAdditionalInfo WHERE Person.IdPerson = '" + patientId + "' AND Person.IdPerson = PatientAdditionalInfo.IdPerson";
             SqlCommand person      = new SqlCommand(findPatient, connection);
             using (SqlDataReader patientFromDataBase = person.ExecuteReader())
             {
                 while (patientFromDataBase.Read())
                 {
                     PatientDto p = new PatientDto();
                     if (patientFromDataBase["FamilyName"].ToString() != "")
                     {
                         p.FamilyName = Convert.ToString(patientFromDataBase["FamilyName"]);
                     }
                     else
                     {
                         p.FamilyName = null;
                     }
                     if (patientFromDataBase["MiddleName"].ToString() != "")
                     {
                         p.MiddleName = Convert.ToString(patientFromDataBase["MiddleName"]);
                     }
                     else
                     {
                         p.MiddleName = null;
                     }
                     if (patientFromDataBase["GivenName"].ToString() != "")
                     {
                         p.GivenName = Convert.ToString(patientFromDataBase["GivenName"]);
                     }
                     else
                     {
                         p.GivenName = null;
                     }
                     p.BirthDate = Convert.ToDateTime(patientFromDataBase["BirthDate"]);
                     p.Sex       = Convert.ToByte(patientFromDataBase["IdSex"]);
                     p.IsVip     = Convert.ToBoolean(patientFromDataBase["IsVip"]);
                     if (patientFromDataBase["IdSocialStatus"].ToString() != "")
                     {
                         p.SocialStatus = Convert.ToString(patientFromDataBase["IdSocialStatus"]);
                     }
                     else
                     {
                         p.SocialStatus = null;
                     }
                     if (patientFromDataBase["IdSocialGroup"].ToString() != "")
                     {
                         p.SocialGroup = Convert.ToByte(patientFromDataBase["IdSocialGroup"]);
                     }
                     else
                     {
                         p.SocialGroup = null;
                     }
                     if (patientFromDataBase["IdLivingAreaType"].ToString() != "")
                     {
                         p.IdLivingAreaType = Convert.ToByte(patientFromDataBase["IdLivingAreaType"]);
                     }
                     else
                     {
                         p.IdLivingAreaType = null;
                     }
                     if (patientFromDataBase["IdBloodType"].ToString() != "")
                     {
                         p.IdBloodType = Convert.ToByte(patientFromDataBase["IdBloodType"]);
                     }
                     else
                     {
                         p.IdBloodType = null;
                     }
                     if (patientFromDataBase["DeathTime"].ToString() != "")
                     {
                         p.DeathTime = Convert.ToDateTime(patientFromDataBase["DeathTime"]);
                     }
                     else
                     {
                         p.DeathTime = null;
                     }
                     p.IdPatientMIS = mis;
                     p.IdGlobal     = patientId;
                     TestPatient patient = new TestPatient(guid, idlpu, p);
                     patient.documents  = TestDocument.BuildDocumentsFromDataBaseData(patientId);
                     patient.addreses   = TestAddress.BuildAdressesFromDataBaseData(patientId);
                     patient.contacts   = TestContact.BuildContactsFromDataBaseData(patientId);
                     patient.job        = TestJob.BuildTestJobFromDataBase(patientId);
                     patient.privilege  = TestPrivilege.BuildTestPrivilegeFromDataBase(patientId);
                     patient.birthplace = TestBirthplace.BuildBirthplaceFromDataBaseData(patientId);
                     return(patient);
                 }
             }
         }
     }
     return(null);
 }
示例#18
0
 private void FindMismatch(TestPatient b)
 {
     if (this.patient.FamilyName != b.patient.FamilyName)
     {
         Global.errors2.Add("несовпадение FamilyName TestPatient");
     }
     if (this.patient.MiddleName != b.patient.MiddleName)
     {
         Global.errors2.Add("несовпадение MiddleName TestPatient");
     }
     if (this.patient.GivenName != b.patient.GivenName)
     {
         Global.errors2.Add("несовпадение GivenName TestPatient");
     }
     if (this.patient.BirthDate != b.patient.BirthDate)
     {
         Global.errors2.Add("несовпадение BirthDate TestPatient");
     }
     if (this.patient.Sex != b.patient.Sex)
     {
         Global.errors2.Add("несовпадение Sex TestPatient");
     }
     if (this.patient.IsVip != b.patient.IsVip)
     {
         Global.errors2.Add("несовпадение IsVip TestPatient");
     }
     if (this.patient.SocialStatus != b.patient.SocialStatus)
     {
         Global.errors2.Add("несовпадение SocialStatus TestPatient");
     }
     if (this.patient.SocialGroup != b.patient.SocialGroup)
     {
         Global.errors2.Add("несовпадение SocialGroup TestPatient");
     }
     if (this.patient.IdLivingAreaType != b.patient.IdLivingAreaType)
     {
         Global.errors2.Add("несовпадение IdLivingAreaType TestPatient");
     }
     if (this.patient.IdBloodType != b.patient.IdBloodType)
     {
         Global.errors2.Add("несовпадение IdBloodType TestPatient");
     }
     if (this.patient.DeathTime != b.patient.DeathTime)
     {
         Global.errors2.Add("несовпадение DeathTime TestPatient");
     }
     if (Global.GetLength(this.docs) != Global.GetLength(b.docs))
     {
         Global.errors2.Add("несовпадение длины documents TestPatient");
     }
     if (Global.GetLength(this.conts) != Global.GetLength(b.conts))
     {
         Global.errors2.Add("несовпадение длины contacts TestPatient");
     }
     if (Global.GetLength(this.adds) != Global.GetLength(b.adds))
     {
         Global.errors2.Add("несовпадение длины addreses TestPatient");
     }
     if (Global.GetLength(this.job) != Global.GetLength(b.job))
     {
         Global.errors2.Add("несовпадение длины job TestPatient");
     }
     if (Global.GetLength(this.privilege) != Global.GetLength(b.privilege))
     {
         Global.errors2.Add("несовпадение длины privilege TestPatient");
     }
     if (Global.GetLength(this.birthplace) != Global.GetLength(b.birthplace))
     {
         Global.errors2.Add("несовпадение длины birthplace TestPatient");
     }
 }
示例#19
0
 public void UpdateCaseBase(string guid, CaseBase cb)
 {
     if (guid != "")
     {
         GUID = guid.ToLower();
     }
     if (cb != null)
     {
         if (cb.CloseDate != DateTime.MinValue)
         {
             this.caseBase.CloseDate = cb.CloseDate;
         }
         if (cb.Comment != "")
         {
             this.caseBase.Comment = cb.Comment;
         }
         if (cb.Confidentiality != 0)
         {
             this.caseBase.Confidentiality = cb.Confidentiality;
         }
         if (cb.CuratorConfidentiality != 0)
         {
             this.caseBase.CuratorConfidentiality = cb.CuratorConfidentiality;
         }
         if (cb.DoctorConfidentiality != 0)
         {
             this.caseBase.DoctorConfidentiality = cb.DoctorConfidentiality;
         }
         if (cb.HistoryNumber != "")
         {
             this.caseBase.HistoryNumber = cb.HistoryNumber;
         }
         if (cb.IdCaseAidType != 0)
         {
             this.caseBase.IdCaseAidType = cb.IdCaseAidType;
         }
         if (cb.IdCaseMis != "")
         {
             this.caseBase.IdCaseMis = cb.IdCaseMis;
         }
         if (cb.IdCaseResult != 0)
         {
             this.caseBase.IdCaseResult = cb.IdCaseResult;
         }
         if (cb.IdLpu != "")
         {
             this.caseBase.IdLpu = cb.IdLpu;
         }
         if (cb.IdPaymentType != 0)
         {
             this.caseBase.IdPaymentType = cb.IdPaymentType;
         }
         if (cb.OpenDate != DateTime.MinValue)
         {
             this.caseBase.OpenDate = cb.OpenDate;
         }
         if (cb.Author != null)
         {
             autor = new TestParticipant(cb.Author, cb.IdLpu);
             if (autor.doctor.doctor.IdLpu == null)
             {
                 autor.doctor.doctor.IdLpu = cb.IdLpu;
             }
         }
         if (cb.Authenticator != null)
         {
             authenticator = new TestParticipant(cb.Authenticator, cb.IdLpu);
             if (authenticator.doctor.doctor.IdLpu == null)
             {
                 authenticator.doctor.doctor.IdLpu = cb.IdLpu;
             }
         }
         if (cb.LegalAuthenticator != null)
         {
             legalAuthenticator = new TestParticipant(cb.LegalAuthenticator, cb.IdLpu);
             if (legalAuthenticator.doctor.doctor.IdLpu == null)
             {
                 legalAuthenticator.doctor.doctor.IdLpu = cb.IdLpu;
             }
         }
         if (cb.DoctorInCharge != null)
         {
             doctorInCharge = new TestDoctor(cb.DoctorInCharge, cb.IdLpu);
             if (doctorInCharge.doctor.IdLpu == null)
             {
                 doctorInCharge.doctor.IdLpu = cb.IdLpu;
             }
         }
         if (cb.Guardian != null)
         {
             guardian = new TestGuardian(cb.Guardian);
         }
         if (cb.IdPatientMis != null)
         {
             patient = TestPatient.BuildPatientFromDataBaseData(guid, cb.IdLpu, cb.IdPatientMis);
         }
     }
 }
示例#20
0
        public ArrayList Find(string guid, string idlpu, TestPatient patient)
        {
            string findPatient = "";

            if (patient.patient.IdPatientMIS != null)
            {
                findPatient = "SELECT * FROM ExternalId WHERE IdPersonMIS = '" + patient.patient.IdPatientMIS + "' AND SystemGuid = '" + guid + "'";
            }
            else
            {
                if (patient.patient.Sex == 0)
                {
                    findPatient = "SELECT * FROM Person WHERE FamilyName = '" + patient.patient.FamilyName + "' AND GivenName ='" + patient.patient.GivenName + "' AND BirthDate ='" + patient.patient.BirthDate + "'";
                }
                else
                {
                    findPatient = "SELECT * FROM Person WHERE FamilyName = '" + patient.patient.FamilyName + "' AND GivenName ='" + patient.patient.GivenName + "' AND BirthDate ='" + patient.patient.BirthDate + "' AND IdSex ='" + patient.patient.Sex + "'";
                }
            }
//            ContactPersonDto p = new ContactPersonDto();
            ArrayList patients  = new ArrayList();
            string    patientId = "";

            using (SqlConnection connection = Global.GetSqlConnection())
            {
                SqlCommand findPatients = new SqlCommand(findPatient, connection);
                using (SqlDataReader patientsReader = findPatients.ExecuteReader())
                {
                    //int i = 0;
                    while (patientsReader.Read())
                    {
                        patientId = Convert.ToString(patientsReader["IdPerson"]);
                        if (patient.documents != null)
                        {
                            string findDoc = "";
                            if (patient.documents[0].document.DocS != null)
                            {
                                findDoc = "SELECT * FROM Document WHERE IdPerson = '" + patientId + "' AND DocS ='" + patient.documents[0].document.DocS + "' AND DocN ='" + patient.documents[0].document.DocN + "'";
                            }
                            else
                            {
                                findDoc = "SELECT * FROM Document WHERE IdPerson = '" + patientId + "' AND DocN ='" + patient.documents[0].document.DocN + "'";
                            }
                            using (SqlConnection connection2 = Global.GetSqlConnection())
                            {
                                SqlCommand findPatients2 = new SqlCommand(findDoc, connection2);
                                using (SqlDataReader patientsReader2 = findPatients2.ExecuteReader())
                                {
                                    string addedId = "";
                                    while (patientsReader2.Read())
                                    {
                                        if (addedId != patientId)
                                        {
                                            TestPatient patientFromDb = TestPatient.BuildPatientFromDataBaseData(patientId: patientId);
                                            addedId             = patientId;
                                            patientFromDb.GUID  = guid;
                                            patientFromDb.IDLPU = idlpu;
                                            patients.Add(patientFromDb);
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            TestPatient patientFromDb2 = TestPatient.BuildPatientFromDataBaseData(patientId: patientId);
                            patients.Add(patientFromDb2);
                        }
                    }
                }
            }
            return(patients);
        }