377 lines
15 KiB
C#
377 lines
15 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using SOH.Kernel;
|
|
using SOH.BLL;
|
|
using EAS.Services;
|
|
using SOH.Entities;
|
|
using SOH.Common;
|
|
|
|
namespace SOH.BasicSettings
|
|
{
|
|
[ModuleAttribute(ModuleID = "7A17CD2E-97D2-496F-B3C4-E9B53713AD31", ModuleName = "疾病类型维护")]
|
|
|
|
public partial class frmJiBingLeiXingWeiHu : SOH.Window.baseChildForm
|
|
{
|
|
private List<FamiliarDiagnose> fld; //新的诊断表
|
|
public frmJiBingLeiXingWeiHu()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void frmJiBingLeiXingWeiHu_Load(object sender, EventArgs e)
|
|
{
|
|
var vservice = ServiceContainer.GetService<It_ks>();
|
|
List<keshi> al = vservice.GetAllks("", -1, Convert.ToInt32(LoginUser.yydm));
|
|
tksBindingSource.DataSource = al;
|
|
comboBox2.DataSource = al;
|
|
this.dataGridView1.AutoGenerateColumns = false;
|
|
this.familiarDiagnoseBindingSource.DataSource = vservice.GetFLD();
|
|
fld = vservice.GetFLD();
|
|
|
|
}
|
|
|
|
int zt = 0; //0增加 1修改
|
|
private void dgvvkslist_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
|
|
if (dgvvkslist.CurrentRow.Index < 0)
|
|
{
|
|
return;
|
|
}
|
|
zt = 0;
|
|
var vservice = ServiceContainer.GetService<It_jbk>();
|
|
tjbkBindingSource.DataSource = vservice.GetjbkByKsbm(Convert.ToInt32(dgvvkslist.Rows[dgvvkslist.CurrentRow.Index].Cells["ksbmDataGridViewTextBoxColumn"].Value));
|
|
}
|
|
|
|
private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (dataGridView2.CurrentRow.Index < 0)
|
|
{
|
|
return;
|
|
}
|
|
zt = 1;
|
|
this.tbfctx.Text = this.dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["fctx"].Value.ToString();
|
|
this.tbjbmc.Text = this.dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["jbmc"].Value.ToString();
|
|
this.tbjbms.Text = this.dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["cdms"].Value.ToString();
|
|
tbnlsx.Text = this.dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["nlsx"].Value.ToString();
|
|
tbnlxx.Text = this.dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["nlxx"].Value.ToString();
|
|
tbxssx.Text = this.dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["xssx"].Value.ToString();
|
|
tbzjm.Text = this.dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["zjm"].Value.ToString();
|
|
txnr.Text = this.dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["txnr1"].Value.ToString();
|
|
cbbhyzk.SelectedIndex = Convert.ToInt32(this.dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["hyzk"].Value.ToString());
|
|
cbbxb.SelectedIndex = Convert.ToInt32(this.dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["xb"].Value.ToString());
|
|
|
|
var vservice = ServiceContainer.GetService<It_kszdjg>();
|
|
//tkszdjgBindingSource1.DataSource = vservice.GetzdjgByjbbm(Convert.ToInt32(dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["jbbmDataGridViewTextBoxColumn"].Value));
|
|
familiarDiagnoseBindingSource1.DataSource = vservice.GetzdjgByjbbmNew(Convert.ToInt32(dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["jbbmDataGridViewTextBoxColumn"].Value));
|
|
|
|
}
|
|
|
|
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
var vservice = ServiceContainer.GetService<It_kszdjg>();
|
|
this.tkszdjgBindingSource.DataSource = vservice.GetzdjgByKs(Convert.ToInt32(this.comboBox2.SelectedValue));
|
|
}
|
|
|
|
|
|
|
|
private void dataGridView3_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (e.RowIndex < 0)
|
|
{
|
|
return;
|
|
}
|
|
t_kszdjg o = dataGridView3.Rows[e.RowIndex].DataBoundItem as t_kszdjg;
|
|
List<t_kszdjg> al1;
|
|
if ((tkszdjgBindingSource1.DataSource as List<t_kszdjg>) == null)
|
|
{
|
|
al1 = new List<t_kszdjg>();
|
|
}
|
|
else
|
|
{
|
|
al1 = (tkszdjgBindingSource1.DataSource as List<t_kszdjg>);
|
|
}
|
|
for (int i = 0; i < al1.Count; i++)
|
|
{
|
|
if (al1[i].zdxh == o.zdxh)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
//tkszdjgBindingSource.Remove(o);
|
|
tkszdjgBindingSource1.Add(o);
|
|
}
|
|
|
|
private void dataGridView4_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
|
|
}
|
|
public bool Commit()
|
|
{
|
|
if (tbfctx.Text == "")
|
|
{
|
|
MessageBox.Show("复查天数不能为空!");
|
|
return false;
|
|
}
|
|
if (tbjbmc.Text == "")
|
|
{
|
|
MessageBox.Show("疾病名称不能为空!");
|
|
return false;
|
|
}
|
|
if (tbjbms.Text == "")
|
|
{
|
|
MessageBox.Show("疾病描述不能为空!");
|
|
return false;
|
|
}
|
|
if (tbnlsx.Text == "")
|
|
{
|
|
MessageBox.Show("年龄上限不能为空!");
|
|
return false;
|
|
}
|
|
if (tbnlxx.Text == "")
|
|
{
|
|
MessageBox.Show("年龄下限不能为空!");
|
|
return false;
|
|
}
|
|
if (cbbhyzk.SelectedIndex == -1)
|
|
{
|
|
MessageBox.Show("请选择婚姻状况!");
|
|
return false;
|
|
}
|
|
if (cbbxb.SelectedIndex == -1)
|
|
{
|
|
MessageBox.Show("请选择性别!");
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
private void tbjbmc_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.tbzjm.Text = StrToPinyin.GetChineseFirstSpell(this.tbjbmc.Text);
|
|
}
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
{
|
|
if (!Commit())
|
|
{
|
|
return;
|
|
}
|
|
if (zt == 0)
|
|
{
|
|
t_jbk k = new t_jbk();
|
|
k.cdms = this.tbjbms.Text;
|
|
k.fctx = Convert.ToInt32(this.tbfctx.Text);
|
|
k.fzxssx = Convert.ToInt32(this.tbxssx.Text);
|
|
k.hyzk = Convert.ToInt16(cbbhyzk.SelectedIndex);
|
|
k.jbbm = ServiceContainer.GetService<IBasic>().GetMax(k.DbTableName, 1);
|
|
k.jbmc = this.tbjbmc.Text;
|
|
k.ksbm = Convert.ToInt32(((SOH.Entities.keshi)(this.dgvvkslist.Rows[dgvvkslist.CurrentRow.Index].DataBoundItem)).ksbm);
|
|
k.nlsx = Convert.ToInt16(this.tbnlsx.Text);
|
|
k.nlxx = Convert.ToInt16(this.tbnlxx.Text);
|
|
k.txnr = this.txnr.Text;
|
|
k.xb = Convert.ToInt16(cbbxb.SelectedIndex);
|
|
k.xssx = Convert.ToInt32(this.tbxssx.Text);
|
|
k.zjm = this.tbzjm.Text;
|
|
var service = ServiceContainer.GetService<It_jbk>();
|
|
var service1 = ServiceContainer.GetService<It_kszdjg>();
|
|
//service1.Updatejbbm(((System.Windows.Forms.BindingSource)(dataGridView4.DataSource)).DataSource as List<Entities.t_kszdjg>,k.jbbm);
|
|
service1.UpdatejbbmByNewJB(((System.Windows.Forms.BindingSource)(dataGridView5.DataSource)).DataSource as List<Entities.FamiliarDiagnose>, k.jbbm);
|
|
MessageBox.Show(service.Insert(k).Message);
|
|
dgvvkslist_CellClick(null, null);
|
|
}
|
|
}
|
|
|
|
private void button4_Click(object sender, EventArgs e)
|
|
{
|
|
Commit();
|
|
if (zt == 1)
|
|
{
|
|
var service = ServiceContainer.GetService<It_jbk>();
|
|
var service1 = ServiceContainer.GetService<It_kszdjg>();
|
|
if (dataGridView2.CurrentRow.Index < 0)
|
|
{
|
|
MessageBox.Show("请选择疾病!");
|
|
return;
|
|
}
|
|
t_jbk k = service.GetjbkByjbbm(Convert.ToInt32(this.dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["jbbmDataGridViewTextBoxColumn"].Value.ToString()));
|
|
k.cdms = this.tbjbms.Text;
|
|
k.fctx = Convert.ToInt32(this.tbfctx.Text);
|
|
k.fzxssx = Convert.ToInt32(this.tbxssx.Text);
|
|
k.hyzk = Convert.ToInt16(cbbhyzk.SelectedIndex);
|
|
k.jbmc = this.tbjbmc.Text;
|
|
if (dgvvkslist.CurrentRow.Index < 0)
|
|
{
|
|
MessageBox.Show("请按照流程创建疾病!");
|
|
return;
|
|
}
|
|
k.ksbm = Convert.ToInt32(this.dgvvkslist.Rows[dgvvkslist.CurrentRow.Index].Cells["ksbmDataGridViewTextBoxColumn"].Value);
|
|
k.nlsx = Convert.ToInt16(this.tbnlsx.Text);
|
|
k.nlxx = Convert.ToInt16(this.tbnlxx.Text);
|
|
k.txnr = this.txnr.Text;
|
|
k.xb = Convert.ToInt16(cbbxb.SelectedIndex);
|
|
k.xssx = Convert.ToInt32(this.tbxssx.Text);
|
|
k.zjm = this.tbzjm.Text;
|
|
//service1.Updatejbbm(((System.Windows.Forms.BindingSource)(dataGridView4.DataSource)).DataSource as List<Entities.t_kszdjg>, Convert.ToInt32(this.dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["jbbmDataGridViewTextBoxColumn"].Value.ToString()));
|
|
service1.UpdatejbbmByNewJB(((System.Windows.Forms.BindingSource)(dataGridView5.DataSource)).DataSource as List<Entities.FamiliarDiagnose>, Convert.ToInt32(this.dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells["jbbmDataGridViewTextBoxColumn"].Value.ToString()));
|
|
|
|
MessageBox.Show(service.Update(k).Message);
|
|
dgvvkslist_CellClick(null, null);
|
|
}
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
tbfctx.Text = "";
|
|
tbjbmc.Text = "";
|
|
tbjbms.Text = "";
|
|
tbnlsx.Text = "100";
|
|
tbnlxx.Text = "0";
|
|
tbxssx.Text = "0";
|
|
tbzjm.Text = "";
|
|
cbbhyzk.SelectedIndex = -1;
|
|
cbbxb.SelectedIndex = -1;
|
|
zt = 0;
|
|
//List<Entities.t_kszdjg> al = new List<Entities.t_kszdjg>();
|
|
//tkszdjgBindingSource1.DataSource = al;
|
|
List<Entities.FamiliarDiagnose> fld = new List<Entities.FamiliarDiagnose>();
|
|
familiarDiagnoseBindingSource1.DataSource = fld;
|
|
}
|
|
|
|
private void button5_Click(object sender, EventArgs e)
|
|
{
|
|
if (dataGridView2.CurrentRow == null || dataGridView2.CurrentRow.Index < 0)
|
|
{
|
|
return;
|
|
}
|
|
t_jbk o = dataGridView2.Rows[dataGridView2.CurrentRow.Index].DataBoundItem as t_jbk;
|
|
var service = ServiceContainer.GetService<It_jbk>();
|
|
MessageBox.Show(service.Del(o).Message);
|
|
dgvvkslist_CellClick(null, null);
|
|
}
|
|
|
|
private void tbfctx_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
m_textBox_KeyDown(sender, e);
|
|
}
|
|
|
|
private void tbfctx_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
m_textBox_KeyPress(sender, e);
|
|
}
|
|
|
|
private void tbnlsx_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
m_textBox_KeyDown(sender, e);
|
|
}
|
|
|
|
private void tbnlsx_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
m_textBox_KeyPress(sender, e);
|
|
}
|
|
|
|
private void tbnlxx_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
m_textBox_KeyDown(sender, e);
|
|
}
|
|
|
|
private void tbnlxx_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
m_textBox_KeyPress(sender, e);
|
|
}
|
|
|
|
private void tbxssx_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
m_textBox_KeyDown(sender, e);
|
|
}
|
|
|
|
private void tbxssx_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
m_textBox_KeyPress(sender, e);
|
|
}
|
|
|
|
private void dataGridView4_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (e.RowIndex < 0)
|
|
{
|
|
return;
|
|
}
|
|
t_kszdjg o = dataGridView4.Rows[e.RowIndex].DataBoundItem as t_kszdjg;
|
|
tkszdjgBindingSource1.Remove(o);
|
|
}
|
|
|
|
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (e.RowIndex < 0)
|
|
{
|
|
return;
|
|
}
|
|
FamiliarDiagnose f = dataGridView1.Rows[e.RowIndex].DataBoundItem as FamiliarDiagnose;
|
|
List<FamiliarDiagnose> fall;
|
|
if ((familiarDiagnoseBindingSource1.DataSource as List<FamiliarDiagnose>) == null)
|
|
{
|
|
fall = new List<FamiliarDiagnose>();
|
|
}
|
|
else
|
|
{
|
|
fall = (familiarDiagnoseBindingSource1.DataSource as List<FamiliarDiagnose>);
|
|
}
|
|
for (int i = 0; i < fall.Count; i++)
|
|
{
|
|
if (fall[i].ID == f.ID)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
//tkszdjgBindingSource.Remove(o);
|
|
familiarDiagnoseBindingSource1.Add(f);
|
|
}
|
|
|
|
private void dataGridView5_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
if (e.RowIndex < 0)
|
|
{
|
|
return;
|
|
}
|
|
FamiliarDiagnose f = dataGridView5.Rows[e.RowIndex].DataBoundItem as FamiliarDiagnose;
|
|
familiarDiagnoseBindingSource1.Remove(f);
|
|
}
|
|
|
|
private void Load_ZHXM_TJ(string zjf)
|
|
{
|
|
if (fld == null)
|
|
{
|
|
return;
|
|
}
|
|
//var data = led.Where(t => (xb == 2 ? true : (t.xb == xb && t.xb == 2)) && (hyzk == 2 ? true : (t.hyzk == hyzk && t.hyzk == 2)) && ((zjf == null || zjf == "") ? true : (t.zjm.Contains(zjf))));
|
|
var data = fld.Where(t => ((zjf == null || zjf == "") ? true : (t.PY.Contains(zjf))));
|
|
if (data.Any())
|
|
{
|
|
List<FamiliarDiagnose> fld1 = data.ToList();
|
|
this.familiarDiagnoseBindingSource.DataSource = null;
|
|
this.familiarDiagnoseBindingSource.DataSource = fld1;
|
|
}
|
|
else
|
|
{
|
|
this.familiarDiagnoseBindingSource.DataSource = null;
|
|
}
|
|
}
|
|
|
|
private void txt_zjf_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
string zjf = this.txt_zjf.Text.Trim();
|
|
zjf = zjf.ToUpper();
|
|
Load_ZHXM_TJ(zjf);
|
|
}
|
|
}
|
|
}
|
|
}
|