/// <summary>
        /// 加载常用诊断数据
        /// </summary>
        /// <param name="employeeid">所属医生Id</param>
        /// <returns>常用诊断数据表</returns>
        public DataTable LoadCommonData(long employeeid)
        {
            string strsql = Tables.mz_doc_commondiagnosis.RECORD_DOC + _oleDb.EuqalTo() + employeeid
                            + _oleDb.And() + Tables.mz_doc_commondiagnosis.DELETE_BIT + _oleDb.EuqalTo() + 0 + _oleDb.OrderBy("Frequency desc");

            return(BindEntity <Model.Mz_Doc_CommonDiagnosis> .CreateInstanceDAL(_oleDb).GetList(strsql));
        }
Example #2
0
        /// <summary>
        /// 病历记录
        /// </summary>
        /// <param name="patId">病人ID</param>
        /// <param name="patListId">病人就诊ID</param>
        /// <param name="emrTypeCode">病历类型编码</param>
        public EmrRecord(long patId, long patListId, string emrTypeCode)
        {
            _oleDb = BaseBLL.oleDb;
            Model.Emr_Record tmpRecord = BindEntity <Model.Emr_Record> .CreateInstanceDAL(_oleDb).GetModel(
                HIS.BLL.Tables.emr_record.PATID + _oleDb.EuqalTo() + patId + _oleDb.And() +
                HIS.BLL.Tables.emr_record.PATLISTID + _oleDb.EuqalTo() + patListId + _oleDb.And() +
                HIS.BLL.Tables.emr_record.RECORDTYPE + _oleDb.EuqalTo() + "'" + emrTypeCode.Trim() + "'" + _oleDb.And() +
                HIS.BLL.Tables.emr_record.RECORDFLAG + _oleDb.EuqalTo() + 0);

            if (tmpRecord == null)
            {
                this.RecordId = -1;
            }
            else
            {
                this.RecordId         = tmpRecord.RecordId;
                this.PatId            = tmpRecord.PatId;
                this.PatListId        = tmpRecord.PatListId;
                this.RecordType       = tmpRecord.RecordType;
                this.RecordContent    = tmpRecord.RecordContent;
                this.RecordCreateEmp  = tmpRecord.RecordCreateEmp;
                this.RecordCreateDept = tmpRecord.RecordCreateDept;
                this.RecordCreateDate = tmpRecord.RecordCreateDate;
                this.HistoryRecordId  = tmpRecord.HistoryRecordId;
                this.RecordFlag       = tmpRecord.RecordFlag;
                this.UpdateFlag       = tmpRecord.UpdateFlag;
                this.Delete_Bit       = tmpRecord.Delete_Bit;
            }
        }
