private void button3_Click(object sender, EventArgs e) { if (this.dataGridView1.SelectedRows.Count < 1) { MessageBox.Show("未选中任何行!"); return; } aUolderHelthService hm = new aUolderHelthService(); string name = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); string archiveno = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); string idnumber = dataGridView1.SelectedRows[0].Cells[2].Value.ToString(); string sex = dataGridView1.SelectedRows[0].Cells[7].Value.ToString(); string barcode = dataGridView1.SelectedRows[0].Cells["bar_code"].Value.ToString(); string examid = dataGridView1.SelectedRows[0].Cells["exam_id"].Value.ToString(); hm.label47.Text = "修改老年人生活自理能力评估表"; hm.Text = "修改老年人生活自理能力评估表"; hm.flag = 1; hm.sex = sex; hm.archiveno = archiveno; hm._barCode = barcode; hm._examid = examid; DataTable dt = null; if (examid == "") { dt = olderHelthS.query(archiveno); //查找对应的ID healthCheckupDao hcd = new healthCheckupDao(); examid = hcd.GetExaminationRecord(archiveno, idnumber, barcode); } else { dt = olderHelthS.queryForExamID(examid); } if (dt == null || dt.Rows.Count < 1) { MessageBox.Show("此人未参加自理能力评估,请先添加!"); return; } if (dt != null && dt.Rows.Count > 0) { hm.textBox1.Text = dt.Rows[0]["name"].ToString(); hm.textBox2.Text = dt.Rows[0]["aichive_no"].ToString(); hm.textBox12.Text = dt.Rows[0]["id_number"].ToString(); string[] ck2 = dt.Rows[0]["answer_result"].ToString().Split(','); hm.numericUpDown1.Value = Decimal.Parse(ck2[0]); hm.numericUpDown2.Value = Decimal.Parse(ck2[1]); hm.numericUpDown3.Value = Decimal.Parse(ck2[2]); hm.numericUpDown4.Value = Decimal.Parse(ck2[3]); hm.numericUpDown5.Value = Decimal.Parse(ck2[4]); hm.numericUpDown6.Value = Decimal.Parse(dt.Rows[0]["total_score"].ToString()); } if (hm.ShowDialog() == DialogResult.OK) { //xcuncode = basicInfoSettings.xcuncode; //刷新页面 queryOlderHelthService(); MessageBox.Show("修改成功!"); } }
private void button2_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count < 1) { return; } string name = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); string archiveno = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); string idnumber = dataGridView1.SelectedRows[0].Cells[2].Value.ToString(); string sex = dataGridView1.SelectedRows[0].Cells[7].Value.ToString(); string barcode = dataGridView1.SelectedRows[0].Cells["bar_code"].Value.ToString(); string examid = dataGridView1.SelectedRows[0].Cells["exam_id"].Value.ToString(); DataTable dt = null; if (examid == "") { //dt = olderHelthS.query(archiveno); dt = olderHelthS.query1(archiveno, barcode); //查找对应的ID healthCheckupDao hcd = new healthCheckupDao(); examid = hcd.GetExaminationRecord(archiveno, idnumber, barcode); } else { dt = olderHelthS.queryForExamID(examid); } if (dt.Rows.Count > 0) { string _testdate = dt.Rows[0]["test_date"].ToString(); string _strDisplay = string.Format("此身份信息号已参加过评估了,问询日期为{0} !", _testdate); MessageBox.Show(_strDisplay); return; } aUolderHelthService hm = new aUolderHelthService(); hm.label47.Text = "添加老年人生活自理能力评估表"; hm.Text = "添加老年人生活自理能力评估表"; hm.textBox1.Text = name; hm.textBox2.Text = archiveno; hm.textBox12.Text = idnumber; hm.sex = sex; hm.flag = 0; hm._barCode = barcode; hm._examid = examid; if (hm.ShowDialog() == DialogResult.OK) { //刷新页面 //xcuncode = basicInfoSettings.xcuncode; queryOlderHelthService(); MessageBox.Show("添加成功!"); } }
//添加 修改 高血压随访记录历史表 调此方法 private void button1_Click(object sender, EventArgs e) { if (this.dataGridView1.SelectedRows.Count < 1) { MessageBox.Show("未选中任何行!"); return; } int row = dataGridView1.CurrentRow.Index; string code = dataGridView1["archive_no", row].Value.ToString(); string idnum = dataGridView1["id_number", row].Value.ToString(); string examid = dataGridView1["exam_id", row].Value.ToString(); string barcode = dataGridView1["bar_code", row].Value.ToString(); DataTable dtcode = null; if (examid == "") { dtcode = tcmHealthService.checkTcmHealthServicesByno1(code, idnum, barcode); if (examid == "") { healthCheckupDao hd = new healthCheckupDao(); //获取exam_id examid = hd.GetExaminationRecord(code, idnum, barcode); } } else { dtcode = tcmHealthService.checkTcmHealthServicesByExamID(examid); } if (dtcode.Rows.Count > 0) { string _testdate = dtcode.Rows[0]["test_date"].ToString(); string _strDisplay = string.Format("此患者已参加过中医体质服务了,日期为{0} !", _testdate); MessageBox.Show(_strDisplay); return; } addtcmHealthServices addtcm = new addtcmHealthServices(1, dataGridView1["name", row].Value.ToString(), dataGridView1["archive_no", row].Value.ToString(), dataGridView1["id_number", row].Value.ToString(), examid); addtcm.bar_code = barcode; addtcm.exam_id = examid; addtcm.StartPosition = FormStartPosition.CenterScreen; if (addtcm.ShowDialog() == DialogResult.OK) { querytcmHealthServices(); } }
private void button4_Click(object sender, EventArgs e) { string _stag = "1"; bean.elderly_selfcare_estimateBean elderly_selfcare_estimateBean = new bean.elderly_selfcare_estimateBean(); elderly_selfcare_estimateBean.sex = sex; elderly_selfcare_estimateBean.name = this.textBox1.Text.Replace(" ", ""); elderly_selfcare_estimateBean.aichive_no = this.textBox2.Text.Replace(" ", ""); elderly_selfcare_estimateBean.id_number = this.textBox12.Text.Replace(" ", ""); elderly_selfcare_estimateBean.answer_result += "," + this.numericUpDown1.Value.ToString(); elderly_selfcare_estimateBean.answer_result += "," + this.numericUpDown2.Value.ToString(); elderly_selfcare_estimateBean.answer_result += "," + this.numericUpDown3.Value.ToString(); elderly_selfcare_estimateBean.answer_result += "," + this.numericUpDown4.Value.ToString(); elderly_selfcare_estimateBean.answer_result += "," + this.numericUpDown5.Value.ToString(); elderly_selfcare_estimateBean.answer_result = elderly_selfcare_estimateBean.answer_result.Substring(1); elderly_selfcare_estimateBean.total_score = this.numericUpDown6.Value.ToString(); if (this.numericUpDown6.Value >= 0 && this.numericUpDown6.Value <= 3) { elderly_selfcare_estimateBean.judgement_result = "可自理"; _stag = "1"; } else if (this.numericUpDown6.Value >= 4 && this.numericUpDown6.Value <= 8) { elderly_selfcare_estimateBean.judgement_result = "轻度依赖"; _stag = "2"; } else if (this.numericUpDown6.Value >= 9 && this.numericUpDown6.Value <= 18) { elderly_selfcare_estimateBean.judgement_result = "中度依赖"; _stag = "3"; } else if (this.numericUpDown6.Value >= 19) { elderly_selfcare_estimateBean.judgement_result = "不能自理"; _stag = "4"; } else { } //////以下页面未用 数据库字段格式要求 elderly_selfcare_estimateBean.upload_time = DateTime.Now.ToString("yyyy-MM-dd"); elderly_selfcare_estimateBean.create_time = DateTime.Now.ToString("yyyy-MM-dd"); elderly_selfcare_estimateBean.update_time = DateTime.Now.ToString("yyyy-MM-dd"); elderly_selfcare_estimateBean.upload_status = "0"; elderly_selfcare_estimateBean.test_date = DateTime.Now.ToString("yyyy-MM-dd"); elderly_selfcare_estimateBean.create_name = frmLogin.name; elderly_selfcare_estimateBean.test_doctor = basicInfoSettings.zeren_doctor; if (_examid == "") { healthCheckupDao hcd = new healthCheckupDao(); _examid = hcd.GetExaminationRecord(elderly_selfcare_estimateBean.aichive_no, elderly_selfcare_estimateBean.id_number, _barCode); } elderly_selfcare_estimateBean.exam_id = _examid; string _id = ""; if (flag == 1) { _id = _examid; } bool isfalse = olderHelthServices.aUelderly_selfcare_estimateForExamID(elderly_selfcare_estimateBean, _id); //bool isfalse = olderHelthServices.aUelderly_selfcare_estimate(elderly_selfcare_estimateBean, archiveno); if (isfalse) { //这里就要更新对应的 zkhw_tj_bgdc-->lnrzlnlpg、physical_examination_record-->base_selfcare_estimate string id_number = textBox12.Text; string aichive_no = textBox2.Text; tjcheckDao tjdao = new tjcheckDao(); //用事务更新 tjdao.UpdateOldestimateTran("1", _barCode, id_number, _examid, _stag); this.DialogResult = DialogResult.OK; } }
private int Update() { if (exam_id == "") { //这里对应找到examid healthCheckupDao hcd = new healthCheckupDao(); string examid = hcd.GetExaminationRecord(aichive_no, id_number, bar_code); #region 为空操作 保险操作 string res = GetFen(); DateTime time = DateTime.Now; var tz = TZ(); string bj = BJ(); string issql = @"update elderly_tcm_record set upload_status=0,test_date=@test_date,answer_result=@answer_result,qixuzhi_score=@qixuzhi_score,qixuzhi_result=@qixuzhi_result,yangxuzhi_score=@yangxuzhi_score,yangxuzhi_result=@yangxuzhi_result,yinxuzhi_score=@yinxuzhi_score,yinxuzhi_result=@yinxuzhi_result,tanshizhi_score=@tanshizhi_score,tanshizhi_result=@tanshizhi_result,shirezhi_score=@shirezhi_score,shirezhi_result=@shirezhi_result,xueyuzhi_score=@xueyuzhi_score,xueyuzhi_result=@xueyuzhi_result,qiyuzhi_score=@qiyuzhi_score,qiyuzhi_result=@qiyuzhi_result,tebingzhi_sorce=@tebingzhi_sorce,tebingzhi_result=@tebingzhi_result,pinghezhi_sorce=@pinghezhi_sorce,pinghezhi_result=@pinghezhi_result,tcm_guidance=@tcm_guidance,update_user=@update_user,update_name=@update_name,update_time=@update_time,exam_id=@exam_id where name=@name and aichive_no=@aichive_no and id_number=@id_number"; MySqlParameter[] args = new MySqlParameter[] { new MySqlParameter("@name", Names), new MySqlParameter("@aichive_no", aichive_no), new MySqlParameter("@id_number", id_number), new MySqlParameter("@test_date", time.ToString("yyyy-MM-dd")), new MySqlParameter("@answer_result", res), new MySqlParameter("@qixuzhi_score", tz["气虚质体质"]), new MySqlParameter("@qixuzhi_result", tz["气虚质体质"] >= 11?1:0), new MySqlParameter("@yangxuzhi_score", tz["阳虚质体质"]), new MySqlParameter("@yangxuzhi_result", tz["阳虚质体质"] >= 11?1:0), new MySqlParameter("@yinxuzhi_score", tz["阴虚质体质"]), new MySqlParameter("@yinxuzhi_result", tz["阴虚质体质"] >= 11?1:0), new MySqlParameter("@tanshizhi_score", tz["痰湿质体质"]), new MySqlParameter("@tanshizhi_result", tz["痰湿质体质"] >= 11?1:0), new MySqlParameter("@shirezhi_score", tz["湿热质体质"]), new MySqlParameter("@shirezhi_result", tz["湿热质体质"] >= 11?1:0), new MySqlParameter("@xueyuzhi_score", tz["血瘀质体质"]), new MySqlParameter("@xueyuzhi_result", tz["血瘀质体质"] >= 11?1:0), new MySqlParameter("@qiyuzhi_score", tz["气郁质体质"]), new MySqlParameter("@qiyuzhi_result", tz["气郁质体质"] >= 11?1:0), new MySqlParameter("@tebingzhi_sorce", tz["特禀质体质"]), new MySqlParameter("@tebingzhi_result", tz["特禀质体质"] >= 11?1:0), new MySqlParameter("@pinghezhi_sorce", tz["平和质体质"]), //new MySqlParameter("@pinghezhi_result", (tz["平和质体质"]>=17&&tz["气虚质体质"]<=8&&tz["阳虚质体质"]<=8&&tz["阴虚质体质"]<=8&&tz["痰湿质体质"]<=8&&tz["湿热质体质"]<=8&&tz["血瘀质体质"]<=8&&tz["气郁质体质"]<=8&&tz["特禀质体质"]<=8)?1:0), new MySqlParameter("@pinghezhi_result", (tz["平和质体质"] >= 1)?1:0), new MySqlParameter("@tcm_guidance", bj), new MySqlParameter("@update_user", frmLogin.userCode), new MySqlParameter("@update_name", frmLogin.name), new MySqlParameter("@update_time", time), new MySqlParameter("@exam_id", examid) }; return(DbHelperMySQL.ExecuteSql(issql, args)); #endregion } else { #region 为空 string res = GetFen(); DateTime time = DateTime.Now; var tz = TZ(); string bj = BJ(); string issql = @"update elderly_tcm_record set upload_status=0,test_date=@test_date,answer_result=@answer_result,qixuzhi_score=@qixuzhi_score,qixuzhi_result=@qixuzhi_result,yangxuzhi_score=@yangxuzhi_score,yangxuzhi_result=@yangxuzhi_result,yinxuzhi_score=@yinxuzhi_score,yinxuzhi_result=@yinxuzhi_result,tanshizhi_score=@tanshizhi_score,tanshizhi_result=@tanshizhi_result,shirezhi_score=@shirezhi_score,shirezhi_result=@shirezhi_result,xueyuzhi_score=@xueyuzhi_score,xueyuzhi_result=@xueyuzhi_result,qiyuzhi_score=@qiyuzhi_score,qiyuzhi_result=@qiyuzhi_result,tebingzhi_sorce=@tebingzhi_sorce,tebingzhi_result=@tebingzhi_result,pinghezhi_sorce=@pinghezhi_sorce,pinghezhi_result=@pinghezhi_result,tcm_guidance=@tcm_guidance,update_user=@update_user,update_name=@update_name,update_time=@update_time where exam_id=@exam_id"; MySqlParameter[] args = new MySqlParameter[] { new MySqlParameter("@exam_id", exam_id), new MySqlParameter("@test_date", time.ToString("yyyy-MM-dd")), new MySqlParameter("@answer_result", res), new MySqlParameter("@qixuzhi_score", tz["气虚质体质"]), new MySqlParameter("@qixuzhi_result", tz["气虚质体质"] >= 11?1:0), new MySqlParameter("@yangxuzhi_score", tz["阳虚质体质"]), new MySqlParameter("@yangxuzhi_result", tz["阳虚质体质"] >= 11?1:0), new MySqlParameter("@yinxuzhi_score", tz["阴虚质体质"]), new MySqlParameter("@yinxuzhi_result", tz["阴虚质体质"] >= 11?1:0), new MySqlParameter("@tanshizhi_score", tz["痰湿质体质"]), new MySqlParameter("@tanshizhi_result", tz["痰湿质体质"] >= 11?1:0), new MySqlParameter("@shirezhi_score", tz["湿热质体质"]), new MySqlParameter("@shirezhi_result", tz["湿热质体质"] >= 11?1:0), new MySqlParameter("@xueyuzhi_score", tz["血瘀质体质"]), new MySqlParameter("@xueyuzhi_result", tz["血瘀质体质"] >= 11?1:0), new MySqlParameter("@qiyuzhi_score", tz["气郁质体质"]), new MySqlParameter("@qiyuzhi_result", tz["气郁质体质"] >= 11?1:0), new MySqlParameter("@tebingzhi_sorce", tz["特禀质体质"]), new MySqlParameter("@tebingzhi_result", tz["特禀质体质"] >= 11?1:0), new MySqlParameter("@pinghezhi_sorce", tz["平和质体质"]), //new MySqlParameter("@pinghezhi_result", (tz["平和质体质"]>=17&&tz["气虚质体质"]<=8&&tz["阳虚质体质"]<=8&&tz["阴虚质体质"]<=8&&tz["痰湿质体质"]<=8&&tz["湿热质体质"]<=8&&tz["血瘀质体质"]<=8&&tz["气郁质体质"]<=8&&tz["特禀质体质"]<=8)?1:0), new MySqlParameter("@pinghezhi_result", (tz["平和质体质"] >= 1)?1:0), new MySqlParameter("@tcm_guidance", bj), new MySqlParameter("@update_user", frmLogin.userCode), new MySqlParameter("@update_name", frmLogin.name), new MySqlParameter("@update_time", time) }; return(DbHelperMySQL.ExecuteSql(issql, args)); #endregion } }