Example #1
0
        public DataTable findPackingInfo(int userid, string date, string hospital_name)
        {
            string sql  = "";
            string flag = "";

            flag = db.get_role_by_userid(userid);
            string sql_1 = "";

            if (hospital_name != "0")
            {
                sql_1 = "'" + hospital_name.Replace("_", "','") + "'";
            }
            else
            {
                sql_1 = "select id from hospital";
            }
            if (flag != "0")
            {
                sql = "select p.ID,p.Pspnum,p.customid,p.delnum,p.Hospitalid,p.name,p.sex,p.age,p.phone,p.address,p.department,p.inpatientarea,p.ward,p.sickbed,(select top 1 hnum from hospital as h where h.id = p.hospitalid) as hnum,(select  top 1 hname from hospital as h where h.id = p.hospitalid) as hname,"
                      + "p.diagresult,p.dose,p.takenum,p.getdrugtime,p.getdrugnum,p.takemethod,p.decscheme,p.oncetime,p.twicetime,p.packagenum,p.dotime,p.doperson,p.dtbcompany,p.dtbaddress,p.dtbphone,p.dtbtype,p.soakwater,p.soaktime,p.labelnum,p.remark,p.doctor,p.footnote,p.ordertime,p.curstate"
                      + ",pk.Fpactate pstatus,pk.Starttime Starttime,pk.PacTime PacTime,( select top 1 machinename  from machine   where  mark =1 and unitnum in (select unitnum from machine where id in (select machineid from tisaneunit as t where t.pid =p.id))) as packmachine  from prescription as p inner join Packing pk on p.id=pk.DecoctingNum left join hospital hs on hs.id = p.hospitalid  where pk.employeeId=" + userid +
                      " and CONVERT(varchar, pk.Starttime, 120) like '%" + date + "%' " + " and hs.id in(" + sql_1 + ")" + " order by pk.Starttime desc";
            }
            else
            {
                sql = "select p.ID,p.Pspnum,p.customid,p.delnum,p.Hospitalid,p.name,p.sex,p.age,p.phone,p.address,p.department,p.inpatientarea,p.ward,p.sickbed,(select top 1 hnum from hospital as h where h.id = p.hospitalid) as hnum,(select  top 1 hname from hospital as h where h.id = p.hospitalid) as hname,"
                      + "p.diagresult,p.dose,p.takenum,p.getdrugtime,p.getdrugnum,p.takemethod,p.decscheme,p.oncetime,p.twicetime,p.packagenum,p.dotime,p.doperson,p.dtbcompany,p.dtbaddress,p.dtbphone,p.dtbtype,p.soakwater,p.soaktime,p.labelnum,p.remark,p.doctor,p.footnote,p.ordertime,p.curstate"
                      + ",pk.Fpactate pstatus,pk.Starttime Starttime,pk.PacTime PacTime,( select top 1 machinename  from machine   where  mark =1 and unitnum in (select unitnum from machine where id in (select machineid from tisaneunit as t where t.pid =p.id))) as packmachine  from prescription as p inner join Packing pk on p.id=pk.DecoctingNum left join hospital hs on hs.id = p.hospitalid where " + " CONVERT(varchar, pk.Starttime, 120) like '%" + date + "%'" + " and hs.id in(" + sql_1 + ")" + " order by pk.Starttime desc";
            }
            db.write_log_txt("包装时间排序:" + sql);
            DataTable dt = db.get_DataTable(sql);

            return(dt);
        }
        ///// <summary>
        ///// 查询复核信息
        ///// </summary>
        ///// <returns>DataTable对象</returns>
        public DataTable findRecheckedInfo(int userid, string date, string hospital_name)
        {
            string sql  = "";
            string flag = "";

            flag = db.get_role_by_userid(userid);
            string sql_1 = "";

            if (hospital_name != "0")
            {
                sql_1 = "'" + hospital_name.Replace("_", "','") + "'";
            }
            else
            {
                sql_1 = "select id from hospital";
            }
            if (flag != "0")
            {
                sql = "select p.ID,p.Pspnum,p.customid,p.delnum,p.Hospitalid,p.name,p.sex,p.age,p.phone,p.address,p.department,p.inpatientarea,p.ward,p.sickbed,(select hnum from hospital as h where h.id = p.hospitalid) as hnum,(select hname from hospital as h where h.id = p.hospitalid) as hname,"
                      + "p.diagresult,p.dose,p.takenum,p.getdrugtime,p.getdrugnum,p.takemethod,p.decscheme,p.oncetime,p.twicetime,p.packagenum,p.dotime,p.doperson,(select count(*) from drug as d where d.pid = p.id) as drugnum,p.dtbcompany,p.dtbaddress,p.dtbphone,p.dtbtype,p.soakwater,p.soaktime,p.labelnum,p.remark,p.doctor,p.footnote,p.ordertime,p.curstate"
                      + ",r.id as rid,r.AuditStatus rstatus,r.AuditTime rwordDate,r.imgname rimgname  from prescription as p inner join Audit r on p.id=r.pid left join hospital hs on hs.id = p.hospitalid where r.employeeId=" + userid + " and CONVERT(varchar, r.AuditTime, 120) like '%" + date + "%' " + " and hs.id in(" + sql_1 + ")" + " order by r.AuditTime desc";
            }
            else
            {
                sql = "select p.ID,p.Pspnum,p.customid,p.delnum,p.Hospitalid,p.name,p.sex,p.age,p.phone,p.address,p.department,p.inpatientarea,p.ward,p.sickbed,(select hnum from hospital as h where h.id = p.hospitalid) as hnum,(select hname from hospital as h where h.id = p.hospitalid) as hname,"
                      + "p.diagresult,p.dose,p.takenum,p.getdrugtime,p.getdrugnum,p.takemethod,p.decscheme,p.oncetime,p.twicetime,p.packagenum,p.dotime,p.doperson,(select count(*) from drug as d where d.pid = p.id) as drugnum,p.dtbcompany,p.dtbaddress,p.dtbphone,p.dtbtype,p.soakwater,p.soaktime,p.labelnum,p.remark,p.doctor,p.footnote,p.ordertime,p.curstate"
                      + ",r.id as rid,r.AuditStatus rstatus,r.AuditTime rwordDate,r.imgname rimgname  from prescription as p inner join Audit r on p.id=r.pid left join hospital hs on hs.id = p.hospitalid   where " + "  CONVERT(varchar, r.AuditTime, 120) like '%" + date + "%' " + " and hs.id in(" + sql_1 + ")" + " order by r.AuditTime desc";
            }

            DataTable dt = db.get_DataTable(sql);

            return(dt);
        }
