Exemple #1
0
        /// <summary>
        /// 检索一个病人的所有处方头信息
        /// </summary>
        /// <param name="queryPat">门诊发药病人</param>
        /// <returns>处方头列表</returns>
        public DataTable GetPrescriptions(Structs.FY_MZ_Patient queryPat, int drFlag)
        {
            string invoiceNum;

            if (queryPat.InvoiceNum == "" || queryPat.InvoiceNum == null)
            {
                invoiceNum = "";
            }
            else
            {
                invoiceNum = Convert.ToInt32(queryPat.InvoiceNum.Trim()).ToString();
            }
            string sql = @"select 
                            Charge_Flag, 
                            ChargeCode ,
                            CostMasterID as ChargeID,
                            Drug_Flag,
                            ExecDeptCode,
                            ExecDocCode,
                            b.name as exeDocName, 
                            a.PatID as PatientID,
                            d.patname as PatientName,  
                            PresAmount ,
                            PresCostCode,  
                             PresMasterID as PrescriptionID,
                            PresType as PrescType  ,
                            PresDate,
                            PresDeptCode,
                            c.name as presDeptName, 
                            PresDocCode,
                            e.name as PresDocName,
                            Record_Flag ,
                            a.PatListID as RegisterID, 
                            TicketCode ,
                            TicketNum ,
                            Total_Fee 
                            from mz_presmaster a 
                            left join base_employee_property b on a.ExecdocCode = cast(b.employee_id as char(10)) and a.workid=b.workid
                            left join base_dept_property c on a.ExecDeptCode = cast(c.dept_id as char(10)) and a.workid=c.workid
                            left join mz_patlist d on a.patlistid=d.patlistid and a.workid=d.workid 
                            left join base_employee_property e on a.PresDocCode = cast(e.employee_id as char(10)) and a.workid=e.workid
                            where a.ticketnum='" + invoiceNum + "' and a.prestype in ('0','1','2','3') and a.charge_flag=1 and a.drug_flag="
                         + drFlag.ToString() + " and a.record_flag=0 and a.ExecDeptCode='" + queryPat.ExecDeptId.ToString() + "'";

            return(oleDb.GetDataTable(sql));
        }
Exemple #2
0
        /// <summary>
        /// 按发票号检索门诊待发药病人
        /// </summary>
        /// <param name="inVoiceNum">发票号</param>
        /// <returns>门诊发药病人</returns>
        public HIS.Interface.Structs.FY_MZ_Patient GetPatient(string PerfChar, string inVoiceNum, int deptId, int drFlag)
        {
            HIS.Interface.Structs.FY_MZ_Patient patient = new HIS.Interface.Structs.FY_MZ_Patient( );

            string strWhere = "a." + Tables.mz_presmaster.PATLISTID + oleDb.EuqalTo( ) + "b." + Tables.mz_patlist.PATLISTID;

            strWhere += oleDb.And( ) + Tables.mz_presmaster.TICKETNUM + oleDb.EuqalTo( ) + "'" + Convert.ToInt64(inVoiceNum).ToString( ) + "'";
            strWhere += oleDb.And( ) + Tables.mz_presmaster.TICKETCODE + oleDb.EuqalTo( ) + "'" + PerfChar.Trim() + "'";
            strWhere += oleDb.And( ) + Tables.mz_presmaster.RECORD_FLAG + oleDb.EuqalTo( ) + "0";
            strWhere += oleDb.And( ) + Tables.mz_presmaster.PRESTYPE + oleDb.In( ) + "('0','1','2','3')";
            strWhere += oleDb.And( ) + Tables.mz_presmaster.CHARGE_FLAG + oleDb.EuqalTo( ) + "1";
            strWhere += oleDb.And( ) + Tables.mz_presmaster.DRUG_FLAG + oleDb.EuqalTo( ) + drFlag;
            strWhere += oleDb.And() + Tables.mz_presmaster.EXECDEPTCODE + oleDb.EuqalTo() + "'" + deptId.ToString() + "'";

            string table1 = oleDb.TableName(oleDb.TableNameBM(Tables.MZ_PRESMASTER, "a"), oleDb.TableNameBM(Tables.MZ_PATLIST, "b"));

            string sql = oleDb.Table(table1, "", strWhere,
                                     "a." + Tables.mz_presmaster.TICKETNUM,
                                     "a." + Tables.mz_presmaster.TICKETCODE,
                                     "b." + Tables.mz_patlist.PATNAME,
                                     "b." + Tables.mz_patlist.PATSEX,
                                     "b." + Tables.mz_patlist.AGE);
            DataTable tb = oleDb.GetDataTable(sql);

            if (tb.Rows.Count == 0)
            {
                throw new Exception("没有找到病人信息!");
            }

            patient.InvoiceNum = inVoiceNum;
            patient.PerfChar   = tb.Rows[0]["TICKETCODE"].ToString( );
            patient.PatAge     = tb.Rows[0]["AGE"].ToString( );
            patient.PatName    = tb.Rows[0]["PatName"].ToString( );
            patient.PatSex     = tb.Rows[0]["PATSEX"].ToString( );
            patient.ExecDeptId = deptId;
            return(patient);
        }