private void button4_Click(object sender, EventArgs e) { healthPoor hp = new healthPoor(); hp.archive_no = this.textBox2.Text; hp.id_number = this.textBox12.Text; if (IS == 1) { if (this.radioButton1.Checked) { hp.sex = "1"; } else if (this.radioButton2.Checked) { hp.sex = "2"; } hp.birthday = this.dateTimePicker1.Text; hp.visit_doctor = doctor_id; } hp.visit_date = this.dateTimePicker2.Text; if (this.radioButton3.Checked) { hp.visit_type = "1"; } else if (this.radioButton4.Checked) { hp.visit_type = "2"; } else if (this.radioButton5.Checked) { hp.visit_type = "3"; } hp.work_info = this.richTextBox1.Text; hp.advice = this.richTextBox2.Text; bool bl = hpsd.aUelderly_selfcare_estimate(hp, id); if (bl) { MessageBox.Show("保存成功!"); this.DialogResult = DialogResult.OK; } }
public bool aUelderly_selfcare_estimate(healthPoor hp, string id) { int ret = 0; String sql = ""; if (id == "") { id = Result.GetNewId(); sql = @"insert into poor_follow_record (id,name,archive_no,id_number,visit_date,visit_type,sex,birthday,visit_doctor,work_info,advice,create_user,create_name,create_org,create_org_name,create_time,upload_status) values "; sql += @" ('" + id + "','" + hp.name + "', '" + hp.archive_no + "', '" + hp.id_number + "', '" + hp.visit_date + "', '" + hp.visit_type + "', '" + hp.sex + "', '" + hp.birthday + "', '" + hp.visit_doctor + "', '" + hp.work_info + "', '" + hp.advice + "','" + frmLogin.userCode + "','" + frmLogin.name + "','" + frmLogin.organCode + "','" + frmLogin.organName + "', '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', 0)"; } else { sql = @"update poor_follow_record set visit_date='" + hp.visit_date + "',visit_type='" + hp.visit_type + "',work_info='" + hp.work_info + "',advice='" + hp.advice + "',update_user= '******',update_name= '" + frmLogin.name + "',update_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',upload_status=0 where archive_no = '" + hp.archive_no + "' and id_number='" + hp.id_number + "'"; } ret = DbHelperMySQL.ExecuteSql(sql); return(ret == 0 ? false : true); }