Example #3
0
        public DataTable findDeliveryInfo(int userid, string date, string hospital_name)
        {
            string sql  = "";
            string flag = "";

            flag = db.get_role_by_userid(userid);
            string sql_1 = "";

            if (hospital_name != "0")
            {
                sql_1 = "'" + hospital_name.Replace("_", "','") + "'";
            }
            else
            {
                sql_1 = "select id from hospital";
            }
            if (flag != "0")
            {
                sql = "select p.ID,p.Pspnum,p.customid,p.delnum,p.Hospitalid,p.name,p.sex,p.age,p.phone,p.address,p.department,p.inpatientarea,p.ward,p.sickbed,(select hnum from hospital as h where h.id = p.hospitalid) as hnum,(select hname from hospital as h where h.id = p.hospitalid) as hname,"
                      + "p.diagresult,p.dose,p.takenum,p.getdrugtime,p.getdrugnum,p.takemethod,p.decscheme,p.oncetime,p.twicetime,p.packagenum,p.dotime,p.doperson,p.dtbcompany,p.dtbaddress,p.dtbphone,p.dtbtype,p.soakwater,p.soaktime,p.labelnum,p.remark,p.doctor,p.footnote,p.ordertime,p.curstate"
                      + ",d.Sendstate dstatus,d.SendTime dSendTime   from prescription as p inner join Delivery d on p.id=d.DecoctingNum left join hospital hs on hs.id = p.hospitalid where d.employeeId=" + userid + " and CONVERT(varchar, d.SendTime, 120) like '%" + date + "%' " + " and hs.id in(" + sql_1 + ")" + " order by d.SendTime desc";
            }
            else
            {
                sql = "select p.ID,p.Pspnum,p.customid,p.delnum,p.Hospitalid,p.name,p.sex,p.age,p.phone,p.address,p.department,p.inpatientarea,p.ward,p.sickbed,(select hnum from hospital as h where h.id = p.hospitalid) as hnum,(select hname from hospital as h where h.id = p.hospitalid) as hname,"
                      + "p.diagresult,p.dose,p.takenum,p.getdrugtime,p.getdrugnum,p.takemethod,p.decscheme,p.oncetime,p.twicetime,p.packagenum,p.dotime,p.doperson,p.dtbcompany,p.dtbaddress,p.dtbphone,p.dtbtype,p.soakwater,p.soaktime,p.labelnum,p.remark,p.doctor,p.footnote,p.ordertime,p.curstate"
                      + ",d.Sendstate dstatus,d.SendTime dSendTime  from prescription as p inner join Delivery d on p.id=d.DecoctingNum left join hospital hs on hs.id = p.hospitalid where " + "  CONVERT(varchar, d.SendTime, 120) like '%" + date + "%' " + " and hs.id in(" + sql_1 + ")" + " order by d.SendTime desc";
            }
            db.write_log_txt("pda发货列表: " + sql);
            DataTable dt = db.get_DataTable(sql);

            return(dt);
        }