Example #3
0
        /// <summary>
        /// 获得处方明细列表
        /// </summary>
        /// <param name="condition">查询条件</param>
        /// <returns></returns>
        public List <PresDetail> GetPresDetailList(string condition)
        {
            string strsql = HIS.BLL.Tables.mz_doc_preslist.PRESHEADID + _oleDb.EuqalTo() + this.PresHeadId
                            + _oleDb.And() + HIS.BLL.Tables.mz_doc_preslist.DELETE_BIT + _oleDb.EuqalTo() + 0
                            + (condition == "" ? "" : (_oleDb.And() + condition))
                            + _oleDb.OrderBy(HIS.BLL.Tables.mz_doc_preslist.ORDERNO);

            return((List <PresDetail>)Public.Function.DataTableToList <PresDetail>(BindEntity <HIS.Model.Mz_Doc_PresList> .CreateInstanceDAL(_oleDb).GetList(strsql)));
        }
        public DataSet GetMouldData()
        {
            DataSet dataSet  = new DataSet();
            string  strwhere = Tables.mz_doc_medicalapply_mould.LEVEL + _oleDb.EuqalTo() + 1
                               + _oleDb.And() + HIS.BLL.Tables.mz_doc_medicalapply_mould.ELEMENT_NAME + _oleDb.EuqalTo() + "'" + this.Element_Name + "'"
                               + _oleDb.And() + HIS.BLL.Tables.mz_doc_medicalapply_mould.MEDICAL_CLASS + _oleDb.EuqalTo() + this.Medical_Class;
            DataTable table = BindEntity <HIS.Model.Mz_Doc_MedicalApply_Mould> .CreateInstanceDAL(_oleDb).GetList(strwhere);

            table.TableName = "LevelHMould";
            dataSet.Tables.Add(table);

            strwhere = Tables.mz_doc_medicalapply_mould.LEVEL + _oleDb.EuqalTo() + 2
                       + _oleDb.And() + HIS.BLL.Tables.mz_doc_medicalapply_mould.ELEMENT_NAME + _oleDb.EuqalTo() + "'" + this.Element_Name + "'"
                       + _oleDb.And() + HIS.BLL.Tables.mz_doc_medicalapply_mould.CREATE_DEPT + _oleDb.EuqalTo() + this.Create_Dept
                       + _oleDb.And() + HIS.BLL.Tables.mz_doc_medicalapply_mould.MEDICAL_CLASS + _oleDb.EuqalTo() + this.Medical_Class;
            table = BindEntity <HIS.Model.Mz_Doc_MedicalApply_Mould> .CreateInstanceDAL(_oleDb).GetList(strwhere);

            table.TableName = "LevelDMould";
            dataSet.Tables.Add(table);

            strwhere = Tables.mz_doc_medicalapply_mould.LEVEL + _oleDb.EuqalTo() + 3
                       + _oleDb.And() + HIS.BLL.Tables.mz_doc_medicalapply_mould.ELEMENT_NAME + _oleDb.EuqalTo() + "'" + this.Element_Name + "'"
                       + _oleDb.And() + HIS.BLL.Tables.mz_doc_medicalapply_mould.CREATE_EMP + _oleDb.EuqalTo() + this.Create_Emp
                       + _oleDb.And() + HIS.BLL.Tables.mz_doc_medicalapply_mould.MEDICAL_CLASS + _oleDb.EuqalTo() + this.Medical_Class;
            table = BindEntity <HIS.Model.Mz_Doc_MedicalApply_Mould> .CreateInstanceDAL(_oleDb).GetList(strwhere);

            table.TableName = "LevelPMould";
            dataSet.Tables.Add(table);

            return(dataSet);
        }
