public IList <DdtAlcoProtocol> GetAll() { IList <DdtAlcoProtocol> list = new List <DdtAlcoProtocol>(); using (dynamic connection = connectionFactory.GetConnection()) { String sql = "SELECT r_object_id, dss_pribor, dss_conclusion, dss_mimics, dss_breathe, dss_tremble, dss_illness, dss_orientation, dss_skin, " + "dss_drunk, dss_pressure, dss_pulse, dsb_template, dss_touch_nose, dss_docs, dss_bio, dss_speech, dss_cause, dss_smell, dss_motions," + " r_creation_date, dsid_hospitality_session, dss_eyes, r_modify_date, dss_walk, dss_nistagm, dss_look, dss_trub, dss_behavior, dsid_doctor, dsid_patient " + "FROM ddt_alco_protocol"; Logger.Debug(CultureInfo.CurrentCulture, "SQL: {0}", sql); Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(sql, connection); using (DbDataReader reader = command.ExecuteReader()) { while (reader.Read()) { DdtAlcoProtocol obj = new DdtAlcoProtocol(); obj.ObjectId = reader.IsDBNull(0) ? null : reader.GetString(0); obj.Pribor = reader.IsDBNull(1) ? null : reader.GetString(1); obj.Conclusion = reader.IsDBNull(2) ? null : reader.GetString(2); obj.Mimics = reader.IsDBNull(3) ? null : reader.GetString(3); obj.Breathe = reader.IsDBNull(4) ? null : reader.GetString(4); obj.Tremble = reader.IsDBNull(5) ? null : reader.GetString(5); obj.Illness = reader.IsDBNull(6) ? null : reader.GetString(6); obj.Orientation = reader.IsDBNull(7) ? null : reader.GetString(7); obj.Skin = reader.IsDBNull(8) ? null : reader.GetString(8); obj.Drunk = reader.IsDBNull(9) ? null : reader.GetString(9); obj.Pressure = reader.IsDBNull(10) ? null : reader.GetString(10); obj.Pulse = reader.IsDBNull(11) ? null : reader.GetString(11); obj.Template = reader.GetBoolean(12); obj.TouchNose = reader.IsDBNull(13) ? null : reader.GetString(13); obj.Docs = reader.IsDBNull(14) ? null : reader.GetString(14); obj.Bio = reader.IsDBNull(15) ? null : reader.GetString(15); obj.Speech = reader.IsDBNull(16) ? null : reader.GetString(16); obj.Cause = reader.IsDBNull(17) ? null : reader.GetString(17); obj.Smell = reader.IsDBNull(18) ? null : reader.GetString(18); obj.Motions = reader.IsDBNull(19) ? null : reader.GetString(19); obj.CreationDate = reader.IsDBNull(20) ? DateTime.MinValue : reader.GetDateTime(20); obj.HospitalitySession = reader.IsDBNull(21) ? null : reader.GetString(21); obj.Eyes = reader.IsDBNull(22) ? null : reader.GetString(22); obj.ModifyDate = reader.IsDBNull(23) ? DateTime.MinValue : reader.GetDateTime(23); obj.Walk = reader.IsDBNull(24) ? null : reader.GetString(24); obj.Nistagm = reader.IsDBNull(25) ? null : reader.GetString(25); obj.Look = reader.IsDBNull(26) ? null : reader.GetString(26); obj.Trub = reader.IsDBNull(27) ? null : reader.GetString(27); obj.Behavior = reader.IsDBNull(28) ? null : reader.GetString(28); obj.Doctor = reader.IsDBNull(29) ? null : reader.GetString(29); obj.Doctor = reader.IsDBNull(30) ? null : reader.GetString(30); list.Add(obj); } } } return(list); }
private void alcoExamItem_Click(object sender, EventArgs e) { IEnumerator it = hospitalPatientsTbl.SelectedRows.GetEnumerator(); if (it.MoveNext()) { DataGridViewRow row = (DataGridViewRow)it.Current; DataGridViewCell cell = row.Cells[0]; string value = cell.Value.ToString(); DdtAlcoProtocol protocol = service.GetDdtAlcoProtocolService().GetByHospitalSession(value); Dictionary <string, string> values = new Dictionary <string, string>(); values.Add("{patient.behavior}", protocol == null ? "неустойчивое" : protocol.Behavior); values.Add("{patient.bio}", protocol == null ? "1,81 ‰" : protocol.Bio); values.Add("{patient.breathe}", protocol == null ? "20 дыхательных движений в минуту" : protocol.Breathe); values.Add("{patient.cause}", protocol == null ? "медицинская помощь" : protocol.Cause); values.Add("{patient.conclusion}", protocol == null ? "" : protocol.Conclusion); values.Add("{docs}", protocol == null ? " " : protocol.Docs); values.Add("{patient.drunk}", protocol == null ? "0,5 литра водки" : protocol.Drunk); values.Add("{patient.vascular}", protocol == null ? "фотореакции живые" : protocol.Eyes); values.Add("{patient.illness}", protocol == null ? "отрицает" : protocol.Illness); values.Add("{patient.look}", protocol == null ? "опрятен" : protocol.Look); values.Add("{patient.mimics}", protocol == null ? "вялая" : protocol.Mimics); values.Add("{patient.motions}", protocol == null ? "без патологии" : protocol.Motions); values.Add("{patient.nistagm}", protocol == null ? "nistagmTxt" : protocol.Nistagm); values.Add("{patient.orientation}", protocol == null ? "ориентирован" : protocol.Orientation); values.Add("{patient.pressure}", protocol == null ? "130/90 мм рт.ст." : protocol.Pressure); values.Add("{patient.eyes}", protocol == null ? "фотореакции живые" : protocol.Eyes); values.Add("{patient.pribor}", protocol == null ? " " : protocol.Pribor); values.Add("{patient.pulse}", protocol == null ? "pulseTxt" : protocol.Pulse); values.Add("{patient.skin}", protocol == null ? "гиперемия лица" : protocol.Skin); values.Add("{patient.smell}", protocol == null ? " " : protocol.Smell); values.Add("{patient.talk}", protocol == null ? "смазана" : protocol.Speech); values.Add("{patient.touch_nose}", protocol == null ? "с промахиванием" : protocol.TouchNose); values.Add("{patient.tremble}", protocol == null ? "да" : protocol.Tremble); values.Add("{patient.trub}", protocol == null ? " " : protocol.Trub); values.Add("{patient.walk}", protocol == null ? "не проводилась" : protocol.Walk); values.Add("{datetime}", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString()); values.Add("{analysis.date}", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString()); values.Add("{patient.work}", " "); values.Add("{reason}", " "); TemplatesUtils.fillBlankTemplate(service, "blank_alco_examination_template.doc", value, values); } }
private void saveBtn_Click(object sender, EventArgs e) { DdtAlcoProtocol protocol = service.GetDdtAlcoProtocolService().GetByHospitalSession(hospitalitySession.ObjectId); if (protocol == null) { protocol = new DdtAlcoProtocol(); protocol.HospitalitySession = hospitalitySession.ObjectId; protocol.Template = false; } protocol.Behavior = behaviorTxt.Text; protocol.Bio = bioTxt.Text; protocol.Breathe = breatheTxt.Text; protocol.Conclusion = conclusionTxt.Text; protocol.Docs = docsTxt.Text; protocol.Drunk = drunkTxt.Text; protocol.Eyes = eyesTxt.Text; protocol.Illness = illnessTxt.Text; protocol.Look = lookTxt.Text; protocol.Mimics = mimicsTxt.Text; protocol.Motions = motionTxt.Text; protocol.Nistagm = nistagmTxt.Text; protocol.Orientation = orientationTxt.Text; protocol.Pressure = pressureTxt.Text; protocol.Pribor = priborTxt.Text; protocol.Pulse = pulseTxt.Text; protocol.Skin = skinTxt.Text; protocol.Smell = smellTxt.Text; protocol.Speech = speechTxt.Text; protocol.TouchNose = touchNoseTxt.Text; protocol.Tremble = trembleTxt.Text; protocol.Trub = trubTxt.Text; protocol.Walk = walkTxt.Text; protocol.Cause = causeTxt.Text; protocol.Doctor = hospitalitySession.CuringDoctor; protocol.Patient = hospitalitySession.Patient; service.GetDdtAlcoProtocolService().Save(protocol); Close(); }
private void initProtocol() { DdvPatient patient = service.GetDdvPatientService().GetById(hospitalitySession.Patient); if (patient != null) { Text += " " + patient.ShortName; } DdtAlcoProtocol protocol = service.GetDdtAlcoProtocolService().GetByHospitalSession(hospitalitySession.ObjectId); if (protocol != null) { behaviorTxt.Text = protocol.Behavior; bioTxt.Text = protocol.Bio; breatheTxt.Text = protocol.Breathe; conclusionTxt.Text = protocol.Conclusion; docsTxt.Text = protocol.Docs; drunkTxt.Text = protocol.Drunk; eyesTxt.Text = protocol.Eyes; illnessTxt.Text = protocol.Illness; lookTxt.Text = protocol.Look; mimicsTxt.Text = protocol.Mimics; motionTxt.Text = protocol.Motions; nistagmTxt.Text = protocol.Nistagm; orientationTxt.Text = protocol.Orientation; pressureTxt.Text = protocol.Pressure; priborTxt.Text = protocol.Pribor; pulseTxt.Text = protocol.Pulse; skinTxt.Text = protocol.Skin; smellTxt.Text = protocol.Smell; speechTxt.Text = protocol.Speech; touchNoseTxt.Text = protocol.TouchNose; trembleTxt.Text = protocol.Tremble; trubTxt.Text = protocol.Trub; walkTxt.Text = protocol.Walk; causeTxt.Text = protocol.Cause; } }
public string Save(DdtAlcoProtocol protocol) { using (dynamic connection = connectionFactory.GetConnection()) { if (GetById(protocol.ObjectId) != null) { string sql = "UPDATE ddt_alco_protocol SET " + "dsid_hospitality_session = @HospitalitySession, " + "dss_look = @Look, " + "dss_cause = @Cause, " + "dss_behavior = @Behavior, " + "dss_orientation = @Orientation, " + "dss_speech = @Speech, " + "dss_skin = @Skin, " + "dss_breathe = @Breathe, " + "dss_pulse = @Pulse, " + "dss_pressure = @Pressure, " + "dss_eyes = @Eyes, " + "dss_nistagm = @Nistagm, " + "dss_motions = @Motions, " + "dss_mimics = @Mimics, " + "dss_walk = @Walk, " + "dss_touch_nose = @TouchNose, " + "dss_tremble = @Tremble, " + "dss_illness = @Illness, " + "dss_drunk = @Drunk, " + "dss_smell = @Smell, " + "dss_pribor = @Pribor, " + "dss_trub = @Trub, " + "dss_bio = @Bio, " + "dss_docs = @Docs, " + "dss_conclusion = @Conclusion, " + "dsb_template = @Template, " + "dsid_doctor= @Doctor, " + "dsid_patient= @Patient " + "WHERE r_object_id = @ObjectId"; Logger.Debug(CultureInfo.CurrentCulture, "SQL: {0}", sql); using (Npgsql.NpgsqlCommand cmd = new Npgsql.NpgsqlCommand(sql, connection)) { cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@HospitalitySession", protocol.HospitalitySession); cmd.Parameters.AddWithValue("@Look", protocol.Look == null ? "" : protocol.Look); cmd.Parameters.AddWithValue("@Cause", protocol.Cause == null ? "" : protocol.Cause); cmd.Parameters.AddWithValue("@Behavior", protocol.Behavior == null ? "" : protocol.Behavior); cmd.Parameters.AddWithValue("@Orientation", protocol.Orientation == null ? "" : protocol.Orientation); cmd.Parameters.AddWithValue("@Speech", protocol.Speech == null ? "" : protocol.Speech); cmd.Parameters.AddWithValue("@Skin", protocol.Skin == null ? "" : protocol.Skin); cmd.Parameters.AddWithValue("@Breathe", protocol.Breathe == null ? "" : protocol.Breathe); cmd.Parameters.AddWithValue("@Pulse", protocol.Pulse == null ? "" : protocol.Pulse); cmd.Parameters.AddWithValue("@Pressure", protocol.Pressure == null ? "" : protocol.Pressure); cmd.Parameters.AddWithValue("@Eyes", protocol.Eyes == null ? "" : protocol.Eyes); cmd.Parameters.AddWithValue("@Nistagm", protocol.Nistagm == null ? "" : protocol.Nistagm); cmd.Parameters.AddWithValue("@Motions", protocol.Motions == null ? "" : protocol.Motions); cmd.Parameters.AddWithValue("@Mimics", protocol.Mimics == null ? "" : protocol.Mimics); cmd.Parameters.AddWithValue("@Walk", protocol.Walk == null ? "" : protocol.Walk); cmd.Parameters.AddWithValue("@TouchNose", protocol.TouchNose == null ? "" : protocol.TouchNose); cmd.Parameters.AddWithValue("@Tremble", protocol.Tremble == null ? "" : protocol.Tremble); cmd.Parameters.AddWithValue("@Illness", protocol.Illness == null ? "" : protocol.Illness); cmd.Parameters.AddWithValue("@Drunk", protocol.Drunk == null ? "" : protocol.Drunk); cmd.Parameters.AddWithValue("@Smell", protocol.Smell == null ? "" : protocol.Smell); cmd.Parameters.AddWithValue("@Pribor", protocol.Pribor == null ? "" : protocol.Pribor); cmd.Parameters.AddWithValue("@Trub", protocol.Trub == null ? "" : protocol.Trub); cmd.Parameters.AddWithValue("@Bio", protocol.Bio == null ? "" : protocol.Bio); cmd.Parameters.AddWithValue("@Docs", protocol.Docs == null ? "" : protocol.Docs); cmd.Parameters.AddWithValue("@Conclusion", protocol.Conclusion == null ? "" : protocol.Conclusion); cmd.Parameters.AddWithValue("@Template", protocol.Template); cmd.Parameters.AddWithValue("@ObjectId", protocol.ObjectId); cmd.Parameters.AddWithValue("@Doctor", protocol.Doctor); cmd.Parameters.AddWithValue("@Patient", protocol.Patient); cmd.ExecuteNonQuery(); } return(protocol.ObjectId); } else { string sql = "INSERT INTO ddt_alco_protocol(dsid_hospitality_session,dss_look,dss_cause,dss_behavior,dss_orientation,dss_speech,dss_skin,dss_breathe,dss_pulse,dss_pressure,dss_eyes,dss_nistagm,dss_motions,dss_mimics,dss_walk,dss_touch_nose,dss_tremble,dss_illness,dss_drunk,dss_smell,dss_pribor,dss_trub,dss_bio,dss_docs,dss_conclusion,dsb_template,dsid_doctor, dsid_patient) " + "VALUES(@HospitalitySession,@Look,@Cause,@Behavior,@Orientation,@Speech,@Skin,@Breathe,@Pulse,@Pressure,@Eyes,@Nistagm,@Motions,@Mimics,@Walk,@TouchNose,@Tremble,@Illness,@Drunk,@Smell,@Pribor,@Trub,@Bio,@Docs,@Conclusion,@Template,@Doctor,@Patient) RETURNING r_object_id"; Logger.Debug(CultureInfo.CurrentCulture, "SQL: {0}", sql); using (Npgsql.NpgsqlCommand cmd = new Npgsql.NpgsqlCommand(sql, connection)) { cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("@HospitalitySession", protocol.HospitalitySession); cmd.Parameters.AddWithValue("@Look", protocol.Look == null ? "" : protocol.Look); cmd.Parameters.AddWithValue("@Cause", protocol.Cause == null ? "" : protocol.Cause); cmd.Parameters.AddWithValue("@Behavior", protocol.Behavior == null ? "" : protocol.Behavior); cmd.Parameters.AddWithValue("@Orientation", protocol.Orientation == null ? "" : protocol.Orientation); cmd.Parameters.AddWithValue("@Speech", protocol.Speech == null ? "" : protocol.Speech); cmd.Parameters.AddWithValue("@Skin", protocol.Skin == null ? "" : protocol.Skin); cmd.Parameters.AddWithValue("@Breathe", protocol.Breathe == null ? "" : protocol.Breathe); cmd.Parameters.AddWithValue("@Pulse", protocol.Pulse == null ? "" : protocol.Pulse); cmd.Parameters.AddWithValue("@Pressure", protocol.Pressure == null ? "" : protocol.Pressure); cmd.Parameters.AddWithValue("@Eyes", protocol.Eyes == null ? "" : protocol.Eyes); cmd.Parameters.AddWithValue("@Nistagm", protocol.Nistagm == null ? "" : protocol.Nistagm); cmd.Parameters.AddWithValue("@Motions", protocol.Motions == null ? "" : protocol.Motions); cmd.Parameters.AddWithValue("@Mimics", protocol.Mimics == null ? "" : protocol.Mimics); cmd.Parameters.AddWithValue("@Walk", protocol.Walk == null ? "" : protocol.Walk); cmd.Parameters.AddWithValue("@TouchNose", protocol.TouchNose == null ? "" : protocol.TouchNose); cmd.Parameters.AddWithValue("@Tremble", protocol.Tremble == null ? "" : protocol.Tremble); cmd.Parameters.AddWithValue("@Illness", protocol.Illness == null ? "" : protocol.Illness); cmd.Parameters.AddWithValue("@Drunk", protocol.Drunk == null ? "" : protocol.Drunk); cmd.Parameters.AddWithValue("@Smell", protocol.Smell == null ? "" : protocol.Smell); cmd.Parameters.AddWithValue("@Pribor", protocol.Pribor == null ? "" : protocol.Pribor); cmd.Parameters.AddWithValue("@Trub", protocol.Trub == null ? "" : protocol.Trub); cmd.Parameters.AddWithValue("@Bio", protocol.Bio == null ? "" : protocol.Bio); cmd.Parameters.AddWithValue("@Docs", protocol.Docs == null ? "" : protocol.Docs); cmd.Parameters.AddWithValue("@Conclusion", protocol.Conclusion == null ? "" : protocol.Conclusion); cmd.Parameters.AddWithValue("@Template", protocol.Template); cmd.Parameters.AddWithValue("@Doctor", protocol.Doctor); cmd.Parameters.AddWithValue("@Patient", protocol.Patient); return((string)cmd.ExecuteScalar()); } } } }