static public List <TestForm027U> BuildForm027UFromDataBaseData(string idStep) { List <TestForm027U> form = new List <TestForm027U>(); if (idStep != "") { List <TestAttachment> lta = TestAttachment.BuildTestAttacmentFromDataBase(idStep, idForm027U); if (lta != null) { foreach (TestAttachment i in lta) { Form027U r = new Form027U(); r.CreationDate = i.CreationDate; r.Header = i.DocHead; TestForm027U tr = new TestForm027U(r); tr.attachment = i; tr.doctor = TestDoctor.BuildTestDoctorFromDataBase(i.IdDoctor); form.Add(tr); } } } if (form.Count != 0) { return(form); } else { return(null); } }
public override bool Equals(Object obj) { TestAttachment p = obj as TestAttachment; if ((object)p == null) { return(false); } if (this.attachment == p.attachment) { return(true); } if ((this.attachment == null) || (p.attachment == null)) { return(false); } if ((this.attachment.Url == p.attachment.Url) && (this.attachment.MimeType == p.attachment.MimeType)) { return(true); } else { this.FindMismatch(p); Global.errors3.Add("несовпадение TestAttachment"); return(false); } }
static public List <TestLaboratoryReport> BuildLaboratoryReportFromDataBaseData(string idStep) { List <TestLaboratoryReport> llr = new List <TestLaboratoryReport>(); if (idStep != "") { List <TestAttachment> lta = TestAttachment.BuildTestAttacmentFromDataBase(idStep, idLaboratoryReport); if (lta != null) { foreach (TestAttachment i in lta) { LaboratoryReport r = new LaboratoryReport(); r.CreationDate = i.CreationDate; r.Header = i.DocHead; TestLaboratoryReport tr = new TestLaboratoryReport(r); tr.attachment = i; tr.doctor = TestDoctor.BuildTestDoctorFromDataBase(i.IdDoctor); llr.Add(tr); } } } if (llr.Count != 0) { return(llr); } else { return(null); } }
public TestReferral(Referral r, string idLpu = "") { referral = r; attachment = new TestAttachment(r.Attachment); doctor = new TestDoctor(r.Author, idLpu); departmentHead = new TestDoctor(r.DepartmentHead, idLpu); }
public TestReferral(Referral r, string idLpu = "") { referral = r; attachment = new TestAttachment(r.Attachment); doctor = new TestDoctor(r.Author, idLpu); departmentHead = new TestDoctor(r.DepartmentHead, idLpu); }
public TestConsultNote(ConsultNote r, string idLpu = "") { if (r != null) { consultNote = r; attachment = new TestAttachment(r.Attachment); doctor = new TestDoctor(r.Author, idLpu); } }
public TestForm027U(Form027U r, string idLpu = "") { if (r != null) { form027U = r; attachment = new TestAttachment(r.Attachment); doctor = new TestDoctor(r.Author, idLpu); } }
public TestConsultNote(ConsultNote r, string idLpu = "") { if (r != null) { consultNote = r; attachment = new TestAttachment(r.Attachment); doctor = new TestDoctor(r.Author, idLpu); } }
public TestLaboratoryReport(LaboratoryReport r, string idLpu = "") { if (r != null) { laboratoryReport = r; attachment = new TestAttachment(r.Attachment); doctor = new TestDoctor(r.Author, idLpu); } }
public TestDischargeSummary(DischargeSummary r, string idLpu = "") { if (r != null) { dischargeSummary = r; attachment = new TestAttachment(r.Attachment); doctor = new TestDoctor(r.Author, idLpu); } }
public TestForm027U(Form027U r, string idLpu = "") { if (r != null) { form027U = r; attachment = new TestAttachment(r.Attachment); doctor = new TestDoctor(r.Author, idLpu); } }
public TestLaboratoryReport(LaboratoryReport r, string idLpu = "") { if (r != null) { laboratoryReport = r; attachment = new TestAttachment(r.Attachment); doctor = new TestDoctor(r.Author, idLpu); } }
public TestDischargeSummary(DischargeSummary r, string idLpu = "") { if (r != null) { dischargeSummary = r; attachment = new TestAttachment(r.Attachment); doctor = new TestDoctor(r.Author, idLpu); } }
private void FindMismatch(TestAttachment at) { if (this.attachment.Url != at.attachment.Url) { Global.errors3.Add("несовпадение Url TestAttachment"); } if (this.attachment.MimeType != at.attachment.MimeType) { Global.errors3.Add("несовпадение MimeType TestAttachment"); } }
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 static List<TestAttachment> BuildTestAttacmentFromDataBase(string idStep, string idMedDocumentType) { List<TestAttachment> taList = new List<TestAttachment>(); if (idStep != "") { using (SqlConnection connection = Global.GetSqlConnection()) { string findDocuments = "SELECT * FROM MedDocument WHERE IdStep = '" + idStep + "' AND IdMedDocumentType = '" + idMedDocumentType + "'"; SqlCommand participantCommand = new SqlCommand(findDocuments, connection); using (SqlDataReader docsReader = participantCommand.ExecuteReader()) { while (docsReader.Read()) { MedDocument.DocumentAttachment at = new MedDocument.DocumentAttachment(); if (docsReader["Attachment"].ToString() != "") { byte[] ata = docsReader["Attachment"] as byte[]; if (ata != null) at.Data = ata; } if (docsReader["AttachmentHash"].ToString() != "") { byte[] ath = docsReader["AttachmentHash"] as byte[]; if (ath != null) at.Hash = ath; } if (docsReader["AttachmentURL"].ToString() != "") at.Url = new Uri(Convert.ToString(docsReader["AttachmentURL"])); if (docsReader["MIMEType"].ToString() != "") at.MimeType = docsReader["MIMEType"].ToString(); TestAttachment t = new TestAttachment(at); if (docsReader["IdMedDocument"].ToString() != "") t.idMedDocument = docsReader["IdMedDocument"].ToString(); if (docsReader["DocHead"].ToString() != "") t.DocHead = docsReader["DocHead"].ToString(); if (docsReader["CreationDate"].ToString() != "") t.CreationDate = Convert.ToDateTime(docsReader["CreationDate"]); if (docsReader["IdDoctor"].ToString() != "") t.IdDoctor = docsReader["IdDoctor"].ToString(); taList.Add(t); } } } } if (taList.Count != 0) return taList; else 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 TestDispensaryOne(DispensaryOne r, string idLpu = "") { if (r != null) { dispansaryOne = r; attachment = new TestAttachment(r.Attachment); doctor = new TestDoctor(r.Author, idLpu); hdDoctor = new TestDoctor(r.HealthGroup.Doctor, idLpu); if (r.Recommendations != null) { recom = new List<TestRecommendation>(); foreach(Recommendation i in r.Recommendations) { recom.Add(new TestRecommendation(i, idLpu)); } } } }
public TestDispensaryOne(DispensaryOne r, string idLpu = "") { if (r != null) { dispansaryOne = r; attachment = new TestAttachment(r.Attachment); doctor = new TestDoctor(r.Author, idLpu); hdDoctor = new TestDoctor(r.HealthGroup.Doctor, idLpu); if (r.Recommendations != null) { recom = new List <TestRecommendation>(); foreach (Recommendation i in r.Recommendations) { recom.Add(new TestRecommendation(i, idLpu)); } } } }
static public TestDischargeSummary BuildSickListFromDataBaseData(string idStep) { if (idStep != "") { List <TestAttachment> lta = TestAttachment.BuildTestAttacmentFromDataBase(idStep, idEpicrisis); if (lta != null) { foreach (TestAttachment i in lta) { DischargeSummary r = new DischargeSummary(); r.CreationDate = i.CreationDate; r.Header = i.DocHead; TestDischargeSummary tr = new TestDischargeSummary(r); tr.attachment = i; tr.doctor = TestDoctor.BuildTestDoctorFromDataBase(i.IdDoctor); return(tr); } } } return(null); }
static public TestConsultNote BuildSickListFromDataBaseData(string idStep) { if (idStep != "") { List <TestAttachment> lta = TestAttachment.BuildTestAttacmentFromDataBase(idStep, idConsultNote); if (lta != null) { foreach (TestAttachment i in lta) { ConsultNote r = new ConsultNote(); r.CreationDate = i.CreationDate; r.Header = i.DocHead; TestConsultNote tr = new TestConsultNote(r); tr.attachment = i; tr.doctor = TestDoctor.BuildTestDoctorFromDataBase(i.IdDoctor); return(tr); } } } return(null); }
private void FindMismatch(TestAttachment at) { if (this.attachment.Url != at.attachment.Url) Global.errors3.Add("несовпадение Url TestAttachment"); if (this.attachment.MimeType != at.attachment.MimeType) Global.errors3.Add("несовпадение MimeType TestAttachment"); }
static public TestDispensaryOne BuildSickListFromDataBaseData(string idStep) { if (idStep != "") { List <TestAttachment> lta = TestAttachment.BuildTestAttacmentFromDataBase(idStep, idDispensaryOne); if (lta != null) { foreach (TestAttachment i in lta) { using (SqlConnection connection = Global.GetSqlConnection()) { string findDO = "SELECT TOP(1) * FROM DispensaryStage1, DispensaryStage1HealthGroup WHERE DispensaryStage1.idDispensaryStage1 = (SELECT MAX(idDispensaryStage1) FROM DispensaryStage1 WHERE IdMedDocument = '" + i.idMedDocument + "') AND DispensaryStage1.idDispensaryStage1 = DispensaryStage1HealthGroup.idDispensaryStage1"; SqlCommand DOcommand = new SqlCommand(findDO, connection); using (SqlDataReader DOReader = DOcommand.ExecuteReader()) { while (DOReader.Read()) { DispensaryOne r = new DispensaryOne(); r.HealthGroup = new HealthGroup(); r.HealthGroup.HealthGroupInfo = new HealthGroupInfo(); if (DOReader["IsGuested"].ToString() != "") { r.IsGuested = Convert.ToBoolean(DOReader["IsGuested"]); } if (DOReader["HasExtraResearchRefferal"].ToString() != "") { r.HasExtraResearchRefferal = Convert.ToBoolean(DOReader["HasExtraResearchRefferal"]); } if (DOReader["IsUnderObservation"].ToString() != "") { r.IsUnderObservation = Convert.ToBoolean(DOReader["IsUnderObservation"]); } if (DOReader["HasExpertCareRefferal"].ToString() != "") { r.HasExpertCareRefferal = Convert.ToBoolean(DOReader["HasExpertCareRefferal"]); } if (DOReader["HasPrescribeCure"].ToString() != "") { r.HasPrescribeCure = Convert.ToBoolean(DOReader["HasPrescribeCure"]); } if (DOReader["HasHealthResortRefferal"].ToString() != "") { r.HasHealthResortRefferal = Convert.ToBoolean(DOReader["HasHealthResortRefferal"]); } if (DOReader["HasSecondStageRefferal"].ToString() != "") { r.HasSecondStageRefferal = Convert.ToBoolean(DOReader["HasSecondStageRefferal"]); } if (DOReader["IdHealthGroup"].ToString() != "") { r.HealthGroup.HealthGroupInfo.IdHealthGroup = Convert.ToByte(DOReader["IdHealthGroup"]); } if (DOReader["Date"].ToString() != "") { r.HealthGroup.HealthGroupInfo.Date = Convert.ToDateTime(DOReader["Date"]); } r.Header = i.DocHead; r.CreationDate = i.CreationDate; TestDispensaryOne tdo = new TestDispensaryOne(r); if (DOReader["IdDoctor"].ToString() != "") { tdo.hdDoctor = TestDoctor.BuildTestDoctorFromDataBase((DOReader["IdDoctor"]).ToString()); } if (DOReader["idDispensaryStage1"].ToString() != "") { tdo.recom = TestRecommendation.BuildSickListFromDataBaseData(DOReader["idDispensaryStage1"].ToString()); } tdo.doctor = TestDoctor.BuildTestDoctorFromDataBase(i.IdDoctor); tdo.attachment = i; return(tdo); } } } } } } return(null); }
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); } }
//public TestReferral(ReferralDto r) //{ // referral = new Referral // { // ReferralInfo = new ReferralInfo // { // IdReferralType = Convert.ToByte(r.IdReferralType), // IdReferralMis = r.IdReferralMis, // IssuedDateTime = r.IssuedDateTime, // //r.IdUrgencyType; // MkbCode = r.MkbCode, // Reason = r.Reason // }, // IdSourceLpu = r.IdSourceLpu, // IdTargetLpu = r.IdTargetLpu, // //r.IdLPU; // }; // attachment = new TestAttachment(new MedDocument.DocumentAttachment()); // doctor = TestDoctor.BuildTestDoctorFromDataBase(r.IdDoctorRef); // departmentHead = TestDoctor.BuildTestDoctorFromDataBase(r.IdRefDepartmentHead); //} static public List <TestReferral> BuildReferralFromDataBaseData(string idStep) { List <TestReferral> trl = new List <TestReferral>(); if (idStep != "") { List <TestAttachment> lta = TestAttachment.BuildTestAttacmentFromDataBase(idStep, idReferral); if (lta != null) { foreach (TestAttachment i in lta) { using (SqlConnection connection = Global.GetSqlConnection()) { string findR = "SELECT * FROM Referral WHERE IdMedDocument = '" + i.idMedDocument + "'"; SqlCommand Rcommand = new SqlCommand(findR, connection); using (SqlDataReader RReader = Rcommand.ExecuteReader()) { while (RReader.Read()) { Referral r = new Referral(); r.ReferralInfo = new ReferralInfo(); if (RReader["MkbCode"].ToString() != "") { r.ReferralInfo.MkbCode = Convert.ToString(RReader["MkbCode"]); } if (RReader["IdSourceLpu"].ToString() != "") { r.IdSourceLpu = Global.GetIdIdLpu(Convert.ToString(RReader["IdSourceLpu"])); } if (RReader["IdTargetLpu"].ToString() != "") { r.IdTargetLpu = Global.GetIdIdLpu(Convert.ToString(RReader["IdTargetLpu"])); } if (RReader["Reason"].ToString() != "") { r.ReferralInfo.Reason = Convert.ToString(RReader["Reason"]); } if (RReader["IdReferralMIS"].ToString() != "") { r.ReferralInfo.IdReferralMis = Convert.ToString(RReader["IdReferralMIS"]); } if (RReader["IdReferralType"].ToString() != "") { r.ReferralInfo.IdReferralType = Convert.ToByte(RReader["IdReferralType"]); } if (RReader["IssuedDateTime"].ToString() != "") { r.ReferralInfo.IssuedDateTime = Convert.ToDateTime(RReader["IssuedDateTime"]); } if (RReader["IdHospitalizationOrder"].ToString() != "") { r.ReferralInfo.HospitalizationOrder = Convert.ToByte(RReader["IdHospitalizationOrder"]); } if (RReader["ReferralId"].ToString() != "") { r.ReferralID = Convert.ToString(RReader["ReferralId"]); } if (RReader["RelatedId"].ToString() != "") { r.RelatedID = Convert.ToString(RReader["RelatedId"]); } r.CreationDate = i.CreationDate; r.Header = i.DocHead; //Тут нет ReferalId и referedId TestReferral tr = new TestReferral(r); tr.attachment = i; if (RReader["IdRefDepartmentHead"].ToString() != "") { tr.departmentHead = TestDoctor.BuildTestDoctorFromDataBase((RReader["IdRefDepartmentHead"]).ToString()); } tr.doctor = TestDoctor.BuildTestDoctorFromDataBase(i.IdDoctor); trl.Add(tr); } } } } } } if (trl.Count != 0) { return(trl); } else { return(null); } }
static public List <TestAttachment> BuildTestAttacmentFromDataBase(string idStep, string idMedDocumentType) { List <TestAttachment> taList = new List <TestAttachment>(); if (idStep != "") { using (SqlConnection connection = Global.GetSqlConnection()) { string findDocuments = "SELECT * FROM MedDocument WHERE IdStep = '" + idStep + "' AND IdMedDocumentType = '" + idMedDocumentType + "'"; SqlCommand participantCommand = new SqlCommand(findDocuments, connection); using (SqlDataReader docsReader = participantCommand.ExecuteReader()) { while (docsReader.Read()) { MedDocument.DocumentAttachment at = new MedDocument.DocumentAttachment(); if (docsReader["Attachment"].ToString() != "") { byte[] ata = docsReader["Attachment"] as byte[]; if (ata != null) { at.Data = ata; } } if (docsReader["AttachmentHash"].ToString() != "") { byte[] ath = docsReader["AttachmentHash"] as byte[]; if (ath != null) { at.Hash = ath; } } if (docsReader["AttachmentURL"].ToString() != "") { at.Url = new Uri(Convert.ToString(docsReader["AttachmentURL"])); } if (docsReader["MIMEType"].ToString() != "") { at.MimeType = docsReader["MIMEType"].ToString(); } TestAttachment t = new TestAttachment(at); if (docsReader["IdMedDocument"].ToString() != "") { t.idMedDocument = docsReader["IdMedDocument"].ToString(); } if (docsReader["DocHead"].ToString() != "") { t.DocHead = docsReader["DocHead"].ToString(); } if (docsReader["CreationDate"].ToString() != "") { t.CreationDate = Convert.ToDateTime(docsReader["CreationDate"]); } if (docsReader["IdDoctor"].ToString() != "") { t.IdDoctor = docsReader["IdDoctor"].ToString(); } taList.Add(t); } } } } if (taList.Count != 0) { return(taList); } else { return(null); } }