public static void fillBlankTemplate(IDbDataService service, string templateFileName, string hospitalSessionId, Dictionary <string, string> values) { DdtHospital hospitalSession = service.GetDdtHospitalService().GetById(hospitalSessionId); DdvPatient patient = null; if (hospitalSession != null) { DdvDoctor doc = service.GetDdvDoctorService().GetById(hospitalSession.CuringDoctor); patient = service.GetDdvPatientService().GetById(hospitalSession.Patient); values.Add(@"{doctor.who.short}", doc.ShortName); values.Add(@"{patient.initials}", patient.ShortName); values.Add(@"{patient.birthdate}", patient.Birthdate.ToShortDateString()); values.Add(@"{patient.diagnosis}", hospitalSession.Diagnosis); values.Add(@"{patient.age}", DateTime.Now.Year - patient.Birthdate.Year + ""); values.Add(@"{admission.date}", hospitalSession.AdmissionDate.ToShortDateString()); values.Add(@"{patient.historycard}", patient.MedCode); values.Add(@"{doctor.who}", doc.FullName); values.Add(@"{patient.fullname}", patient.FullName); values.Add(@"{date}", DateTime.Now.ToShortDateString()); IList <DdvDoctor> allGroupsDoc = service.GetDdvDoctorService().GetByGroupName("cardioreanimation_department_head"); doc = allGroupsDoc.Count > 0 ? allGroupsDoc[0] : null; values.Add(@"{doctor.io.department}", doc?.ShortName); allGroupsDoc.Clear(); allGroupsDoc = service.GetDdvDoctorService().GetByGroupName("therapy_deputy_head"); doc = allGroupsDoc.Count > 0 ? allGroupsDoc[0] : null; values.Add(@"{doctor.io.hospital}", doc?.ShortName); } string resultName = getTempFileName("Бланк", patient?.FullName); TemplatesUtils.FillTemplateAndShow(Directory.GetCurrentDirectory() + "\\Templates\\" + templateFileName, values, resultName); }
public string processTemplate(IDbDataService service, string hospitalitySession, string objectId, Dictionary <string, string> aditionalValues) { Dictionary <string, string> values = null; if (aditionalValues != null) { values = new Dictionary <string, string>(aditionalValues); } else { values = new Dictionary <string, string>(); } DdtInspection obj = service.GetDdtInspectionService().GetById(objectId); values.Add("{date}", obj.InspectionDate.ToShortDateString()); values.Add("{time}", obj.InspectionDate.ToShortTimeString()); values.Add("{patient.diagnosis}", obj.Diagnosis); values.Add("{complaints}", obj.Complaints); values.Add("{inspection}", obj.Inspection); values.Add("{kateter}", obj.KateterPlacement); values.Add("{result}", obj.InspectionResult); DdvPatient patient = service.GetDdvPatientService().GetById(obj.Patient); values.Add("{patient.initials}", patient == null ? "" : patient.ShortName); values.Add("{patient.age}", patient == null ? "" : (DateTime.Now.Year - patient.Birthdate.Year) + ""); if (!values.ContainsKey("{doctor.who.short}")) { DdvDoctor doc = service.GetDdvDoctorService().GetById(obj.Doctor); values.Add("{doctor.who.short}", doc == null ? "" : doc.ShortName); } IList <DdvDoctor> heads = service.GetDdvDoctorService().GetByGroupName("cardioreanimation_department_head"); if (heads.Count != 0) { DdvDoctor head = heads[0]; values.Add("{doctor.head.short}", head.ShortName); } PutAnalysisData(values, service, obj.ObjectId); string resultFileName = TemplatesUtils.getTempFileName("Ежедневный осмотр", patient.FullName); return(TemplatesUtils.FillTemplate(Directory.GetCurrentDirectory() + "\\Templates\\" + TEMPLATE_FILE_NAME, values, resultFileName)); }
public string processTemplate(IDbDataService service, string hospitalitySession, string objectId, Dictionary <string, string> aditionalValues) { Dictionary <string, string> values = null; if (aditionalValues != null) { values = new Dictionary <string, string>(aditionalValues); } else { values = new Dictionary <string, string>(); } DdtConsilium obj = service.GetDdtConsiliumService().GetById(objectId); values.Add(@"{consilium.date}", DateTime.Now.ToString("dd.MM.yyyy")); values.Add(@"{consilium.time}", DateTime.Now.ToString("HH:mm")); values.Add(@"{consilium.members}", GetMembersInString(service, objectId)); values.Add(@"{admin}", obj?.DutyAdminName); values.Add(@"{doctor.who}", GetDoctorInString(service, obj.Doctor)); values.Add(@"{consilium.goal}", obj.Goal); DdvPatient patient = service.GetDdvPatientService().GetById(obj.Patient); values.Add(@"{patient.initials}", patient.ShortName); values.Add(@"{patient.age}", (DateTime.Now.Year - patient.Birthdate.Year) + ""); values.Add(@"{patient.diagnosis}", obj.Diagnosis); values.Add(@"{consilium.decision}", obj.Decision); values.Add(@"{journal}", obj.Dynamics); PutAnalysisData(values, service, obj.ObjectId); if (values.ContainsKey("{on_ekg}")) { values.Remove("{on_ekg}"); } if (values.ContainsKey("{on_blood}")) { values.Remove("{on_blood}"); } values.Add("{on_ekg}", "ЭКГ в ОКР:"); values.Add("{on_blood}", "В анализах крови: "); return(TemplatesUtils.FillTemplate(Directory.GetCurrentDirectory() + "\\Templates\\" + TemplateFileName, values, TemplatesUtils.getTempFileName("Консилиум", patient.FullName))); }
public string processTemplate(IDbDataService service, string hospitalitySession, string objectId, Dictionary <string, string> aditionalValues) { Dictionary <string, string> values = null; if (aditionalValues != null) { values = new Dictionary <string, string>(aditionalValues); } else { values = new Dictionary <string, string>(); } values.Add(@"{date}", DateTime.Now.ToString("dd.MM.yyyy")); DdvPatient patient = service.GetDdvPatientService().GetById(objectId); values.Add(@"{patient}", patient.FullName); return(TemplatesUtils.FillTemplate(Directory.GetCurrentDirectory() + "\\Templates\\" + TemplateFileName, values)); }
public static void fillAmbulanceLetterTemplate(IDbDataService service, string templateFileName, string hospitalSessionId, Dictionary <string, string> values) { DdtHospital hospitalSession = service.GetDdtHospitalService().GetById(hospitalSessionId); DdvDoctor doc = service.GetDdvDoctorService().GetById(hospitalSession.CuringDoctor); DdvPatient patient = service.GetDdvPatientService().GetById(hospitalSession.Patient); values.Add(@"{doctor.who.short}", doc.ShortName); values.Add(@"{patient.initials}", patient.ShortName); values.Add(@"{patient.birthdate}", patient.Birthdate.ToShortDateString()); values.Add(@"{patient.diagnosis}", hospitalSession.Diagnosis); values.Add(@"{patient.age}", DateTime.Now.Year - patient.Birthdate.Year + ""); values.Add(@"{admission.date}", hospitalSession.AdmissionDate.ToShortDateString()); values.Add(@"{patient.historycard}", patient.MedCode); values.Add(@"{doctor.who}", doc.FullName); values.Add(@"{patient.fullname}", patient.FullName); values.Add(@"{date}", DateTime.Now.ToShortDateString()); string resultName = getTempFileName("Письмо для скорой", patient?.FullName); TemplatesUtils.FillTemplateAndShow(Directory.GetCurrentDirectory() + "\\Templates\\" + templateFileName, values, resultName); }
public string processTemplate(IDbDataService service, string hospitalitySession, string objectId, Dictionary <string, string> aditionalValues) { Dictionary <string, string> values = null; if (aditionalValues != null) { values = new Dictionary <string, string>(aditionalValues); } else { values = new Dictionary <string, string>(); } DdtEpicrisis obj = service.GetDdtEpicrisisService().GetById(objectId); values.Add("{diagnosis}", obj.Diagnosis); values.Add("{date}", obj.EpicrisisDate.ToShortDateString()); DdvPatient patient = service.GetDdvPatientService().GetById(obj.Patient); values.Add("{patient.initials}", patient == null ? "" : patient.ShortName); values.Add("{patient.age}", patient == null ? "" : (DateTime.Now.Year - patient.Birthdate.Year) + ""); DdtHospital hospital = service.GetDdtHospitalService().GetById(hospitalitySession); values.Add("{patient.admission_date}", hospital.AdmissionDate.ToShortDateString()); DdtAnamnesis anamnesis = service.GetDdtAnamnesisService().GetByHospitalSessionId(hospital.ObjectId); values.Add("{complaints}", anamnesis == null ? " " : anamnesis.Complaints); values.Add("{anamnesis}", anamnesis == null ? " " : anamnesis.AnamnesisMorbi); StringBuilder inspectonBld = new StringBuilder(); inspectonBld.Append(CompileValue("St.Presens", anamnesis?.StPresens)); inspectonBld.Append(CompileValue("Органы дыхания", anamnesis?.RespiratorySystem)); inspectonBld.Append(CompileValue("Сердечно-сосудистая система", anamnesis?.CardiovascularSystem)); inspectonBld.Append(CompileValue("Органы пищеварения", anamnesis?.DigestiveSystem)); values.Add("{inspection}", anamnesis == null ? " " : inspectonBld.ToString()); DdtSerology serology = service.GetDdtSerologyService().GetByHospitalSession(hospital.ObjectId); StringBuilder serologyBld = new StringBuilder(); if (serology != null) { serologyBld.Append(CompileValue("Группа крови", serology.BloodType)); serologyBld.Append(CompileValue("Резус-фактор", serology.RhesusFactor)); serologyBld.Append(CompileValue("RW", serology.Rw)); } values.Add("{serology}", serology == null ? " " : serologyBld.ToString()); PutAnalysisData(values, service, obj.ObjectId); StringBuilder bloodStr = new StringBuilder(); if (serology != null) { bloodStr.Append(CompileValue("KELL-ag", serology.KellAg)); bloodStr.Append(CompileValue("HBs ag", serology.HbsAg)); bloodStr.Append(CompileValue("Anti HCV крови", serology.AntiHcv)); bloodStr.Append(CompileValue("HIV", serology.Hiv)); } if (obj.EpicrisisType == (int)DdtEpicrisisDsiType.TRANSFER) { DdtTransfer transfer = service.GetDdtTransferService().GetByHospitalSession(hospitalitySession); if (transfer != null) { values.Add("{destination}", transfer.Destination); values.Add("{contact}", transfer.Contacts); values.Add("{transport_justification}", transfer.TransferJustification); values.Add("{patient.release_date}", transfer.StartDate.ToShortDateString()); } } else if (obj.EpicrisisType == (int)DdtEpicrisisDsiType.DEATH) { values.Add("{conclusion}", " "); } DdvDoctor doc = service.GetDdvDoctorService().GetById(obj.Doctor); values.Add("{doctor.who.short}", doc.ShortName); DdvDoctor surgery = service.GetDdvDoctorService().GetById(hospital.DutyDoctor); values.Add("{surgery}", surgery?.ShortName + "\n"); DdvDoctor anest = service.GetDdvDoctorService().GetById(hospital.AnesthetistDoctor); values.Add("{anestesiolog}", anest?.ShortName); string resultFileName = TemplatesUtils.getTempFileName("Эпикриз", patient.FullName); return(TemplatesUtils.FillTemplate(Directory.GetCurrentDirectory() + "\\Templates\\" + getTemplateName(obj), values, resultFileName)); }
public string processTemplate(IDbDataService service, string hospitalitySession, string objectId, Dictionary <string, string> aditionalValues) { Dictionary <string, string> values = null; if (aditionalValues != null) { values = new Dictionary <string, string>(aditionalValues); } else { values = new Dictionary <string, string>(); } DdtTransfusion transfusion = service.GetDdtTransfusionService().GetById(objectId); DdtHospital hospital = service.GetDdtHospitalService().GetById(hospitalitySession); DdvPatient patient = service.GetDdvPatientService().GetById(hospital.Patient); DdtBloodAnalysis bloodAnalysis = service.GetDdtBloodAnalysisService().GetById(transfusion.BloodAnalysis); values.Add(@"{name}", patient.FullName); values.Add(@"{age}", (DateTime.Now.Year - patient.Birthdate.Year) + ""); values.Add(@"{historycard}", patient.MedCode); values.Add(@"{diagnosis}", hospital.Diagnosis); values.Add(@"{blood}", patient.BloodGroup); values.Add(@"{rh}", patient.RHFactor); values.Add(@"{kell}", patient.Kell); values.Add(@"{phenotype}", patient.Phenotype); values.Add(@"{indications}", "гемическая гипоксия"); values.Add(@"{meduim}", transfusion?.TransfusionMedium); values.Add(@"{doctor}", GetDoctorInString(service, transfusion?.Doctor)); values.Add(@"{transfusionDate}", transfusion?.TransfusionDate.ToShortDateString()); string mediumNames = ""; string mediumCounts = ""; String[] transfusionMediumArray = transfusion.TransfusionMedium.Split(','); foreach (String mediumWithCount in transfusionMediumArray) { String[] mediumArray = mediumWithCount.Split(':'); string mediumName = mediumArray[0]; string mediumCount = mediumArray[1]; switch (mediumName) { case "Blood": mediumName = "Кровь"; break; case "Plasma": mediumName = "Плазма"; break; case "Albumin": continue; case "Platelet": mediumName = "Тромбоцит"; break; } mediumNames += string.IsNullOrEmpty(mediumNames) ? mediumName : ", " + mediumName; mediumCounts += string.IsNullOrEmpty(mediumCounts) ? mediumCount + " дозы" : ", " + mediumCount + " дозы"; } values.Add(@"{mediumNames}", mediumNames); values.Add(@"{mediumCounts}", mediumCounts); values.Add(@"{Hemog}", bloodAnalysis.Hemoglobin); values.Add(@"{Hemat}", "пусто"); values.Add(@"{aptt}", "пусто"); values.Add(@"{inr}", "пусто"); return(TemplatesUtils.FillTemplate(Directory.GetCurrentDirectory() + "\\Templates\\" + TemplateFileName, values)); }
public string processTemplate(IDbDataService service, string hospitalitySession, string objectId, Dictionary <string, string> aditionalValues) { Dictionary <string, string> values = null; if (aditionalValues != null) { values = new Dictionary <string, string>(aditionalValues); } else { values = new Dictionary <string, string>(); } DdtAnamnesis anamnesis = service.GetDdtAnamnesisService().GetById(objectId); values.Add("{allergy}", anamnesis.AnamnesisAllergy); values.Add("{complaints}", anamnesis.Complaints); values.Add("{anamnesis}", anamnesis.AnamnesisMorbi); values.Add("{chronicle}", anamnesis.AccompanyingIllnesses); values.Add("{epid}", anamnesis.AnamnesisEpid); values.Add("{alco}", anamnesis.DrugsIntoxication); values.Add("{st_presens}", anamnesis.StPresens); values.Add("{respiratory_system}", anamnesis.RespiratorySystem); values.Add("{cardiovascular}", anamnesis.CardiovascularSystem); values.Add("{digestive_system}", anamnesis.DigestiveSystem); values.Add("{urinary_system}", anamnesis.UrinarySystem); values.Add("{nervous_system}", anamnesis.NervousSystem); values.Add("{past_surgeries}", anamnesis.PastSurgeries); values.Add("{operation_cause}", anamnesis.OperationCause); values.Add("{diagnosis}", anamnesis.Diagnosis); values.Add("{justification}", anamnesis.DiagnosisJustification); DdvDoctor doc = service.GetDdvDoctorService().GetById(anamnesis.Doctor); values.Add("{cardio}", doc.ShortName); PutAnalysisData(values, service, anamnesis.ObjectId); StringBuilder builder = new StringBuilder(); DdtIssuedMedicineList medList = service.GetDdtIssuedMedicineListService().GetListByParentId(anamnesis?.ObjectId); if (medList != null) { IList <DdtIssuedMedicine> med = service.GetDdtIssuedMedicineService().GetListByMedicineListId(medList.ObjectId); for (int i = 0; i < med.Count; i++) { DdtCure cure = service.GetDdtCureService().GetById(med[i].Cure); if (cure != null) { builder.Append(cure.Name).Append('\n'); } } } values.Add("{issued_medicine}", builder.ToString()); StringBuilder actionsBuilder = new StringBuilder(); IList <DdtIssuedAction> actions = service.GetDdtIssuedActionService().GetListByParentId(objectId); for (int i = 0; i < actions.Count; i++) { actionsBuilder.Append(i + 1).Append(". "); actionsBuilder.Append(actions[i].Action).Append('\n'); } values.Add("{issued_actions}", actionsBuilder.ToString()); DdtHospital hospital = service.GetDdtHospitalService().GetById(hospitalitySession); values.Add("{date}", hospital.AdmissionDate.ToShortDateString() + " " + hospital.AdmissionDate.ToShortTimeString()); DdvPatient patient = service.GetDdvPatientService().GetById(hospital.Patient); string resultName = TemplatesUtils.getTempFileName("Первичный осмотр", patient.FullName); return(TemplatesUtils.FillTemplate(Directory.GetCurrentDirectory() + "\\Templates\\" + TEMPLATE_FILE_NAME, values, resultName)); }
public string processTemplate(IDbDataService service, string hospitalitySession, string objectId, Dictionary <string, string> aditionalValues) { Dictionary <string, string> values = null; if (aditionalValues != null) { values = new Dictionary <string, string>(aditionalValues); } else { values = new Dictionary <string, string>(); } DdtJournalDay day = service.GetDdtJournalDayService().GetById(objectId); PutAnalysisData(values, service, objectId); DdvDoctor doc = service.GetDdvDoctorService().GetById(day.Doctor); values.Add("{doctor.initials}", doc == null ? "" : doc.ShortName); IList <DdtKag> kags = service.GetDdtKagService().GetByParentId(day.ObjectId); DdtKag kag = kags.Count > 0 ? kags[0] : null; string kagValue = ""; if (kag != null) { kagValue += kag.Results == null ? "" : "У пациента по данным КАГ выявлено:" + kag.Results + "\n"; kagValue += kag.KagManipulation == null ? "" : "Пациенту выполнено:" + kag.KagManipulation + "\n"; kagValue += kag.KagAction == null ? "" : "Таким образом, у пациента:" + kag.KagAction + "\n"; } List <string> partsPaths = new List <string>(); if (day.JournalType == (int)DdtJournalDsiType.AfterKag) { Dictionary <string, string> first = new Dictionary <string, string>(); DdtVariousSpecConcluson cardiovascular = service.GetDdtVariousSpecConclusonService().GetByParentId(objectId); DdvDoctor surgeryDoc = service.GetDdvDoctorService().GetById(cardiovascular?.AdditionalInfo4); first.Add("{time}", day.AdmissionDate.ToShortTimeString()); first.Add("{title}", "Осмотр дежурного кардиореаниматолога " + (doc == null ? "" : doc.ShortName) + " совместно с ангиохирургом " + surgeryDoc?.ShortName + ". \n Пациента доставили из рентгеноперационной."); first.Add("{complaints}", "Жалоб на момент осмотра не предъявляет."); first.Add("{journal}", JournalShuffleUtils.shuffleJournalText()); first.Add("{on_monitor}", ""); first.Add("{monitor}", ""); first.Add("{doctor.initials}", doc == null ? "" : doc.ShortName); first.Add("{kag_diagnosis}", kagValue); first.Add("{diagnosis}", kag == null ? "Таким образом, у пациента:" + day.Diagnosis : ""); PutAnalysisData(first, service, null); partsPaths.Add(TemplatesUtils.FillTemplate(Directory.GetCurrentDirectory() + "\\Templates\\" + TEMPLATE_FILE_NAME, first)); Dictionary <string, string> surgeryValues = new Dictionary <string, string>(); surgeryValues.Add("{time}", cardiovascular.AdmissionDate.ToShortTimeString()); surgeryValues.Add("{title}", "Осмотр ренгеноваскулярного хирурга " + surgeryDoc?.ShortName + ". \n"); surgeryValues.Add("{complaints}", "Жалоб на момент осмотра не предъявляет."); surgeryValues.Add("{journal}", cardiovascular?.SpecialistConclusion); surgeryValues.Add("{on_monitor}", ""); surgeryValues.Add("{monitor}", " "); surgeryValues.Add("{kag_diagnosis}", " "); surgeryValues.Add("{diagnosis}", " "); surgeryValues.Add("{doctor.initials}", surgeryDoc == null ? "" : surgeryDoc.ShortName); PutAnalysisData(surgeryValues, service, null); partsPaths.Add(TemplatesUtils.FillTemplate(Directory.GetCurrentDirectory() + "\\Templates\\" + TEMPLATE_FILE_NAME, surgeryValues)); } List <DdtJournal> journals = service.GetDdtJournalService().GetByJournalDayId(objectId); for (int i = 0; i < journals.Count; i++) { Dictionary <string, string> jrnlValues = new Dictionary <string, string>(); DdtJournal journal = journals[i]; jrnlValues.Add("{time}", journal.AdmissionDate.ToShortTimeString()); jrnlValues.Add("{title}", " "); jrnlValues.Add("{complaints}", journal.Complaints); jrnlValues.Add("{on_monitor}", string.IsNullOrEmpty(journal.Monitor) ? string.Empty : "По монитору: "); jrnlValues.Add("{journal}", journal.Journal); jrnlValues.Add("{monitor}", string.IsNullOrEmpty(journal.Monitor) ? string.Empty : journal.Monitor); DdvDoctor jrnlDoc = service.GetDdvDoctorService().GetById(journal.Doctor); jrnlValues.Add("{doctor.initials}", day.JournalType == (int)DdtJournalDsiType.AfterKag || jrnlDoc == null ? doc?.ShortName : jrnlDoc.ShortName); if (i == journals.Count - 1) { jrnlValues.Add("{kag_diagnosis}", kagValue); jrnlValues.Add("{diagnosis}", String.IsNullOrEmpty(day.Diagnosis) ? "" : "Таким образом, у пациента:" + day.Diagnosis); PutAnalysisData(jrnlValues, service, objectId); } else { jrnlValues.Add("{kag_diagnosis}", " "); jrnlValues.Add("{diagnosis}", " "); PutAnalysisData(jrnlValues, service, null); } string mainPart = TemplatesUtils.FillTemplate(Directory.GetCurrentDirectory() + "\\Templates\\" + TEMPLATE_FILE_NAME, jrnlValues); partsPaths.Add(mainPart); } DdvPatient patient = service.GetDdvPatientService().GetById(day.Patient); string resultName = TemplatesUtils.getTempFileName("Журнал", patient.FullName); return(TemplatesUtils.MergeFiles(partsPaths.ToArray(), false, resultName)); }