video/InfoForm.cs
2024-12-11 19:48:43 +08:00

116 lines
3.7 KiB
C#

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;
/// <summary>
/// 新增
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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;
}
/// <summary>
/// 初始化
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void InfoForm_Load(object sender, EventArgs e)
{
datekaifangsj.Value = DateTime.Now;
}
private void button2_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
/// <summary>
/// 生成项目编码
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button4_Click(object sender, EventArgs e)
{
Guid guid = Guid.NewGuid();
string guidString = guid.ToString("N"); // 没有分隔符
textexamItemcode.Text = "US" + guidString;
}
/// <summary>
/// 生成检查编号
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button3_Click(object sender, EventArgs e)
{
Guid guid = Guid.NewGuid();
string guidString = guid.ToString("N"); // 没有分隔符
txt_jianchabh.Text = guidString;
}
/// <summary>
/// 验证必填
/// </summary>
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;
}
/// <summary>
/// 生成患者ID
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button5_Click(object sender, EventArgs e)
{
string time= DateTime.Now.ToString("yyyyMMddHHmmss");
textjianchaid.Text = "M"+time;
}
}
}