3791 lines
133 KiB
C#
3791 lines
133 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 SOH.Entities;
|
||
using EAS;
|
||
using SOH.Common;
|
||
using EAS.Data;
|
||
using EAS.Services;
|
||
using SOH.Data;
|
||
using SOH.Entities.DTO;
|
||
using System.Configuration;
|
||
using SOH.Configuration;
|
||
using System.Reflection;
|
||
using System.Drawing.Imaging;
|
||
using System.IO;
|
||
using System.Security.Cryptography;
|
||
using System.Web;
|
||
using SOH.KeFu;
|
||
using Newtonsoft.Json.Linq;
|
||
using Newtonsoft.Json;
|
||
using System.Net;
|
||
|
||
namespace SOH.QianTai
|
||
{
|
||
[ModuleAttribute(ModuleID = "C227F4BE-0BFD-4785-83FD-F24E6EC7F6E3", ModuleName = "前台基本业务")]
|
||
public partial class frmJiBenYeWu : SOH.Window.baseChildForm
|
||
{
|
||
private short fddm; //分店代码
|
||
private List<Entities.DTO.dto_zhxm> led; //根据分店选出所有的未注销的组合项目
|
||
private short a_xb;
|
||
private short a_hyzk;
|
||
private short a_tcbm;
|
||
private string tab3_op = ""; //tab3选项卡中的新建还是修改操作的标识
|
||
private Role role;
|
||
|
||
private List<t_ttgzb> ttlist; //tab3中的团检会员信息
|
||
|
||
public frmJiBenYeWu()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
|
||
private void Init()
|
||
{
|
||
|
||
string pzpath = System.Windows.Forms.Application.StartupPath + "\\pz.jpg";
|
||
pic_zp.Image = Image.FromFile(pzpath);
|
||
pic_zp3.Image = Image.FromFile(pzpath);
|
||
pic_pz2.Image = Image.FromFile(pzpath);
|
||
string pzpath1 = System.Windows.Forms.Application.StartupPath + "\\pz1.jpg";
|
||
pic_zp1.Image = Image.FromFile(pzpath1);
|
||
//tab1的 datagridview
|
||
//this.gvJXXM.AutoGenerateColumns = false;
|
||
//this.gvTCXM.AutoGenerateColumns = false;
|
||
//this.gvTJXM.AutoGenerateColumns = false;
|
||
//this.gvJXMX.AutoGenerateColumns = false;
|
||
|
||
//tab3的datagridview
|
||
|
||
|
||
this.dgv_jczt.AutoGenerateColumns = false;
|
||
//获取分店代码
|
||
string fddmstr = LoginUser.yydm;
|
||
short fd = 0;
|
||
short.TryParse(fddmstr, out fd);
|
||
fddm = fd;
|
||
|
||
//查询所有的组合项目
|
||
var vs = ServiceContainer.GetService<It_zhxm>();
|
||
led = vs.GetZhxm(fddm);
|
||
|
||
//查询用户套餐折率和加项折率
|
||
var vs1 = ServiceContainer.GetService<Iczyrole>();
|
||
role = vs1.GetRoleByczyid(LoginUser.username);
|
||
}
|
||
|
||
private void frmJiBenYeWu_Load(object sender, EventArgs e)
|
||
{
|
||
Init();
|
||
//初始化回收选项卡数据
|
||
iniths();
|
||
Load_tab1(); //加载第一个选项卡
|
||
|
||
Load_tab3();
|
||
|
||
}
|
||
|
||
private void Load_tab1()
|
||
{
|
||
this.gvJXXM.AutoGenerateColumns = false;
|
||
this.gvTCXM.AutoGenerateColumns = false;
|
||
this.gvTJXM.AutoGenerateColumns = false;
|
||
this.gvJXMX.AutoGenerateColumns = false;
|
||
|
||
Load_tab1_TJLB();
|
||
Load_tab1_YWDB();
|
||
this.cbXB.SelectedIndex = 0;
|
||
this.cbHYZK.SelectedIndex = 0;
|
||
a_xb = 0;
|
||
a_hyzk = 0;
|
||
a_tcbm = 0;
|
||
Load_tab1_TC(0, 0);
|
||
Load_tab1_KS();
|
||
//short tcbm = (short)this.cbTJTC.SelectedValue;
|
||
//Load_tab1_TCXM(tcbm);
|
||
Load_tab1_ZHXM("", 0, 0);
|
||
}
|
||
|
||
#region TAB1-个人体检登记
|
||
|
||
/// <summary>
|
||
/// 加载体检类别(用户级别)
|
||
/// </summary>
|
||
private void Load_tab1_TJLB()
|
||
{
|
||
this.cbTJLB.DataSource = SOH.Common.CommonDT.YHJB;
|
||
this.cbTJLB.DisplayMember = "jbmc";
|
||
this.cbTJLB.ValueMember = "jbbm";
|
||
}
|
||
|
||
List<t_ygzd> lty = new List<t_ygzd>();
|
||
|
||
/// <summary>
|
||
/// 加载业务代表
|
||
/// </summary>
|
||
private void Load_tab1_YWDB()
|
||
{
|
||
string yydmstr = LoginUser.yydm; //当前医院代码-分店
|
||
short yydm = 0;
|
||
short.TryParse(yydmstr, out yydm);
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
lty = vs.GetYgzdByFD(yydm);
|
||
//lty.Add()
|
||
//t_ygzd ty = new t_ygzd();
|
||
//ty.bm = 0;
|
||
//ty.xm = "无";
|
||
//lty.Insert(0, ty);
|
||
if (lty != null)
|
||
{
|
||
//this.cbYWDB.DataSource = lty;
|
||
this.cbYWDB.DisplayMember = "xm";
|
||
this.cbYWDB.ValueMember = "bm";
|
||
|
||
this.cbYWDB.Items.AddRange(lty.ToArray());
|
||
this.cbYWDB.SelectedIndex = 0;
|
||
}
|
||
|
||
|
||
}
|
||
|
||
//加载科室信息 (此处查了所有类型的科室 lx=-1)
|
||
private void Load_tab1_KS()
|
||
{
|
||
string fddm_str = LoginUser.yydm; //分店代码
|
||
int fddm = 0;
|
||
Int32.TryParse(fddm_str, out fddm);
|
||
int lx = -1;
|
||
var vs = ServiceContainer.GetService<It_ks>();
|
||
List<keshi> ltk = vs.GetAllks("", lx, fddm);
|
||
if (ltk == null)
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
this.cbTJKS.DisplayMember = "ksmc";
|
||
this.cbTJKS.ValueMember = "ksbm";
|
||
this.cbTJKS.DataSource = ltk;
|
||
}
|
||
}
|
||
|
||
//根据性别和婚姻状况加载体检套餐
|
||
private void Load_tab1_TC(short xb, short hyzk)
|
||
{
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
List<t_tc> ltt = vs.GetTCByCondition(xb, hyzk, fddm);
|
||
if (ltt == null)
|
||
{
|
||
this.cbTJTC.DataSource = null;
|
||
}
|
||
else
|
||
{
|
||
this.cbTJTC.DisplayMember = "tcmc";
|
||
this.cbTJTC.ValueMember = "tcbm";
|
||
this.cbTJTC.DataSource = ltt;
|
||
}
|
||
this.cbTJTC.SelectedIndex = -1;
|
||
|
||
}
|
||
|
||
|
||
|
||
List<Entities.DTO.dto_zhxm> _zhxm;
|
||
/// <summary>
|
||
/// tab1中根据性别和婚姻状况、分店代码加载组合项目
|
||
/// </summary>
|
||
private void Load_tab1_ZHXM(string zjf, short xb, short hyzk)
|
||
{
|
||
//var vs = ServiceContainer.GetService<It_zhxm>();
|
||
//List<Entities.DTO.dto_zhxm> list= vs.GetZhxmByZjf("",fddm,xb, hyzk);
|
||
if (led == 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 = led.Where(t => ((zjf == null || zjf == "") ? true : (t.zjm.Contains(zjf))));
|
||
var data = led.Where(t => (xb == 2 ? true : (t.xb == xb || t.xb == 2)) && ((zjf == null || zjf == "") ? true : (t.zjm.Contains(zjf))));
|
||
if (data.Any())
|
||
{
|
||
List<Entities.DTO.dto_zhxm> ld = data.ToList();
|
||
this.gvTJXM.DataSource = null;
|
||
this.gvTJXM.DataSource = ld.OrderBy(t => t.ksbm).ToList();
|
||
_zhxm = ld.OrderBy(t => t.ksbm).ToList();
|
||
}
|
||
else
|
||
{
|
||
this.gvTJXM.DataSource = null;
|
||
}
|
||
}
|
||
|
||
|
||
//取消按钮清除所有信息
|
||
private void Clear_tab1()
|
||
{
|
||
this.tbJKGW.Text = "";
|
||
this.tbSFZH.Text = "";
|
||
this.cbYWDB.SelectedValue = 0;
|
||
this.cbTJLB.SelectedValue = 0;
|
||
this.tbHyh.Text = "";
|
||
this.tbXM.Text = "";
|
||
this.tbNL.Text = "";
|
||
this.tbLXDH.Text = "";
|
||
this.tbTXDZ.Text = "";
|
||
this.txtBZ.Text = "";
|
||
|
||
this.cbDXTJ.Checked = false;
|
||
this.cbVIP.Checked = false;
|
||
this.cbPA.Checked = false;
|
||
|
||
this.cbHYZK.SelectedIndex = 0;
|
||
this.cbXB.SelectedIndex = 0;
|
||
|
||
a_xb = 0;
|
||
a_hyzk = 0;
|
||
|
||
Load_tab1_TC(0, 0);
|
||
|
||
Load_tab1_ZHXM("", 0, 0);
|
||
this.gvTCXM.DataSource = null;
|
||
this.gvJXMX.DataSource = null;
|
||
this.gvJXXM.DataSource = null;
|
||
this.tbTCJG.Text = "0";
|
||
this.tbZHJ.Text = "0";
|
||
this.tbJXJG.Text = "0";
|
||
this.tbZHJ2.Text = "0";
|
||
this.tbSSJE.Text = "0";
|
||
|
||
this.tbSFZH.Focus();
|
||
|
||
}
|
||
|
||
//个人登记查询
|
||
private void SearchInfo()
|
||
{
|
||
#region 根据身份证号查询是否是已登记会员
|
||
string sfzh = this.tbSFZH.Text.Trim();
|
||
//验证身份证号的长度
|
||
//&& sfzh.Length != 15
|
||
if (sfzh.Length != 18 || sfzh.Length != 15)
|
||
{
|
||
MessageBox.Show("身份证号长度不符");
|
||
this.tbSFZH.Select();
|
||
return;
|
||
}
|
||
//根据身份证号计算出生日期和年龄
|
||
int nl = Common.PubFunc.GetNlBySfz(sfzh);
|
||
string csrq = Common.PubFunc.GetCsrqBySfz(sfzh);
|
||
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
t_hyb thyb = vs.GetHyBySfzh(sfzh);
|
||
if (thyb == null)
|
||
{
|
||
MessageBox.Show("未找到该身份证对应的会员信息,请录入详细信息后登记");
|
||
DateTime dt;
|
||
if (DateTime.TryParse(string.IsNullOrEmpty(csrq) ? "" : csrq, out dt))
|
||
{
|
||
this.dtpCSRQ.Value = dt;
|
||
}
|
||
this.tbNL.Text = nl.ToString();
|
||
}
|
||
else
|
||
{
|
||
//查到会员信息之后,控件赋值
|
||
//thyb.yhjb == null ? 0 : thyb.yhjb //会员级别
|
||
//this.cbTJLB.SelectedValue();
|
||
this.tbLXDH.Text = thyb.tel1 == null ? "" : thyb.tel1; //联系电话
|
||
DateTime dt;
|
||
if (DateTime.TryParse(string.IsNullOrEmpty(csrq) ? "" : csrq, out dt))
|
||
{
|
||
this.dtpCSRQ.Value = dt;
|
||
}
|
||
this.tbNL.Text = nl.ToString();
|
||
this.tbTXDZ.Text = thyb.txdz == null ? "" : thyb.txdz.ToString(); //通讯地址
|
||
//this.tbHYH.Text = thyb.hyh.ToString(); //会员号
|
||
this.tbHyh.Text = thyb.hyh.ToString(); //会员号
|
||
this.tbXM.Text = thyb.xm; //姓名
|
||
this.cbXB.SelectedValue = thyb.xb; //性别选择
|
||
this.cbHYZK.SelectedValue = thyb.hyzk;
|
||
}
|
||
|
||
#endregion
|
||
}
|
||
|
||
//个人登记
|
||
private void btnDJ_Click(object sender, EventArgs e)
|
||
{
|
||
//1.点击查询找到会员后填写信息登记
|
||
//2.点击查询后没有找到会员填写信息登记
|
||
//3.没有点击查询直接录入信息后登记
|
||
//有会员号 必定需要有身份证号,有没有会员号的区别在于是否进行hyb的信息添加
|
||
//
|
||
|
||
//登记验证
|
||
bool ifhy = false;
|
||
//根据是否有会员号判断是否会员
|
||
string hy = this.tbHyh.Text;
|
||
//信息
|
||
string sfzh = this.tbSFZH.Text.Trim();
|
||
string xm = this.tbXM.Text.Trim();
|
||
short xb = (short)this.cbXB.SelectedIndex;
|
||
short hyzk = (short)this.cbHYZK.SelectedIndex;
|
||
short nl = 0;
|
||
short.TryParse(this.tbNL.Text.Trim(), out nl);
|
||
string zjm = xm.ToPinYin();
|
||
string lxdh = this.tbLXDH.Text.Trim();
|
||
string txdz = this.tbTXDZ.Text.Trim();
|
||
string bzxx = this.txtBZ.Text.Trim();
|
||
string tjzje_str = this.tbSSJE.Text.Trim(); //
|
||
int tjzje = 0;
|
||
double tjzjetemp = 0D;
|
||
double.TryParse(tjzje_str, out tjzjetemp);
|
||
tjzje = (int)tjzjetemp; //tjzje
|
||
|
||
string tczje_str = "";
|
||
if (lbl_wdh.Text != "")
|
||
{
|
||
tczje_str = lbl_wdjg.Text;
|
||
}
|
||
else
|
||
{
|
||
tczje_str = this.tbZHJ.Text;
|
||
}
|
||
|
||
int tczje = 0;
|
||
double tczjetemp = 0D;
|
||
double.TryParse(tczje_str, out tczjetemp); //套餐总金额
|
||
tczje = (int)tczjetemp;
|
||
short tczl = (short)this.udTCZL.Value;
|
||
short jxzl = (short)this.udJXZL.Value;
|
||
short dxtj = (short)(this.cbDXTJ.Checked ? 1 : 0); //是否单项体检
|
||
short vip = (short)(this.cbVIP.Checked ? 1 : 2); //是否vip
|
||
short PA = (short)(this.cbPA.Checked ? 1 : 0); //是否vip
|
||
|
||
//身份证号可以为空,但是基本格式要对,18位
|
||
if (string.IsNullOrEmpty(sfzh))
|
||
{
|
||
MessageBox.Show("请输入正确的身份证号信息");
|
||
return;
|
||
}
|
||
if (fddm == 1 && string.IsNullOrEmpty(tbJKGW.Text))
|
||
{
|
||
MessageBox.Show("请输入业务代表信息");
|
||
this.tbJKGW.Focus();
|
||
return;
|
||
}
|
||
|
||
if (sfzh.Length == 18) //对于有身份证号的信息进行判断
|
||
{
|
||
//根据身份证号获取此人是否已经有体检信息
|
||
var vsqt = ServiceContainer.GetService<IQianTai>();
|
||
OperationResult orexsit = vsqt.IfExistGJBySFZH(sfzh, fddm);
|
||
if (orexsit.State == 0)
|
||
{
|
||
MessageBox.Show(orexsit.Message);
|
||
return;
|
||
}
|
||
}
|
||
|
||
if (string.IsNullOrEmpty(xm) || xm.Length < 2)
|
||
{
|
||
MessageBox.Show("请输入正确的姓名信息");
|
||
return;
|
||
}
|
||
string nlstr = this.tbNL.Text.Trim();
|
||
if (!short.TryParse(nlstr, out nl))
|
||
{
|
||
MessageBox.Show("请输入正确格式的年龄");
|
||
return;
|
||
}
|
||
if (this.cbTJTC.SelectedIndex < 0)
|
||
{
|
||
MessageBox.Show("请选择体检套餐");
|
||
return;
|
||
}
|
||
string tcstr = this.cbTJTC.SelectedValue == null ? "" : this.cbTJTC.SelectedValue.ToString();
|
||
int tcbm = 0;
|
||
if (!Int32.TryParse(tcstr, out tcbm) || tcbm <= 0)
|
||
{
|
||
MessageBox.Show("请选择体检套餐");
|
||
return;
|
||
}
|
||
if (tczje == 0 && this.gvJXXM.Rows.Count <= 0)
|
||
{
|
||
MessageBox.Show("请选择检查项目");
|
||
return;
|
||
}
|
||
var b = ServiceContainer.GetService<IBasic>(); //gemax方法所在类
|
||
int hyh = 0;
|
||
if (!string.IsNullOrEmpty(hy) && Int32.TryParse(hy, out hyh))
|
||
{
|
||
ifhy = true;
|
||
}
|
||
|
||
t_hyb thyb = new t_hyb();
|
||
|
||
//会员表添加,会员信息会根据身份证号进行比对添加,这里先构建出来
|
||
hyh = b.gethyh(fddm, 1); //获取会员号
|
||
thyb.sfz = sfzh;
|
||
thyb.yhjb = (short)this.cbTJLB.SelectedIndex; //用户类别 、级别
|
||
thyb.xm = xm;
|
||
thyb.xb = xb;
|
||
thyb.hyzk = hyzk;
|
||
thyb.nl = nl;
|
||
thyb.tel1 = lxdh;
|
||
thyb.txdz = this.tbTXDZ.Text.Trim();
|
||
thyb.csrq = this.dtpCSRQ.Value;
|
||
thyb.xx = 4; //猜测为血型默认为4
|
||
thyb.hybz = 1;
|
||
thyb.bz = txdz;
|
||
|
||
//原来有会员信息的
|
||
if (ifhy)
|
||
{
|
||
hyh = Convert.ToInt32(hy);
|
||
}
|
||
else //原来没有会员信息的
|
||
{
|
||
thyb.hyh = hyh;
|
||
|
||
}
|
||
|
||
//个人工作表添加
|
||
t_grgzb tg = new t_grgzb();
|
||
int tm = 0;
|
||
if (fddm == 1)
|
||
{
|
||
tm = b.gettmh(3, 0, 1);
|
||
}
|
||
else
|
||
{
|
||
tm = b.gettmh(fddm, 0, 1);
|
||
}
|
||
tg.tm = tm;
|
||
tg.hyh = hyh;
|
||
tg.tcbm = tcbm;
|
||
tg.xm = xm;
|
||
tg.xb = xb;
|
||
tg.nl = nl;
|
||
tg.hyzk = hyzk;
|
||
tg.tjrq = DateTime.Now;
|
||
tg.tmztz = 1;
|
||
tg.tckxfbz = 0;
|
||
tg.czjjxbj = 1;
|
||
tg.tjzje = tjzje * 100;
|
||
tg.tczje = tczje * 100;
|
||
tg.tczl = tczl;
|
||
tg.djczy = LoginUser.username;
|
||
tg.bz = bzxx;
|
||
tg.tjlb = (short)(this.cbTJLB.SelectedIndex < 0 ? 0 : this.cbTJLB.SelectedIndex);
|
||
tg.zjm = zjm;
|
||
tg.dh = lxdh;
|
||
tg.dz = txdz;
|
||
tg.hylb = (short)(this.cbTJLB.SelectedIndex < 0 ? 0 : this.cbTJLB.SelectedIndex); //用户类别
|
||
tg.dxtj = dxtj;
|
||
tg.khlx = vip;
|
||
tg.hfbz = PA;
|
||
//tg.xiaoshou = this.cbYWDB.SelectedValue == null ? "" : this.cbYWDB.SelectedValue.ToString();
|
||
|
||
t_ygzd ygzdd = new t_ygzd();
|
||
ygzdd = (t_ygzd)this.cbYWDB.SelectedItem;
|
||
tg.xiaoshou = ygzdd == null ? "" : ygzdd.bm.ToString();
|
||
|
||
tg.sfzh = sfzh;
|
||
tg.csrq = this.dtpCSRQ.Value;
|
||
tg.doctor = this.tbJKGW.Text.Trim(); //体检顾问
|
||
tg.fddm = fddm;
|
||
tg.dyrq = new DateTime(1900, 1, 1);
|
||
tg.sj = lbl_wdh.Text;
|
||
System.IO.MemoryStream ms = new System.IO.MemoryStream();
|
||
pic_zp.Image.Save(ms, ImageFormat.Jpeg);
|
||
tg.image = ms.ToArray();
|
||
//t_jjxb中增加加减项目记录
|
||
List<t_jjxb> lt = new List<t_jjxb>();
|
||
//从加项表中取加项信息
|
||
List<t_zhxm> jxlist = this.gvJXXM.DataSource as List<t_zhxm>;
|
||
if (tczje == 0 && (jxlist == null || jxlist.Count == 0))
|
||
{
|
||
//没有套餐金额 也没有加项的
|
||
MessageBox.Show("请选择套餐或者加项信息");
|
||
return;
|
||
}
|
||
if (jxlist != null)
|
||
{
|
||
for (int i = 0; i < jxlist.Count; i++)
|
||
{
|
||
string jxmc = jxlist[i].zhmc;
|
||
int jxbm = jxlist[i].zhbm;
|
||
t_jjxb jjx = new t_jjxb();
|
||
jjx.xh = b.GetMax("dbo.jjx", 1);
|
||
jjx.tm = tm;
|
||
jjx.zhbm = jxbm;
|
||
jjx.jjx = 0; //加项为0
|
||
jjx.ysfbz = 0; //已收费标志
|
||
jjx.zl = jxzl; //折率
|
||
jjx.jjxje = jxlist[i].jg * jxzl / 100; //?gridview中是否有jg?
|
||
jjx.jglx = 1;
|
||
jjx.jjxlx = 1;
|
||
jjx.czy = LoginUser.username;
|
||
jjx.fddm = fddm;
|
||
lt.Add(jjx);
|
||
}
|
||
}
|
||
|
||
//从减项表中取减项信息
|
||
List<t_zhxm> jxlist2 = this.gvJXMX.DataSource as List<t_zhxm>;
|
||
if (jxlist2 != null)
|
||
{
|
||
for (int j = 0; j < jxlist2.Count; j++)
|
||
{
|
||
string jxmc = jxlist2[j].zhmc;
|
||
int jxbm = jxlist2[j].zhbm;
|
||
t_jjxb jjx = new t_jjxb();
|
||
jjx.xh = b.GetMax("dbo.jjx", 1);
|
||
jjx.tm = tm;
|
||
jjx.zhbm = jxbm;
|
||
jjx.jjx = 1; //减项为1
|
||
jjx.ysfbz = 0; //已收费标志
|
||
jjx.zl = tczl; //折率
|
||
jjx.jjxje = jxlist2[j].jg; //?gridview中是否有jg?
|
||
jjx.jglx = 0;
|
||
jjx.jjxlx = 1;
|
||
jjx.czy = LoginUser.username;
|
||
jjx.fddm = fddm;
|
||
lt.Add(jjx);
|
||
}
|
||
}
|
||
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
OperationResult or = vs.GRDJ(thyb, tg, lt, ifhy);
|
||
if (or.State == 1) //成功
|
||
{
|
||
lbl_wdh.Text = lbl_wdjg.Text = lbl_tcmc.Text="";
|
||
MessageBox.Show("登记成功");
|
||
pic_zp.Image = Image.FromFile(System.Windows.Forms.Application.StartupPath + "\\pz.jpg");
|
||
Clear_tab1();
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("登记失败," + or.Message);
|
||
}
|
||
}
|
||
|
||
//取消按钮,重置个人信息和所选套餐等
|
||
private void btnQX_Click(object sender, EventArgs e)
|
||
{
|
||
Clear_tab1();
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 套餐选择切换
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void cbTJTC_SelectionChangeCommitted(object sender, EventArgs e)
|
||
{
|
||
if (this.cbTJTC.Text != "System.Data.DataRowView")
|
||
{
|
||
string tcbmstr = this.cbTJTC.SelectedValue == null ? "" : this.cbTJTC.SelectedValue.ToString();
|
||
short tcbm = 0;
|
||
short.TryParse(tcbmstr, out tcbm);
|
||
if (tcbm == a_tcbm)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
/*
|
||
var vser = ServiceContainer.GetService<ITaoCan>();
|
||
var tc = vser.GetModelBytcbm(tcbm);
|
||
if(tc.xb!=2)
|
||
{
|
||
if(tc.xb!=cbXB.SelectedIndex)
|
||
{
|
||
MessageBox.Show("你选择的体检套餐性别和当前客户的性别不相符!");
|
||
return;
|
||
}
|
||
}*/
|
||
a_tcbm = tcbm;
|
||
this.gvJXMX.DataSource = null;
|
||
this.gvJXXM.DataSource = null;
|
||
Load_tab1_TCXM(tcbm);
|
||
GetTCJG();
|
||
GetJXJG();
|
||
tb_tcZJM.Text = "";
|
||
}
|
||
this.btnDJ.Focus();
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 根据套餐主编码加载套餐详细项目信息
|
||
/// </summary>
|
||
/// <param name="tcbm"></param>
|
||
private void Load_tab1_TCXM(short tcbm)
|
||
{
|
||
var vs = ServiceContainer.GetService<It_zhxmmx>();
|
||
List<t_zhxm> ltz = vs.GetZhxmmxByTcbm(tcbm);
|
||
this.gvTCXM.DataSource = null;
|
||
this.gvTCXM.DataSource = ltz;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 体检科室切换的时候,改变gvTJXM表格的项目信息
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
//private void cbTJKS_SelectionChangeCommitted(object sender, EventArgs e)
|
||
//{
|
||
// string ksmc=this.cbTJKS.SelectedText;
|
||
// for (int i = 0; i < this.gvTJXM.Rows.Count; i++)
|
||
// {
|
||
// string temp = this.gvTJXM.Rows[i].Cells["ksmc3"].Value.ToString();
|
||
// if (temp.Equals(ksmc))
|
||
// {
|
||
// this.gvTJXM.FirstDisplayedScrollingRowIndex = i;
|
||
// break;
|
||
// }
|
||
// }
|
||
//}
|
||
|
||
private void cbTJKS_SelectedValueChanged(object sender, EventArgs e)
|
||
{
|
||
string ksmc = this.cbTJKS.SelectedItem == null ? "" : this.cbTJKS.SelectedItem.ToString();
|
||
if (string.IsNullOrEmpty(ksmc))
|
||
{
|
||
return;
|
||
}
|
||
//for (int i = 0; i < this.gvTJXM.Rows.Count; i++)
|
||
//{
|
||
/*
|
||
string temp = this.gvTJXM.Rows[i].Cells["ksmc3"].Value.ToString();
|
||
if (temp.Equals(ksmc))
|
||
{
|
||
this.gvTJXM.FirstDisplayedScrollingRowIndex = i;
|
||
break;
|
||
}*/
|
||
if (_zhxm != null)
|
||
{
|
||
string ksbm = cbTJKS.SelectedValue.ToString();
|
||
int iksbm = 0;
|
||
int.TryParse(ksbm, out iksbm);
|
||
gvTJXM.DataSource = null;
|
||
gvTJXM.DataSource = _zhxm.Where(t => t.ksbm == iksbm).ToList();
|
||
}
|
||
//}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 所有体检项目grid双击向加项中增加
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void gvTJXM_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||
{
|
||
if (e.RowIndex == -1)
|
||
{
|
||
return;
|
||
}
|
||
dto_zhxm dz = this.gvTJXM.Rows[e.RowIndex].DataBoundItem as dto_zhxm;
|
||
t_zhxm tz = new t_zhxm();
|
||
tz.zhbm = dz.zhbm;
|
||
tz.zhmc = dz.zhmc;
|
||
tz.jg_v = dz.jg;
|
||
|
||
//加项数据源
|
||
List<t_zhxm> ltz = this.gvJXXM.DataSource as List<t_zhxm>;
|
||
if (ltz == null)
|
||
{
|
||
ltz = new List<t_zhxm>();
|
||
}
|
||
//套餐数据源
|
||
List<t_zhxm> lt = this.gvTCXM.DataSource as List<t_zhxm>;
|
||
if (lt == null)
|
||
{
|
||
lt = new List<t_zhxm>();
|
||
}
|
||
//减项数据源
|
||
List<t_zhxm> lt_j = this.gvJXMX.DataSource as List<t_zhxm>;
|
||
if (lt_j == null)
|
||
{
|
||
lt_j = new List<t_zhxm>();
|
||
}
|
||
|
||
//判断加项以及体检套餐里面是否有该项目
|
||
if (lt.Where(t => t.zhbm == tz.zhbm).Any() || ltz.Where(t => t.zhbm == tz.zhbm).Any())
|
||
{
|
||
MessageBox.Show("该组合项目已经在套餐项目或者加项中存在!");
|
||
return;
|
||
}
|
||
else if (lt_j.Where(t => t.zhbm == tz.zhbm).Any()) //如果减项中有的话 将减项中去掉,回到套餐中
|
||
{
|
||
//移除减项中的该组合项目
|
||
t_zhxm th = lt_j.Where(t => t.zhbm == tz.zhbm).First();
|
||
lt_j.Remove(th);
|
||
this.gvJXMX.DataSource = null;
|
||
if (lt_j == null || lt_j.Count == 0)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
this.gvJXMX.DataSource = lt_j;
|
||
}
|
||
|
||
lt.Add(th);
|
||
this.gvTCXM.DataSource = null;
|
||
this.gvTCXM.DataSource = lt;
|
||
|
||
//移除原来的项
|
||
List<Entities.DTO.dto_zhxm> list = this.gvTJXM.DataSource as List<Entities.DTO.dto_zhxm>;
|
||
list.Remove(dz);
|
||
this.gvTJXM.DataSource = null;
|
||
this.gvTJXM.DataSource = list.OrderBy(t => t.ksbm).ToList();
|
||
GetTCJG();
|
||
}
|
||
else //加项和减项和套餐中都没有的,直接放到加项中
|
||
{
|
||
ltz.Add(tz);
|
||
this.gvJXXM.DataSource = null;
|
||
this.gvJXXM.DataSource = ltz;
|
||
//this.gvJXXM.Refresh();
|
||
GetJXJG(); //加项价格
|
||
|
||
//移除原来的项
|
||
List<Entities.DTO.dto_zhxm> list = this.gvTJXM.DataSource as List<Entities.DTO.dto_zhxm>;
|
||
list.Remove(dz);
|
||
this.gvTJXM.DataSource = null;
|
||
this.gvTJXM.DataSource = list.OrderBy(t => t.ksbm).ToList();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 在助记符输入后按回车进行查询相关的组合项目
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void tbTJKSZJM_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode == Keys.Enter)
|
||
{
|
||
short xb = (short)this.cbXB.SelectedIndex;
|
||
short hyzk = (short)this.cbHYZK.SelectedIndex;
|
||
string zjf = this.tbTJKSZJM.Text.Trim();
|
||
zjf = zjf.ToLower();
|
||
Load_tab1_ZHXM(zjf, xb, hyzk);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 套餐项目双击行事件(减项)
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void gvTCXM_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||
{
|
||
if (e.RowIndex < 0)
|
||
{
|
||
return;
|
||
}
|
||
//问题 移除数据有错误溢出
|
||
t_zhxm tz = gvTCXM.Rows[e.RowIndex].DataBoundItem as t_zhxm;
|
||
|
||
//将删除的项放到减项里
|
||
List<t_zhxm> lt_j = this.gvJXMX.DataSource as List<t_zhxm>;
|
||
if (lt_j == null)
|
||
{
|
||
lt_j = new List<t_zhxm>();
|
||
}
|
||
lt_j.Add(tz);
|
||
this.gvJXMX.DataSource = null;
|
||
this.gvJXMX.DataSource = lt_j;
|
||
|
||
|
||
//移除原来的
|
||
List<t_zhxm> lt = this.gvTCXM.DataSource as List<t_zhxm>;
|
||
lt.Remove(tz);
|
||
this.gvTCXM.DataSource = null;
|
||
this.gvTCXM.DataSource = lt;
|
||
|
||
//更改套餐的总费用
|
||
GetTCJG();
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 计算套餐总价格
|
||
/// </summary>
|
||
private void GetTCJG()
|
||
{
|
||
t_tc tcb = ServiceContainer.GetService<IQianTai>().GetTcBytcbm(a_tcbm);
|
||
|
||
if (tcb != null)
|
||
{
|
||
if (tcb.sjjg != tcb.yhjg)
|
||
{
|
||
double tc1 = 0.0D;
|
||
//int yhjgs = Convert.ToInt32(tcb.yhjg);
|
||
//double yhjg = 0.0D;
|
||
double.TryParse((tcb.yhjg / 100).ToString(), out tc1);
|
||
this.tbTCJG.Text = tc1.ToString();
|
||
|
||
double zl = (double)this.udTCZL.Value;
|
||
double zhj = tc1 * zl / 100;
|
||
double result = Math.Round(zhj, 0);
|
||
this.tbZHJ.Text = result.ToString();
|
||
|
||
|
||
string zhj2str = this.tbZHJ2.Text.Trim();
|
||
double zhj2 = 0.0D;
|
||
double.TryParse(zhj2str, out zhj2);
|
||
|
||
double sum = zhj + zhj2;
|
||
this.tbSSJE.Text = sum.ToString();
|
||
}
|
||
else
|
||
{
|
||
|
||
double tc = 0.0D;
|
||
//获取套餐项目总价格
|
||
for (int i = 0; i < this.gvTCXM.Rows.Count; i++)
|
||
{
|
||
object o = this.gvTCXM.Rows[i].Cells["jg1"].Value;
|
||
if (o == null || string.IsNullOrEmpty(o.ToString()))
|
||
{
|
||
continue;
|
||
}
|
||
double temp1 = 0.0D;
|
||
double.TryParse(o.ToString(), out temp1);
|
||
tc += temp1;
|
||
}
|
||
this.tbTCJG.Text = tc.ToString();
|
||
|
||
double zl = (double)this.udTCZL.Value;
|
||
double zhj = tc * zl / 100;
|
||
double result = Math.Round(zhj, 0);
|
||
this.tbZHJ.Text = result.ToString();
|
||
|
||
|
||
string zhj2str = this.tbZHJ2.Text.Trim();
|
||
double zhj2 = 0.0D;
|
||
double.TryParse(zhj2str, out zhj2);
|
||
|
||
double sum = zhj + zhj2;
|
||
this.tbSSJE.Text = sum.ToString();
|
||
}
|
||
}
|
||
|
||
}
|
||
/// <summary>
|
||
/// 获取加项总价格
|
||
/// </summary>
|
||
private void GetJXJG()
|
||
{
|
||
double jx = 0.0D;
|
||
//获取加项总价格
|
||
for (int i = 0; i < this.gvJXXM.Rows.Count; i++)
|
||
{
|
||
object o = this.gvJXXM.Rows[i].Cells["jg2"].Value;
|
||
if (o == null || string.IsNullOrEmpty(o.ToString()))
|
||
{
|
||
continue;
|
||
}
|
||
double temp2 = 0.0D;
|
||
double.TryParse(o.ToString(), out temp2);
|
||
jx += temp2;
|
||
}
|
||
this.tbJXJG.Text = jx.ToString();
|
||
|
||
//加项的折后价
|
||
double zl = (double)this.udJXZL.Value;
|
||
double zhj2 = jx * zl / 100;
|
||
double result = Math.Round(zhj2, 0);
|
||
this.tbZHJ2.Text = result.ToString();
|
||
|
||
//套餐的折后价
|
||
string zhjstr = this.tbZHJ.Text.Trim();
|
||
double zhj = 0;
|
||
double.TryParse(zhjstr, out zhj);
|
||
|
||
double sum = zhj + zhj2;
|
||
this.tbSSJE.Text = sum.ToString();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 性别选择变化时
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void cbXB_SelectionChangeCommitted(object sender, EventArgs e)
|
||
{
|
||
int xbint = this.cbXB.SelectedIndex;
|
||
short xb = (short)xbint;
|
||
if (xb == a_xb)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
a_xb = xb;
|
||
int hyint = this.cbHYZK.SelectedIndex;
|
||
short hyzk = (short)hyint;
|
||
Load_tab1_TC(xb, hyzk);
|
||
Load_tab1_ZHXM("", xb, hyzk);
|
||
this.gvTCXM.DataSource = null;
|
||
this.gvJXMX.DataSource = null;
|
||
this.gvJXXM.DataSource = null;
|
||
this.tbTCJG.Text = "0.0";
|
||
this.tbZHJ.Text = "0.0";
|
||
this.tbJXJG.Text = "0.0";
|
||
this.tbZHJ2.Text = "0.0";
|
||
this.tbSSJE.Text = "0.0";
|
||
}
|
||
this.cbTJTC.Focus();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 婚姻状况选择变化时
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void cbHYZK_SelectionChangeCommitted(object sender, EventArgs e)
|
||
{
|
||
int hyint = this.cbHYZK.SelectedIndex;
|
||
short hyzk = (short)hyint;
|
||
if (hyzk == a_hyzk)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
a_hyzk = hyzk;
|
||
int xbint = this.cbXB.SelectedIndex;
|
||
short xb = (short)xbint;
|
||
Load_tab1_TC(xb, hyzk);
|
||
Load_tab1_ZHXM("", xb, hyzk);
|
||
this.gvTCXM.DataSource = null;
|
||
this.gvJXMX.DataSource = null;
|
||
this.gvJXXM.DataSource = null;
|
||
this.tbTCJG.Text = "0";
|
||
this.tbZHJ.Text = "0";
|
||
this.tbJXJG.Text = "0";
|
||
this.tbZHJ2.Text = "0";
|
||
this.tbSSJE.Text = "0";
|
||
}
|
||
this.cbTJTC.Focus();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 套餐折率变换时事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void udTCZL_ValueChanged(object sender, EventArgs e)
|
||
{
|
||
if ((short)this.udTCZL.Value < role.tczl)
|
||
{
|
||
MessageBox.Show("套餐折率超出角色权限");
|
||
//this.udTCZL.UpButton();
|
||
this.udTCZL.Value = role.tczl;
|
||
return;
|
||
}
|
||
|
||
double zl = (double)this.udTCZL.Value;
|
||
string tcjgstr = this.tbTCJG.Text;
|
||
double tcjg = 0;
|
||
double.TryParse(tcjgstr, out tcjg);
|
||
double zhj = tcjg * zl / 100;
|
||
double result = Math.Round(zhj, 2);
|
||
int jg1 = (int)result;
|
||
this.tbZHJ.Text = jg1.ToString();
|
||
|
||
//加项折扣后价格 算总价
|
||
string zhj2str = this.tbZHJ2.Text.Trim();
|
||
double zhj2 = 0.0D;
|
||
double.TryParse(zhj2str, out zhj2);
|
||
int jg2 = (int)zhj2;
|
||
|
||
int sum = jg1 + jg2;
|
||
this.tbSSJE.Text = sum.ToString();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 加项折率变化时事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void udJXZL_ValueChanged(object sender, EventArgs e)
|
||
{
|
||
if ((short)this.udJXZL.Value < role.jxzl)
|
||
{
|
||
MessageBox.Show("加项折率超出角色权限");
|
||
//this.udJXZL.UpButton();
|
||
this.udJXZL.Value = role.jxzl;
|
||
return;
|
||
}
|
||
|
||
double zl = (double)this.udJXZL.Value;
|
||
string jxjgstr = this.tbJXJG.Text;
|
||
double jxjg = 0;
|
||
double.TryParse(jxjgstr, out jxjg);
|
||
double zhj2 = jxjg * zl / 100;
|
||
double result = Math.Round(zhj2, 2);
|
||
int jg1 = (int)result;
|
||
this.tbZHJ2.Text = (jg1).ToString();
|
||
|
||
//套餐的折后价
|
||
string zhjstr = this.tbZHJ.Text.Trim();
|
||
double zhj = 0;
|
||
double.TryParse(zhjstr, out zhj);
|
||
int jg2 = (int)zhj;
|
||
|
||
int sum = jg1 + jg2;
|
||
this.tbSSJE.Text = sum.ToString();
|
||
}
|
||
|
||
private void gvJXXM_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||
{
|
||
if (e.RowIndex == -1)
|
||
{
|
||
return;
|
||
}
|
||
t_zhxm dz = this.gvJXXM.Rows[e.RowIndex].DataBoundItem as t_zhxm;
|
||
int zhbm = dz.zhbm;
|
||
//体检加项
|
||
List<t_zhxm> ltz = this.gvJXXM.DataSource as List<t_zhxm>;
|
||
|
||
//组合项目列表要增加
|
||
List<Entities.DTO.dto_zhxm> ldz = this.gvTJXM.DataSource as List<Entities.DTO.dto_zhxm>;
|
||
if (ldz.Where(t => t.zhbm == zhbm).Any())
|
||
{
|
||
//已有不需要添加
|
||
}
|
||
else
|
||
{
|
||
dto_zhxm dtz = led.Where(t => t.zhbm == dz.zhbm).FirstOrDefault();
|
||
if (dz != null)
|
||
{
|
||
ldz.Add(dtz);
|
||
}
|
||
|
||
this.gvTJXM.DataSource = null;
|
||
this.gvTJXM.DataSource = ldz.OrderBy(t => t.ksbm).ToList();
|
||
}
|
||
|
||
//加项项目里面去掉该项
|
||
ltz.Remove(dz);
|
||
this.gvJXXM.DataSource = null;
|
||
if (ltz == null || ltz.Count == 0)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
this.gvJXXM.DataSource = ltz;
|
||
}
|
||
GetJXJG();
|
||
}
|
||
|
||
private void gvJXMX_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||
{
|
||
if (e.RowIndex == -1)
|
||
{
|
||
return;
|
||
}
|
||
t_zhxm tz = this.gvJXMX.Rows[e.RowIndex].DataBoundItem as t_zhxm; //取出该行数据
|
||
|
||
//取套餐项目列表
|
||
List<t_zhxm> ltz = this.gvTCXM.DataSource as List<t_zhxm>;
|
||
ltz.Add(tz);
|
||
this.gvTCXM.DataSource = null;
|
||
this.gvTCXM.DataSource = ltz;
|
||
GetTCJG();
|
||
|
||
//减项列表
|
||
List<t_zhxm> lt_j = this.gvJXMX.DataSource as List<t_zhxm>;
|
||
lt_j.Remove(tz);
|
||
this.gvJXMX.DataSource = null;
|
||
if (lt_j == null)
|
||
{
|
||
|
||
}
|
||
else
|
||
{
|
||
this.gvJXMX.DataSource = lt_j;
|
||
}
|
||
|
||
}
|
||
//查询
|
||
private void btnCX1_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
System.Configuration.Configuration conf = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Windows.Forms.Application.StartupPath + "\\local.ext");
|
||
// string sfzdkq = "";
|
||
if (conf.AppSettings.Settings.AllKeys.Contains("QYSFZDKQ"))
|
||
{
|
||
if (conf.AppSettings.Settings["QYSFZDKQ"].Value != "1")
|
||
{
|
||
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
||
return;
|
||
}
|
||
|
||
var group = conf.SectionGroups["object"];
|
||
if (group == null)
|
||
{
|
||
//group = new ConfigurationSectionGroup();
|
||
//conf.SectionGroups.Add("object", group);
|
||
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
||
return;
|
||
}
|
||
|
||
|
||
// ConfigurationSection section = new ConfigurationSection();
|
||
// group.Sections.Add("IDCard",)
|
||
|
||
|
||
MyAssemblySection section = group.Sections["ass"] as MyAssemblySection;
|
||
MyAssemblyElement myelement = null;
|
||
foreach (MyAssemblyElement element in section.MyAssemblyElements)
|
||
{
|
||
if (element.name == "IDCard")
|
||
{
|
||
myelement = element;
|
||
break;
|
||
}
|
||
}
|
||
if (myelement == null)
|
||
{
|
||
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
||
return;
|
||
}
|
||
var ass = Assembly.Load(myelement.assembly);
|
||
SOH.Interface.IIDCardRead idcard = ass.CreateInstance(myelement.type) as SOH.Interface.IIDCardRead;
|
||
int result = idcard.init();
|
||
if (result != 0)
|
||
{
|
||
MessageBox.Show("初始化读卡器失败!");
|
||
return;
|
||
|
||
}
|
||
result = idcard.read();
|
||
if (result != 0)
|
||
{
|
||
MessageBox.Show("读卡失败!");
|
||
return;
|
||
|
||
}
|
||
tbSFZH.Text = idcard.sfzh;
|
||
//idcard.
|
||
cxhy();
|
||
string xm = idcard.xm;
|
||
tbXM.Text = xm;
|
||
if (tbTXDZ.Text == "")
|
||
tbTXDZ.Text = idcard.dz;
|
||
idcard.exit();
|
||
|
||
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region TAB2-团体体检持卡登记
|
||
private void tbTM2_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode == Keys.Enter)
|
||
{
|
||
string tmstr = this.tbTM2.Text.Trim();
|
||
if (string.IsNullOrEmpty(tmstr) || tmstr.Length != 10)
|
||
{
|
||
MessageBox.Show("请输入正确格式的条码号");
|
||
Clear2();
|
||
this.tbTM2.Select();
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
int tm = 0;
|
||
if (Int32.TryParse(tmstr, out tm))
|
||
{
|
||
labpd.Visible = false;
|
||
labpd.Text = "";
|
||
TJSearch(tm, fddm);
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("请输入正确格式的条码");
|
||
Clear2();
|
||
return;
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据条码号查询
|
||
/// </summary>
|
||
private void TJSearch(int tm, short fdm)
|
||
{
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
string json = vs.GetTTDJInfo(tm);
|
||
if (string.IsNullOrEmpty(json))
|
||
{
|
||
//this.lbError.Text = "未能找到对应的信息";
|
||
//this.lbError.Visible = true;
|
||
MessageBox.Show("未能找到对应的信息");
|
||
Clear2();
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
DataTable dt = new DataTable();
|
||
try
|
||
{
|
||
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(json);
|
||
if (dt.Rows.Count == 0)
|
||
{
|
||
MessageBox.Show("未能找到对应的信息");
|
||
Clear2();
|
||
return;
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MessageBox.Show("获取信息出错" + ex.Message);
|
||
Clear2();
|
||
return;
|
||
}
|
||
//进行判断
|
||
string fdstr = dt.Rows[0]["fddm"].ToString(); //合同所在分店
|
||
string htzt = dt.Rows[0]["htzt"].ToString(); //体检合同状态
|
||
string tmztz = dt.Rows[0]["tmztz"].ToString(); //体检条码状态
|
||
string tjlb = dt.Rows[0]["tjlb"].ToString();
|
||
if (tjlb == "1")
|
||
{
|
||
this.checkBox1.Checked = true;
|
||
}
|
||
else
|
||
{
|
||
this.checkBox1.Checked = false;
|
||
}
|
||
if (fdstr != fddm.ToString())
|
||
{
|
||
MessageBox.Show("此客人的信息不属于本分店");
|
||
Clear2();
|
||
return;
|
||
}
|
||
if (htzt == "1") //htzt=1是正常的合同
|
||
{
|
||
//过
|
||
}
|
||
else if (htzt == "0")
|
||
{
|
||
MessageBox.Show("对应单位的合同还未生效");
|
||
Clear2();
|
||
return;
|
||
}
|
||
else if (htzt == "2")
|
||
{
|
||
MessageBox.Show("对应单位的合同已经失效");
|
||
Clear2();
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("对应单位的合同不明确");
|
||
Clear2();
|
||
return;
|
||
}
|
||
//看当前人的体检状态 tmztz
|
||
if (tmztz == "0")
|
||
{
|
||
//等于0的 为可以进行登记的
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("该客人已经进行体检,不能登记");
|
||
Clear2();
|
||
return;
|
||
}
|
||
|
||
//看体检合同是公费还是自费
|
||
string gzfbj = dt.Rows[0]["gzfbj"].ToString();
|
||
if (gzfbj == "1") //自费不能在此登记
|
||
{
|
||
MessageBox.Show("团检自费合同不能在此登记,请到团检现场登记");
|
||
Clear2();
|
||
return;
|
||
}
|
||
|
||
/*string lxdh = dt.Rows[0]["lxdh"].ToString();
|
||
if (lxdh == "") //电话为空不能登记
|
||
{
|
||
MessageBox.Show("联系电话不能为空,请录入联系电话并补打导检单!");
|
||
Clear2();
|
||
return;
|
||
}
|
||
|
||
if (lxdh.Length < 5)
|
||
{
|
||
MessageBox.Show("联系电话格式不正确,请录入联系电话并补打导检单!");
|
||
Clear2();
|
||
return;
|
||
}*/
|
||
//如果符合登记条件,显示相关信息
|
||
//this.tbTM2.Text = dt.Rows[0]["tm"].ToString(); //条码存储起来
|
||
this.tbDWMC2.Text = dt.Rows[0]["khmc"].ToString();
|
||
this.tbSSFZ2.Text = dt.Rows[0]["htfzmc"].ToString();
|
||
this.tbHyh2.Text = dt.Rows[0]["hyh"].ToString();
|
||
this.tbXM2.Text = dt.Rows[0]["xm"].ToString();
|
||
string xb = dt.Rows[0]["xb"] == null ? "" : dt.Rows[0]["xb"].ToString();
|
||
if (string.IsNullOrEmpty(xb) || xb == "2")
|
||
{
|
||
this.tbXB2.Text = "";
|
||
}
|
||
else
|
||
{
|
||
this.tbXB2.Text = (xb == "0" ? "男" : "女");
|
||
}
|
||
this.tbNL2.Text = dt.Rows[0]["nl"].ToString();
|
||
string hyzk = dt.Rows[0]["hyzk"] == null ? "" : dt.Rows[0]["hyzk"].ToString();
|
||
if (string.IsNullOrEmpty(hyzk) || hyzk == "2")
|
||
{
|
||
this.tbHYZK2.Text = "";
|
||
}
|
||
else
|
||
{
|
||
this.tbHYZK2.Text = (hyzk == "0" ? "未婚" : "已婚");
|
||
}
|
||
this.tb_TM2.Text = tm.ToString();
|
||
this.tbYGH2.Text = dt.Rows[0]["ygh"].ToString();
|
||
this.tbSSBM2.Text = dt.Rows[0]["bm"].ToString();
|
||
this.tbLXDH2.Text = dt.Rows[0]["lxdh"].ToString();
|
||
this.tbCSRQ2.Text = dt.Rows[0]["csrq"].ToString();
|
||
this.tbTXDZ2.Text = dt.Rows[0]["bz"].ToString();
|
||
this.tbSFZH2.Text = dt.Rows[0]["sfzh"].ToString();
|
||
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 未找到的时候清除信息框
|
||
/// </summary>
|
||
private void Clear2()
|
||
{
|
||
this.tb_TM2.Text = "";
|
||
this.tbDWMC2.Text = "";
|
||
this.tbSSFZ2.Text = "";
|
||
this.tbHyh2.Text = "";
|
||
this.tbXM2.Text = "";
|
||
this.tbXB2.Text = "";
|
||
this.tbNL2.Text = "";
|
||
this.tbHYZK2.Text = "";
|
||
this.tbYGH2.Text = "";
|
||
this.tbSSBM2.Text = "";
|
||
this.tbLXDH2.Text = "";
|
||
this.tbCSRQ2.Text = "";
|
||
this.tbTXDZ2.Text = "";
|
||
}
|
||
|
||
/// <summary>
|
||
/// 团检持卡登记
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void btnDJ2_Click(object sender, EventArgs e)
|
||
{
|
||
//找到tm
|
||
string tmstr = this.tb_TM2.Text;
|
||
string sfzh = this.tbSFZH2.Text.Trim();
|
||
string xmstr = this.tbXM2.Text.Trim();
|
||
int tjlb = 0;
|
||
string vip = "";
|
||
if (this.checkBox1.Checked == true)
|
||
{
|
||
tjlb = 1;
|
||
vip = "是";
|
||
}
|
||
else
|
||
{
|
||
tjlb = 2;
|
||
vip = "否";
|
||
}
|
||
if (string.IsNullOrEmpty(tmstr))
|
||
{
|
||
MessageBox.Show("请扫描条码获取信息后登记");
|
||
Clear2();
|
||
return;
|
||
}
|
||
int tm = int.Parse(tmstr.Trim());
|
||
//if (string.IsNullOrEmpty(sfzh) || sfzh.Length != 18)
|
||
//{
|
||
// MessageBox.Show("身份证号格式错误");
|
||
// this.tbSFZH2.Select();
|
||
// return;
|
||
//}
|
||
//if (string.IsNullOrEmpty(xmstr)||xmstr.Length<2)
|
||
//{
|
||
// MessageBox.Show("请输入姓名信息");
|
||
// this.tbSFZH2.Select();
|
||
// return;
|
||
//}
|
||
|
||
//1.更新t_ttgzb中的该tm对应的tmztz\djczy\tjrq\nl\tel\csrq\upflag=1\bz=''\fddm=2
|
||
t_ttgzb tg = new t_ttgzb();
|
||
tg.tm = tm;
|
||
tg.tjrq = DateTime.Now;
|
||
tg.xm = xmstr;
|
||
string nlstr = this.tbNL2.Text;
|
||
short nl = 0;
|
||
short.TryParse(nlstr, out nl);
|
||
tg.nl = nl;
|
||
tg.tel = this.tbLXDH2.Text;
|
||
string csrqstr = this.tbCSRQ2.Text;
|
||
DateTime csrq;
|
||
DateTime.TryParse(csrqstr, out csrq);
|
||
tg.csrq = csrq;
|
||
tg.upflag = 1;
|
||
tg.bz = this.tbTXDZ2.Text.Trim();
|
||
tg.fddm = fddm;
|
||
tg.tmztz = 2;
|
||
tg.djczy = LoginUser.username;
|
||
tg.sfzh = this.tbSFZH2.Text;
|
||
tg.khlx = tjlb;
|
||
tg.barcode = vip;
|
||
if (pic_zp1.Image == null)
|
||
{
|
||
tg.image = null;
|
||
}
|
||
else
|
||
{
|
||
System.IO.MemoryStream ms = new System.IO.MemoryStream();
|
||
pic_zp1.Image.Save(ms, ImageFormat.Jpeg);
|
||
tg.image = ms.ToArray();
|
||
}
|
||
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
|
||
//System.Configuration.Configuration cm = System.Configuration.ConfigurationManager.OpenExeConfiguration(AppDomain.CurrentDomain.BaseDirectory + "\\local.ext");
|
||
//string isOpen = cm.AppSettings.Settings["isOpenPaidui"].Value;
|
||
|
||
var FenDianService = ServiceContainer.GetService<IFenDian>();
|
||
FenDian fd = FenDianService.getFenDianById(Convert.ToInt32(LoginUser.yydm));
|
||
|
||
OperationResult or = vs.Tjdj_CK(tg, fd.isPaidui.ToString());
|
||
if (or.State == 1)
|
||
{
|
||
MessageBox.Show(or.Message);
|
||
this.tbTM2.Text = ""; //清空信息
|
||
pic_zp1.Image = Image.FromFile(System.Windows.Forms.Application.StartupPath + "\\pz.jpg");
|
||
Clear2();
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show(or.Message);
|
||
labpd.Visible = true;
|
||
labpd.Text = or.Message;
|
||
return;
|
||
}
|
||
}
|
||
|
||
//取消按钮
|
||
private void tab2_btnQX_Click(object sender, EventArgs e)
|
||
{
|
||
this.tbTM2.Text = "";
|
||
Clear2();
|
||
}
|
||
|
||
|
||
#endregion
|
||
|
||
#region TAB3-团体体检现场登记
|
||
|
||
private void Load_tab3()
|
||
{
|
||
this.gvTJDW.AutoGenerateColumns = false;
|
||
this.gv3_TJFZ.AutoGenerateColumns = false;
|
||
this.gvHYXX.AutoGenerateColumns = false;
|
||
tab3_op = "";
|
||
SetReadonly();
|
||
}
|
||
|
||
private void btMH3_Click(object sender, EventArgs e)
|
||
{
|
||
string tjdw = this.tb3_TJDW.Text.Trim();
|
||
GetTJDW(tjdw);
|
||
}
|
||
|
||
private void btnQB3_Click(object sender, EventArgs e)
|
||
{
|
||
this.tb3_TJDW.Text = "";
|
||
GetTJDW("");
|
||
}
|
||
|
||
/// <summary>
|
||
/// 根据团检单位的拼音码查询团检单位
|
||
/// </summary>
|
||
/// <param name="tjdw"></param>
|
||
private void GetTJDW(string tjdw)
|
||
{
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
List<dto_tjxx> ldt = vs.GetTJXX(fddm, tjdw);
|
||
this.gvTJDW.DataSource = ldt;
|
||
}
|
||
|
||
//团体体检单位表格行选中
|
||
private void gvTJDW_SelectionChanged(object sender, EventArgs e)
|
||
{
|
||
if (this.gvTJDW.SelectedRows.Count > 0)
|
||
{
|
||
Clear_FZXX();
|
||
ttlist = null;
|
||
this.tbXM_S.Text = "";
|
||
this.gv3_TJFZ.DataSource = null;
|
||
this.gvHYXX.DataSource = null;
|
||
|
||
int rowindex = this.gvTJDW.SelectedRows[0].Index;
|
||
dto_tjxx dtj = this.gvTJDW.Rows[rowindex].DataBoundItem as dto_tjxx;
|
||
//string htbmstr = this.gvTJDW.Rows[rowindex].Cells["HTBM3"].Value == null ? "" : this.gvTJDW.Rows[rowindex].Cells["HTBM3"].Value.ToString();
|
||
//int htbm = 0;
|
||
//Int32.TryParse(htbmstr, out htbm);
|
||
List<t_htfzb> lth = GetHtfzByHtbm(dtj.htbm);
|
||
this.gv3_TJFZ.DataSource = lth;
|
||
|
||
}
|
||
}
|
||
|
||
//清空分组信息group,改变实收价格
|
||
private void Clear_FZXX()
|
||
{
|
||
SetReadonly();
|
||
this.tb3_JFFS.Text = "";
|
||
this.tb3_JXFS.Text = "";
|
||
this.tb3_SYXB.Text = "";
|
||
this.tb3_HYZK.Text = "";
|
||
this.tb3_SSJG.Text = "0";
|
||
//新建修改的操作方式改为空
|
||
tab3_op = "";
|
||
ttlist = null;
|
||
}
|
||
|
||
//根据合同编码获取合同分组信息
|
||
private List<t_htfzb> GetHtfzByHtbm(int htbm)
|
||
{
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
List<t_htfzb> lth = vs.GetHtfz(htbm, 1); //htzt=1 表示合同处于正常的体检状态
|
||
return lth;
|
||
}
|
||
|
||
|
||
//体检分组表格选中事件
|
||
private void gv3_TJFZ_SelectionChanged(object sender, EventArgs e)
|
||
{
|
||
if (this.gv3_TJFZ.SelectedRows.Count > 0)
|
||
{
|
||
Clear_FZXX();
|
||
ttlist = null;
|
||
this.tbXM_S.Text = "";
|
||
this.gvHYXX.DataSource = null;
|
||
|
||
int rowindex = this.gv3_TJFZ.SelectedRows[0].Index;
|
||
t_htfzb thf = this.gv3_TJFZ.Rows[rowindex].DataBoundItem as t_htfzb;
|
||
int htfzbm = thf.htfzbm;
|
||
//string htfzbmstr = this.gv3_TJFZ.Rows[rowindex].Cells["htfzbm3"].Value.ToString();
|
||
//int htfzbm = 0;
|
||
//Int32.TryParse(htfzbmstr, out htfzbm);
|
||
|
||
//窗体中分组信息中的 交费方式 加项方式 适用性别 婚姻状况
|
||
List<t_htfzb> lth = this.gv3_TJFZ.DataSource as List<t_htfzb>;
|
||
if (lth == null || lth.Count == 0)
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
t_htfzb th = lth.Where(t => t.htfzbm == htfzbm).FirstOrDefault();
|
||
if (th == null)
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
this.tb3_JFFS.Text = th.gzfbj == 1 ? "自费" : "公费";
|
||
this.tb3_JXFS.Text = th.jxgzfbj == 1 ? "自费" : "公费";
|
||
this.tb3_SYXB.Text = th.xb == 1 ? "女" : "男";
|
||
string hy = "不限";
|
||
if (th.hyzk == 0)
|
||
{
|
||
hy = "未婚";
|
||
}
|
||
else if (th.hyzk == 1)
|
||
{
|
||
hy = "已婚";
|
||
}
|
||
else
|
||
{
|
||
hy = "不限";
|
||
}
|
||
this.tb3_HYZK.Text = hy;
|
||
//实收价格
|
||
int temp = th.fzjg / 100;
|
||
//价格有折率影响
|
||
//th.fzzl
|
||
//实收价格=分组价格 *分组折率
|
||
//int ssjg = (int)((th.fzjg * th.fzzl) / 10000);
|
||
int ssjg = th.ssjg;
|
||
this.tb3_SSJG.Text = ssjg.ToString();
|
||
}
|
||
}
|
||
|
||
//根据合同分组编码查找该分组下符合条件的会员
|
||
List<t_ttgzb> ltt = new List<t_ttgzb>();
|
||
var vs = ServiceContainer.GetService<It_ttgzb>();
|
||
ltt = vs.GetTtgzbsByHtfzbm(htfzbm, 0);
|
||
ttlist = ltt; //团检会员信息存储
|
||
//this.gvHYXX.DataSource = null;
|
||
this.gvHYXX.DataSource = ltt;
|
||
}
|
||
}
|
||
|
||
//会员信息模糊查询
|
||
private void btn3_MH2_Click(object sender, EventArgs e)
|
||
{
|
||
//获取会员grid的数据源
|
||
if (this.gvHYXX.DataSource == null)
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//List<t_ttgzb> ltt =this.gvHYXX.DataSource as List<t_ttgzb>;
|
||
if (ttlist == null || ttlist.Count == 0)
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
string sword = this.tbXM_S.Text.Trim().ToUpper();
|
||
var datalist = ttlist.Where(t => t.xm.Contains(sword) || t.zjm.Contains(sword));
|
||
if (datalist.Any())
|
||
{
|
||
this.gvHYXX.DataSource = null;
|
||
this.gvHYXX.DataSource = datalist.ToList();
|
||
}
|
||
else
|
||
{
|
||
List<t_ttgzb> ltsearch = datalist.ToList();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
//会员信息表格单元格单击事件,右侧展示相应的信息
|
||
private void gvHYXX_SelectionChanged(object sender, EventArgs e)
|
||
{
|
||
SetHyInfo();
|
||
}
|
||
//string tb3_tmh = "";
|
||
//根据会员信息表格中的选中行,对右侧相关控件赋值
|
||
private void SetHyInfo()
|
||
{
|
||
if (this.gvHYXX.SelectedRows.Count > 0)
|
||
{
|
||
int rowindex = this.gvHYXX.SelectedRows[0].Index;
|
||
DataGridViewRow dgvr = this.gvHYXX.Rows[rowindex];
|
||
t_ttgzb temp = dgvr.DataBoundItem as t_ttgzb;
|
||
//获取会员号、身份证号、出生日期、姓名、性别
|
||
//年龄、婚否、员工号、部门、电话、通讯地址
|
||
string hyh = temp.hyh.ToString(); //dgvr.Cells["hyh3"].Value == null ? "" : dgvr.Cells["hyh3"].Value.ToString();
|
||
string sfzh = temp.sfzh == null ? "" : temp.sfzh.ToString(); //dgvr.Cells["sfzh3"].Value == null ? "" : dgvr.Cells["sfzh3"].Value.ToString();
|
||
//string csrq = dgvr.Cells["csrq3"].Value == null ? "" : dgvr.Cells["csrq3"].Value.ToString();
|
||
string csrq = temp.csrq == null ? "" : temp.csrq.ToString("yyyy-MM-dd");
|
||
string xm = temp.xm == null ? "" : temp.xm.ToString(); //dgvr.Cells["xm3"].Value == null ? "" : dgvr.Cells["xm3"].Value.ToString();
|
||
int xb = temp.xb;
|
||
//string xbstr =dgvr.Cells["xb3"].Value == null ? "" : dgvr.Cells["xb3"].Value.ToString();
|
||
//int xbtemp = temp.xb;
|
||
//if (Int32.TryParse(xbstr, out xbtemp))
|
||
//{
|
||
// xb = xbtemp;
|
||
//}
|
||
string nl = temp.nl.ToString(); //dgvr.Cells["nl3"].Value == null ? "" : dgvr.Cells["nl3"].Value.ToString();
|
||
int hyzk = temp.hyzk;
|
||
//string hf = temp.hyzk.ToString();
|
||
//int hyzk = -1;
|
||
//int hytemp = 0;
|
||
//if (Int32.TryParse(hf, out hytemp))
|
||
//{
|
||
// hyzk = hytemp;
|
||
//}
|
||
string ygh = temp.ygh == null ? "" : temp.ygh; //dgvr.Cells["ygh3"].Value == null ? "" : dgvr.Cells["ygh3"].Value.ToString();
|
||
string bm = temp.ssbm == null ? "" : temp.ssbm.ToString(); //dgvr.Cells["bm3"].Value == null ? "" : dgvr.Cells["bm3"].Value.ToString();
|
||
string dh = temp.tel == null ? "" : temp.tel.ToString(); //dgvr.Cells["dh3"].Value == null ? "" : dgvr.Cells["dh3"].Value.ToString();
|
||
string txdz = temp.bz == null ? "" : temp.bz.ToString(); //dgvr.Cells["txdz3"].Value == null ? "" : dgvr.Cells["txdz3"].Value.ToString();
|
||
//tb3_tmh = temp.tm.ToString(); //dgvr.Cells["tm3"].Value.ToString();
|
||
this.tb3_HYH.Text = hyh;
|
||
this.tb3_SFZH.Text = sfzh;
|
||
this.tb3_CSRQ.Text = csrq;
|
||
this.tb3_XM.Text = xm;
|
||
this.cb3_XB.SelectedIndex = xb;
|
||
this.tb3_NL.Text = nl;
|
||
this.cb3_HYZK.SelectedIndex = hyzk;
|
||
this.tb3_YGH.Text = ygh;
|
||
this.tb3_BM.Text = bm;
|
||
this.tb3_DH.Text = dh;
|
||
this.tb3_TXDZ.Text = txdz;
|
||
}
|
||
}
|
||
|
||
//设置
|
||
private void SetReadonly()
|
||
{
|
||
this.tb3_HYH.ReadOnly = true;
|
||
this.tb3_SFZH.ReadOnly = true;
|
||
this.tb3_CSRQ.ReadOnly = true;
|
||
this.tb3_XM.ReadOnly = true;
|
||
//this.cb3_XB.Enabled = false;
|
||
//this.tb3_NL.ReadOnly = true;
|
||
//this.cb3_HYZK.Enabled = false;
|
||
this.tb3_YGH.ReadOnly = true;
|
||
this.tb3_BM.ReadOnly = true;
|
||
this.tb3_DH.ReadOnly = true;
|
||
this.tb3_TXDZ.ReadOnly = true;
|
||
}
|
||
|
||
|
||
//取消
|
||
private void tb3_btnQX_Click(object sender, EventArgs e)
|
||
{
|
||
tab3_Clear();
|
||
}
|
||
|
||
//登记
|
||
private void tb3_btnDJ_Click(object sender, EventArgs e)
|
||
{
|
||
string hyhstr = this.tb3_HYH.Text.Trim(); //会员号
|
||
//判断是否可登记
|
||
if (this.gvHYXX.SelectedRows.Count <= 0 || string.IsNullOrEmpty(hyhstr))
|
||
{
|
||
MessageBox.Show("请选择人员信息后登记");
|
||
return;
|
||
}
|
||
|
||
//根据选中的项获取条码号
|
||
int rindex = this.gvHYXX.SelectedRows[0].Index;
|
||
t_ttgzb tg = this.gvHYXX.Rows[rindex].DataBoundItem as t_ttgzb;
|
||
int tm = tg.tm;
|
||
int hyh = tg.hyh;
|
||
|
||
//1.根据tm获取团检的htzt
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
short htzt = vs.GetHtztByTm(tm);
|
||
if (htzt != 1) //1为生效
|
||
{
|
||
MessageBox.Show("该人员所在合同处于未生效或结束状态");
|
||
return;
|
||
}
|
||
//2.根据tm 查看tmztz
|
||
var vst = ServiceContainer.GetService<It_ttgzb>();
|
||
short tmztz = vst.GetTmztzByTm(tm);
|
||
if (tmztz != 0)
|
||
{
|
||
MessageBox.Show("该人员已经登记");
|
||
return;
|
||
}
|
||
|
||
//获取合同编码和合同分组编码
|
||
int htfzbm = 0;
|
||
int htbm = 0;
|
||
if (this.gv3_TJFZ.SelectedRows.Count > 0)
|
||
{
|
||
int rowindex = this.gv3_TJFZ.SelectedRows[0].Index;
|
||
t_htfzb thf = this.gv3_TJFZ.Rows[rowindex].DataBoundItem as t_htfzb;
|
||
htfzbm = thf.htfzbm;
|
||
htbm = thf.htbm;
|
||
}
|
||
|
||
//拼接出所需的信息
|
||
string fybzstr = this.tb3_JFFS.Text.Trim();
|
||
short fybz = 1;
|
||
if (fybzstr == "公费")
|
||
{
|
||
fybz = 0; //0公费 1自费
|
||
}
|
||
//根据收费的类型标志进行不同类型的登记
|
||
t_ttgzb tgnew = new t_ttgzb();
|
||
tg.tm = tm;
|
||
tg.hyh = hyh;
|
||
tg.htbm = htbm;
|
||
tg.htfzbm = htfzbm;
|
||
tg.xm = this.tb3_XM.Text.Trim();
|
||
tg.xb = (short)this.cb3_XB.SelectedIndex;
|
||
int nl = 0;
|
||
string nlstr = this.tb3_NL.Text.Trim();
|
||
Int32.TryParse(nlstr, out nl);
|
||
tg.hyzk = (short)this.cb3_HYZK.SelectedIndex;
|
||
string zjestr = this.tb3_SSJG.Text;
|
||
int zje = 0;
|
||
Int32.TryParse(zjestr, out zje);
|
||
tg.ssbm = this.tb3_BM.Text.Trim();
|
||
tg.ygh = this.tb3_YGH.Text.Trim();
|
||
tg.djczy = LoginUser.username;
|
||
tg.zjm = this.tb3_XM.Text.Trim().ToPinYin();
|
||
tg.sfzh = this.tb3_SFZH.Text.Trim();
|
||
tg.tel = this.tb3_DH.Text.Trim();
|
||
tg.tjrq = DateTime.Now;
|
||
//MemoryStream ms = new MemoryStream();
|
||
//pic_pz2.Image.Save(ms, ImageFormat.Jpeg);
|
||
//tg.image = ms.ToArray();
|
||
DateTime dtcsrq;
|
||
string csrqstr = this.tb3_CSRQ.Text.Trim();
|
||
DateTime.TryParse(csrqstr, out dtcsrq);
|
||
tg.csrq = dtcsrq;
|
||
|
||
//System.Configuration.Configuration cm = System.Configuration.ConfigurationManager.OpenExeConfiguration(AppDomain.CurrentDomain.BaseDirectory + "\\local.ext");
|
||
//string isOpen = cm.AppSettings.Settings["isOpenPaidui"].Value;
|
||
|
||
var FenDianService = ServiceContainer.GetService<IFenDian>();
|
||
FenDian fd = FenDianService.getFenDianById(Convert.ToInt32(LoginUser.yydm));
|
||
|
||
OperationResult or = new OperationResult();
|
||
or = vs.Tjdj_XC(tg, fybz, fd.isPaidui.ToString());
|
||
if (or.State == 1)
|
||
{
|
||
//移除已经登记的人的信息
|
||
//ttlist.Remove()
|
||
int ri = this.gvHYXX.SelectedRows[0].Index;
|
||
t_ttgzb tgk = this.gvHYXX.Rows[ri].DataBoundItem as t_ttgzb;
|
||
ttlist.Remove(tgk);
|
||
this.gvHYXX.DataSource = null;
|
||
if (ttlist != null && ttlist.Count > 0)
|
||
{
|
||
this.gvHYXX.DataSource = ttlist;
|
||
}
|
||
pic_pz2.Image = Image.FromFile(System.Windows.Forms.Application.StartupPath + "\\pz.jpg");
|
||
MessageBox.Show(or.Message);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("登记失败:" + or.Message);
|
||
return;
|
||
}
|
||
|
||
}
|
||
|
||
//清空所有文本框,所有datagridview的datasource设置为null
|
||
private void tab3_Clear()
|
||
{
|
||
this.tb3_TJDW.Text = "";
|
||
this.gvTJDW.DataSource = null;
|
||
this.gv3_TJFZ.DataSource = null;
|
||
this.gvHYXX.DataSource = null;
|
||
this.tbXM_S.Text = "";
|
||
this.tb3_JFFS.Text = "";
|
||
this.tb3_JXFS.Text = "";
|
||
this.tb3_SYXB.Text = "";
|
||
this.tb3_HYZK.Text = "";
|
||
|
||
this.tb3_HYH.Text = "";
|
||
this.tb3_SFZH.Text = "";
|
||
this.tb3_CSRQ.Text = "";
|
||
this.tb3_XM.Text = "";
|
||
this.cb3_XB.SelectedIndex = -1;
|
||
this.tb3_NL.Text = "";
|
||
this.cb3_HYZK.Text = "";
|
||
this.tb3_YGH.Text = "";
|
||
this.tb3_BM.Text = "";
|
||
this.tb3_DH.Text = "";
|
||
this.tb3_SSJG.Text = "";
|
||
this.tb3_TXDZ.Text = "";
|
||
ttlist = null; //人员清空
|
||
tab3_op = ""; //操作方式清空
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 新建人员
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void tab3_xj_Click(object sender, EventArgs e)
|
||
{
|
||
//先判断是否有分组
|
||
int sr = this.gv3_TJFZ.SelectedRows.Count;
|
||
if (sr <= 0)
|
||
{
|
||
MessageBox.Show("未能找到对应的体检分组信息");
|
||
return;
|
||
}
|
||
tab3_SetControlState();
|
||
tab3_op = "xj";
|
||
|
||
this.tb3_HYH.Text = "";
|
||
this.tb3_SFZH.Text = "";
|
||
this.tb3_CSRQ.Text = "";
|
||
this.tb3_XM.Text = "";
|
||
//this.tb3_NL.Text = "";
|
||
this.tb3_YGH.Text = "";
|
||
this.tb3_BM.Text = "";
|
||
this.tb3_DH.Text = "";
|
||
this.tb3_TXDZ.Text = "";
|
||
}
|
||
|
||
/// <summary>
|
||
/// 修改人员信息
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void tab3_xg_Click(object sender, EventArgs e)
|
||
{
|
||
if (tab3_op == "xj")
|
||
{
|
||
MessageBox.Show("正在新建信息,请取消后操作");
|
||
return;
|
||
}
|
||
else if (tab3_op == "xg")
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//是否选中了相关的人员
|
||
int sr = this.gvHYXX.SelectedRows.Count;
|
||
if (sr <= 0)
|
||
{
|
||
MessageBox.Show("请选择相应的人员后进行修改");
|
||
return;
|
||
}
|
||
tab3_SetControlState();
|
||
tab3_op = "xg";
|
||
}
|
||
|
||
}
|
||
|
||
//新建或者修改的时候改变控件状态
|
||
private void tab3_SetControlState()
|
||
{
|
||
this.tb3_SFZH.ReadOnly = false;
|
||
this.tb3_XM.ReadOnly = false;
|
||
this.cb3_XB.Enabled = true; //性别和婚姻状况可以根据情况选择
|
||
this.cb3_HYZK.Enabled = true;
|
||
this.tb3_YGH.ReadOnly = false;
|
||
this.tb3_BM.ReadOnly = false;
|
||
this.tb3_DH.ReadOnly = false;
|
||
this.tb3_TXDZ.ReadOnly = false;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 保存新建或者修改操作
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void tab3_bc_Click(object sender, EventArgs e)
|
||
{
|
||
short xbinfo = 0; //性别
|
||
short hyzkinfo = 0; //婚姻状况
|
||
int htbm = 0;
|
||
int htfzbm = 0;
|
||
int tjlb = 0;
|
||
//从gv3_TJFZ这个grid获取分组的性别和婚姻状况限制
|
||
if (this.gv3_TJFZ.SelectedRows.Count > 0)
|
||
{
|
||
// this.gv3_TJFZ.SelectedRows[0]
|
||
int rindex = this.gv3_TJFZ.SelectedRows[0].Index;
|
||
t_htfzb tz = this.gv3_TJFZ.Rows[rindex].DataBoundItem as t_htfzb; //取出该行数据
|
||
xbinfo = tz.xb;
|
||
hyzkinfo = tz.hyzk;
|
||
htbm = tz.htbm;
|
||
htfzbm = tz.htfzbm;
|
||
tjlb = tz.tjlb == 0 ? 2 : 1;
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("请先选择体检分组后新建对应分组的人员");
|
||
return;
|
||
}
|
||
|
||
//获取录入的信息
|
||
string sfzh = this.tb3_SFZH.Text.Trim();
|
||
string xm = this.tb3_XM.Text.Trim();
|
||
int xb = this.cb3_XB.SelectedIndex;
|
||
int hyzk = this.cb3_HYZK.SelectedIndex;
|
||
if (string.IsNullOrEmpty(xm))
|
||
{
|
||
MessageBox.Show("请输入姓名");
|
||
return;
|
||
}
|
||
if (xb == -1)
|
||
{
|
||
MessageBox.Show("请选择性别");
|
||
return;
|
||
}
|
||
if (hyzk == -1)
|
||
{
|
||
MessageBox.Show("请选择婚姻状况");
|
||
return;
|
||
}
|
||
//判断性别 和 婚姻状况是否相符
|
||
bool ifxb = xbinfo == 2 ? true : (xbinfo == xb);
|
||
bool ifhyzk = hyzkinfo == 2 ? true : (hyzkinfo == hyzk);
|
||
if (!ifxb)
|
||
{
|
||
MessageBox.Show("人员性别与分组适用性别不符");
|
||
return;
|
||
}
|
||
if (!ifhyzk)
|
||
{
|
||
MessageBox.Show("人员婚姻状况与分组适用婚姻状况不符");
|
||
return;
|
||
}
|
||
string ygh = this.tb3_YGH.Text.Trim();
|
||
string bm = this.tb3_BM.Text.Trim();
|
||
string dh = this.tb3_DH.Text.Trim();
|
||
string txdz = this.tb3_TXDZ.Text.Trim();
|
||
if (string.IsNullOrEmpty(sfzh))
|
||
{
|
||
MessageBox.Show("身份证号格式不正确");
|
||
this.tb3_SFZH.Select();
|
||
return;
|
||
}
|
||
//根据身份证号计算出生日期和年龄
|
||
int nl = Common.PubFunc.GetNlBySfz(sfzh);
|
||
string csrq = Common.PubFunc.GetCsrqBySfz(sfzh);
|
||
if (string.IsNullOrEmpty(csrq) || nl == 0)
|
||
{
|
||
MessageBox.Show("请输入正确的身份证号");
|
||
this.tb3_SFZH.Select();
|
||
return;
|
||
}
|
||
string ssjestr = this.tb3_SSJG.Text.Trim();
|
||
//int tjzje = Int32.Parse(ssjestr) * 100;
|
||
int tjzje = Int32.Parse(ssjestr);
|
||
t_ttgzb tg = new t_ttgzb();
|
||
tg.htbm = htbm;
|
||
tg.htfzbm = htfzbm;
|
||
tg.xm = xm;
|
||
tg.zjm = xm.ToPinYin();
|
||
tg.xb = (short)xb;
|
||
tg.nl = (short)nl;
|
||
tg.hyzk = (short)hyzk;
|
||
tg.lrczy = LoginUser.username;
|
||
tg.ygh = ygh;
|
||
tg.ssbm = bm;
|
||
tg.tel = dh;
|
||
tg.bz = txdz;
|
||
tg.sfzh = sfzh;
|
||
tg.csrq = DateTime.Parse(csrq);
|
||
tg.tjzje = tjzje;
|
||
tg.khlx = tjlb;
|
||
if (tb3_HYH.Text != "")
|
||
{
|
||
tg.hyh = int.Parse(tb3_HYH.Text);
|
||
}
|
||
else
|
||
{
|
||
tg.hyh = 0;
|
||
}
|
||
MemoryStream ms = new MemoryStream();
|
||
pic_pz2.Image.Save(ms, ImageFormat.Jpeg);
|
||
tg.image = ms.ToArray();
|
||
tg.fddm = short.Parse(LoginUser.yydm);
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
if (tab3_op == "xj") //新建情况下
|
||
{
|
||
OperationResult or = vs.InsertTtgzb(tg);
|
||
if (or.State == 0)
|
||
{
|
||
MessageBox.Show("添加失败," + or.Message);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//清空相关信息
|
||
SetReadonly();
|
||
//gvHYXX增加一行
|
||
if (ttlist == null)
|
||
{
|
||
ttlist = new List<t_ttgzb>();
|
||
}
|
||
tg.hyh = int.Parse(or.Tag.Split('|')[0]);
|
||
tg.tm = int.Parse(or.Tag.Split('|')[1]);
|
||
ttlist.Add(tg);
|
||
this.gvHYXX.DataSource = null;
|
||
this.gvHYXX.DataSource = ttlist;
|
||
MessageBox.Show("添加成功");
|
||
return;
|
||
}
|
||
}
|
||
else if (tab3_op == "xg") //修改情况下
|
||
{
|
||
//修改根据 tm进行修改,hyh有可能重复
|
||
t_ttgzb tgz = this.gvHYXX.Rows[this.gvHYXX.SelectedRows[0].Index].DataBoundItem as t_ttgzb;
|
||
tg.tm = tgz.tm;
|
||
tg.hyh = tgz.hyh;
|
||
tg.tel = dh;
|
||
tg.image = ms.ToArray();
|
||
OperationResult or = vs.UpdateTtgzb(tg);
|
||
if (or.State == 0)
|
||
{
|
||
MessageBox.Show("修改失败," + or.Message);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//修改成功后,更新gvHYXX
|
||
ttlist.Remove(tgz);
|
||
ttlist.Add(tg);
|
||
this.gvHYXX.DataSource = null;
|
||
this.gvHYXX.DataSource = ttlist;
|
||
MessageBox.Show("人员信息修改成功");
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 取消新建或者修改操作
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void tab3_qx_Click(object sender, EventArgs e)
|
||
{
|
||
tab3_op = ""; //新建、修改的操作标识
|
||
this.tb3_HYH.Text = "";
|
||
this.tb3_SFZH.Text = "";
|
||
this.tb3_CSRQ.Text = "";
|
||
this.tb3_XM.Text = "";
|
||
this.cb3_XB.SelectedIndex = -1;
|
||
this.cb3_XB.Enabled = false;
|
||
this.cb3_HYZK.SelectedIndex = -1;
|
||
this.cb3_HYZK.Enabled = false;
|
||
this.tb3_NL.Text = "";
|
||
this.tb3_YGH.Text = "";
|
||
this.tb3_BM.Text = "";
|
||
this.tb3_DH.Text = "";
|
||
|
||
//将控件设置为readonly
|
||
SetReadonly();
|
||
|
||
//取消的时候,如果原来选中了人员,这里显示人员信息
|
||
if (this.gvHYXX.SelectedRows.Count > 0)
|
||
{
|
||
SetHyInfo();
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
}
|
||
|
||
//打印导引手册
|
||
private void btnPrintDY_Click(object sender, EventArgs e)
|
||
{
|
||
//MessageBox.Show("打印导引手册");
|
||
if (gvHYXX.SelectedRows.Count <= 0)
|
||
{
|
||
MessageBox.Show("请选择要打印的信息!");
|
||
return;
|
||
}
|
||
var ttgzb = gvHYXX.SelectedRows[0].DataBoundItem as t_ttgzb;
|
||
var f = new SOH.ShouFei.frmPrintDaoJianDan();
|
||
f.init(ttgzb.tm);
|
||
f.print();
|
||
f.Dispose();
|
||
|
||
return;
|
||
}
|
||
|
||
//身份证号控件的鼠标失去焦点事件
|
||
private void tb3_SFZH_Leave(object sender, EventArgs e)
|
||
{
|
||
jysfzh();
|
||
|
||
}
|
||
|
||
private void jysfzh()
|
||
{
|
||
string sfzh = this.tb3_SFZH.Text.Trim();
|
||
//验证身份证号的长度
|
||
//if (sfzh.Length != 18 && sfzh.Length != 15)
|
||
if (string.IsNullOrEmpty(sfzh))
|
||
{
|
||
//this.tbJKGW.Focus();
|
||
MessageBox.Show("身份证号长度不符");
|
||
//this.tb3_SFZH.Select();
|
||
return;
|
||
}
|
||
|
||
//根据身份证号获取此人是否已经有体检信息
|
||
var vsqt = ServiceContainer.GetService<IQianTai>();
|
||
OperationResult or = vsqt.IfExistTJBySFZH(sfzh, fddm);
|
||
if (or.State == 0)
|
||
{
|
||
MessageBox.Show(or.Message);
|
||
//this.tbSFZH.Select();
|
||
return;
|
||
}
|
||
|
||
//根据身份证号计算出生日期和年龄
|
||
int nl = Common.PubFunc.GetNlBySfz(sfzh);
|
||
string csrq = Common.PubFunc.GetCsrqBySfz(sfzh);
|
||
tb3_CSRQ.Text = csrq;
|
||
tb3_NL.Text = nl.ToString();
|
||
short xb_short = Common.PubFunc.GetSexShortBysfz(sfzh);
|
||
this.cb3_XB.SelectedIndex = xb_short;
|
||
if (string.IsNullOrEmpty(csrq) || nl == -1)
|
||
{
|
||
//this.tbJKGW.Focus();
|
||
MessageBox.Show("请输入正确的身份证号");
|
||
this.tb3_SFZH.Select();
|
||
this.tb3_SFZH.SelectAll();
|
||
return;
|
||
}
|
||
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
t_hyb thyb = vs.GetHyBySfzh(sfzh);
|
||
if (thyb != null)
|
||
{
|
||
tb3_HYH.Text = thyb.hyh.ToString();
|
||
tb3_XM.Text = thyb.xm.ToString();
|
||
tb3_TXDZ.Text = thyb.txdz;
|
||
}
|
||
}
|
||
|
||
//改变性别选项时进行判断
|
||
private void cb3_XB_SelectionChangeCommitted(object sender, EventArgs e)
|
||
{
|
||
string syxb = this.tb3_SYXB.Text;
|
||
if (syxb == "不限")
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
int temp = syxb == "男" ? 0 : 1;
|
||
int sindex = this.cb3_XB.SelectedIndex;
|
||
if (temp != sindex)
|
||
{
|
||
MessageBox.Show("所选性别与分组适用性别不符");
|
||
this.cb3_XB.SelectedIndex = temp;
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
//改变婚姻状况时进行判断
|
||
private void cb3_HYZK_SelectionChangeCommitted(object sender, EventArgs e)
|
||
{
|
||
string hyzk = this.tb3_HYZK.Text;
|
||
if (hyzk == "不限")
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
int temp = hyzk == "未婚" ? 0 : 1;
|
||
int sindex = this.cb3_HYZK.SelectedIndex;
|
||
if (temp != sindex)
|
||
{
|
||
MessageBox.Show("所选婚姻状况与分组适用婚姻状况不符");
|
||
this.cb3_HYZK.SelectedIndex = temp;
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
//全部人员
|
||
private void tab3_btnQB_Click(object sender, EventArgs e)
|
||
{
|
||
this.tbXM_S.Text = "";
|
||
this.gvHYXX.DataSource = null;
|
||
if (ttlist == null || ttlist.Count == 0)
|
||
{
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
this.gvHYXX.DataSource = ttlist;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region TAB4-团体体检登记取消
|
||
/// <summary>
|
||
/// 取消登记操作
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void btnQXDJ_Click(object sender, EventArgs e)
|
||
{
|
||
string tmstr = this.tbTM4_1.Text.Trim();
|
||
if (string.IsNullOrEmpty(tmstr))
|
||
{
|
||
MessageBox.Show("请先扫描条码查询出相应数据后再进行取消登记");
|
||
return;
|
||
}
|
||
int tm = 0;
|
||
if (!Int32.TryParse(tmstr, out tm))
|
||
{
|
||
MessageBox.Show("条码格式错误");
|
||
return;
|
||
}
|
||
//int tm = Int32.Parse(tmstr);
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
OperationResult or = vs.IfCanCancleDJ_TJ(tm);
|
||
if (or.State == 1)
|
||
{
|
||
OperationResult or1 = vs.CancleDJByTm(tm);
|
||
if (or1.State == 1)
|
||
{
|
||
MessageBox.Show(or1.Message);
|
||
Clear4();
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show(or1.Message);
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show(or.Message);
|
||
return;
|
||
}
|
||
|
||
}
|
||
|
||
//团检登记取消中的重置
|
||
private void button11_Click(object sender, EventArgs e)
|
||
{
|
||
Clear4();
|
||
}
|
||
|
||
private void Clear4()
|
||
{
|
||
this.tbTM4.Text = "";
|
||
this.tbXM4.Text = "";
|
||
this.tbXB4.Text = "";
|
||
this.tbNL4.Text = "";
|
||
this.tbHYZK4.Text = "";
|
||
this.tbTJDW4.Text = "";
|
||
this.tbYGH4.Text = "";
|
||
this.tbSSBM4.Text = "";
|
||
}
|
||
|
||
private void tbTM4_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode != Keys.Enter)
|
||
{
|
||
return;
|
||
}
|
||
string tmstr = this.tbTM4.Text.Trim();
|
||
if (string.IsNullOrEmpty(tmstr) || tmstr.Length != 10)
|
||
{
|
||
Clear4();
|
||
MessageBox.Show("条码号格式错误");
|
||
return;
|
||
}
|
||
int tm = 0;
|
||
Int32.TryParse(tmstr, out tm);
|
||
if (tm == 0)
|
||
{
|
||
Clear4();
|
||
MessageBox.Show("条码号格式错误");
|
||
return;
|
||
}
|
||
//根据tm获取登记信息
|
||
//select tmztz,hyh,xm,xb,nl,hyzk,ygh,ssbm,khmc from t_ttgzb,t_ht,t_kh
|
||
//where t_ttgzb.htbm=t_ht.htbm and t_ht.khbm=t_kh.khbm and tm=1020128559
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
dto_tjdjxx tdtj = vs.GetTjdjxx(tm);
|
||
if (tdtj == null)
|
||
{
|
||
Clear4();
|
||
MessageBox.Show("未能找到对应条码的登记信息");
|
||
return;
|
||
}
|
||
if (tdtj.tmztz == 1 || tdtj.tmztz == 2)
|
||
{
|
||
this.tbTM4_1.Text = tm.ToString();
|
||
this.tbXM4.Text = tdtj.xm;
|
||
this.tbXB4.Text = tdtj.xb == 0 ? "男" : (tdtj.xb == 1 ? "女" : "");
|
||
this.tbNL4.Text = tdtj.nl.ToString();
|
||
this.tbHYZK4.Text = tdtj.hyzk == 0 ? "未婚" : (tdtj.hyzk == 1 ? "已婚" : "");
|
||
this.tbTJDW4.Text = tdtj.khmc;
|
||
this.tbYGH4.Text = tdtj.ygh;
|
||
this.tbSSBM4.Text = tdtj.ssbm;
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("该人员当前状态不能取消登记");
|
||
return;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region TAB5-体检个人信息修改
|
||
private void btnCX5_Click(object sender, EventArgs e)
|
||
{
|
||
string tmstr = this.tab5_TM.Text.Trim();
|
||
if (string.IsNullOrEmpty(tmstr) || tmstr.Length != 10)
|
||
{
|
||
MessageBox.Show("条码格式不正确");
|
||
this.tab5_TM.Select();
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
int tm = 0;
|
||
if (!Int32.TryParse(tmstr, out tm))
|
||
{
|
||
MessageBox.Show("条码格式不正确");
|
||
this.tab5_TM.Select();
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//根据tm查询个人信息
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
dto_tjdjxx tdtj = vs.GetTjdjxxAll(tm);
|
||
if (tdtj == null)
|
||
{
|
||
Clear5();
|
||
MessageBox.Show("未能找到对应条码的个人信息");
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//控件赋值
|
||
this.tab5_TM_1.Text = tdtj.tm.ToString();
|
||
this.tab5_HYH.Text = tdtj.hyh.ToString();
|
||
this.tab5_LX.Text = tdtj.lx == 0 ? "个检" : "团检";
|
||
this.tab5_XM.Text = tdtj.xm;
|
||
this.tab5_XB.SelectedIndex = tdtj.xb;
|
||
this.tab5_NL.Text = tdtj.nl.ToString();
|
||
this.tab5_HYZK.SelectedIndex = tdtj.hyzk;
|
||
this.tab5_SFZH.Text = tdtj.sfzh;
|
||
this.tab5_CSRQ.Value = tdtj.csrq;
|
||
this.tab5_SSBM.Text = tdtj.ssbm;
|
||
this.tab5_YGH.Text = tdtj.ygh;
|
||
this.tab5_LXDH.Text = tdtj.tel;
|
||
this.tab5_TXDZ.Text = tdtj.txdz;
|
||
this.tab5_DXTJ.Checked = tdtj.dxtj == 1 ? true : false;
|
||
this.tab5_DXTJ.Enabled = tdtj.lx == 0 ? true : false;
|
||
try
|
||
{
|
||
MemoryStream ms = new MemoryStream(tdtj.image);
|
||
pic_zp3.Image = Image.FromStream(ms);
|
||
}
|
||
catch { }
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
//取消按钮
|
||
private void tab5_btnQX_Click(object sender, EventArgs e)
|
||
{
|
||
Clear5();
|
||
}
|
||
|
||
private void Clear5()
|
||
{
|
||
this.tab5_TM.Text = "";
|
||
this.tab5_TM_1.Text = "";
|
||
this.tab5_LX.Text = "";
|
||
this.tab5_XM.Text = "";
|
||
this.tab5_XB.SelectedIndex = -1;
|
||
this.tab5_HYZK.SelectedIndex = -1;
|
||
this.tab5_SFZH.Text = "";
|
||
this.tab5_NL.Text = "";
|
||
this.tab5_CSRQ.Text = "";
|
||
this.tab5_SSBM.Text = "";
|
||
this.tab5_LXDH.Text = "";
|
||
this.tab5_YGH.Text = "";
|
||
this.tab5_TXDZ.Text = "";
|
||
this.tab5_DXTJ.Checked = false;
|
||
this.tab5_DXTJ.Enabled = true;
|
||
}
|
||
|
||
private void tab5_btnQD_Click(object sender, EventArgs e)
|
||
{
|
||
string tmstr = this.tab5_TM_1.Text;
|
||
string lxstr = this.tab5_LX.Text;
|
||
string hyhstr = this.tab5_HYH.Text;
|
||
if (string.IsNullOrEmpty(tmstr) || string.IsNullOrEmpty(hyhstr) || string.IsNullOrEmpty(lxstr))
|
||
{
|
||
MessageBox.Show("请先查询出信息,修改后提交操作");
|
||
return;
|
||
}
|
||
int tm = 0;
|
||
int hyh = 0;
|
||
short lx = 0;
|
||
Int32.TryParse(tmstr, out tm);
|
||
Int32.TryParse(hyhstr, out hyh);
|
||
lx = (short)(lxstr == "个检" ? 0 : (lxstr == "团检" ? 1 : 2));
|
||
|
||
string xmstr = this.tab5_XM.Text.Trim();
|
||
if (string.IsNullOrEmpty(xmstr) || xmstr.Length < 2)
|
||
{
|
||
MessageBox.Show("请输入正确格式的姓名");
|
||
return;
|
||
}
|
||
short xb = (short)this.tab5_XB.SelectedIndex;
|
||
short hyzk = (short)this.tab5_HYZK.SelectedIndex;
|
||
int nl = 0;
|
||
string nlstr = this.tab5_NL.Text.Trim();
|
||
if (string.IsNullOrEmpty(nlstr) || !Int32.TryParse(nlstr, out nl))
|
||
{
|
||
MessageBox.Show("请输入正确格式的年龄");
|
||
return;
|
||
}
|
||
string sfzh = this.tab5_SFZH.Text.Trim();
|
||
if (string.IsNullOrEmpty(sfzh))
|
||
{
|
||
MessageBox.Show("身份证号格式错误");
|
||
return;
|
||
}
|
||
DateTime csrq = tab5_CSRQ.Value;
|
||
string ssbm = this.tab5_SSBM.Text.Trim();
|
||
string ygh = this.tab5_YGH.Text.Trim();
|
||
string tel = this.tab5_LXDH.Text.Trim();
|
||
string dz = this.tab5_TXDZ.Text.Trim();
|
||
short dxtj = (short)(this.tab5_DXTJ.Enabled == false ? 0 : (this.tab5_DXTJ.Checked ? 1 : 0));
|
||
dto_tjdjxx dt = new dto_tjdjxx();
|
||
dt.tm = tm;
|
||
dt.hyh = hyh;
|
||
dt.lx = lx;
|
||
dt.xm = xmstr;
|
||
dt.xb = xb;
|
||
dt.nl = nl;
|
||
dt.hyzk = hyzk;
|
||
dt.sfzh = sfzh;
|
||
dt.csrq = csrq;
|
||
dt.ssbm = ssbm;
|
||
dt.ygh = ygh;
|
||
dt.tel = tel;
|
||
dt.txdz = dz;
|
||
dt.dxtj = dxtj;
|
||
System.IO.MemoryStream ms = new MemoryStream();
|
||
pic_zp3.Image.Save(ms, ImageFormat.Jpeg);
|
||
dt.image = ms.ToArray();
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
OperationResult or = vs.UpdateGzbInfo(dt);
|
||
if (or.State == 1)
|
||
{
|
||
MessageBox.Show(or.Message);
|
||
pic_zp3.Image = Image.FromFile(System.Windows.Forms.Application.StartupPath + "\\pz.jpg");
|
||
Clear5();
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show(or.Message);
|
||
return;
|
||
}
|
||
}
|
||
|
||
|
||
#endregion
|
||
|
||
#region TAB6-体检手册回收确认
|
||
|
||
DataTable dt_xb = new DataTable();
|
||
DataTable dt_hy = new DataTable();
|
||
void iniths()
|
||
{
|
||
#region 绑定性别
|
||
|
||
dt_xb.Columns.Add("xbbm", typeof(short));
|
||
dt_xb.Columns.Add("xbmc", typeof(string));
|
||
DataRow dr = dt_xb.NewRow();
|
||
dr["xbbm"] = 0;
|
||
dr["xbmc"] = "男";
|
||
dt_xb.Rows.Add(dr);
|
||
dr = dt_xb.NewRow();
|
||
dr["xbbm"] = 1;
|
||
dr["xbmc"] = "女";
|
||
dt_xb.Rows.Add(dr);
|
||
dr = dt_xb.NewRow();
|
||
dr["xbbm"] = 2;
|
||
dr["xbmc"] = "不限";
|
||
dt_xb.Rows.Add(dr);
|
||
cbb_hs_xb.DataSource = dt_xb;
|
||
#endregion
|
||
|
||
#region 绑定婚姻
|
||
dt_hy.Columns.Add("hybm", typeof(short));
|
||
dt_hy.Columns.Add("hymc", typeof(string));
|
||
dr = dt_hy.NewRow();
|
||
dr["hybm"] = 0;
|
||
dr["hymc"] = "未婚";
|
||
dt_hy.Rows.Add(dr);
|
||
dr = dt_hy.NewRow();
|
||
dr["hybm"] = 1;
|
||
dr["hymc"] = "已婚";
|
||
dt_hy.Rows.Add(dr);
|
||
dr = dt_hy.NewRow();
|
||
dr["hybm"] = 2;
|
||
dr["hymc"] = "不限";
|
||
dt_hy.Rows.Add(dr);
|
||
cbb_hs_hyzk.DataSource = dt_hy;
|
||
#endregion
|
||
}
|
||
private void textBox56_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode == Keys.Enter)
|
||
{
|
||
var vser = ServiceContainer.GetService<IQianTai>();
|
||
string tm = txt_hs_tm.Text;
|
||
if (string.IsNullOrEmpty(tm.Trim()))
|
||
{
|
||
lbl_err.Text = "请输入条码号!";
|
||
return;
|
||
}
|
||
OperationResult or = vser.gettmstate(tm);
|
||
if (or.State != 1)
|
||
{
|
||
lbl_err.Text = or.Message;
|
||
return;
|
||
}
|
||
lbl_err.Text = or.Message;
|
||
dto_gzb gzb = Newtonsoft.Json.JsonConvert.DeserializeObject<dto_gzb>(or.Tag);
|
||
txt_hs_nl.Text = gzb.nl.ToString();
|
||
txt_hs_xm.Text = gzb.xm;
|
||
txt_hs_ygh.Text = gzb.ygbh;
|
||
txt_hs_csrq.Text = gzb.csrq.ToString("yyyy-MM-dd");
|
||
txt_hs_dh.Text = gzb.ygdh;
|
||
txt_hs_bm.Text = gzb.ygbm;
|
||
cbb_hs_xb.SelectedValue = gzb.xb;
|
||
cbb_hs_hyzk.SelectedValue = gzb.hyzk;
|
||
string stjxm = vser.gettjxmbytm(tm);
|
||
DataTable stdt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(stjxm);
|
||
dgv_jczt.DataSource = stdt;
|
||
}
|
||
}
|
||
|
||
private void dgv_jczt_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
|
||
{
|
||
foreach (DataGridViewRow dgvr in dgv_jczt.Rows)
|
||
{
|
||
DataRowView drv = dgvr.DataBoundItem as DataRowView;
|
||
if (drv.Row["ztz"].ToString() == "4")
|
||
{
|
||
dgvr.DefaultCellStyle.BackColor = Color.LightGreen;
|
||
}
|
||
if (drv.Row["ztz"].ToString() == "1")
|
||
{
|
||
dgvr.DefaultCellStyle.BackColor = Color.LightPink;
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
private void button16_Click(object sender, EventArgs e)
|
||
{
|
||
if (dgv_jczt.Rows.Count > 0)
|
||
{
|
||
DataTable dt = dgv_jczt.DataSource as DataTable;
|
||
object o = dt.Compute("count(ztz)", "ztz=0");
|
||
if (int.Parse(o.ToString()) > 0)
|
||
{
|
||
//---------------------------
|
||
//提示
|
||
//---------------------------
|
||
//此体检客人有未体检的项目,请客人确认是否要放弃这些项目?
|
||
//---------------------------
|
||
//是(Y) 否(N)
|
||
//---------------------------
|
||
|
||
if (MessageBox.Show("此体检客人有未体检的项目,请客人确认是否要放弃这些项目?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.No)
|
||
{
|
||
|
||
return;
|
||
}
|
||
|
||
}
|
||
var vser = ServiceContainer.GetService<IQianTai>();
|
||
OperationResult or = vser.tijianshouchehuishou(txt_hs_tm.Text, LoginUser.username, short.Parse(LoginUser.yydm));
|
||
MessageBox.Show(or.Message);
|
||
if (or.State == 1)
|
||
{
|
||
txt_hs_bm.Text = txt_hs_csrq.Text = txt_hs_dh.Text = txt_hs_nl.Text = txt_hs_tm.Text = txt_hs_xm.Text = txt_hs_ygh.Text = lbl_err.Text = "";
|
||
//dgv_jczt.Rows.Clear();
|
||
dgv_jczt.DataSource = null;
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
#endregion
|
||
|
||
#region TAB7-团体手册回收取消
|
||
|
||
|
||
dto_gzb cx_gzb = null;
|
||
private void txt_cx_tm_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode == Keys.Enter)
|
||
{
|
||
int itm = 0;
|
||
if (txt_cx_tm.Text.Trim().Length == 0)
|
||
{
|
||
lbl_cx_err.Text = "请输入条码!";
|
||
return;
|
||
}
|
||
if (!int.TryParse(txt_cx_tm.Text.Trim(), out itm))
|
||
{
|
||
lbl_cx_err.Text = "请输入正确的条码!";
|
||
return;
|
||
}
|
||
var vser = ServiceContainer.GetService<IQianTai>();
|
||
var tjxx = vser.gettmstate(txt_cx_tm.Text.Trim());
|
||
if (tjxx.State == 4)
|
||
{
|
||
cx_gzb = Newtonsoft.Json.JsonConvert.DeserializeObject<dto_gzb>(tjxx.Tag);
|
||
txt_cx_nl.Text = cx_gzb.nl.ToString();
|
||
txt_cx_xm.Text = cx_gzb.xm;
|
||
cbb_cx_xb.SelectedIndex = cx_gzb.xb;
|
||
cbb_cx_hy.SelectedIndex = cx_gzb.hyzk;
|
||
txt_cx_ygh.Text = cx_gzb.ygbh;
|
||
txt_cx_bm.Text = cx_gzb.ygbm;
|
||
}
|
||
else
|
||
{
|
||
lbl_cx_err.Text = "当前条码状态不能回收!";
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
private void button15_Click(object sender, EventArgs e)
|
||
{
|
||
txt_cx_nl.Text = txt_cx_tm.Text = txt_cx_xm.Text =
|
||
txt_cx_bm.Text = txt_cx_xm.Text = "";
|
||
lbl_cx_err.Text = "";
|
||
cx_gzb = null;
|
||
}
|
||
|
||
private void button14_Click(object sender, EventArgs e)
|
||
{
|
||
if (cx_gzb == null)
|
||
{
|
||
MessageBox.Show("请输入要撤销的条码!");
|
||
return;
|
||
}
|
||
if (cx_gzb.tmztz == 5)
|
||
{
|
||
if (MessageBox.Show("当前客户处于待分析状态,你确认回收吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.No)
|
||
{
|
||
button15_Click(null, null);
|
||
return;
|
||
}
|
||
}
|
||
var vser = ServiceContainer.GetService<IQianTai>();
|
||
OperationResult or = vser.chexiaohuishou(cx_gzb);
|
||
MessageBox.Show(or.Message);
|
||
if (or.State == 1)
|
||
{
|
||
button15_Click(null, null);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
#endregion
|
||
|
||
private void tbSFZH_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode == Keys.Enter)
|
||
{
|
||
|
||
cxhy();
|
||
}
|
||
}
|
||
|
||
private void cxhy()
|
||
{
|
||
#region 根据身份证号查询是否是已登记会员
|
||
//if (e.KeyCode == Keys.Enter)
|
||
string sfzh = this.tbSFZH.Text.Trim();
|
||
//验证身份证号的长度
|
||
//if (sfzh.Length != 18 && sfzh.Length != 15)
|
||
if (string.IsNullOrEmpty(sfzh))
|
||
{
|
||
//this.tbJKGW.Focus();
|
||
MessageBox.Show("身份证号长度不符");
|
||
this.tbSFZH.Select();
|
||
return;
|
||
}
|
||
|
||
//根据身份证号获取此人是否已经有体检信息
|
||
var vsqt = ServiceContainer.GetService<IQianTai>();
|
||
OperationResult or = vsqt.IfExistGJBySFZH(sfzh, fddm);
|
||
if (or.State == 0)
|
||
{
|
||
MessageBox.Show(or.Message);
|
||
this.tbSFZH.Select();
|
||
return;
|
||
}
|
||
|
||
//根据身份证号计算出生日期和年龄
|
||
int nl = Common.PubFunc.GetNlBySfz(sfzh);
|
||
string csrq = Common.PubFunc.GetCsrqBySfz(sfzh);
|
||
short xb_short = Common.PubFunc.GetSexShortBysfz(sfzh);
|
||
this.cbXB.SelectedIndex = xb_short;
|
||
if (string.IsNullOrEmpty(csrq) || nl == -1)
|
||
{
|
||
//this.tbJKGW.Focus();
|
||
MessageBox.Show("请输入正确的身份证号");
|
||
this.tbSFZH.Select();
|
||
return;
|
||
}
|
||
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
t_hyb thyb = vs.GetHyBySfzh(sfzh);
|
||
if (thyb == null)
|
||
{
|
||
this.tbJKGW.Focus();
|
||
MessageBox.Show("未找到该身份证对应的会员信息,请录入详细信息后登记");
|
||
this.cbYWDB.Focus();
|
||
DateTime dt;
|
||
if (DateTime.TryParse(string.IsNullOrEmpty(csrq) ? "" : csrq, out dt))
|
||
{
|
||
this.dtpCSRQ.Value = dt;
|
||
}
|
||
this.tbNL.Text = nl.ToString();
|
||
this.tbHyh.Text = "";
|
||
this.tbXM.Text = "";
|
||
this.tbLXDH.Text = "";
|
||
this.tbTXDZ.Text = "";
|
||
this.txtBZ.Text = "";
|
||
this.cbDXTJ.Checked = false;
|
||
this.cbVIP.Checked = false;
|
||
}
|
||
else
|
||
{
|
||
//查到会员信息之后,控件赋值
|
||
//thyb.yhjb == null ? 0 : thyb.yhjb //会员级别
|
||
//this.cbTJLB.SelectedValue();
|
||
this.tbLXDH.Text = thyb.tel1 == null ? "" : thyb.tel1; //联系电话
|
||
DateTime dt;
|
||
if (DateTime.TryParse(string.IsNullOrEmpty(csrq) ? "" : csrq, out dt))
|
||
{
|
||
this.dtpCSRQ.Value = dt;
|
||
}
|
||
this.tbNL.Text = nl.ToString();
|
||
this.tbTXDZ.Text = thyb.txdz == null ? "" : thyb.txdz.ToString(); //通讯地址
|
||
this.tbHyh.Text = thyb.hyh.ToString(); //会员号
|
||
this.tbXM.Text = thyb.xm; //姓名
|
||
this.cbXB.SelectedValue = thyb.xb; //性别选择
|
||
this.cbHYZK.SelectedValue = thyb.hyzk;
|
||
a_xb = thyb.xb;
|
||
a_hyzk = thyb.hyzk;
|
||
Load_tab1_TC(thyb.xb, thyb.hyzk);
|
||
Load_tab1_ZHXM("", thyb.xb, thyb.hyzk);
|
||
}
|
||
|
||
#endregion
|
||
}
|
||
|
||
private void btn_dk_Click(object sender, EventArgs e)
|
||
{
|
||
System.Configuration.Configuration conf = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Windows.Forms.Application.StartupPath + "\\local.ext");
|
||
// string sfzdkq = "";
|
||
if (conf.AppSettings.Settings.AllKeys.Contains("QYSFZDKQ"))
|
||
{
|
||
if (conf.AppSettings.Settings["QYSFZDKQ"].Value != "1")
|
||
{
|
||
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
||
return;
|
||
}
|
||
|
||
//System.Configuration.Configuration conf = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Windows.Forms.Application.StartupPath + "\\local.ext");
|
||
|
||
var group = conf.SectionGroups["object"];
|
||
if (group == null)
|
||
{
|
||
//group = new ConfigurationSectionGroup();
|
||
//conf.SectionGroups.Add("object", group);
|
||
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
||
return;
|
||
}
|
||
|
||
|
||
// ConfigurationSection section = new ConfigurationSection();
|
||
// group.Sections.Add("IDCard",)
|
||
|
||
|
||
MyAssemblySection section = group.Sections["ass"] as MyAssemblySection;
|
||
MyAssemblyElement myelement = null;
|
||
foreach (MyAssemblyElement element in section.MyAssemblyElements)
|
||
{
|
||
if (element.name == "IDCard")
|
||
{
|
||
myelement = element;
|
||
break;
|
||
}
|
||
}
|
||
if (myelement == null)
|
||
{
|
||
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
||
return;
|
||
}
|
||
var ass = Assembly.Load(myelement.assembly);
|
||
SOH.Interface.IIDCardRead idcard = ass.CreateInstance(myelement.type) as SOH.Interface.IIDCardRead;
|
||
int result = idcard.init();
|
||
if (result != 0)
|
||
{
|
||
MessageBox.Show("初始化读卡器失败!");
|
||
return;
|
||
|
||
}
|
||
result = idcard.read();
|
||
if (result != 0)
|
||
{
|
||
MessageBox.Show("读卡失败!");
|
||
return;
|
||
|
||
}
|
||
tb3_SFZH.Text = idcard.sfzh;
|
||
tb3_SFZH_Leave(null, null);
|
||
string xm = idcard.xm;
|
||
tb3_XM.Text = xm;
|
||
if (tb3_TXDZ.Text == "")
|
||
tb3_TXDZ.Text = idcard.dz;
|
||
idcard.exit();
|
||
jysfzh();
|
||
if (tb3_TXDZ.Text == "")
|
||
{
|
||
tb3_TXDZ.Text = idcard.dz;
|
||
}
|
||
}
|
||
|
||
private void tb3_SFZH_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode == Keys.Enter)
|
||
{
|
||
jysfzh();
|
||
}
|
||
}
|
||
|
||
private void pic_zp_Click(object sender, EventArgs e)
|
||
{
|
||
FrmPaiZhao pz = new FrmPaiZhao();
|
||
pz.img = pic_zp.Image;
|
||
pz.ShowDialog();
|
||
pic_zp.Image = pz.img;
|
||
}
|
||
|
||
private void pic_zp1_Click(object sender, EventArgs e)
|
||
{
|
||
FrmPaiZhao pz = new FrmPaiZhao();
|
||
pz.img = pic_zp1.Image;
|
||
pz.ShowDialog();
|
||
pic_zp1.Image = pz.img;
|
||
}
|
||
|
||
private void pic_zp3_Click(object sender, EventArgs e)
|
||
{
|
||
FrmPaiZhao pz = new FrmPaiZhao();
|
||
pz.img = pic_zp3.Image;
|
||
pz.ShowDialog();
|
||
pic_zp3.Image = pz.img;
|
||
}
|
||
|
||
private void pic_pz2_Click(object sender, EventArgs e)
|
||
{
|
||
FrmPaiZhao pz = new FrmPaiZhao();
|
||
pz.img = pic_pz2.Image;
|
||
pz.ShowDialog();
|
||
pic_pz2.Image = pz.img;
|
||
}
|
||
|
||
private void tbNL_TextChanged(object sender, EventArgs e)
|
||
{
|
||
//try
|
||
//{
|
||
// dtpCSRQ.Value = DateTime.Now.AddYears(-Convert.ToInt32(tbNL.Text.Trim()));
|
||
//}
|
||
//catch { }
|
||
}
|
||
|
||
private void button1_Click(object sender, EventArgs e)
|
||
{
|
||
frm_YanZheng yz = new frm_YanZheng();
|
||
yz.Owner = this;
|
||
yz.Show();
|
||
|
||
}
|
||
List<t_ygzd> listNew = new List<t_ygzd>();
|
||
private void cbYWDB_TextUpdate(object sender, EventArgs e)
|
||
{
|
||
//清空combobox
|
||
this.cbYWDB.Items.Clear();
|
||
//清空listNew
|
||
listNew.Clear();
|
||
//遍历全部备查数据
|
||
|
||
var data = lty.Where(t => ((this.cbYWDB.Text == null || this.cbYWDB.Text == "") ? true : (t.zjm.Contains(this.cbYWDB.Text))));
|
||
if (data.Any())
|
||
{
|
||
listNew = data.ToList();
|
||
|
||
//combobox添加已经查到的关键词
|
||
this.cbYWDB.Items.AddRange(listNew.ToArray());
|
||
this.cbYWDB.DisplayMember = "xm";
|
||
this.cbYWDB.ValueMember = "bm";
|
||
//设置光标位置,否则光标位置始终保持在第一列,造成输入关键词的倒序排列
|
||
this.cbYWDB.SelectionStart = this.cbYWDB.Text.Length;
|
||
//保持鼠标指针原来状态,有时候鼠标指针会被下拉框覆盖,所以要进行一次设置。
|
||
Cursor = Cursors.Default;
|
||
//自动弹出下拉框
|
||
this.cbYWDB.DroppedDown = true;
|
||
}
|
||
|
||
}
|
||
|
||
private void tb_tcZJM_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode == Keys.Enter)
|
||
{
|
||
Load_tab1_TC2(tb_tcZJM.Text.ToString());
|
||
}
|
||
}
|
||
|
||
//根据套餐名称检索
|
||
private void Load_tab1_TC2(string tcmc)
|
||
{
|
||
|
||
int xbint1 = this.cbXB.SelectedIndex;
|
||
short xb1 = (short)xbint1;
|
||
int hyint1 = this.cbHYZK.SelectedIndex;
|
||
short hyzk1 = (short)hyint1;
|
||
|
||
var vs = ServiceContainer.GetService<IQianTai2>();
|
||
List<t_tc> ltt = vs.GetTCByCondition(xb1, hyzk1, fddm);
|
||
if (ltt != null)
|
||
{
|
||
this.cbTJTC.DataSource = null;
|
||
var data = ltt.Where(t => t.tcmc.Contains(tcmc));
|
||
if (data.Any())
|
||
{
|
||
List<t_tc> newtc = data.ToList();
|
||
this.cbTJTC.DataSource = newtc;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
this.cbTJTC.DisplayMember = "tcmc";
|
||
this.cbTJTC.ValueMember = "tcbm";
|
||
this.cbTJTC.DataSource = ltt;
|
||
}
|
||
this.cbTJTC.SelectedIndex = -1;
|
||
|
||
}
|
||
|
||
private void button2_Click(object sender, EventArgs e)
|
||
{
|
||
if (gvHYXX.SelectedRows.Count <= 0)
|
||
{
|
||
MessageBox.Show("请选择要打印的信息!");
|
||
return;
|
||
}
|
||
var ttgzb = gvHYXX.SelectedRows[0].DataBoundItem as t_ttgzb;
|
||
|
||
var f = new SOH.ShouFei.frmprinttm();
|
||
f.init(ttgzb.tm, 0, 0, null);
|
||
f.print();
|
||
f.Dispose();
|
||
return;
|
||
}
|
||
|
||
//打印条码
|
||
private void PrintTm(List<t_ttgzb> lttt)
|
||
{
|
||
if (lttt == null || lttt.Count == 0)
|
||
{
|
||
//MessageBox.Show
|
||
return;
|
||
}
|
||
foreach (t_ttgzb tt in lttt)
|
||
{
|
||
SOH.ShouFei.frmprinttm ptm = new SOH.ShouFei.frmprinttm();
|
||
ptm.init(tt.tm, 0, 0, null);
|
||
ptm.print();
|
||
}
|
||
}
|
||
|
||
private void button5_Click(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
string pa_xm = "";
|
||
string pa_sfz = "";
|
||
string pa_dh = "";
|
||
Object pareq1 = null;
|
||
Object pareq2 = null;
|
||
if (cbsfzh.Checked)
|
||
{
|
||
if (patxt_sfz.Text.Equals(""))
|
||
{
|
||
MessageBox.Show("请输入身份证号!");
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
pa_sfz = patxt_sfz.Text;
|
||
}
|
||
}
|
||
if (cbxm.Checked)
|
||
{
|
||
if (txtpa_xm.Text.Equals(""))
|
||
{
|
||
MessageBox.Show("请输入姓名!");
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
pa_xm = txtpa_xm.Text;
|
||
}
|
||
}
|
||
if (cbdh.Checked)
|
||
{
|
||
if (txtpa_dh.Text.Equals(""))
|
||
{
|
||
MessageBox.Show("请输入电话!");
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
pa_dh = txtpa_dh.Text;
|
||
}
|
||
}
|
||
if (cbtjrq.Checked)
|
||
{
|
||
DateTime date1 = padt1.Value.Date;
|
||
//DateTime date2 = padt2.Value.Date.AddDays(1).AddMilliseconds(-1);
|
||
DateTime date2 = padt2.Value.Date;
|
||
if (DateTime.Compare(date1, date2) > 0)
|
||
{
|
||
MessageBox.Show("预约日期输入错误!请重新选择!");
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
pareq1 = date1.ToString("yyyy-MM-dd");
|
||
pareq2 = date2.ToString("yyyy-MM-dd");
|
||
}
|
||
}
|
||
|
||
var vservice = ServiceContainer.GetService<IPingAn>();
|
||
String data = vservice.GetPaYysqList(pa_sfz, pa_xm, pa_dh, Convert.ToDateTime(pareq1), Convert.ToDateTime(pareq2), LoginUser.yydm);
|
||
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject(data, typeof(DataTable)) as DataTable;
|
||
if (dt.Rows.Count != 0)
|
||
{
|
||
payysqBindingSource.DataSource = dt;
|
||
//dgvPaList.DataSource = dt;
|
||
//dgvPaList.Refresh();
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
|
||
}
|
||
|
||
}
|
||
|
||
private void button3_Click(object sender, EventArgs e)
|
||
{
|
||
System.Configuration.Configuration conf = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Windows.Forms.Application.StartupPath + "\\local.ext");
|
||
// string sfzdkq = "";
|
||
if (conf.AppSettings.Settings.AllKeys.Contains("QYSFZDKQ"))
|
||
{
|
||
if (conf.AppSettings.Settings["QYSFZDKQ"].Value != "1")
|
||
{
|
||
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
||
return;
|
||
}
|
||
|
||
var group = conf.SectionGroups["object"];
|
||
if (group == null)
|
||
{
|
||
//group = new ConfigurationSectionGroup();
|
||
//conf.SectionGroups.Add("object", group);
|
||
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
||
return;
|
||
}
|
||
|
||
|
||
// ConfigurationSection section = new ConfigurationSection();
|
||
// group.Sections.Add("IDCard",)
|
||
|
||
|
||
MyAssemblySection section = group.Sections["ass"] as MyAssemblySection;
|
||
MyAssemblyElement myelement = null;
|
||
foreach (MyAssemblyElement element in section.MyAssemblyElements)
|
||
{
|
||
if (element.name == "IDCard")
|
||
{
|
||
myelement = element;
|
||
break;
|
||
}
|
||
}
|
||
if (myelement == null)
|
||
{
|
||
MessageBox.Show("系统没有配置读卡器相关配置,请联系管理员设置!");
|
||
return;
|
||
}
|
||
var ass = Assembly.Load(myelement.assembly);
|
||
SOH.Interface.IIDCardRead idcard = ass.CreateInstance(myelement.type) as SOH.Interface.IIDCardRead;
|
||
int result = idcard.init();
|
||
if (result != 0)
|
||
{
|
||
MessageBox.Show("初始化读卡器失败!");
|
||
return;
|
||
|
||
}
|
||
result = idcard.read();
|
||
if (result != 0)
|
||
{
|
||
MessageBox.Show("读卡失败!");
|
||
return;
|
||
|
||
}
|
||
|
||
if (string.IsNullOrEmpty(idcard.sfzh))
|
||
{
|
||
//this.tbJKGW.Focus();
|
||
MessageBox.Show("身份证号长度不符");
|
||
this.patxt_sfz.Select();
|
||
return;
|
||
}
|
||
|
||
|
||
patxt_sfz.Text = idcard.sfzh;
|
||
idcard.exit();
|
||
|
||
var vservice = ServiceContainer.GetService<IPingAn>();
|
||
String data = vservice.GetPaYysqList(patxt_sfz.Text, "", "", DateTime.MinValue, DateTime.MinValue, LoginUser.yydm);
|
||
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject(data, typeof(DataTable)) as DataTable;
|
||
if (dt.Rows.Count != 0)
|
||
{
|
||
dgvPaList.DataSource = dt;
|
||
dgvPaList.Refresh();
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("身份证号未查询到客户信息!");
|
||
this.patxt_sfz.Select();
|
||
return;
|
||
}
|
||
}
|
||
|
||
private void button4_Click(object sender, EventArgs e)
|
||
{
|
||
if (dgvPaList.SelectedRows.Count > 0)
|
||
{
|
||
DataRowView o = dgvPaList.Rows[dgvPaList.CurrentRow.Index].DataBoundItem as DataRowView;
|
||
//var pa = dgvPaList.SelectedRows[0];
|
||
//pa_yysq yysq = pa.DataBoundItem as pa_yysq;
|
||
if (o.Row[6].ToString() != "200")
|
||
{
|
||
MessageBox.Show("用户已到检!");
|
||
}
|
||
else
|
||
{
|
||
//frm_Pa_DJHX djhx = new frm_Pa_DJHX(o, this);
|
||
//djhx.ShowDialog();
|
||
if (!string.IsNullOrEmpty(this.txt_yzm.Text))
|
||
{
|
||
string timestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||
string sign = MD5Encrypt("tianrui" + "0871338ce2bddd34fd02a0c383d0b73a" + timestamp);
|
||
|
||
//string jm = Md5Decrypt(sign);
|
||
string orderState = o.Row["orderState"].ToString() == "预约已确认" ? "01" : "03";
|
||
//orderState= (d.orderState == "01") ? "预约已确认" : "预约待确认",
|
||
|
||
var dic = new Dictionary<string, string>() {
|
||
{"pajkKey","tianrui"},
|
||
{"sign",sign },
|
||
{"timestamp",timestamp },
|
||
{"hospitalOrderId",o.Row["hospitalOrderId"].ToString() },
|
||
{"orderId",o.Row["orderId"].ToString() },
|
||
{"orderState","03" },
|
||
{"captcha",this.txt_yzm.Text }
|
||
};
|
||
|
||
//var builder = new UriBuilder("https://tj.test.pajk.cn/tj/api/updateOrder");//测试环境
|
||
var builder = new UriBuilder("https://tj.jk.cn/tj/api/updateOrder");//正式环境
|
||
var query = HttpUtility.ParseQueryString(builder.Query);
|
||
foreach (var item in dic.Keys)
|
||
{
|
||
query[item] = dic[item];
|
||
}
|
||
string url = builder + "?" + query.ToString().Trim('?');
|
||
|
||
var vservice = ServiceContainer.GetService<IPingAn>();
|
||
|
||
string js = Get_Http(url, 10000, "");
|
||
//{"status":"401"} 解析
|
||
JObject jo = (JObject)JsonConvert.DeserializeObject(js);
|
||
string status = jo["status"].ToString();
|
||
switch (status)
|
||
{
|
||
case "400":
|
||
MessageBox.Show("参数异常!");
|
||
break;
|
||
case "401":
|
||
MessageBox.Show("权限异常!");
|
||
break;
|
||
case "500":
|
||
MessageBox.Show("未知错误!");
|
||
break;
|
||
case "402":
|
||
MessageBox.Show("验证码错误!");
|
||
break;
|
||
case "200":
|
||
MessageBox.Show("验证成功!");
|
||
pa_yysq yysq = vservice.Djhx(o.Row["hospitalOrderId"].ToString(), o.Row["orderId"].ToString(), this.txt_yzm.Text);
|
||
|
||
tabControl1.SelectedTab = tabControl1.TabPages[0];
|
||
this.tbSFZH.Text = yysq.customerIdentityNo;
|
||
this.tbXM.Text = yysq.customerName;
|
||
this.tbLXDH.Text = yysq.phone;
|
||
this.cbPA.Checked = true;
|
||
|
||
break;
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("验证码不能为空!");
|
||
this.txt_yzm.Focus();
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("请选择用户!");
|
||
}
|
||
}
|
||
public string Get_Http(string url, int timeout, string parm)
|
||
{
|
||
string strResult = "";
|
||
try
|
||
{
|
||
//创建请求
|
||
HttpWebRequest myReq = (HttpWebRequest)HttpWebRequest.Create(url);
|
||
//请求响应时间
|
||
myReq.Timeout = timeout;
|
||
//得到响应对象
|
||
HttpWebResponse myRes = (HttpWebResponse)myReq.GetResponse();
|
||
//获取流
|
||
Stream myStream = myRes.GetResponseStream();
|
||
//读取字符
|
||
StreamReader sr = new StreamReader(myStream, Encoding.UTF8);
|
||
StringBuilder sb = new StringBuilder();
|
||
while (-1 != sr.Peek())
|
||
{
|
||
sb.Append(sr.ReadLine());
|
||
}
|
||
strResult = sb.ToString();
|
||
}
|
||
catch (Exception exp)
|
||
{
|
||
strResult = "错误:" + exp.Message;
|
||
}
|
||
return strResult;
|
||
}
|
||
|
||
public string postFileMessage(string strUrl, List<PostDateClass> postParaList)
|
||
{
|
||
try
|
||
{
|
||
string responseContent = "";
|
||
var memStream = new MemoryStream();
|
||
HttpWebRequest webRequest = (HttpWebRequest)HttpWebRequest.Create(strUrl);
|
||
//var webRequest = (HttpWebRequest)WebRequest.Create(strUrl);
|
||
// 边界符
|
||
var boundary = "---------------" + DateTime.Now.Ticks.ToString("x");
|
||
// 边界符
|
||
var beginBoundary = Encoding.ASCII.GetBytes("--" + boundary + "\r\n");
|
||
// 最后的结束符
|
||
var endBoundary = Encoding.ASCII.GetBytes("--" + boundary + "--\r\n");
|
||
memStream.Write(beginBoundary, 0, beginBoundary.Length);
|
||
// 设置属性
|
||
webRequest.Method = "POST";
|
||
webRequest.Timeout = 10000;
|
||
webRequest.ContentType = "multipart/form-data; boundary=" + boundary;
|
||
for (int i = 0; i < postParaList.Count; i++)
|
||
{
|
||
PostDateClass temp = postParaList[i];
|
||
if (temp.Type == 1)
|
||
{
|
||
var fileStream = new FileStream(temp.Value, FileMode.Open, FileAccess.Read);
|
||
// 写入文件
|
||
const string filePartHeader =
|
||
"Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\n" +
|
||
"Content-Type: application/octet-stream\r\n\r\n";
|
||
var header = string.Format(filePartHeader, temp.Prop, temp.Value);
|
||
var headerbytes = Encoding.UTF8.GetBytes(header);
|
||
memStream.Write(headerbytes, 0, headerbytes.Length);
|
||
var buffer = new byte[1024];
|
||
int bytesRead; // =0
|
||
while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
|
||
{
|
||
memStream.Write(buffer, 0, bytesRead);
|
||
}
|
||
string end = "\r\n";
|
||
headerbytes = Encoding.UTF8.GetBytes(end);
|
||
memStream.Write(headerbytes, 0, headerbytes.Length);
|
||
fileStream.Close();
|
||
}
|
||
else if (temp.Type == 0)
|
||
{
|
||
// 写入字符串的Key
|
||
var stringKeyHeader = "Content-Disposition: form-data; name=\"{0}\"" +
|
||
"\r\n\r\n{1}\r\n";
|
||
var header = string.Format(stringKeyHeader, temp.Prop, temp.Value);
|
||
var headerbytes = Encoding.UTF8.GetBytes(header);
|
||
memStream.Write(headerbytes, 0, headerbytes.Length);
|
||
}
|
||
if (i != postParaList.Count - 1)
|
||
memStream.Write(beginBoundary, 0, beginBoundary.Length);
|
||
else
|
||
// 写入最后的结束边界符
|
||
memStream.Write(endBoundary, 0, endBoundary.Length);
|
||
}
|
||
webRequest.ContentLength = memStream.Length;
|
||
var requestStream = webRequest.GetRequestStream();
|
||
memStream.Position = 0;
|
||
var tempBuffer = new byte[memStream.Length];
|
||
memStream.Read(tempBuffer, 0, tempBuffer.Length);
|
||
memStream.Close();
|
||
requestStream.Write(tempBuffer, 0, tempBuffer.Length);
|
||
requestStream.Close();
|
||
using (HttpWebResponse res = (HttpWebResponse)webRequest.GetResponse())
|
||
{
|
||
|
||
using (Stream resStream = res.GetResponseStream())
|
||
{
|
||
byte[] buffer = new byte[1024];
|
||
int read;
|
||
try
|
||
{
|
||
while ((read = resStream.Read(buffer, 0, buffer.Length)) > 0)
|
||
{
|
||
responseContent += Encoding.UTF8.GetString(buffer, 0, read);
|
||
}
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
|
||
}
|
||
|
||
}
|
||
res.Close();
|
||
}
|
||
return responseContent;
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
}
|
||
return null;
|
||
|
||
|
||
}
|
||
|
||
private void button6_Click(object sender, EventArgs e)
|
||
{
|
||
if (dgvPaList.SelectedRows.Count > 0)
|
||
{
|
||
DataRowView o = dgvPaList.Rows[dgvPaList.CurrentRow.Index].DataBoundItem as DataRowView;
|
||
//var pa = dgvPaList.SelectedRows[0];
|
||
//pa_yysq yysq = pa.DataBoundItem as pa_yysq;
|
||
if (o.Row[6].ToString() == "200")//!=
|
||
{
|
||
MessageBox.Show("用户未到检!");
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//7 = 姓名,8身份证号,9电话,11是否查看PDF报告 医院订单id=0,性别=12,生日=13,订单id=1
|
||
if (o.Row[11].ToString() != "Y")
|
||
{
|
||
MessageBox.Show("客户未授权查看PDF报告!");
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
string ddid = o.Row[1].ToString();
|
||
string xm = o.Row[7].ToString();
|
||
string sfz = o.Row[8].ToString();
|
||
string dh = o.Row[9].ToString();
|
||
string yyddid = o.Row[0].ToString();
|
||
string orderid = o.Row[1].ToString();
|
||
string tjrq = o.Row[4].ToString();
|
||
string xb = o.Row[12].ToString() == "男" ? "M" : "F";
|
||
string csrq = o.Row[13].ToString();
|
||
string captcha = o.Row[16].ToString();
|
||
string customerIdentityType = o.Row[17].ToString();
|
||
string files = "";
|
||
var vservice = ServiceContainer.GetService<IPingAn>();
|
||
DataTable dt = vservice.GetPaGrgzb(xm, sfz, dh, tjrq);
|
||
DataTable dt1 = vservice.GetPaTtgzb(xm, sfz, dh, tjrq);
|
||
string tmhs = "";
|
||
if (dt.Rows.Count != 0) //!=
|
||
{
|
||
tmhs = dt.Rows[0]["tm"].ToString();
|
||
}else if(dt1.Rows.Count != 0)
|
||
{
|
||
tmhs = dt1.Rows[0]["tm"].ToString();
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("客户报告未完成!");
|
||
return;
|
||
}
|
||
|
||
|
||
frmShowBaoGao fsb = new frmShowBaoGao();
|
||
fsb.init(tmhs, 7);
|
||
//fsb.daochu(((DataRowView)dr.DataBoundItem).Row[10].ToString() + " " + ((DataRowView)dr.DataBoundItem).Row[2].ToString());
|
||
|
||
//files=fsb.daochuImagePdf2(ddid);
|
||
files = fsb.daochu2(ddid);
|
||
|
||
string timestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||
string sign = MD5Encrypt("tianrui" + "0871338ce2bddd34fd02a0c383d0b73a" + timestamp);
|
||
List<PostDateClass> postList = new List<PostDateClass>();
|
||
postList.Add(new PostDateClass("pajkKey", "tianrui"));
|
||
postList.Add(new PostDateClass("sign", sign));
|
||
postList.Add(new PostDateClass("timestamp", timestamp));
|
||
postList.Add(new PostDateClass("file", files, 1));
|
||
postList.Add(new PostDateClass("fileName", orderid));
|
||
postList.Add(new PostDateClass("hospitalOrderId", yyddid));
|
||
postList.Add(new PostDateClass("customerName", xm));
|
||
postList.Add(new PostDateClass("customerIdentityType", customerIdentityType));
|
||
postList.Add(new PostDateClass("customerIdentityNo", sfz));
|
||
postList.Add(new PostDateClass("customerGender", xb));
|
||
postList.Add(new PostDateClass("customerBirthday", csrq));
|
||
postList.Add(new PostDateClass("captcha", captcha));
|
||
|
||
//string strURL = "https://tj.test.pajk.cn/tj/api/getPdf"; //测试地址
|
||
string strURL = "https://tj.jk.cn/tj/api/getPdf";//正式地址
|
||
|
||
string strRequest = postFileMessage(strURL, postList);
|
||
string result = strRequest;
|
||
|
||
JObject jo = (JObject)JsonConvert.DeserializeObject(result);
|
||
string status = jo["status"].ToString();
|
||
switch (status)
|
||
{
|
||
case "400":
|
||
MessageBox.Show("参数异常!");
|
||
break;
|
||
case "401":
|
||
MessageBox.Show("权限异常!");
|
||
break;
|
||
case "500":
|
||
MessageBox.Show("未知错误!");
|
||
break;
|
||
case "402":
|
||
MessageBox.Show("验证码错误!");
|
||
break;
|
||
case "200":
|
||
MessageBox.Show("上传成功!");
|
||
vservice.Bgsc(orderid);
|
||
//this.Close();
|
||
break;
|
||
}
|
||
|
||
}
|
||
//frm_Pa_DJHX djhx = new frm_Pa_DJHX(o, this);
|
||
//djhx.ShowDialog();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("请选择用户!");
|
||
return;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 用MD5加密字符串
|
||
/// </summary>
|
||
/// <param name="password">待加密的字符串</param>
|
||
/// <returns></returns>
|
||
public string MD5Encrypt(string password)
|
||
{
|
||
MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();
|
||
byte[] hashedDataBytes;
|
||
hashedDataBytes = md5Hasher.ComputeHash(Encoding.GetEncoding("gb2312").GetBytes(password));
|
||
StringBuilder tmp = new StringBuilder();
|
||
foreach (byte i in hashedDataBytes)
|
||
{
|
||
tmp.Append(i.ToString("x2"));
|
||
}
|
||
return tmp.ToString();
|
||
}
|
||
|
||
public void DjhxTz(string sfz, string xm, string dh)
|
||
{
|
||
tabControl1.SelectedTab = tabControl1.TabPages[0];
|
||
this.tbSFZH.Text = sfz;
|
||
this.tbXM.Text = xm;
|
||
this.tbLXDH.Text = dh;
|
||
this.cbPA.Checked = true;
|
||
}
|
||
|
||
public class results
|
||
{
|
||
public string date { get; set; }
|
||
public int canOrder { get; set; }
|
||
public int provideVipData { get; set; }
|
||
public int vipMaxNum { get; set; }
|
||
public int vipOrderNum { get; set; }
|
||
public int maxNum { get; set; }
|
||
public int orderNum { get; set; }
|
||
}
|
||
|
||
private void button7_Click(object sender, EventArgs e)
|
||
{
|
||
tabControl1.SelectedTab = tabControl1.TabPages[0];
|
||
this.tbSFZH.Text = "123";
|
||
this.tbXM.Text = "222";
|
||
this.tbLXDH.Text = "333";
|
||
this.cbPA.Checked = true;
|
||
}
|
||
|
||
private void dgvPaList_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||
{
|
||
if (status.Index == e.ColumnIndex)
|
||
{
|
||
if (e.Value == null)
|
||
{
|
||
return;
|
||
}
|
||
if (e.Value.Equals("200"))
|
||
{
|
||
e.Value = "订单生效";
|
||
}
|
||
if (e.Value.Equals("201"))
|
||
{
|
||
e.Value = "客户已到检";
|
||
}
|
||
if (e.Value.Equals("202"))
|
||
{
|
||
e.Value = "报告已上传";
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
private void button8_Click(object sender, EventArgs e)
|
||
{
|
||
new ExcelDC().ExportExcel("平安预约名单", this.dgvPaList);
|
||
}
|
||
}
|
||
}
|