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); }
private string GetMembersInString(IDbDataService service, string consiliumId) { IList <DdtConsiliumRelation> consiluimRelations = service.GetDdtConsiliumRelationService().GetConsiliumRelationsByConsiliumId(consiliumId); Dictionary <int, String> memberToOrder = new Dictionary <int, String>(); SortedDictionary <String, String> sortedMembers = new SortedDictionary <String, String>(); foreach (DdtConsiliumRelation relation in consiluimRelations) { DdtConsiliumGroupMember groupMember = service.GetDdtConsiliumGroupMemberService().GetById(relation.Member); DdtConsiliumGroup group = service.GetDdtConsiliumGroupService().GetById(groupMember.Group); DdvDoctor doctor = service.GetDdvDoctorService().GetById(groupMember.Doctor); if (!sortedMembers.ContainsKey(group.Level + " " + group.Name + " " + doctor.ShortName)) { sortedMembers.Add(group.Level + " " + group.Name + " " + doctor.ShortName, group.Name + " " + groupMember.Name + " " + doctor.ShortName); } } StringBuilder str = new StringBuilder(); foreach (KeyValuePair <String, String> kvp in sortedMembers) { if (str.Length > 0) { str.Append('\n'); } str.Append(kvp.Value); } return(str.ToString()); }
public object getObject() { DdtJournal journal = DbDataService.GetInstance().GetDdtJournalService().GetById(objectId); if (journal == null) { journal = new DdtJournal(); journal.JournalType = (int)DdtJournalDsiType.PendingJustification; } journal.Ad = deferredAdTxt.Text; journal.Chdd = defferedChddTxt.Text; journal.Chss = deferredChssTxt.Text; journal.Journal = deferredJournalTxt.Text; journal.Monitor = deferredMonitorTxt.Text; journal.AdmissionDate = CommonUtils.ConstructDateWIthTime(deferredStartDate.Value, deferredStartTime.Value); DdvDoctor selectedDoc = (DdvDoctor)docBox.SelectedItem; if (selectedDoc != null) { journal.Doctor = selectedDoc.ObjectId; } return(journal); }
private void OpenDeathProtocol(object sender, EventArgs e) { if (getIsNotValid()) { MessageBox.Show("Введены не все данные на форме!", "Предупреждение!", MessageBoxButtons.OK); return; } string templatePath = Directory.GetCurrentDirectory() + "\\Templates\\death_template.doc"; Dictionary <string, string> values = new Dictionary <string, string>(); values.Add(@"{date}", deathDateTxt.Value.ToString("MM.dd.yyyy")); values.Add(@"{time}", deathTimeCtrl.Text); DdvDoctor doc = (DdvDoctor)doctorsBox.SelectedItem; values.Add(@"{doctor.who.short}", doc != null ? doc.ShortName: ""); values.Add( "{patient.passport_info}", string.Format(CultureInfo.CurrentCulture, "{0} {1}, выдан {2} {3}", patient.PassportSerial, patient.PassportNum, patient.PassportDate.ToShortDateString(), patient.PassportIssuePlace) ); values.Add(@"{doctor.appointment_name}", ""); values.Add(@"{patient.full_name}", patient.FullName); values.Add(@"{patient.birthdate}", patient.Birthdate != null ? patient.Birthdate.ToShortDateString(): ""); values.Add(@"{patient.sex}", patient.Sex ? "мужской" : "женский"); values.Add(@"{patient.medcode}", patient.MedCode); values.Add(@"{doctor.who}", doc != null ? doc.FullName: ""); TemplatesUtils.FillTemplateAndShow(templatePath, values, TemplatesUtils.getTempFileName("Констатация смерти", patient.FullName)); }
public List <DdvDoctor> GetByQuery(string sql) { List <DdvDoctor> list = new List <DdvDoctor>(); using (dynamic connection = connectionFactory.GetConnection()) { Logger.Debug(CultureInfo.CurrentCulture, "SQL: {0}", sql); Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(sql, connection); using (DbDataReader reader = command.ExecuteReader()) { while (reader.Read()) { DdvDoctor obj = new DdvDoctor(); obj.ObjectId = reader.IsDBNull(0) ? null : reader.GetString(0); obj.FullName = reader.IsDBNull(1) ? null : reader.GetString(1); obj.MiddleName = reader.IsDBNull(2) ? null : reader.GetString(2); obj.FirstName = reader.IsDBNull(3) ? null : reader.GetString(3); obj.ModifyDate = reader.IsDBNull(4) ? DateTime.MinValue : reader.GetDateTime(4); obj.ShortName = reader.IsDBNull(5) ? null : reader.GetString(5); obj.CreationDate = reader.IsDBNull(6) ? DateTime.MinValue : reader.GetDateTime(6); obj.LastName = reader.IsDBNull(7) ? null : reader.GetString(7); list.Add(obj); } } } return(list); }
public IList <DdvDoctor> GetByGroupName(string groupName) { IList <DdvDoctor> list = new List <DdvDoctor>(); using (dynamic connection = connectionFactory.GetConnection()) { String sql = String.Format("SELECT d.r_object_id, d.dss_full_name, d.dss_middle_name, d.dss_first_name, d.r_modify_date," + " d.dss_short_name, d.r_creation_date, d.dss_last_name FROM ddv_doctor d, dm_group_users g WHERE g.dss_group_name = '{0}'" + " AND d.r_object_id = g.dsid_doctor_id", groupName); Logger.Debug(CultureInfo.CurrentCulture, "SQL: {0}", sql); Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(sql, connection); using (DbDataReader reader = command.ExecuteReader()) { while (reader.Read()) { DdvDoctor obj = new DdvDoctor(); obj.ObjectId = reader.IsDBNull(0) ? null : reader.GetString(0); obj.FullName = reader.IsDBNull(1) ? null : reader.GetString(1); obj.MiddleName = reader.IsDBNull(2) ? null : reader.GetString(2); obj.FirstName = reader.IsDBNull(3) ? null : reader.GetString(3); obj.ModifyDate = reader.IsDBNull(4) ? DateTime.MinValue : reader.GetDateTime(4); obj.ShortName = reader.IsDBNull(5) ? null : reader.GetString(5); obj.CreationDate = reader.IsDBNull(6) ? DateTime.MinValue : reader.GetDateTime(6); obj.LastName = reader.IsDBNull(7) ? null : reader.GetString(7); list.Add(obj); } } } return(list); }
public IList <DdvDoctor> GetByConsiliumGroupId(string consiliumGroupId) { IList <DdvDoctor> list = new List <DdvDoctor>(); using (dynamic connection = connectionFactory.GetConnection()) { String sql = String.Format("SELECT d.r_object_id, dss_full_name, dss_middle_name, dss_first_name, d.r_modify_date, dss_short_name, d.r_creation_date, dss_last_name, gm.dss_name " + "FROM ddt_consilium_group cg, ddt_consilium_group_member gm, ddv_doctor d " + "WHERE cg.r_object_id = gm.dsid_group and gm.dsid_doctor = d.r_object_id and cg.r_object_id = '{0}'", consiliumGroupId); Logger.Debug(CultureInfo.CurrentCulture, "SQL: {0}", sql); Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(sql, connection); using (DbDataReader reader = command.ExecuteReader()) { while (reader.Read()) { DdvDoctor obj = new DdvDoctor(); obj.ObjectId = reader.IsDBNull(0) ? null : reader.GetString(0); obj.FullName = reader.IsDBNull(1) ? null : reader.GetString(1); obj.MiddleName = reader.IsDBNull(2) ? null : reader.GetString(2); obj.FirstName = reader.IsDBNull(3) ? null : reader.GetString(3); obj.ModifyDate = reader.IsDBNull(4) ? DateTime.MinValue : reader.GetDateTime(4); obj.ShortName = (reader.IsDBNull(8) ? null : reader.GetString(8)) + " " + (reader.IsDBNull(5) ? null : reader.GetString(5)); obj.CreationDate = reader.IsDBNull(6) ? DateTime.MinValue : reader.GetDateTime(6); obj.LastName = reader.IsDBNull(7) ? null : reader.GetString(7); list.Add(obj); } } } return(list); }
public DdvDoctor GetById(string id) { using (dynamic connection = connectionFactory.GetConnection()) { String sql = String.Format("SELECT r_object_id, dss_full_name, dss_middle_name, dss_first_name, r_modify_date, dss_short_name, r_creation_date," + " dss_last_name FROM ddv_doctor WHERE r_object_id = '{0}'", id); Logger.Debug(CultureInfo.CurrentCulture, "SQL: {0}", sql); Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(sql, connection); using (DbDataReader reader = command.ExecuteReader()) { if (reader.Read()) { DdvDoctor obj = new DdvDoctor(); obj.ObjectId = reader.IsDBNull(0) ? null : reader.GetString(0); obj.FullName = reader.IsDBNull(1) ? null : reader.GetString(1); obj.MiddleName = reader.IsDBNull(2) ? null : reader.GetString(2); obj.FirstName = reader.IsDBNull(3) ? null : reader.GetString(3); obj.ModifyDate = reader.IsDBNull(4) ? DateTime.MinValue : reader.GetDateTime(4); obj.ShortName = reader.IsDBNull(5) ? null : reader.GetString(5); obj.CreationDate = reader.IsDBNull(6) ? DateTime.MinValue : reader.GetDateTime(6); obj.LastName = reader.IsDBNull(7) ? null : reader.GetString(7); return(obj); } } } return(null); }
private void OpenReanimationProtocol(object sender, EventArgs e) { if (getIsNotValid()) { MessageBox.Show("Введены не все данные на форме!", "Предупреждение!", MessageBoxButtons.OK); return; } string templatePath = Directory.GetCurrentDirectory() + "\\Templates\\reanim_operations_template.doc"; Dictionary <string, string> values = new Dictionary <string, string>(); values.Add(@"{death.date}", deathDateTxt.Text); values.Add(@"{death.time}", deathTimeCtrl.Text); DdvDoctor doc = (DdvDoctor)doctorsBox.SelectedItem; values.Add(@"{doctor.who.short}", doc == null ? "" : doc.ShortName); DateTime deathTime = CommonUtils.ConstructDateWIthTime(deathDateTxt.Value, deathTimeCtrl.Value); for (int i = 0; i < 10; i++) { deathTime = deathTime.AddMinutes(-5.0); values.Add(@"{time" + i + "}", deathTime.ToShortTimeString()); } TemplatesUtils.FillTemplateAndShow(templatePath, values, TemplatesUtils.getTempFileName("Реанимационные действия", patient.FullName)); }
public void refreshObject(object obj) { if (obj != null && obj is DdtJournal) { DdtJournal journal = (DdtJournal)obj; deferredJournalTxt.Text = journal.Journal; deferredAdTxt.Text = journal.Ad; defferedChddTxt.Text = journal.Chdd; deferredChssTxt.Text = journal.Chss; deferredMonitorTxt.Text = journal.Monitor; deferredStartDate.Value = journal.AdmissionDate; deferredStartTime.Value = journal.AdmissionDate; DdvDoctor doc = DbDataService.GetInstance().GetDdvDoctorService().GetById(journal.Doctor); docBox.SelectedIndex = docBox.FindStringExact(doc.ShortName); objectId = journal.ObjectId; isNew = string.IsNullOrEmpty(objectId); hasChanges = false; } else { deferredJournalTxt.Text = JournalShuffleUtils.shuffleJournalText(); deferredChssTxt.SelectedIndex = JournalShuffleUtils.shuffleNextIndex(deferredChssTxt.Items.Count - 1); deferredAdTxt.SelectedIndex = JournalShuffleUtils.shuffleNextIndex(deferredAdTxt.Items.Count - 1); defferedChddTxt.SelectedIndex = defferedChddTxt.FindString("14"); } }
internal static void SetDoctorsComboboxDefaultValue(IDbDataService service, ComboBox cb, string dsidCuringDoctor) { if (!string.IsNullOrEmpty(dsidCuringDoctor)) { DdvDoctor doctor = service.GetDdvDoctorService().GetById(dsidCuringDoctor); cb.SelectedIndex = cb.FindStringExact(doctor.ShortName); } }
private void InitDocBoxValue(ComboBox cb, string docId) { if (!string.IsNullOrEmpty(docId)) { DdvDoctor doc = service.GetDdvDoctorService().GetById(docId); cb.SelectedIndex = cb.FindStringExact(doc?.ShortName); } }
private void InitControls() { if (hospital == null) { return; } DdvPatient patient = service.GetDdvPatientService().GetById(hospital.Patient); addressTxt.Text = patient.Address; patientLastName.Text = patient.LastName; patientFirstName.Text = patient.FirstName; patientSecondName.Text = patient.MiddleName; medCodeTxt.Text = patient.MedCode; phoneTxt.Text = patient.Phone; snilsTxt.Text = patient.Snils; omsTxt.Text = patient.Oms; passportDataTxt.Value = patient.PassportDate; passportIssuePlaceTxt.Text = patient.PassportIssuePlace; passportNumTxt.Text = patient.PassportNum; passportSerialTxt.Text = patient.PassportSerial; weightTxt.Text = patient.Weight.ToString(CultureInfo.InvariantCulture); highTxt.Text = patient.High.ToString(CultureInfo.InvariantCulture); patientBirthDate.Value = patient.Birthdate; sdBtn.Checked = patient.Sd; maleChb.Checked = patient.Sex; femaleChb.Checked = !patient.Sex; patientReceiptDate.Value = hospital.AdmissionDate; patientReceiptTime.Text = hospital.AdmissionDate.TimeOfDay.ToString(); DdvDoctor docDuty = service.GetDdvDoctorService().GetById(hospital.CuringDoctor); dutyCardioBox.SelectedIndex = dutyCardioBox.FindStringExact(docDuty.ShortName); DdvDoctor docCuring = service.GetDdvDoctorService().GetById(hospital.DutyDoctor); cardioDocBox.SelectedIndex = cardioDocBox.FindStringExact(docCuring.ShortName); DdvDoctor docSubstitution = service.GetDdvDoctorService().GetById(hospital.SubstitutionDoctor); subDoctorBox.SelectedIndex = subDoctorBox.FindStringExact(docSubstitution.ShortName); DdvDoctor directorCardioReanim = service.GetDdvDoctorService().GetById(hospital.DirCardioReanimDoctor); directorCardioReanimBox.SelectedIndex = directorCardioReanimBox.FindStringExact(directorCardioReanim.ShortName); DdvDoctor anesthetistDoctor = service.GetDdvDoctorService().GetById(hospital.AnesthetistDoctor); anesthetistComboBox.SelectedIndex = anesthetistComboBox.FindStringExact(anesthetistDoctor.ShortName); roomTxt.Text = hospital.RoomCell; }
private void printBtn_Click(object sender, EventArgs e) { SaveIssuedMedicine(); Dictionary <string, string> values = new Dictionary <string, string>(); DdtIssuedMedicineList medList = service.GetDdtIssuedMedicineListService().GetById(issuedMedId); DdtHospital hospitalSession = service.GetDdtHospitalService().GetById(hospitalitySession.ObjectId); DdvDoctor doc = null; DdvDoctor nurse = null; DdvDoctor director = null; DdvDoctor pharma = null; DdvPatient patient = null; if (medList != null) { doc = service.GetDdvDoctorService().GetById(medList.Doctor); nurse = service.GetDdvDoctorService().GetById(medList.Nurse); director = service.GetDdvDoctorService().GetById(medList.Director); pharma = service.GetDdvDoctorService().GetById(medList.Pharmacologist); patient = service.GetDdvPatientService().GetById(medList.Patient); } values.Add(@"{doctor.who.short}", doc?.ShortName); values.Add(@"{patient.diagnosis}", diagnosisTxt.Text); values.Add(@"{patient.age}", patient != null? DateTime.Now.Year - patient.Birthdate.Year + "": ""); values.Add(@"{admission.date}", hospitalSession.AdmissionDate.ToShortDateString()); values.Add(@"{patient.historycard}", patient?.MedCode); values.Add(@"{patient.fullname}", patient?.FullName); values.Add(@"{kag}", kagBtn.Checked ? shortlyOperationTxt.Text : ""); values.Add(@"{nurse}", nurse?.ShortName); values.Add(@"{doctor.pharma}", pharma?.ShortName); values.Add(@"{doctor.director}", director?.ShortName); values.Add(@"{room}", hospitalitySession.RoomCell); values.Add(@"{cell}", ""); values.Add(@"{diet}", "НКД"); values.Add(@"{date}", DateTime.Now.ToShortDateString()); //todo переписать,когда будет время. Сделать добавление в таблицу строчек автоматом for (int i = 0; i < 19; i++) { string value = ""; if (i < medicineList.Count) { DdtCure cure = service.GetDdtCureService().GetById(medicineList[i].Cure); value = cure.Name; } values.Add(@"{issued_medicine_" + i + "}", value); } string templatePath = Directory.GetCurrentDirectory() + "\\Templates\\issued_medicine_template.doc"; TemplatesUtils.FillTemplateAndShow(templatePath, values, TemplatesUtils.getTempFileName("Назначения", patient.FullName)); }
private void gkb52Btn_Click(object sender, System.EventArgs e) { Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("{from_date}", fromDate.Value.ToShortDateString()); data.Add("{from_time}", fromTime.Value.ToShortTimeString()); data.Add("{to_date}", toDate.Value.ToShortDateString()); data.Add("{to_time}", toTime.Value.ToShortTimeString()); DdvDoctor doc = (DdvDoctor)doctorsBox.SelectedItem; data.Add("{doctor.selected}", doc == null ? "" : doc.ShortName); TemplatesUtils.fillAmbulanceLetterTemplate(service, "gkb52_letter_template.doc", hospitalitySession.ObjectId, data); }
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 void saveObject(DdtHospital hospitalitySession, string parentId, string parentType) { if (string.IsNullOrEmpty(journalTxt.Text) || !(isDirty() || isNew)) { return; } DdtJournal journal = (DdtJournal)getObject(); DdvDoctor selectedDoc = (DdvDoctor)docBox.SelectedItem; journal.Doctor = selectedDoc == null ? hospitalitySession.CuringDoctor : selectedDoc.ObjectId; journal.HospitalitySession = hospitalitySession.ObjectId; journal.Patient = hospitalitySession.Patient; journal.JournalDayId = parentId; objectId = DbDataService.GetInstance().GetDdtJournalService().Save(journal); hasChanges = false; isNew = false; }
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); }
private void printBtn_Click(object sender, EventArgs e) { Save(); ITemplateProcessor tp = TemplateProcessorManager.getProcessorByObjectType(DdtInspection.NAME); if (tp != null) { Dictionary <string, String> values = new Dictionary <string, string>(); DdvDoctor doctor = (DdvDoctor)cardioDoctorBox.SelectedItem; if (doctor != null) { values.Add("{doctor.who.short}", doctor.ShortName); } string filled = tp.processTemplate(service, hospitalitySession.ObjectId, inspectionObj.ObjectId, values); TemplatesUtils.ShowDocument(filled); } }
public object getObject() { DdtJournal journal = DbDataService.GetInstance().GetDdtJournalService().GetById(objectId); if (journal == null) { journal = new DdtJournal(); journal.JournalType = journalType; double weight = 1; if (journalType == (int)DdtJournalDsiType.PendingJustification) { weight = 0.25; } else if (journalType == (int)DdtJournalDsiType.AfterPending) { weight = 0.04; } journal.Weight = weight; } journal.Ad = adTxt.Text; journal.Chdd = chddTxt.Text; journal.Chss = chssTxt.Text; journal.Complaints = complaintsTxt.Text; journal.Journal = journalTxt.Text; journal.Monitor = monitorTxt.Text; journal.GoodRhythm = goodRhytmBtn.Checked; journal.Freeze = freeze.Checked; journal.AdmissionDate = CommonUtils.ConstructDateWIthTime(startDateTxt.Value, startTimeTxt.Value); DdvDoctor selectedDoc = (DdvDoctor)docBox.SelectedItem; if (selectedDoc != null) { journal.Doctor = selectedDoc.ObjectId; } return(journal); }
private void InitControls() { curingDoc = service.GetDdvDoctorService().GetById(hospitalitySession?.CuringDoctor); ControlUtils.InitDoctorsByGroupName(service.GetDdvDoctorService(), adminTxt, "duty_administrators"); DdvPatient patient = service.GetDdvPatientService().GetById(hospitalitySession.Patient); if (patient != null) { Text += " " + patient.ShortName; } diagnosisTxt0.Text = hospitalitySession.Diagnosis; if (!string.IsNullOrEmpty(consiliumId)) { DdtConsilium consilium = service.GetDdtConsiliumService().GetById(consiliumId); if (consilium != null) { goalTxt.Text = consilium.Goal; dynamicsTxt.Text = consilium.Dynamics; adminTxt.SelectedIndex = adminTxt.FindStringExact(consilium.DutyAdminName); diagnosisTxt0.Text = consilium.Diagnosis; decisionTxt.Text = consilium.Decision; IList <DdtConsiliumRelation> consiliumRelations = service.GetDdtConsiliumRelationService().GetConsiliumRelationsByConsiliumId(consilium.ObjectId); InitMembersByRelations(service, consiliumRelations); } } else { DdtAnamnesis anamnesis = service.GetDdtAnamnesisService().GetByHospitalSessionId(hospitalitySession.ObjectId); if (anamnesis != null) { diagnosisTxt0.Text = anamnesis.Diagnosis; } IList <DdtConsiliumGroupMember> defaultGroupMembers = service.GetDdtConsiliumGroupMemberService().GetDefault(); InitDefaultMembers(service, defaultGroupMembers); } }
private void saveAnamnesis(IDbDataService service) { if (anamnesis == null) { anamnesis = new DdtAnamnesis(); anamnesis.HospitalitySession = hospitalSession.ObjectId; anamnesis.Patient = hospitalSession.Patient; anamnesis.InspectionDate = DateTime.Now; } DdvDoctor doc = (DdvDoctor)docBox.SelectedItem; anamnesis.Doctor = doc.ObjectId; anamnesis.AccompanyingIllnesses = getSafeStringValue(accompanyingIllnessesTxt); anamnesis.AnamnesisAllergy = getSafeStringValue(anamnesisAllergyTxt); anamnesis.AnamnesisEpid = getSafeStringValue(anamnesisEpidTxt); anamnesis.AnamnesisMorbi = getSafeStringValue(anamnesisMorbiTxt); anamnesis.AnamnesisVitae = getSafeStringValue(anamnesisVitaeTxt); anamnesis.CardiovascularSystem = getSafeStringValue(cardiovascularSystemTxt); anamnesis.Complaints = getSafeStringValue(complaintsTxt); anamnesis.DiagnosisJustification = getSafeStringValue(justificationTxt); anamnesis.DigestiveSystem = getSafeStringValue(digestiveSystemTxt); anamnesis.DrugsIntoxication = getSafeStringValue(drugsTxt); anamnesis.NervousSystem = getSafeStringValue(nervousSystemTxt); anamnesis.PastSurgeries = getSafeStringValue(pastSurgeriesTxt); anamnesis.RespiratorySystem = getSafeStringValue(respiratorySystemTxt); anamnesis.StPresens = getSafeStringValue(stPresensTxt); anamnesis.UrinarySystem = getSafeStringValue(urinarySystemTxt); anamnesis.Diagnosis = getSafeStringValue(diagnosisTxt); anamnesis.OperationCause = getSafeStringValue(operationCauseTxt); anamnesis.DiagnosisJustification = getSafeStringValue(justificationTxt); string id = service.GetDdtAnamnesisService().Save(anamnesis); anamnesis.ObjectId = id; }
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>(); } 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)); }
private string GetDoctorInString(IDbDataService service, String doctorId) { DdvDoctor doc = service.GetDdvDoctorService().GetById(doctorId); return(doc.ShortName); }
private void admisPatient_Click(object sender, EventArgs e) { if (!GetIsValid()) { MessageBox.Show("Заполните поля помеченные жирным шрифтом!", "Warning", MessageBoxButtons.OK); return; } DdvPatient patient = service.GetDdvPatientService().GetById(hospital?.Patient); if (patient == null) { patient = new DdvPatient(); } patient.Address = addressTxt.Text.Trim(); patient.LastName = patientLastName.Text.Trim(); patient.MiddleName = patientSecondName.Text.Trim(); patient.FirstName = patientFirstName.Text.Trim(); patient.MedCode = medCodeTxt.Text.Trim(); patient.Phone = phoneTxt.Text; patient.Snils = snilsTxt.Text; patient.Oms = omsTxt.Text; patient.PassportDate = passportDataTxt.Value; patient.PassportIssuePlace = passportIssuePlaceTxt.Text; patient.PassportNum = passportNumTxt.Text; patient.PassportSerial = passportSerialTxt.Text; patient.Sd = sdBtn.Checked; patient.Sex = maleChb.Checked; if (!string.IsNullOrEmpty(weightTxt.Text)) { patient.Weight = (float)Double.Parse(weightTxt.Text.Trim()); } if (!string.IsNullOrEmpty(highTxt.Text)) { patient.High = (float)Double.Parse(highTxt.Text.Trim()); } patient.Birthdate = DateTime.ParseExact(patientBirthDate.Text.Trim(), "dd.MM.yyyy", CultureInfo.InvariantCulture); String patientId = service.GetDdtPatientService().Save(patient); if (hospital == null) { hospital = new DdtHospital(); hospital.Patient = patientId; } hospital.Active = true; hospital.AdmissionDate = CommonUtils.ConstructDateWIthTime(patientReceiptDate.Value, patientReceiptTime.Value); DdvDoctor docDuty = (DdvDoctor)cardioDocBox.SelectedItem; hospital.DutyDoctor = docDuty.ObjectId; DdvDoctor docCuring = (DdvDoctor)dutyCardioBox.SelectedItem; hospital.CuringDoctor = docCuring.ObjectId; DdvDoctor docSubstitution = (DdvDoctor)subDoctorBox.SelectedItem; hospital.SubstitutionDoctor = docSubstitution.ObjectId; DdvDoctor directorCardioReanim = (DdvDoctor)directorCardioReanimBox.SelectedItem; hospital.DirCardioReanimDoctor = directorCardioReanim.ObjectId; DdvDoctor anesthetistDoctor = (DdvDoctor)anesthetistComboBox.SelectedItem; hospital.AnesthetistDoctor = anesthetistDoctor.ObjectId; hospital.RoomCell = roomTxt.Text ?? roomTxt.Text.Trim(); service.GetDdtHospitalService().Save(hospital); //todo перенести в статусную строку Close(); }
public bool Save() { if (!getIsValid()) { return(false); } service.GetDdtHospitalService().Save(hospitalitySession); DdtJournalDay journalDay = null; if (!string.IsNullOrEmpty(journalDayId)) { journalDay = service.GetDdtJournalDayService().GetById(journalDayId); } else { journalDay = new DdtJournalDay(); journalDay.JournalType = 1; journalDay.HospitalitySession = hospitalitySession.ObjectId; journalDay.Patient = hospitalitySession.Patient; journalDay.JournalType = (int)DdtJournalDsiType.AfterKag; //journal.Complaints = "Жалоб на момент осмотра не предъявляет."; } journalDay.AdmissionDate = CommonUtils.ConstructDateWIthTime(admissionDateTxt.Value, admissionTimeTxt.Value); DdvDoctor doc = (DdvDoctor)journalDocBox.SelectedItem; journalDay.Doctor = doc == null ? hospitalitySession.DutyDoctor : doc.ObjectId; journalDay.Diagnosis = afterKagDiagnosisTxt.Text; journalDayId = service.GetDdtJournalDayService().Save(journalDay); DdtVariousSpecConcluson cardioVascularConc = service.GetDdtVariousSpecConclusonService().GetByParentId(journalDayId); if (cardioVascularConc == null) { cardioVascularConc = new DdtVariousSpecConcluson(); cardioVascularConc.Parent = journalDayId; } cardioVascularConc.AdmissionDate = CommonUtils.ConstructDateWIthTime(cardioDate.Value, cardioTime.Value); cardioVascularConc.SpecialistConclusion = surgeryInspectationTxt.Text; cardioVascularConc.AdditionalInfo1 = chddSurgeryTxt.Text; cardioVascularConc.AdditionalInfo3 = adSurgeryTxt.Text; cardioVascularConc.AdditionalInfo2 = chssSurgeryTxt.Text; cardioVascularConc.AdditionalInfo4 = (string)cardioVascularBox.SelectedValue; service.GetDdtVariousSpecConclusonService().Save(cardioVascularConc); if (!string.IsNullOrEmpty(kagDiagnosisTxt.Text)) { DdtKag kag = service.GetDdtKagService().GetById(kagId); if (kag == null) { kag = new DdtKag(); kag.Doctor = hospitalitySession.CuringDoctor; kag.HospitalitySession = hospitalitySession.ObjectId; kag.Patient = hospitalitySession.Patient; DateTime admissionDateTime = CommonUtils.ConstructDateWIthTime(admissionDateTxt.Value, admissionTimeTxt.Value); kag.AnalysisDate = admissionDateTime.AddMinutes(-75); kag.StartTime = admissionDateTime.AddMinutes(-75); kag.EndTime = admissionDateTime.AddMinutes(-15); kag.KagAction = kagDiagnosisTxt.Text; kagId = service.GetDdtKagService().Save(kag); IDdtRelationService relationService = DbDataService.GetInstance().GetDdtRelationService(); if (kagId != null && relationService.GetByParentAndChildIds(journalDayId, kagId) == null) { DdtRelation relation = new DdtRelation(); relation.Parent = journalDayId; relation.Child = kagId; relation.ChildType = DdtJournal.NAME; relationService.Save(relation); } } } for (int i = 0; i < dutyCardioContainer.Controls.Count; i++) { JournalKAGControl journalCtrl = (JournalKAGControl)dutyCardioContainer.Controls[i]; journalCtrl.saveObject(hospitalitySession, journalDayId, DdtJournal.NAME); } analysisTabControl1.save(journalDayId, DdtJournal.NAME); return(true); }
private void SaveIssuedMedicine() { DdtIssuedMedicineList medList = service.GetDdtIssuedMedicineListService().GetById(issuedMedId); if (medList == null) { medList = new DdtIssuedMedicineList(); medList.HospitalitySession = hospitalitySession.ObjectId; medList.Patient = hospitalitySession.Patient; } DdvDoctor dir = (DdvDoctor)directorBox.SelectedItem; medList.Director = dir?.ObjectId; DdvDoctor pharm = (DdvDoctor)clinicalPharmacologistBox.SelectedItem; medList.Pharmacologist = pharm?.ObjectId; DdvDoctor nurse = (DdvDoctor)nurseBox.SelectedItem; medList.Nurse = nurse?.ObjectId; DdvDoctor doc = (DdvDoctor)cardioReanimBox.SelectedItem; medList.Doctor = doc == null ? hospitalitySession.DutyDoctor : doc.ObjectId; medList.Diagnosis = diagnosisTxt.Text; medList.TemplateName = templateName; medList.HasKag = shortlyOperationTxt.Text; medList.IssuingDate = createDateTxt.Value; service.GetDdtIssuedMedicineListService().Save(medList); IList <DdtIssuedMedicine> list = service.GetDdtIssuedMedicineService().GetListByMedicineListId(medList.ObjectId); //Добавляем текущий список foreach (DdtIssuedMedicine med in medicineList) { if (med.Cure != null) { med.MedList = medList.ObjectId; service.GetDdtIssuedMedicineService().Save(med); } } //Удаляем то, что было в списке, а сейчас нет foreach (DdtIssuedMedicine old in list) { bool found = false; foreach (DdtIssuedMedicine med in medicineList) { if (old.ObjectId == med.ObjectId) { found = true; break; } } if (!found) { service.GetDdtIssuedMedicineService().Delete(old.ObjectId); } } }
public bool Save() { if (!getIsValid()) { return(false); } hospitalitySession.Diagnosis = getSafeStringValue(diagnosisTxt1); service.GetDdtHospitalService().Save(hospitalitySession); DdtConsilium consilium = null; if (!string.IsNullOrEmpty(consiliumId)) { consilium = service.GetDdtConsiliumService().GetById(consiliumId); } else { consilium = new DdtConsilium { ConsiliumDate = DateTime.Now, HospitalitySession = hospitalitySession.ObjectId, Patient = hospitalitySession.Patient, Doctor = hospitalitySession.CuringDoctor }; } consilium.Decision = getSafeStringValue(decisionTxt); consilium.Diagnosis = getSafeStringValue(diagnosisTxt0); consilium.DutyAdminName = getSafeStringValue(adminTxt); consilium.Dynamics = getSafeStringValue(dynamicsTxt); consilium.Goal = getSafeStringValue(goalTxt); consiliumId = service.GetDdtConsiliumService().Save(consilium); foreach (Control doctorInfoPnl in doctorsContainer.Controls) { DdtConsiliumRelation consiliumRelation = null; String doctorInfoPnlName = getSafeObjectValueUni <string>(doctorInfoPnl, new getValue <string>((ctrl) => (ctrl.Name))); string indexstr = string.Intern(doctorInfoPnlName.Substring(CommonUtils.GetFirstDigitIndex(doctorInfoPnlName))); int indx = Int32.Parse(indexstr); Control objectIdCtrl = CommonUtils.FindControl(doctorsContainer, "objectIdLbl" + indx); if (!string.IsNullOrEmpty(objectIdCtrl.Text)) { consiliumRelation = service.GetDdtConsiliumRelationService().GetById(objectIdCtrl.Text); } else { consiliumRelation = new DdtConsiliumRelation(); consiliumRelation.Consilium = consiliumId; } Control appCb = CommonUtils.FindControl(doctorsContainer, "appointmentTxt" + indx); DdtConsiliumGroup group = getSafeObjectValueUni <DdtConsiliumGroup>(appCb, (ctrl) => ((DdtConsiliumGroup)((ComboBox)ctrl).SelectedItem)); Control docCb = CommonUtils.FindControl(doctorsContainer, "doctorWho" + indx); DdvDoctor doctor = getSafeObjectValueUni <DdvDoctor>(docCb, (ctrl) => ((DdvDoctor)((ComboBox)ctrl).SelectedItem)); if (group != null && doctor != null) { DdtConsiliumGroupMember consiliumGroupMember = service.GetDdtConsiliumGroupMemberService().GetByDoctorAndGroupId(doctor.ObjectId, group.ObjectId); consiliumRelation.Member = consiliumGroupMember.ObjectId; service.GetDdtConsiliumRelationService().Save(consiliumRelation); } } foreach (String consiliumRelationId in consiliumRelationToRemove) { service.Delete(DdtConsiliumRelation.NAME, consiliumRelationId); } analysisTabControl1.save(consiliumId, DdtConsilium.NAME); SetConsiliumIdToTransfusion(); return(true); }
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)); }