using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace videoGather { public partial class InfoForm : Form { public InfoForm() { InitializeComponent(); } public HisInfo info; /// /// 新增 /// /// /// private void button1_Click(object sender, EventArgs e) { if (!inspect()) { return; } info = new HisInfo(); info.jianchaid = textjianchaid.Text.Trim(); info.name = txtname.Text.Trim(); info.jianchabh = txt_jianchabh.Text.Trim(); info.sfz = textsfz.Text.Trim(); info.birthdate = datebirthdate.Value.ToString("yyyy-MM-dd"); info.age = string.IsNullOrEmpty(textage.Text.Trim())?0:int.Parse(textage.Text.Trim()); info.sex = comboBoxsex.Text; info.yiyuanname = ConfigurationManager.AppSettings["yymc"]; info.yiyuancode = ConfigurationManager.AppSettings["yycode"]; info.kaifangsj = datekaifangsj.Value.ToString("yyyy-MM-dd HH:mm:ss"); info.jianchamingcheng = textexamItemName.Text; info.nhbm = textexamItemcode.Text; this.DialogResult = DialogResult.OK; } /// /// 初始化 /// /// /// private void InfoForm_Load(object sender, EventArgs e) { datekaifangsj.Value = DateTime.Now; } private void button2_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; } /// /// 生成项目编码 /// /// /// private void button4_Click(object sender, EventArgs e) { Guid guid = Guid.NewGuid(); string guidString = guid.ToString("N"); // 没有分隔符 textexamItemcode.Text = "US" + guidString; } /// /// 生成检查编号 /// /// /// private void button3_Click(object sender, EventArgs e) { Guid guid = Guid.NewGuid(); string guidString = guid.ToString("N"); // 没有分隔符 txt_jianchabh.Text = guidString; } /// /// 验证必填 /// private bool inspect() { bool bol=true; if (string.IsNullOrEmpty(textjianchaid.Text.Trim()) || string.IsNullOrEmpty(txt_jianchabh.Text.Trim()) || string.IsNullOrEmpty(txtname.Text.Trim()) || string.IsNullOrEmpty(textexamItemName.Text.Trim()) || string.IsNullOrEmpty(textexamItemcode.Text.Trim())) { MessageBox.Show("必填字段不能为空"); return false; } return bol; } /// /// 生成患者ID /// /// /// private void button5_Click(object sender, EventArgs e) { string time= DateTime.Now.ToString("yyyyMMddHHmmss"); textjianchaid.Text = "M"+time; } } }