private void buildPrescriptionFromPatient(Patient patient) { // e,g. //new string[] { "", "Medication", "Morning", "Noon", "Evening" }, //new string[] { "1", "iso ace 20mg", "100", "100", "100" }, //new string[] { "", "you should now have a keystore that opens to the password bzFE5gja if you change this password, you need to modify the jvm.options file to reflect the same.", "", "", "" }, //new string[] { "", "", "", "", "" } List<string> medlines = new List<string>(); int i = 1; string[] HEAD = { "", "Medication", "Morning", "Noon", "Evening" }; string[] BLANK = { "", "", "", "", "" }; string[] lines; foreach (string[] D in new string[][] { HEAD }) { lines = formatMedicationOrDosageForPrint(D); foreach (string line in lines) { medlines.Add(line); } } foreach (Dosage d in patient.getCurrentPrescription().getPrescriptionItems()) { int[] dose = d.getDose(); string[] dosage = {"", d.getRecommended(), "", "", "" }; string[] med = { i + "", d.getMedicine().getName(), dose[0] + "", dose[1] + "", dose[2] + "" }; i++; foreach (string[] D in new string[][] { med, dosage, BLANK }) { lines = formatMedicationOrDosageForPrint(D); foreach (string line in lines) { medlines.Add(line); } } } PRESCRIPTION = medlines.ToArray(); }
public void print(Patient patient) { printDocument = new PrintDocument(); printDocument.PrintPage += new PrintPageEventHandler(PrintPage); string name = patient.getName(); string age_gen = patient.getAge() + "/" + patient.getGender(); string date = DateTime.Now.ToString("dd-MMM-yyyy"); name_age_date = new string[] {name,age_gen,date}; diagnosis = patient.getCurrentPrescription().getDiagnosis(); buildPrescriptionFromPatient(patient); printDocument.Print(); }