示例#1
0
 public static TestParticipant BuildTestParticipantFromDataBase(string idCase, string idDoctor, byte idPersonRole)
 {
     Participant p = new Participant();
     p.IdRole = idPersonRole;
     TestParticipant part = new TestParticipant(p);
     part.doctor = TestDoctor.BuildTestDoctorFromDataBase(idDoctor);
     return part;
 }
示例#2
0
 private void FindMismatch(TestParticipant p)
 {
     if (p.participant != null)
     {
         if (this.participant.IdRole != p.participant.IdRole)
             Global.errors3.Add("Несовпадение IdRole TestParticipant");
         if (Global.GetLength(this.doctor) != Global.GetLength(p.doctor))
             Global.errors3.Add("Несjвпадение длины doctor TestParticipant");
     }
 }
示例#3
0
 public TestService(Service s, string idLpu = "")
 {
     if (s != null)
     {
         document = s;
         if (s.Performer != null)
             doctor = new TestParticipant(s.Performer, idLpu);
         if (document.PaymentInfo == null)
             document.PaymentInfo = new PaymentInfo();
     }
 }
示例#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 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);
         }
     }
 }
示例#6
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);
        }
示例#7
0
        static public List <TestService> BuildServiseFromDataBaseData(string IdStep)
        {
            List <TestService> serviseList = new List <TestService>();

            using (SqlConnection connection = Global.GetSqlConnection())
            {
                string     findService    = "SELECT * FROM Service, Step, nsi.ServiceType WHERE Service.IdStep = '" + IdStep + "' AND Service.IdStep = Step.IdStep AND Service.idServiceType = nsi.ServiceType.IdServiceType";
                SqlCommand serviceCommand = new SqlCommand(findService, connection);
                using (SqlDataReader serviceReader = serviceCommand.ExecuteReader())
                {
                    while (serviceReader.Read())
                    {
                        Service s = new Service();
                        s.PaymentInfo = new PaymentInfo();
                        if (serviceReader["DateEnd"].ToString() != "")
                        {
                            s.DateEnd = Convert.ToDateTime(serviceReader["DateEnd"]);
                        }
                        else
                        {
                            s.DateEnd = DateTime.MinValue;
                        }
                        if (serviceReader["DateStart"].ToString() != "")
                        {
                            s.DateStart = Convert.ToDateTime(serviceReader["DateStart"]);
                        }
                        else
                        {
                            s.DateStart = DateTime.MinValue;
                        }
                        if (serviceReader["IdFedNsi"].ToString() != "")
                        {
                            s.IdServiceType = Convert.ToString(serviceReader["IdFedNsi"]);
                        }
                        if (serviceReader["ServiceName"].ToString() != "")
                        {
                            s.ServiceName = Convert.ToString(serviceReader["ServiceName"]);
                        }
                        if (serviceReader["IdRHealthCareUnit"].ToString() != "")
                        {
                            s.PaymentInfo.HealthCareUnit = Convert.ToByte(serviceReader["IdRHealthCareUnit"]);
                        }
                        if (serviceReader["IdRVisitPaymentType"].ToString() != "")
                        {
                            s.PaymentInfo.IdPaymentType = Convert.ToByte(serviceReader["IdRVisitPaymentType"]);
                        }
                        if (serviceReader["IdRPaymentStatus"].ToString() != "")
                        {
                            s.PaymentInfo.PaymentState = Convert.ToByte(serviceReader["IdRPaymentStatus"]);
                        }
                        if (serviceReader["Quantity"].ToString() != "")
                        {
                            s.PaymentInfo.Quantity = Convert.ToInt32(serviceReader["Quantity"]);
                        }
                        if (serviceReader["Tariff"].ToString() != "")
                        {
                            s.PaymentInfo.Tariff = Convert.ToDecimal(serviceReader["Tariff"]);
                        }
                        TestService ts = new TestService(s);
                        if ((serviceReader["IdPersonRole"].ToString() != "") && (serviceReader["IdCase"].ToString() != ""))
                        {
                            ts.doctor = TestParticipant.BuildTestParticipantFromDataBase(serviceReader["IdCase"].ToString(), serviceReader["IdDoctor"].ToString(), Convert.ToByte(serviceReader["IdPersonRole"]));
                        }
                        serviseList.Add(ts);
                    }
                }
            }
            if (serviseList.Count != 0)
            {
                return(serviseList);
            }
            else
            {
                return(null);
            }
        }
示例#8
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);
     }
 }