private void btnSelectP1_Click(object sender, EventArgs e) { Patients patient = new Patients(); patient.PatientID = int.Parse(txPatientID1.Text); Patientinfo pi = new Patientinfo(); if (pi.FindPatient(patient)) { txName.Text = patient.PatienName; txIDNum.Text = patient.IDNumber; txAge.Text = patient.Age.ToString(); txTell.Text = patient.Phone; if (patient.Sex == "男") { rdbtnM.Checked = true; } else { rdbtnF.Checked = true; } Content con = new Content(); con.PatientID = patient.PatientID; ManagmentOfContent mcon = new ManagmentOfContent(); dataGridView2.DataSource = mcon.ShowContent(con); } else { MessageBox.Show("查无此病例"); } }
public static Registeruser patientInfobyregid(Guid getid) { GuruETCEntities _etc = new GuruETCEntities(); Registeruser _edituser = new Registeruser(); long? PinfoId = _etc.RegistrationCodes.Where(d => d.RegCode == getid).Select(d => d.PatientInfoId).FirstOrDefault(); if (PinfoId != 0) { Patientinfo _getpinfo = _etc.Patientinfoes.Where(d => d.PID == PinfoId).FirstOrDefault(); if (_getpinfo != null) { _edituser.Email = _getpinfo.Email; _edituser.DOB = _getpinfo.DOB.Value.ToShortDateString(); _edituser.Name = _getpinfo.Name; _edituser.Address1 = _getpinfo.Address1; _edituser.Address2 = _getpinfo.Address2; _edituser.PhoneNumber = _getpinfo.PhoneNumber;; _edituser.DoctorKey = (Guid)_getpinfo.refby; } else { return(null); } } return(_edituser); }
/// <summary> /// 缴费操作 /// <input> /// PrepaidPayment /// </input> /// </summary> /// <param name="prepaidpayment"></param> /// <returns></returns> public Boolean Pay(PrepaidPayment prepaidpayment) { this.prepaidpayment = prepaidpayment; Sqlhelper sqlhelper = new Sqlhelper(); DataTable datatable = new DataTable(); datatable = sqlhelper.Exesql("SELECT * from PrepaidPayment WHERE PatientID = '" + prepaidpayment.PatientID + "' AND Time='" + prepaidpayment.Time + "'"); if (datatable.Rows.Count > 0)//检查是否有同一日期同一用户的数据,有则更新 { int resualt = sqlhelper.ExecuteNonQuery("update PrepaidPayment set Prepay=Prepay+'" + prepaidpayment.Prepay + "' where PatientID = '" + prepaidpayment.PatientID + "'"); if (resualt > 0) { Balance balance = new Balance(); balance.PatientID = prepaidpayment.PatientID; balance.BalanceMoney = prepaidpayment.Prepay; updateBalance(balance); return(true); } else { return(false); } } else { //先检查是否有此用户 Patientinfo patientinfo = new Patientinfo(); Patients patient = new Patients(); patient.PatientID = prepaidpayment.PatientID; if (patientinfo.FindPatient(patient))//若存在此用户,则插入新的数据 { int resualt = sqlhelper.ExecuteNonQuery("INSERT INTO PrepaidPayment( PatientID,Time,Prepay) VAlUES('" + prepaidpayment.PatientID + "', '" + prepaidpayment.Time + "','" + prepaidpayment.Prepay + "') "); if (resualt > 0)//插入成功,则修改Balance中的值 { Balance balance = new Balance(); balance.PatientID = prepaidpayment.PatientID; balance.BalanceMoney = prepaidpayment.Prepay; if (FindBalance(balance))//Balance中有此数据,则更新数据 { updateBalance(balance); } else//Balance 中无此数据,则插入; { insertBalance(balance); } return(true); } else { return(false); } } else { return(false); } } }
public static string AddPatientInfo(string pname, string padd1, string padd2, string pphone, string pdob, string pmedhis, string ppathis, string pemail, string pmot, Guid dguid) { GuruETC.DB.GuruETCEntities _etc = new DB.GuruETCEntities(); string msg = string.Empty; string senderDisplayName = string.Empty; try { Patientinfo _pinfo = new Patientinfo(); _pinfo.Name = pname; _pinfo.Address1 = padd1; _pinfo.Address2 = padd2; _pinfo.DOB = DateTime.Parse(pdob); _pinfo.PhoneNumber = pphone; _pinfo.MedicalHistory = pmedhis; _pinfo.PatientHistorical = ppathis; _pinfo.PersonalMotivator = pmot; _pinfo.Email = pemail; _pinfo.refby = dguid; _etc.AddToPatientinfoes(_pinfo); _etc.SaveChanges(); RegistrationCode _rcode = new RegistrationCode(); _rcode.createdDate = DateTime.Today; _rcode.ExpiryDate = DateTime.Today.AddDays(1); _rcode.PatientInfoId = _pinfo.PID; Guid Getcode = Guid.NewGuid(); _rcode.RegCode = Getcode; _rcode.IsAuth = true; _etc.AddToRegistrationCodes(_rcode); _etc.SaveChanges(); ThreadStart starterimg = () => bitMethod(pemail, pname, senderDisplayName, Getcode); Thread threadimg = new Thread(starterimg); threadimg.ApartmentState = ApartmentState.STA; threadimg.Start(); msg = "Success"; } catch (Exception ex) { throw ex; } return(msg); }
private void btnSelectP_Click(object sender, EventArgs e) { Patients patient = new Patients(); patient.PatientID = int.Parse(txPatientID.Text); Patientinfo patientinfo = new Patientinfo(); if (patientinfo.FindPatient(patient)) { txBedID.Text = patient.BID; txOffice.Text = patient.DName; } else { MessageBox.Show("此病例不存在"); } }
private void btnUpdate_Click(object sender, EventArgs e) { Patients patient = new Patients(); patient.PatientID = int.Parse(txPatientID.Text); patient.BID = txBedID.Text; patient.DName = txOffice.Text; Patientinfo patientinfo = new Patientinfo(); if (patientinfo.UpdatePatient(patient)) { MessageBox.Show("修改成功"); } else { MessageBox.Show("修改失败"); } }
private void btnAgree_Click(object sender, EventArgs e) { PermissionCheck newCheck = new PermissionCheck(); Patients patient = new Patients(); patient.IDNumber = comboBox1.Text; Patientinfo patientinfo = new Patientinfo(); ///如果不是第一次入院,不新建病例 if (patientinfo.FindPatientByIDNumber(patient)) { } else///如果是第一次入院,则新建病例 { patient.Age = int.Parse(txAge.Text); patient.PatienName = txName.Text; if (rdBtnF.Checked == true) { patient.Sex = "女"; } else { patient.Sex = "男"; } patient.IDNumber = txIDNum.Text; patient.Phone = txTell.Text; patientinfo.InertPatient(patient); } int result; result = newCheck.Agree(comboBox1.Text); if (result > 0) { MessageBox.Show("操作成功!", "信息提示", MessageBoxButtons.OKCancel); } comboBox1.Items.Remove(this.comboBox1.SelectedItem); txAge.Text = ""; txIDNum.Text = ""; txName.Text = ""; txTell.Text = ""; rdBtnF.Checked = false; rdBtnM.Checked = false; }
public static Patientinfo IsValidid(string id) { Patientinfo _getInfo = new Patientinfo(); GuruETC.DB.GuruETCEntities _etc = new DB.GuruETCEntities(); try { Guid getId = Guid.Parse(id); RegistrationCode _rcode = _etc.RegistrationCodes.Where(d => d.RegCode == getId && d.ExpiryDate >= DateTime.Today).FirstOrDefault(); if (_rcode != null) { _getInfo = _etc.Patientinfoes.Where(d => d.PID == _rcode.PatientInfoId).FirstOrDefault(); } } catch { } return(_getInfo); }