/// <summary> /// 发票流水号获得病人 /// </summary> /// <param name="InvoiceSerialNo">发票号</param> public OutPatient(string VisitNo) { List <HIS.Model.MZ_CostMaster> models = null; HIS.Model.MZ_PatList model = null; model = (MZ_PatList)MSAccessDb.GetModel("MZ_PATLIST", Tables.mz_patlist.VISITNO + "='" + VisitNo + "'", typeof(MZ_PatList)); if (model == null) { throw new Exception("输入的门诊就诊号找不到病人登记信息"); } this.PatListID = model.PatListID; this.PatID = model.PatID; this.PatientName = model.PatName; this.VisitNo = model.VisitNo; this.Sex = model.PatSex; this.Age = model.Age; this.PYM = model.PYM; this.WBM = model.WBM; _mediCard = model.MediCard; _mediType = model.MediType; _hpCode = model.HpCode; _hpGrade = model.HpGrade; _cureDeptCode = model.CureDeptCode; _cureEmpCode = model.CureEmpCode; _diseaseCode = model.DiseaseCode; string[] disease = model.DiseaseName.Split("|".ToCharArray()); _diseaseName = disease[0]; if (disease.Length > 1) { _diseaseMemo = disease[1]; } _cureDate = model.CureDate; }
/// <summary> /// 更新本次就诊登记信息 /// </summary> /// <returns>成功标识;true</returns> public bool UpdateRegister() { //HIS.SYSTEM.DatabaseAccessLayer.OleDB oleDB = new HIS.SYSTEM.DatabaseAccessLayer.OleDB( ); //oleDB.Initialize( ); try { //HIS.DAL.MZ_PatList mz_patList = new HIS.DAL.MZ_PatList( ); //mz_patList._OleDB = oleDB; HIS.Model.MZ_PatList register = (MZ_PatList)MSAccessDb.GetModel("MZ_PATLIST", Tables.mz_patlist.PATLISTID + "=" + this.PatListID, typeof(MZ_PatList)); register.CureDeptCode = _cureDeptCode; //就诊科室 register.CureEmpCode = _cureEmpCode; //就诊医生 register.DiseaseCode = _diseaseCode; //疾病代码 if (register.REG_DOC_CODE.Trim( ) == "") { //如果挂号医生为空,则将挂号医生更改为当前就诊医生 register.REG_DOC_CODE = _cureEmpCode; register.REG_DOC_NAME = DataReader.GetEmployeeNameById(Convert.ToInt32(_cureEmpCode)); register.REG_DEPT_CODE = _cureDeptCode; register.REG_DEPT_NAME = DataReader.GetDeptNameById(Convert.ToInt32(_cureDeptCode)); } register.DiseaseName = _diseaseName.Replace("|", "") + "|" + _diseaseMemo.Replace("|", ""); //疾病名称 register.HpCode = _hpCode; //就医机构代码 register.HpGrade = _hpGrade; //就医机构级别 register.MediCard = _mediCard; //医疗证卡号 register.MediType = _mediType; //就诊类型 register.PatCode = ""; //病人代码???? register.PatID = this.PatID; //病人ID,如果是普通病人,则为0;否则参见PatientInfo.PatID; register.PatListID = this.PatListID; //本次就诊号 register.PatName = this.PatientName; //病人姓名 register.PatSex = this.Sex; //性别 register.PYM = this.PYM; //拼音码 register.WBM = this.WBM; //五笔码 register.Age = this.Age; //年龄 register.VisitNo = this.VisitNo; //就诊号(门诊号) MSAccessDb.UpdateRecord(register); //将处方表中挂号的记录改为处方医生 string strWhere = Tables.mz_presmaster.PATLISTID + "=" + this.PatListID + " and " + Tables.mz_presmaster.HAND_FLAG + "= 0"; MZ_PresMaster mz_presmaster = (MZ_PresMaster)MSAccessDb.GetModel("MZ_PRESMASTER", strWhere, typeof(MZ_PresMaster)); if (mz_presmaster != null) { if (mz_presmaster.PresDocCode == null || mz_presmaster.PresDocCode.Trim( ) == "") { strWhere += " and " + Tables.mz_presmaster.PRESMASTERID + "=" + mz_presmaster.PresMasterID; MSAccessDb.UpdateRecord(new string[] { Tables.mz_presmaster.PRESDOCCODE + "=" + "'" + _cureEmpCode + "'", Tables.mz_presmaster.PRESDEPTCODE + "=" + "'" + _cureDeptCode + "'" }, strWhere, typeof(MZ_PresMaster)); } } return(true); } catch (Exception err) { throw new Exception("更新病人等级信息发生错误!"); } }
/// <summary> /// 根据病人ID获得病人的费用明细 /// </summary> /// <param name="id"></param> /// <param name="IsConfird"></param> /// <param name="deptid"></param> /// <param name="docid"></param> /// <returns></returns> public override DataTable FindDetails(string id, bool IsConfird, int deptid, int docid) { string strWhere = Tables.mz_patlist.VISITNO + oleDb.EuqalTo() + "'" + id + "'"; HIS.Model.MZ_PatList mzpat = BindEntity <HIS.Model.MZ_PatList> .CreateInstanceDAL(oleDb).GetModel(strWhere); if (mzpat == null) { return(null); } List <HIS.Model.MZ_PatList> mzplist = new List <HIS.Model.MZ_PatList>(); mzplist.Add(mzpat); return(MzGetFee.GetMzItems(mzplist, IsConfird, deptid, docid)); }
/// <summary> /// 发票号 /// </summary> /// <param name="InviceNo"></param> /// <param name="InvoiceType"></param> public OutPatient(string InviceNo, OPDBillKind InvoiceType) { List <HIS.Model.MZ_CostMaster> models = null; HIS.Model.MZ_PatList model = null; string strWhere = ""; if (InvoiceType == OPDBillKind.门诊收费发票) { strWhere = "TICKETNUM='" + InviceNo + "'" + " and " + Tables.mz_costmaster.HANG_FLAG + " = 1"; } else { strWhere = "TICKETNUM='" + InviceNo + "'" + " and " + Tables.mz_costmaster.HANG_FLAG + " = 0"; } models = MSAccessDb.GetListArray <MZ_CostMaster>("MZ_COSTMASTER", strWhere); if (models.Count == 0) { throw new Exception("输入的发票流水号找不到病人登记信息"); } else { model = (MZ_PatList)MSAccessDb.GetModel("MZ_PATLIST", Tables.mz_patlist.PATLISTID + "=" + models[0].PatListID, typeof(MZ_PatList)); } this.PatListID = model.PatListID; this.PatID = model.PatID; this.PatientName = model.PatName; this.VisitNo = model.VisitNo; this.Sex = model.PatSex; this.Age = model.Age; this.PYM = model.PYM; this.WBM = model.WBM; _mediCard = model.MediCard; _mediType = model.MediType; _hpCode = model.HpCode; _hpGrade = model.HpGrade; _cureDeptCode = model.CureDeptCode; _cureEmpCode = model.CureEmpCode; _diseaseCode = model.DiseaseCode; string[] disease = model.DiseaseName.Split("|".ToCharArray( )); _diseaseName = disease[0]; if (disease.Length > 1) { _diseaseMemo = disease[1]; } _cureDate = model.CureDate; }
/// <summary> /// 登记本次就诊 /// </summary> /// <returns>本次就诊号</returns> public int NewRegister() { MSAccessDb.BeginTrans(); try { HIS.Model.MZ_PatList register = new HIS.Model.MZ_PatList( ); register.CureDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")); //就诊日期 register.CureDeptCode = _cureDeptCode; //就诊科室 register.CureEmpCode = _cureEmpCode; //就诊医生 register.DiseaseCode = _diseaseCode; //疾病代码 register.DiseaseName = _diseaseName; //疾病名称 register.HpCode = _hpCode; //就医机构代码 register.HpGrade = _hpGrade; //就医机构级别 register.MediCard = _mediCard; //医疗证卡号 register.MediType = _mediType; //就诊类型 register.PatCode = " "; //病人代码 register.PatID = 0; //病人ID,如果是普通病人,则为0;否则参见PatientInfo.PatID; register.PatName = PatientName; //病人姓名 register.PatSex = Sex; //性别 register.PYM = " "; //拼音码 register.WBM = " "; //五笔码 register.Age = Age; register.VisitNo = " "; //( new RegController( ) ).CreateVisitNo( ); register.PatListID = MSAccessDb.GetMaxID("MZ_PATLIST", Tables.mz_patlist.PATLISTID); int newRegisterno = 0; MSAccessDb.InsertRecord(register, Tables.mz_patlist.PATLISTID); newRegisterno = register.PatListID; if (newRegisterno > 0) { this.PatListID = newRegisterno; this.VisitNo = register.VisitNo; MSAccessDb.CommitTrans( ); return(this.PatListID); //返回就诊ID } else { throw new Exception("创建病人登记信息失败!"); } } catch (Exception err) { MSAccessDb.RollbackTrans( ); throw new Exception("新登记病人信息发生错误!"); } }
/// <summary> /// 得到门诊病人列表 /// </summary> /// <param name="IsConfird">true= 已确费 false=未确费</param> /// <param name="deptid"></param> /// <param name="docid"></param> /// <param name="bdate"></param> /// <param name="edate"></param> /// <returns></returns> public override List <HIS.Model.MZ_PatList> GetMzList(bool IsConfird, int deptid, int docid, DateTime?bdate, DateTime?edate) { if (IsConfird) { string strWhere =// Tables.medical_confir.CONFIRDOC + oleDb.EuqalTo() + docid + oleDb.And() + //不根据确费医生加载 Tables.medical_confir.CANCEL_FLAG + oleDb.EuqalTo() + 0 + oleDb.And() + Tables.medical_confir.CONFIRDATE + oleDb.GreaterThanAndEqualTo() + "'" + bdate.Value.Date + "'" + oleDb.And() + Tables.medical_confir.CONFIRDATE + oleDb.LessThanAndEqualTo() + "'" + edate.Value.Date.AddDays(1) + "'" + oleDb.And() + Tables.medical_confir.MARK_FLAG + oleDb.EuqalTo() + 0; List <HIS.Model.Medical_Confir> confird = BindEntity <HIS.Model.Medical_Confir> .CreateInstanceDAL(oleDb).GetListArray(strWhere); if (confird == null || confird.Count == 0) { return(null); } List <HIS.Model.MZ_PatList> patlists = new List <HIS.Model.MZ_PatList>(); for (int i = 0; i < confird.Count; i++) { HIS.Model.MZ_PatList plist = BindEntity <HIS.Model.MZ_PatList> .CreateInstanceDAL(oleDb).GetModel(confird[i].PatListId); int j = 0; for (j = 0; j < patlists.Count; j++) { if (patlists[j].PatListID == plist.PatListID) { break; } } if (j == patlists.Count) { patlists.Add(plist); } } return(patlists); } else { object obj = GetConfig(); string strsql = ""; if (obj == null || obj.ToString().Trim() == "1") //按医技科室确费 2010.9.19 heyan { strsql = "select distinct(a.patlistid) from mz_presorder a left outer join BASE_ITEM_DEPT b on a.itemid=b.item_id left outer join mz_presmaster c " + " on a.presmasterid= c.presmasterid left outer join mz_costmaster d on c.presmasterid=d.presmasterid where b.dept_id =" + deptid + " " + " and a.itemtype='00' and d.costdate >='" + bdate.Value.Date + "' and d.costdate<='" + edate.Value.Date.AddDays(1) + "'and c.charge_flag=1 and a.workid=" + HIS.SYSTEM.Core.EntityConfig.WorkID + " " + " and a.presorderid not in (select presorderid from medical_confir where cancel_flag=0 and mark_flag=0)"; } else { strsql = "select distinct(a.patlistid) from mz_presorder a left outer join mz_presmaster c " + " on a.presmasterid= c.presmasterid left outer join mz_costmaster d on c.presmasterid=d.presmasterid where " + " a.itemtype='00' and d.costdate >='" + bdate.Value.Date + "' and d.costdate<='" + edate.Value.Date.AddDays(1) + "'and c.charge_flag=1 and a.workid=" + HIS.SYSTEM.Core.EntityConfig.WorkID + " " + " and a.presorderid not in (select presorderid from medical_confir where cancel_flag=0 and mark_flag=0)"; } DataTable dt = oleDb.GetDataTable(strsql); if (dt == null || dt.Rows.Count == 0) { return(null); } List <HIS.Model.MZ_PatList> patlists = new List <HIS.Model.MZ_PatList>(); for (int i = 0; i < dt.Rows.Count; i++) { HIS.Model.MZ_PatList plist = BindEntity <HIS.Model.MZ_PatList> .CreateInstanceDAL(oleDb).GetModel(Convert.ToInt32(dt.Rows[i]["patlistid"])); patlists.Add(plist); } return(patlists); } }