public static TestGuardian BuildTestGuardianFromDataBase(string guardianId, string patientId) { if ((guardianId != "") && (patientId != "")) { string findIdRealationTypeString = "SELECT TOP(1) * FROM mm_Person2Person WHERE IdPerson = '" + patientId + "' AND IdPersonRelated = '" + guardianId + "'"; using (SqlConnection connection = Global.GetSqlConnection()) { SqlCommand IdInstitution = new SqlCommand(findIdRealationTypeString, connection); Guardian g = new Guardian(); using (SqlDataReader IdRelationTypeReader = IdInstitution.ExecuteReader()) { while (IdRelationTypeReader.Read()) { g.IdRelationType = Convert.ToByte(IdRelationTypeReader["IdRelationType"]); if (Convert.ToString(IdRelationTypeReader["UnderlyingDocument"]) != "") g.UnderlyingDocument = Convert.ToString(IdRelationTypeReader["UnderlyingDocument"]); else g.UnderlyingDocument = null; } } TestGuardian guard = new TestGuardian(g); guard.person = TestPerson.BuildPersonFromDataBaseData(guardianId); return guard; } } return null; }
public TestSickList(SickList r, string idLpu = "") { if (r != null) { sickList = r; attachment = new TestAttachment(r.Attachment); if (r.Author != null) doctor = new TestDoctor(r.Author, idLpu); if (r.SickListInfo.Caregiver != null) guardian = new TestGuardian(r.SickListInfo.Caregiver); } }
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); }
static public List <TestSickList> BuildSickListFromDataBaseData(string idStep, string patientId) { List <TestSickList> tsl = new List <TestSickList>(); if (idStep != "") { List <TestAttachment> lta = TestAttachment.BuildTestAttacmentFromDataBase(idStep, idSickList); if (lta != null) { foreach (TestAttachment i in lta) { using (SqlConnection connection = Global.GetSqlConnection()) { string findSL = "SELECT * FROM SickList WHERE IdMedDocument = '" + i.idMedDocument + "'"; SqlCommand SLcommand = new SqlCommand(findSL, connection); using (SqlDataReader SLReader = SLcommand.ExecuteReader()) { while (SLReader.Read()) { SickList r = new SickList(); r.SickListInfo = new SickListInfo(); if (SLReader["Number"].ToString() != "") { r.SickListInfo.Number = Convert.ToString(SLReader["Number"]); } if (SLReader["DateStart"].ToString() != "") { r.SickListInfo.DateStart = Convert.ToDateTime(SLReader["DateStart"]); } if (SLReader["DateEnd"].ToString() != "") { r.SickListInfo.DateEnd = Convert.ToDateTime(SLReader["DateEnd"]); } if (SLReader["IdRDisabilityDocStatus"].ToString() != "") { r.SickListInfo.DisabilityDocState = Convert.ToByte(SLReader["IdRDisabilityDocStatus"]); } if (SLReader["IdRDisabilityDocReason"].ToString() != "") { r.SickListInfo.DisabilityDocReason = Convert.ToByte(SLReader["IdRDisabilityDocReason"]); } if (SLReader["IsPatient"].ToString() != "") { r.SickListInfo.IsPatientTaker = Convert.ToBoolean(SLReader["IsPatient"]); } r.CreationDate = i.CreationDate; r.Header = i.DocHead; TestSickList tr = new TestSickList(r); tr.attachment = i; tr.doctor = TestDoctor.BuildTestDoctorFromDataBase(i.IdDoctor); if (SLReader["IdCareGiver"].ToString() != "") { tr.guardian = TestGuardian.BuildTestGuardianFromDataBase(SLReader["IdCareGiver"].ToString(), patientId); } tsl.Add(tr); } } } } } } if (tsl.Count != 0) { return(tsl); } else { return(null); } }
private void FindMismatch(TestGuardian g) { if (g.guardian != null) { if (this.guardian.IdRelationType != g.guardian.IdRelationType) Global.errors3.Add("Несовпадение IdRelationType TestGuardian"); if (this.guardian.UnderlyingDocument != g.guardian.UnderlyingDocument) Global.errors3.Add("Несовпадение UnderlyingDocument TestGuardian"); if (Global.GetLength(this.person) != Global.GetLength(g.person)) Global.errors3.Add("Несовпадение длины person TestGuardian"); } }
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); } }