private static string headline(long year, long halfyear, ActionKind actionKind, int patients) { StringBuilder sb = new StringBuilder(); sb.Append("<big><big>SPD - NextAction</big></big> " + actionKind.ToString() + " " + year + " - " + halfyear + " " + patients + " Patients " + DateTime.Now.ToShortDateString() + Environment.NewLine); sb.Append("<br><br>" + Environment.NewLine); return sb.ToString(); }
public IList<long> FindPatientIdsByYearHalfYearAndActionKind(long year, long halfYear, ActionKind actionKind) { try { long tstart = DateTime.Now.Ticks; DbUtil.OpenConnection(); if (findPatientIdByYearHalfYearActionDataCmd == null) { findPatientIdByYearHalfYearActionDataCmd = DbUtil.CreateCommand(SQL_FIND_PATIENTID_BY_YEAR_HALFYEAR_ACTIONKIND, DbUtil.CurrentConnection); findPatientIdByYearHalfYearActionDataCmd.Parameters.Add(DbUtil.CreateParameter("@actionyear", DbType.Int64)); findPatientIdByYearHalfYearActionDataCmd.Parameters.Add(DbUtil.CreateParameter("@actionhalfyear", DbType.Int64)); findPatientIdByYearHalfYearActionDataCmd.Parameters.Add(DbUtil.CreateParameter("@actionkind", DbType.Int64)); } ((IDataParameter)findPatientIdByYearHalfYearActionDataCmd.Parameters["@actionyear"]).Value = year; ((IDataParameter)findPatientIdByYearHalfYearActionDataCmd.Parameters["@actionhalfyear"]).Value = halfYear; ((IDataParameter)findPatientIdByYearHalfYearActionDataCmd.Parameters["@actionkind"]).Value = (long)actionKind; using (IDataReader rdr = findPatientIdByYearHalfYearActionDataCmd.ExecuteReader()) { IList<long> patientIds = new List<long>(); while (rdr.Read()) { patientIds.Add((long)(int)rdr["PatientID"]); } long tend = DateTime.Now.Ticks; log.Info("Find PatientIds By Year HalfYear And ActionKind Year: " + year + " HalfYear: " + halfYear + " ActionKind: " + actionKind.ToString() + " Count: " + patientIds.Count + " " + ((tend - tstart) / 10000) + "ms"); return patientIds; } } catch (Exception e) { log.Error(e.Message); throw e; } finally { DbUtil.CloseConnection(); } }
/// <summary> /// Prints the next action list. /// </summary> /// <param name="patients">The patients.</param> /// <param name="year">The year.</param> /// <param name="halfyear">The halfyear.</param> /// <param name="actionKind">Kind of the action.</param> public void PrintNextActionList(IList<PatientData> patients, long year, long halfyear, ActionKind actionKind) { if (patients == null || patients.Count == 0) { return; } PrintableDocument pd = new PrintableDocument(); pd.DocumentName = "SPD Next Action List"; pd.Landscape = false; Font headlineFont = new Font("Arial", 13.0f, FontStyle.Bold); Font dateFont = new Font("Arial", 10.5f, FontStyle.Bold); Font printFont = new Font("Arial", 11, FontStyle.Regular); Font boldPrintFont = new Font("Arial", 11, FontStyle.Bold); Font barCodeFont = null; if (StaticUtilities.IsFontInstalled("Free 3 of 9 Extended") && SPD.GUI.Properties.Settings.Default.Barcode) { barCodeFont = new Font("Free 3 of 9 Extended", 30, FontStyle.Regular, GraphicsUnit.Point); } float leftMargin = 65; float topMargin = 30; int page = 1; int line = 2; PrintablePage pp = new PrintablePage(); pp.AddPrintableObject(new PrintableTextObject("SPD - NextAction - " + actionKind.ToString(), headlineFont, Brushes.Black, leftMargin, topMargin + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableTextObject(year + " - " + halfyear + " " + patients.Count + " Patients", printFont, Brushes.Black, leftMargin + 300, topMargin + 3 + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableTextObject(DateTime.Now.ToShortDateString() + " Page: " + page, printFont, Brushes.Black, leftMargin + 545, topMargin + 3 + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)topMargin + 20, (int)leftMargin + 680, (int)topMargin + 20)); foreach (PatientData patient in patients) { pp.AddPrintableObject(new PrintableTextObject("ID: " + patient.Id, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); pp.AddPrintableObject(new PrintableTextObject("Sex: " + patient.Sex, printFont, Brushes.Black, leftMargin + 100, topMargin + (float)(line * 17.56))); pp.AddPrintableObject(new PrintableTextObject("Phone: " + patient.Phone, printFont, Brushes.Black, leftMargin + 200, topMargin + (float)(line * 17.56))); pp.AddPrintableObject(new PrintableTextObject("Birthdate: " + patient.DateOfBirth.ToShortDateString() + " - " + CommonUtilities.StaticUtilities.getAgeFromBirthDate(patient.DateOfBirth) + " years", printFont, Brushes.Black, leftMargin + 450, topMargin + (float)(line * 17.56))); line++; if (barCodeFont != null) { pp.AddPrintableObject(new PrintableTextObject(String.Format("*000000{0}*", patient.Id.ToString()), barCodeFont, Brushes.Black, 500, topMargin + (float)(line * 17.56))); } pp.AddPrintableObject(new PrintableTextObject("Name: " + patient.FirstName + " " + patient.SurName, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; List<string> extradiagnoses = new List<string>(); OperationData operation = this.patComp.GetLastOperationByPatientID(patient.Id); VisitData visit = this.patComp.GetLastVisitByPatientID(patient.Id); if (operation != null && !String.IsNullOrEmpty(operation.Diagnoses)) { extradiagnoses.Add(operation.Diagnoses); extradiagnoses = this.SplitStringsForPrinting(80, extradiagnoses); pp.AddPrintableObject(new PrintableTextObject("OP Diagnoses:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; foreach (string diagnosesLine in extradiagnoses) { pp.AddPrintableObject(new PrintableTextObject(diagnosesLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; } } if (visit != null && !String.IsNullOrEmpty(visit.ExtraDiagnosis)) { extradiagnoses.Add(visit.ExtraDiagnosis); extradiagnoses = this.SplitStringsForPrinting(80, extradiagnoses); pp.AddPrintableObject(new PrintableTextObject("Visit Diagnoses:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; foreach (string diagnosesLine in extradiagnoses) { pp.AddPrintableObject(new PrintableTextObject(diagnosesLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; } } //Therapy if (visit != null && !String.IsNullOrEmpty(visit.ExtraTherapy)) { List<string> therapy = new List<string>(); therapy.Add(visit.ExtraTherapy); therapy = this.SplitStringsForPrinting(80, therapy); pp.AddPrintableObject(new PrintableTextObject("Visit Therapy:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; foreach (string therapyLine in therapy) { pp.AddPrintableObject(new PrintableTextObject(therapyLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; } } //TODO List<string> todo = new List<string>(); foreach(NextActionData nextAction in patComp.GetNextActionsByPatientID(patient.Id)) { if (nextAction.ActionYear == year && nextAction.ActionhalfYear == halfyear && nextAction.ActionKind == actionKind && !String.IsNullOrEmpty(nextAction.Todo)) { todo.Add(nextAction.Todo); } } if (todo.Count > 0) { pp.AddPrintableObject(new PrintableTextObject("ToDo:", boldPrintFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; todo = this.SplitStringsForPrinting(80, todo); foreach (string todoLine in todo) { pp.AddPrintableObject(new PrintableTextObject(todoLine, printFont, Brushes.Black, leftMargin, topMargin + (float)(line * 17.56))); line++; } } pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)((line + 2) * 17.56), (int)leftMargin + 680, (int)((line + 2) * 17.56))); line++; if (line > 50) { page++; pd.AddPrintPage(pp); pp = new PrintablePage(); line = 2; pp.AddPrintableObject(new PrintableTextObject("NextAction - " + actionKind.ToString() + " " + year + "\\" + halfyear + " " + patients.Count + " Patients", headlineFont, Brushes.Black, leftMargin, topMargin + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableTextObject("SPD", headlineFont, Brushes.Black, leftMargin + 400, topMargin + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableTextObject(DateTime.Now.ToShortDateString() + " Page: " + page, headlineFont, Brushes.Black, leftMargin + 500, topMargin + (float)(0 * 17.56))); pp.AddPrintableObject(new PrintableLineObject(Pens.Black, (int)leftMargin, (int)topMargin + 20, (int)leftMargin + 680, (int)topMargin + 20)); } } pd.AddPrintPage(pp); pd.DoPrint(); }
private void DrawNextActionFaxListHeadline(IList<PatientData> patients, PrintablePage pp, ActionKind actionKind, long halfYear, long year, int page, Font headlineFont, float leftMargin, float topMargin, Font tableHeadFont, int xId, int xName, int xAge, int xSex, int xPhone, int xDiagnoses) { pp.AddPrintableObject(new PrintableTextObject("SPD - NextAction - FAX List " + actionKind.ToString() + " " + halfYear + "/" + year + " Page: " + page + " No of Patients: " + patients.Count, headlineFont, Brushes.Black, leftMargin, topMargin)); //TableHead pp.AddPrintableObject(new PrintableFillRectangleObject(Brushes.LightGray, (int)leftMargin, (int)topMargin + 22, 1109, 16)); pp.AddPrintableObject(new PrintableTextObject("ID", tableHeadFont, Brushes.Black, xId, topMargin + 23)); pp.AddPrintableObject(new PrintableTextObject("Name", tableHeadFont, Brushes.Black, xName, topMargin + 23)); pp.AddPrintableObject(new PrintableTextObject("Age", tableHeadFont, Brushes.Black, xAge, topMargin + 23)); pp.AddPrintableObject(new PrintableTextObject("Sex", tableHeadFont, Brushes.Black, xSex, topMargin + 23)); pp.AddPrintableObject(new PrintableTextObject("Phone", tableHeadFont, Brushes.Black, xPhone, topMargin + 23)); pp.AddPrintableObject(new PrintableTextObject("Diagnoses", tableHeadFont, Brushes.Black, xDiagnoses, topMargin + 23)); }