Example #5
0
 /// <summary>
 /// 按查询条件获取门诊人次
 /// </summary>
 /// <param name="strWhere">查询条件</param>
 /// <returns>门诊人次</returns>
 public int GetMZPopulation(string strWhere)
 {
     try
     {
         string        workId = HIS.SYSTEM.Core.EntityConfig.WorkID.ToString();
         StringBuilder strSql = new StringBuilder();
         strSql.Append("select count(1) from (");
         strSql.Append("select a.visitno from yzcx_mz_cost a");
         strSql.Append(" where a.workid=" + workId + _oleDb.And() + strWhere);
         strSql.Append(" group by a.visitno");
         strSql.Append(") as b");
         object obj = _oleDb.GetDataResult(strSql.ToString());
         if (obj != null)
         {
             int result;
             if (Int32.TryParse(obj.ToString(), out result))
             {
                 return(result);
             }
             else
             {
                 return(0);
             }
         }
         return(0);
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Example #6
0
        /// <summary>
        /// 获得处方头列表
        /// </summary>
        /// <param name="type">处方类型(1:未收费处方,2:未收费和已收费的正常处方,3:包含已退费的所有处方)</param>
        /// <returns></returns>
        private List <PresHead> GetPresHeadList(int type)
        {
            string strsql = HIS.BLL.Tables.mz_doc_preshead.PATLISTID + _oleDb.EuqalTo() + this.PatListId
                            + _oleDb.And() + HIS.BLL.Tables.mz_doc_preshead.PRES_FLAG + _oleDb.LessThan() + type
                            + _oleDb.OrderBy(HIS.BLL.Tables.mz_doc_preshead.PRESHEADID);

            return((List <PresHead>)Public.Function.DataTableToList <PresHead>(BindEntity <HIS.Model.Mz_Doc_PresHead> .CreateInstanceDAL(_oleDb).GetList(strsql)));
        }
Example #7
0
        /// <summary>
        /// 获得模板列表
        /// </summary>
        /// <param name="level">模板级别</param>
        /// <param name="deptId">所属科室</param>
        /// <param name="employeeId">所属医生</param>
        /// <returns></returns>
        public DataTable GetMouldHeadList(int level, long deptId, long employeeId)
        {
            string strwhere = Tables.mz_doc_presmouldhead.MOULD_LEVEL + _oleDb.EuqalTo() + level
                              + _oleDb.And() + Tables.mz_doc_presmouldhead.DELETE_BIT + _oleDb.EuqalTo() + 0;

            switch (level)
            {
            case 2:
                strwhere = strwhere + _oleDb.And() + HIS.BLL.Tables.mz_doc_presmouldhead.CREATE_DEPT + _oleDb.EuqalTo() + deptId;
                break;

            case 3:
                strwhere = strwhere + _oleDb.And() + HIS.BLL.Tables.mz_doc_presmouldhead.CREATE_DOC + _oleDb.EuqalTo() + employeeId;
                break;

            default:
                break;
            }
            return(BindEntity <HIS.Model.Mz_Doc_PresMouldHead> .CreateInstanceDAL(_oleDb).GetList(strwhere));
        }
Example #8
0
        /// <summary>
        /// 获得病历元素模板列表
        /// </summary>
        /// <returns></returns>
        public DataTable GetElementMould()
        {
            DataTable table = BindEntity <Model.Emr_Mould_Element> .CreateInstanceDAL(_oleDb).GetList(
                HIS.BLL.Tables.emr_mould_element.MOULDTYPE + _oleDb.EuqalTo() + "'" + this.ElementCode.Trim() + "'" +
                _oleDb.And() + HIS.BLL.Tables.emr_mould_element.DELETE_BIT + _oleDb.EuqalTo() + 0 +
                _oleDb.OrderBy() + HIS.BLL.Tables.emr_mould_element.MOULDID);

            if (table != null)
            {
                table.Columns.Add("RowNo", Type.GetType("System.Int32"));
                for (int index = 0; index < table.Rows.Count; index++)
                {
                    table.Rows[index]["RowNo"] = index + 1;
                }
            }
            return(table);
        }
Example #9
0
        /// <summary>
        /// 根据条件查询病人列表
        /// </summary>
        /// <param name="patientSearchInfo">病人查询信息</param>
        /// <returns></returns>
        public DataTable Search_PatList(HIS.MZDoc_BLL.Public.PatientSearchInfo patientSearchInfo)// string cardNo, string visitNo, string patName, int deptId, int docId, DateTime beginTime, DateTime endTime)
        {
            string strsql = @"select distinct a.* ,b.name as DeptName, c.name as DocName ,d.PRES_DEPT,d.PRES_DOC
                                from ( select * from mz_patlist where " + Tables.mz_patlist.MEDICARD + _oleDb.Like() + "'%" + patientSearchInfo.CardNo + "%'"
                            + _oleDb.And() + Tables.mz_patlist.VISITNO + _oleDb.Like() + "'%" + patientSearchInfo.VisitNo + "%'"
                            + _oleDb.And() + Tables.mz_patlist.PATNAME + _oleDb.Like() + "'%" + patientSearchInfo.PatName + "%'"
                            + _oleDb.And() + Tables.mz_patlist.DISEASENAME + _oleDb.Like() + "'%" + patientSearchInfo.Diagnosis + "%'"
                            + _oleDb.And() + HIS.BLL.Tables.mz_patlist.VISITNO + _oleDb.NotEqualTo() + "''"
                            + _oleDb.And() + Tables.mz_patlist.CUREDATE + _oleDb.Between() + "'" + patientSearchInfo.BeginTime.Date + "'" + _oleDb.And() + "'" + patientSearchInfo.EndTime.Date.AddDays(1) + "'"
                            + _oleDb.And() + " workid=" + workid + ")a "
                            + " inner join (select * from mz_doc_preshead where ("
                            + Tables.mz_doc_preshead.PRES_DEPT + _oleDb.EuqalTo() + patientSearchInfo.DeptId + _oleDb.Or() + patientSearchInfo.DeptId + _oleDb.EuqalTo() + "-1)"
                            + _oleDb.And() + "(" + Tables.mz_doc_preshead.PRES_DOC + _oleDb.EuqalTo() + patientSearchInfo.DocId + _oleDb.Or() + patientSearchInfo.DocId + _oleDb.EuqalTo() + "-1)"
                            + _oleDb.And() + Tables.mz_doc_preshead.PRES_FLAG + _oleDb.LessThan() + "2" + _oleDb.And() + " workid=" + workid + " ) d on a.patlistid=d.patlistid "
                            + "left join base_dept_property b on d.PRES_DEPT=b.dept_id "
                            + "left join base_employee_property c on d.PRES_DOC=c.employee_id "
                            + "inner join mz_doc_preslist e on d.presheadid=e.presheadid and e.DELETE_BIT=0 where a.workid=" + workid;

//            string strsql = @"select distinct a.* ,b.name as DeptName, c.name as DocName ,d.PRES_DEPT,d.PRES_DOC
//                              from
//                             ( select * from mz_patlist where ";
//            if (patientSearchInfo.CardNo.Trim() != "")
//            {
//                strsql += Tables.mz_patlist.MEDICARD + _oleDb.Like() + "'%" + patientSearchInfo.CardNo + "%'" + _oleDb.And();
//            }
//            if (patientSearchInfo.VisitNo.Trim() != "")
//            {
//                strsql += Tables.mz_patlist.VISITNO + _oleDb.Like() + "'%" + patientSearchInfo.VisitNo + "%'" + _oleDb.And();
//            }
//            if (patientSearchInfo.PatName.Trim() != "")
//            {
//                strsql += Tables.mz_patlist.PATNAME + _oleDb.Like() + "'%" + patientSearchInfo.PatName + "%'" + _oleDb.And();
//            }
//            if (patientSearchInfo.Diagnosis.Trim() != "")
//            {
//                strsql += Tables.mz_patlist.DISEASENAME + _oleDb.Like() + "'%" + patientSearchInfo.Diagnosis + "%'" + _oleDb.And();
//            }
//            strsql += HIS.BLL.Tables.mz_patlist.VISITNO + _oleDb.NotEqualTo() + "''"
//                                 + _oleDb.And() + Tables.mz_patlist.CUREDATE + _oleDb.Between() + "'" + patientSearchInfo.BeginTime.Date + "'" + _oleDb.And() + "'" + patientSearchInfo.EndTime.Date.AddDays(1) + "'"
//                                 + _oleDb.And() + " workid=" + workid + ")a "
//                              + " inner join (select * from mz_doc_preshead where ("
//                              + Tables.mz_doc_preshead.PRES_DEPT + _oleDb.EuqalTo() + patientSearchInfo.DeptId + _oleDb.Or() + patientSearchInfo.DeptId + _oleDb.EuqalTo() + "-1)"
//                              + _oleDb.And() + "(" + Tables.mz_doc_preshead.PRES_DOC + _oleDb.EuqalTo() + patientSearchInfo.DocId + _oleDb.Or() + patientSearchInfo.DocId + _oleDb.EuqalTo() + "-1)"
//                              + _oleDb.And() + Tables.mz_doc_preshead.PRES_FLAG + _oleDb.LessThan() + "2" + _oleDb.And() + " workid=" + workid + " ) d on a.patlistid=d.patlistid "
//                              + "left join base_dept_property b on d.PRES_DEPT=b.dept_id "
//                              + "left join base_employee_property c on d.PRES_DOC=c.employee_id "
//                              + "inner join mz_doc_preslist e on d.presheadid=e.presheadid and e.DELETE_BIT=0 where a.workid=" + workid;
            return(_oleDb.GetDataTable(strsql));
        }
Example #10
0
        /// <summary>
        /// 累加常用项
        /// </summary>
        /// <param name="itemId">医嘱项目ID</param>
        /// <param name="employeeId">操作人员ID</param>
        public void Increase(int itemId, long employeeId)
        {
            Model.Mz_Doc_CommonItem commonItem = BindEntity <Model.Mz_Doc_CommonItem> .CreateInstanceDAL(_oleDb).GetModel(
                BLL.Tables.mz_doc_commonitem.ITEM_ID + _oleDb.EuqalTo() + itemId
                + _oleDb.And() + BLL.Tables.mz_doc_commonitem.RECORD_DOC + _oleDb.EuqalTo() + employeeId
                + _oleDb.And() + BLL.Tables.mz_doc_commonitem.TYPE + _oleDb.EuqalTo() + 0);

            //如果该项目在常用项目表中不存在,则添加新纪录,否则在使用频度上累加一次
            if (commonItem == null)
            {
                commonItem            = new HIS.Model.Mz_Doc_CommonItem();
                commonItem.Item_Id    = itemId;
                commonItem.Type       = 0;
                commonItem.Record_Doc = (int)employeeId;
                commonItem.Frequency  = 1;
                BindEntity <Model.Mz_Doc_CommonItem> .CreateInstanceDAL(_oleDb).Add(commonItem);
            }
            else
            {
                commonItem.Frequency = commonItem.Frequency + 1;
                BindEntity <Model.Mz_Doc_CommonItem> .CreateInstanceDAL(_oleDb).Update(commonItem);
            }
        }
Example #11
0
        /// <summary>
        /// 检查药品实时库存
        /// </summary>
        /// <returns>库存是否充足</returns>
        public bool CheckDrugStoreNum()
        {
            if (this.IsDrug)
            {
                string strsql = Views.vi_clinical_all_items.DRUG_FLAG + _oleDb.EuqalTo() + 1
                                + _oleDb.And() + Views.vi_clinical_all_items.ITEMID + _oleDb.EuqalTo() + this.Item_Id
                                + _oleDb.And() + Views.vi_clinical_all_items.EXECDEPTCODE + _oleDb.EuqalTo() + this.Dept_Id;
                DataTable table = BindEntity <object> .CreateInstanceDAL(_oleDb, Views.VI_CLINICAL_ALL_ITEMS).GetList(strsql);

                if (table != null && table.Rows.Count > 0)
                {
                    decimal storeNum = Convert.ToDecimal(table.Rows[0]["StoreNum"]);
                    if (this.Item_Amount * this.RelationNum * this.Dosage / this.Item_Rate > storeNum)
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }
Example #12
0
        /// <summary>
        /// 添加模板
        /// </summary>
        public void Add()
        {
            DataTable table = BindEntity <Model.Emr_Mould_Class> .CreateInstanceDAL(_oleDb).GetList(
                Tables.emr_mould_class.MOULDNAME + _oleDb.EuqalTo() + "'" + this.MouldName.Trim() + "'"
                + _oleDb.And() + Tables.emr_mould_class.DELETE_BIT + _oleDb.EuqalTo() + 0);

            if (table != null && table.Rows.Count > 0)
            {
                throw new Exception("该模板名称已存在,请为模板指定新的名称!");
            }
            BindEntity <Model.Emr_Mould_Class> .CreateInstanceDAL(_oleDb).Add(this);

            Model.Emr_Mould_Content content = new HIS.Model.Emr_Mould_Content();
            content.MouldId      = this.MouldId;
            content.MouldContent = _mouldContent.InnerXml;
            BindEntity <Model.Emr_Mould_Content> .CreateInstanceDAL(_oleDb).Add(content);
        }
Example #13
0
        /// <summary>
        /// 得到优惠费用
        /// </summary>
        /// <param name="SystemType">系统类型 1门诊,2住院</param>
        /// <param name="patientCode">病人类型代码</param>
        /// <param name="CostAllFee">全部费用</param>
        /// <param name="ItemTypeFee">项目数据</param>
        /// <param name="OrderFee">费用数据</param>
        /// <returns></returns>
        public decimal GetfaoverAll_Fee(int SystemType, string patientCode, decimal CostAllFee, List <faoverAllData> ItemTypeFee, List <faoverAllData> OrderFee)
        {
            string    strWhere = Tables.base_patienttype_cost.PATTYPECODE + _OleDB.EuqalTo() + "'" + patientCode + "'";
            DataTable dt       = BindEntity <object> .CreateInstanceDAL(_OleDB, Tables.BASE_PATIENTTYPE_COST).GetList(strWhere, Tables.base_patienttype_cost.PATTYPECODE
                                                                                                                      , Tables.base_patienttype_cost.FAVORABLE_SCALE
                                                                                                                      , Tables.base_patienttype_cost.FAVORABLE_TYPE
                                                                                                                      );

            if (dt.Rows.Count < 1)
            {
                return(0);
            }
            int type = Convert.ToInt32(dt.Rows[0]["FAVORABLE_TYPE"]);

            if (type == 0)
            {
                return(0);//优惠功能待实现
            }
            else if (type == 1)
            {
                decimal scale = Convert.ToDecimal(dt.Rows[0]["FAVORABLE_SCALE"]);
                return(Convert.ToDecimal(CostAllFee * (1 - scale)));
            }
            else if (type == 2)
            {
                decimal dec = 0;
                strWhere = Tables.base_item_favorable.PATTYPECODE + _OleDB.EuqalTo() + "'" + patientCode + "'"
                           + _OleDB.And() + Tables.base_item_favorable.ITEMTYPE_FLAG + _OleDB.EuqalTo() + SystemType;
                DataTable favorData = BindEntity <object> .CreateInstanceDAL(_OleDB, Tables.BASE_ITEM_FAVORABLE).GetList(strWhere);

                for (int k = 0; k < ItemTypeFee.Count; k++)
                {
                    for (int i = 0; i < favorData.Rows.Count; i++)
                    {
                        if (favorData.Rows[i]["ITEMCODE"].ToString().Trim() == ItemTypeFee[k].Code)
                        {
                            decimal fee   = Convert.ToDecimal(ItemTypeFee[k].Totalfee);
                            decimal scale = Convert.ToDecimal(favorData.Rows[i]["FAVORABLE_SCALE"]);
                            dec += fee * (1 - scale);
                            break;
                        }
                    }
                }

                return(dec);
            }
            else if (type == 3)
            {
                decimal dec = 0;

                strWhere = Tables.base_itemmx_favorable.PATTYPECODE + _OleDB.EuqalTo() + "'" + patientCode + "'";
                DataTable favorData = BindEntity <object> .CreateInstanceDAL(_OleDB, Tables.BASE_ITEMMX_FAVORABLE).GetList(strWhere);

                for (int i = 0; i < OrderFee.Count; i++)
                {
                    for (int k = 0; k < favorData.Rows.Count; k++)
                    {
                        if (OrderFee[i].Type == 2)//药品
                        {
                            if (Convert.ToInt32(favorData.Rows[k]["ITEMTYPE"]) == 2 && favorData.Rows[k]["ITEMID"].ToString().Trim() == OrderFee[i].Code.ToString())
                            {
                                decimal fee   = OrderFee[i].Totalfee;
                                decimal scale = Convert.ToDecimal(favorData.Rows[k]["FAVORABLE_SCALE"]);
                                dec += fee * (1 - scale);
                                break;
                            }
                        }
                        else if (OrderFee[i].Type == 0)//服务项目
                        {
                            if (Convert.ToInt32(favorData.Rows[k]["ITEMTYPE"]) == 0 && favorData.Rows[k]["ITEMID"].ToString().Trim() == OrderFee[i].Code.ToString())
                            {
                                decimal fee   = OrderFee[i].Totalfee;
                                decimal scale = Convert.ToDecimal(favorData.Rows[k]["FAVORABLE_SCALE"]);
                                dec += fee * (1 - scale);
                                break;
                            }
                        }
                        else if (OrderFee[i].Type == 1)//组合项目
                        {
                            if (Convert.ToInt32(favorData.Rows[k]["ITEMTYPE"]) == 1 && favorData.Rows[k]["ITEMID"].ToString().Trim() == OrderFee[i].Code.ToString())
                            {
                                decimal fee   = OrderFee[i].Totalfee;
                                decimal scale = Convert.ToDecimal(favorData.Rows[k]["FAVORABLE_SCALE"]);
                                dec += fee * (1 - scale);
                                break;
                            }
                        }
                    }
                }

                return(dec);
            }
            else
            {
                return(0);
            }
        }