/// <summary> /// 根据就诊号获取病人信息 /// </summary> /// <param name="VisitNo"></param> /// <returns></returns> public RegPatient GetPatientInfoByVisitNo(string VisitNo) { DataRow dr = reg_dal.GetRegisterInfoByVisitNo(VisitNo); if (dr == null) { throw new OperatorException("没有找到病人信息!"); } RegPatient patient = new RegPatient( ); patient.Address = dr[Tables.patientinfo.PATADDRESS].ToString( ); if (!Convert.IsDBNull(dr[Tables.patientinfo.PATBRIDATE])) { patient.BornDate = Convert.ToDateTime(dr[Tables.patientinfo.PATBRIDATE]); } patient.Folk = Convert.IsDBNull(dr[Tables.patientinfo.PATGROUP])?"" : dr[Tables.patientinfo.PATGROUP].ToString( ); patient.HisCardNo = Convert.IsDBNull(dr[Tables.patientinfo.MEDICARD]) ? "" : dr[Tables.patientinfo.MEDICARD].ToString( ); patient.IDCard = Convert.IsDBNull(dr[Tables.patientinfo.PATNUMBER]) ? "" : dr[Tables.patientinfo.PATNUMBER].ToString( ); patient.Occupation = Convert.IsDBNull(dr[Tables.patientinfo.PATJOB]) ? "" : dr[Tables.patientinfo.PATJOB].ToString( ); patient.PatID = Convert.IsDBNull(dr[Tables.mz_patlist.PATID]) ? 0M : Convert.ToDecimal(dr[Tables.mz_patlist.PATID]); patient.PatientName = Convert.IsDBNull(dr[Tables.mz_patlist.PATNAME]) ? "" : dr[Tables.mz_patlist.PATNAME].ToString( ); patient.PatListID = Convert.IsDBNull(dr[Tables.mz_patlist.PATLISTID]) ? 0 : Convert.ToInt32(dr[Tables.mz_patlist.PATLISTID]); patient.PatType = new PatientType( ); patient.PatType.Code = Convert.IsDBNull(dr[Tables.mz_patlist.MEDITYPE]) ? "" : dr[Tables.mz_patlist.MEDITYPE].ToString( ); patient.Sex = Convert.IsDBNull(dr[Tables.mz_patlist.PATSEX]) ? "" : dr[Tables.mz_patlist.PATSEX].ToString( ); patient.Tel = Convert.IsDBNull(dr[Tables.patientinfo.PATTEL]) ? "" :dr[Tables.patientinfo.PATTEL].ToString( ); patient.ValidCardNo = patient.PatID == 0 ? false : true; patient.VisitNo = VisitNo; patient.PYM = Convert.IsDBNull(dr[Tables.patientinfo.PYM]) ? "" :dr[Tables.patientinfo.PYM].ToString( ); patient.WBM = Convert.IsDBNull(dr[Tables.patientinfo.WBM]) ? "" :dr[Tables.patientinfo.WBM].ToString( ); patient.RegDeptCode = Convert.IsDBNull(dr[Tables.mz_patlist.REG_DEPT_CODE]) ? "" : dr[Tables.mz_patlist.REG_DEPT_CODE].ToString( ); patient.RegDoctorCode = Convert.IsDBNull(dr[Tables.mz_patlist.REG_DOC_CODE]) ? "" : dr[Tables.mz_patlist.REG_DOC_CODE].ToString( ); return(patient); }
public void FindRegDetail(RegPatient Patient) //挂号明细费用 { //查找所需费用项目 string strsql = @"select c.item_name,a.price from MZ_REG_ITEM_FEE d left outer join BASE_SERVICE_ITEMS a on d.item_id=a.item_id left outer join BASE_STAT_ITEM b on a.statitem_code = b.code left outer join base_stat_mzfp c on b.mzfp_code=c.code where d.type_code= '" + Patient.RegTypeCode + "'"; DataTable tbDetail = oleDb.GetDataTable(strsql); for (int i = 0; i < tbDetail.Rows.Count; i++) { if (tbDetail.Rows[i]["item_name"].ToString().Trim() == "挂号费") { RegFee = Convert.ToDecimal(tbDetail.Rows[i]["price"]); } if (tbDetail.Rows[i]["item_name"].ToString().Trim() == "诊查费") { ZcFee = Convert.ToDecimal(tbDetail.Rows[i]["price"]); } if (tbDetail.Rows[i]["item_name"].ToString().Trim() == "检查费") { CheckFee = Convert.ToDecimal(tbDetail.Rows[i]["price"]); } if (tbDetail.Rows[i]["item_name"].ToString().Trim() == "材料费") { ClFee = Convert.ToDecimal(tbDetail.Rows[i]["price"]); } } }
/// <summary> /// 挂号预算 /// </summary> /// <returns></returns> private bool Budget(RegPatient Patient) { try { register = RegisterObject.RegisterFactory.CreateRegisterObject(Patient.PatType.Code); register.OperatorId = this.operatorId; register.OperatorName = this.operatorName; Patient.RegFeeInfo = register.Budget(Patient); return(true); } catch (OperatorException operr) { throw operr; } catch (Exception err) { ErrorWriter.WriteLog(err); throw new Exception("挂号费用计算发生错误!请重试"); } finally { register = null; } }
/// <summary> /// 根据发票获取病人信息 /// </summary> /// <param name="invoiceNo"></param> /// <returns></returns> public RegPatient GetPatientInfoByInvoiceNo(string PerfChar, string invoiceNo) { RegPatient patient = new RegPatient(); DataRow dr = reg_dal.GetRegPatientByInvoiceNo(PerfChar, invoiceNo); if (dr == null) { return(null); } patient.Address = dr[BLL.Tables.patientinfo.PATADDRESS].ToString( ); if (!Convert.IsDBNull(dr[BLL.Tables.patientinfo.PATBRIDATE])) { patient.BornDate = Convert.ToDateTime(dr[BLL.Tables.patientinfo.PATBRIDATE]); } patient.Folk = dr[BLL.Tables.patientinfo.PATGROUP].ToString( ); patient.HisCardNo = dr[BLL.Tables.patientinfo.MEDICARD].ToString( ); patient.IDCard = dr[BLL.Tables.patientinfo.PATNUMBER].ToString( ); patient.Occupation = dr[BLL.Tables.patientinfo.PATJOB].ToString( ); patient.PatID = Convert.ToDecimal(dr[BLL.Tables.patientinfo.PATID]); patient.PatListID = Convert.ToInt32(dr[BLL.Tables.mz_patlist.PATLISTID]); patient.PatientName = dr[BLL.Tables.patientinfo.PATNAME].ToString( ); patient.Sex = dr[BLL.Tables.patientinfo.PATSEX].ToString( ); patient.Tel = dr[BLL.Tables.patientinfo.PATTEL].ToString( ); patient.PatType = new PatientType( ); patient.PatType.Code = dr[BLL.Tables.mz_patlist.MEDITYPE].ToString( ); //patient.PatType.Name = PublicDataReader.GetPatientTypeNameByCode( patient.PatType.Code ); patient.PatType.Name = BaseDataController.GetName(BaseDataCatalog.病人类型列表, patient.PatType.Code); return(patient); }
/// <summary> /// 增加一个病人 /// </summary> /// <param name="Patient"></param> public void AddNewPatient(RegPatient Patient) { Model.PatientInfo patientInfo = null; if (Patient.HisCardNo.Trim( ) != "") { string strWhere = Tables.patientinfo.MEDICARD + oleDb.EuqalTo( ) + "'" + Patient.HisCardNo + "'"; patientInfo = BindEntity <Model.PatientInfo> .CreateInstanceDAL(oleDb).GetModel(strWhere); if (patientInfo != null) { throw new OperatorException("就诊卡号重复!"); } } patientInfo = new HIS.Model.PatientInfo( ); patientInfo.PatName = Patient.PatientName; patientInfo.PatSex = Patient.Sex; patientInfo.MediCard = Patient.HisCardNo; patientInfo.PatBriDate = Patient.BornDate; patientInfo.PatGroup = Patient.Folk; patientInfo.PatTEL = Patient.Tel; patientInfo.PatAddress = Patient.Address; patientInfo.PATJOB = Patient.Occupation; BindEntity <Model.PatientInfo> .CreateInstanceDAL(oleDb).Add(patientInfo); Patient.PatID = patientInfo.PatID; }
/// <summary> /// 查找病人 /// </summary> /// <param name="Patient"></param> /// <returns></returns> public DataTable FindPatient(RegPatient Patient, bool AndOr) { string condiction = ""; string andOr = AndOr ? oleDb.And( ) : oleDb.Or( ); if (Patient != null) { if (Patient.PatientName.Trim( ) != "") { if (condiction.Trim() == "") { condiction += Tables.patientinfo.PATNAME + oleDb.Like( ) + "'%" + Patient.PatientName + "%'"; } else { condiction += andOr + Tables.patientinfo.PATNAME + oleDb.Like( ) + "'%" + Patient.PatientName + "%'"; } } if (Patient.HisCardNo.Trim( ) != "") { if (condiction.Trim( ) == "") { condiction += Tables.patientinfo.MEDICARD + oleDb.Like( ) + "'%" + Patient.HisCardNo + "%'"; } else { condiction += andOr + Tables.patientinfo.MEDICARD + oleDb.Like( ) + "'%" + Patient.HisCardNo + "%'"; } } if (Patient.Sex.Trim( ) != "") { if (condiction.Trim() == "") { condiction += Tables.patientinfo.PATSEX + oleDb.EuqalTo( ) + "'" + Patient.Sex + "'"; } else { condiction += andOr + Tables.patientinfo.PATSEX + oleDb.EuqalTo( ) + "'" + Patient.Sex + "'"; } } if (Patient.IDCard.Trim( ) != "") { if (condiction.Trim() == "") { condiction += Tables.patientinfo.PATNUMBER + oleDb.Like( ) + "'%" + Patient.IDCard + "%'"; } else { condiction += andOr + Tables.patientinfo.PATNUMBER + oleDb.Like( ) + "'%" + Patient.IDCard + "%'"; } } } return(BindEntity <Model.PatientInfo> .CreateInstanceDAL(oleDb).GetList(condiction)); }
/// <summary> /// 保存挂号病人基本信息 /// </summary> /// <param name="Patient"></param> /// <returns></returns> public bool SaveRegPatient(RegPatient Patient) { HIS.Model.PatientInfo mz_patient = null; try { mz_patient = BindEntity <Model.PatientInfo> .CreateInstanceDAL(oleDb).GetModel("PatID=" + Patient.PatID.ToString( )); if (mz_patient == null) { (new CardController( )).AddNewPatient(Patient); } else { (new CardController( )).UpdatePatient(Patient); } //mz_patient.ADDRESS = Patient.Address; //mz_patient.BORNDAY = Patient.BornDate; //mz_patient.CARDNO = Patient.HisCardNo; //mz_patient.FOLK = Patient.Folk; //mz_patient.IDCARD = Patient.IDCard; //mz_patient.OCCUPATION = Patient.Occupation; //mz_patient.PATNAME = Patient.PatientName; //mz_patient.SEX = Patient.Sex; //mz_patient.TEL = Patient.Tel; //mz_patient.TYPE = Convert.ToInt32( Patient.PatType.Code ); //mz_patient.TYPE_NAME = Patient.PatType.Name; //if ( !Patient.ValidCardNo ) //{ // BindEntity<Model.MZ_PATIENT>.CreateInstanceDAL( oleDb ).Add( mz_patient ); // Patient.PatID = mz_patient.PATID; //} //else //{ // BindEntity<Model.MZ_PATIENT>.CreateInstanceDAL( oleDb ).Update( mz_patient ); //} return(true); } catch (OperatorException operr) { throw operr; } catch (Exception err) { ErrorWriter.WriteLog(err.Message); throw new Exception("保存病人基本信息失败!"); } }
public bool FindPatient(string hisCardNo) { HIS.MZ_BLL.RegController regController = new HIS.MZ_BLL.RegController(); regController.OperatorId = view.OperatorId; HIS.MZ_BLL.RegPatient patient = regController.GetPatientBaseInfoByHisCardNo(hisCardNo); if (patient == null) { patient = new HIS.MZ_BLL.RegPatient( ); view.Patient = patient; return(false); } else { view.Patient = patient; view.Patient.ValidCardNo = false; return(true); } }
/// <summary> /// 更新病人信息 /// </summary> /// <param name="Patient">要更新的病人信息</param> public void UpdatePatient(RegPatient Patient) { Model.PatientInfo patientInfo = null; string strWhere = Tables.patientinfo.MEDICARD + oleDb.EuqalTo( ) + "'" + Patient.HisCardNo + "'" + oleDb.And() + Tables.patientinfo.PATID + oleDb.NotEqualTo() + Patient.PatID; patientInfo = BindEntity <Model.PatientInfo> .CreateInstanceDAL(oleDb).GetModel(strWhere); if (patientInfo != null) { throw new OperatorException("就诊卡号重复!"); } BindEntity <Model.PatientInfo> .CreateInstanceDAL(oleDb).Update(Tables.patientinfo.PATID + oleDb.EuqalTo( ) + Patient.PatID, patientInfo.PatName + oleDb.EuqalTo( ) + "'" + Patient.PatientName + "'", patientInfo.PatSex + oleDb.EuqalTo( ) + "'" + Patient.Sex + "'", patientInfo.MediCard + oleDb.EuqalTo( ) + "'" + Patient.HisCardNo + "'", patientInfo.PatBriDate + oleDb.EuqalTo( ) + "'" + Patient.BornDate + "'", patientInfo.PatGroup + oleDb.EuqalTo( ) + "'" + Patient.Folk + "'", patientInfo.PatTEL + oleDb.EuqalTo( ) + "'" + Patient.Tel + "'", patientInfo.PatAddress + oleDb.EuqalTo( ) + "'" + Patient.Address + "'", patientInfo.PATJOB + oleDb.EuqalTo( ) + "'" + Patient.Occupation + "'"); }
/// <summary> /// 正式挂号过程 /// </summary> /// <param name="Patient"></param> /// <returns></returns> public bool RegisterPrecess(RegPatient Patient) { oleDb.BeginTransaction(); try { Patient.VisitNo = CreateVisitNo( ); //正式挂号前创建一个门诊号 bool ret = Register(Patient); oleDb.CommitTransaction( ); return(ret); } catch (OperatorException operr) { oleDb.RollbackTransaction( ); throw operr; } catch (Exception err) { oleDb.RollbackTransaction( ); ErrorWriter.WriteLog(err.Message); throw new Exception("挂号登记发生错误!"); } }
/// <summary> /// 预算处理过程 /// </summary> /// <param name="Patient"></param> /// <returns></returns> public bool BudgetProcess(RegPatient Patient) { oleDb.BeginTransaction(); try { //费用预算 bool ret = Budget(Patient); oleDb.CommitTransaction( ); return(true); } catch (OperatorException operr) { oleDb.RollbackTransaction( ); throw operr; } catch (Exception err) { oleDb.RollbackTransaction( ); ErrorWriter.WriteLog(err.Message); throw new Exception("挂号费用计算发生错误!请重试"); } }
/// <summary> /// 退号 /// </summary> /// <param name="RegInvoiceNo"></param> /// <returns></returns> public bool CancelRegister(string RegInvoiceNo, string PerfChar) { try { RegPatient Patient = GetPatientInfoByInvoiceNo(PerfChar, RegInvoiceNo); if (Patient == null) { throw new OperatorException("没有找到挂号病人信息!\r\n1、请确认挂号收据号是否正确。\r\n2、如果发票有前缀字符,请确认是否输入前缀字符。\r\n3、确认该号是否已经退号"); } OutPatient patient = new OutPatient(Patient.PatListID); Prescription[] pres = patient.GetPrescriptions(PresStatus.全部, true); if (pres.Length > 0) { throw new OperatorException("该病人已经有就诊记录,不能退号"); } register = RegisterObject.RegisterFactory.CreateRegisterObject(Patient.PatType.Code); register.OperatorId = this.operatorId; register.OperatorName = this.operatorName; try { return(register.CancelRegister(RegInvoiceNo, PerfChar)); } catch (OperatorException operr) { throw operr; } catch (Exception e1) { ErrorWriter.WriteLog(e1.Message); throw new Exception("退号操作不成功!请重试"); } } catch (Exception err) { throw err; } }
/// <summary> /// 根据医院诊疗卡获取病人信息 /// </summary> /// <param name="HisCardNo"></param> /// <returns></returns> public RegPatient GetPatientBaseInfoByHisCardNo(string HisCardNo) { RegPatient patient = new RegPatient(); DataRow dr = reg_dal.GetRegPatientByHisCardNo(HisCardNo); if (dr == null) { return(null); } patient.Address = dr[BLL.Tables.patientinfo.PATADDRESS].ToString(); patient.BornDate = Convert.ToDateTime(dr[BLL.Tables.patientinfo.PATBRIDATE]); patient.Folk = dr[BLL.Tables.patientinfo.PATGROUP].ToString( ); patient.HisCardNo = HisCardNo; patient.IDCard = dr[BLL.Tables.patientinfo.PATNUMBER].ToString( ); patient.Occupation = dr[BLL.Tables.patientinfo.PATJOB].ToString( ); patient.PatID = Convert.ToDecimal(dr[BLL.Tables.patientinfo.PATID]); patient.PatientName = dr[BLL.Tables.patientinfo.PATNAME].ToString( ); patient.Sex = dr[BLL.Tables.patientinfo.PATSEX].ToString( ); patient.Tel = dr[BLL.Tables.patientinfo.PATTEL].ToString( ); //patient.PatType.Code = dr[BLL.Tables.mz_patlist.MEDITYPE].ToString( ).Trim( ); return(patient); }