Ejemplo n.º 1
0
        /// <summary>
        /// Get Report Info by rp guid
        /// </summary>
        /// <param name="rpGuid"></param>
        /// <returns></returns>
        public static tagReportInfo GetReportInfo2(string rpGuid)
        {
            int    idx = rpGuid.IndexOf(',');
            string rp  = rpGuid;

            if (idx > 0 && idx < rpGuid.Length)
            {
                rp = rpGuid.Substring(0, idx);
            }
            rp = rp.Trim("' ".ToCharArray());


            string sql = "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED \r\n" +
                         " select "
                         + "  tRegPatient.patientID, tRegPatient.localName, tRegPatient.EnglishName, tRegPatient.address, tRegPatient.telephone,"
                         + "  tRegPatient.isVip, tRegPatient.Comments tRegPatient__Comments, tRegPatient.remotePID tRegPatient__remotePID,"
                         + "  tRegPatient.Gender as tRegPatient__Gender, tRegPatient.Birthday as tRegPatient__Birthday,"
                         + "  tRegOrder.inhospitalNo, tRegOrder.clinicNo, tRegOrder.PatientType, tRegOrder.Observation, "
                         + "  tRegOrder.inHospitalRegion, tRegOrder.BedNo, tRegOrder.comments tRegOrder__orderComment,"
                         + "  tRegOrder.OrderGuid as tRegOrder__OrderGuid, tRegOrder.AccNo, tRegOrder.applyDept as tRegOrder__applyDept,"
                         + "  tRegOrder.applyDoctor as tRegOrder__applyDoctor, tRegOrder.VisitComment tRegOrder__VisitComment,"
                         + "  tRegOrder.remoteAccNo,"
                         + "  tRegProcedure.ProcedureGuid as tRegProcedure__ProcedureGuid, tRegProcedure.status as tRegProcedure__status, "
                         + "  tRegProcedure.charge, tRegProcedure.ModalityType, tRegProcedure.Modality, "
                         + "  tRegProcedure.Registrar, tRegProcedure.RegisterDt, tRegProcedure.Technician, "
                         + "  tRegProcedure.OperationStep, tRegProcedure.ExamineDt, tRegProcedure.comments tRegProcedure__comments, "
                         + "  tRegProcedure.isCharge, tRegProcedure.ProcedureCode tRegProcedure__ProcedureCode, "
                         + "  tRegProcedure.RPDesc tProcedureCode__Description, tRegProcedure.bodypart tProcedureCode__bodypart, "
                         + "  tReport.reportGuid, "
                         + "  tReport.ReportName, tReport.techInfo, tReport.wysText, tReport.wygText, "
                         + "  tReport.WYS, tReport.WYG, "
                         + "  tReport.creater as tReport__creater, tReport.createDt as tReport__createDt,"
                         + "  tReport.submitter as tReport__submitter, tReport.submitDt as tReport__submitDt,"
                         + "  tReport.firstApprover as tReport__firstApprover, tReport.firstApproveDt as tReport__firstApproveDt,"
                         + "  tReport.rejectDt as tReport__rejectDt"
                         + "  from tRegPatient with (nolock), "
                         + "  tRegOrder with (nolock), tRegProcedure with (nolock) "
                         + "  left join tReport with (nolock) on tRegProcedure.reportGuid = tReport.reportGuid "
                         + "  where tRegPatient.PatientGuid = tRegOrder.PatientGuid "
                         + "  and tRegOrder.OrderGuid = tRegProcedure.OrderGuid "
                         + " and tRegProcedure.procedureGuid = '" + rp + "'";

            DataTable dt = new DataTable("ReportInfo");



            tagReportInfo ri = new tagReportInfo();

            if (0 == iWrittenCount++ % 100)
            {
                ServerPubFun.RISLog_Info(0, "GetReportInfo2, SQL=" + sql,
                                         (new System.Diagnostics.StackFrame()).GetFileName(),
                                         (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }
            else
            {
                ServerPubFun.RISLog_Info(0, "GetReportInfo2, rpGuid=" + rpGuid,
                                         (new System.Diagnostics.StackFrame()).GetFileName(),
                                         (new System.Diagnostics.StackFrame()).GetFileLineNumber());
            }
            using (RisDAL dal = new RisDAL())
            {
                dal.ExecuteQuery(sql, dt);

                if (dt != null && dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];

                    ri.status           = ReportCommon.Converter.toInt(dr["tRegProcedure__status"]);
                    ri.dept             = dr["tRegOrder__applyDept"] as string;
                    ri.orderGuid        = dr["tRegOrder__OrderGuid"] as string;
                    ri.reportGuid       = dr["reportGuid"] as string;
                    ri.reportName       = dr["reportName"] as string;
                    ri.AccNO            = dr["AccNO"] as string;
                    ri.patientID        = dr["PatientID"] as string;
                    ri.patientName      = dr["EnglishName"] as string;
                    ri.patientLocalName = dr["LocalName"] as string;
                    // ri.patientAlias = dr["Alias"] as string;
                    ri.patientAddress = dr["Address"] as string;
                    ri.patientPhone   = dr["TelePhone"] as string;
                    // ri.patientMarriage = dr["Marriage"] as string;
                    ri.gender           = dr["tRegPatient__Gender"] as string;
                    ri.patientType      = dr["PatientType"] as string;
                    ri.remotePID        = dr["tRegPatient__remotePID"] as string;
                    ri.modality         = dr["Modality"] as string;
                    ri.modalityType     = dr["modalityType"] as string;
                    ri.operationStep    = dr["operationStep"] as string;
                    ri.reportCreater    = dr["tReport__creater"] as string;
                    ri.reportSubmitter  = dr["tReport__submitter"] as string;
                    ri.reportApprover   = dr["tReport__firstApprover"] as string;
                    ri.reportCreateDt   = ReportCommon.ReportCommon.GetDateTime(dr["tReport__createDt"]);
                    ri.reportSubmitDt   = ReportCommon.ReportCommon.GetDateTime(dr["tReport__submitDt"]);
                    ri.reportApproveDt  = ReportCommon.ReportCommon.GetDateTime(dr["tReport__firstApproveDt"]);
                    ri.reportRejectDt   = ReportCommon.ReportCommon.GetDateTime(dr["tReport__rejectDt"]);
                    ri.birthday         = ReportCommon.ReportCommon.GetDateTime(dr["tRegPatient__birthday"]);
                    ri.registerDt       = ReportCommon.ReportCommon.GetDateTime(dr["registerDt"]);
                    ri.examineDt        = ReportCommon.ReportCommon.GetDateTime(dr["examineDt"]);
                    ri.inHospitalRegion = dr["inHospitalRegion"] as string;
                    ri.visitNo          = dr["clinicNo"] as string;
                    ri.bedNo            = dr["bedNo"] as string;
                    ri.isVIP            = ReportCommon.Converter.toInt(dr["isVip"]).ToString();
                    ri.inHospitalNo     = dr["inhospitalNo"] as string;
                    ri.patientComment   = dr["tRegPatient__Comments"] as string;
                    ri.remoteAccNo      = dr["remoteAccNo"] as string;

                    ri.applyDoctor       = dr["tRegOrder__applyDoctor"] as string;
                    ri.visitComments     = dr["tRegOrder__visitComment"] as string;
                    ri.observation       = dr["Observation"] as string;
                    ri.orderComments     = dr["tRegOrder__orderComment"] as string;
                    ri.technician        = dr["technician"] as string;
                    ri.procedureComments = dr["remoteAccNo"] as string;
                    ri.isCharge          = ReportCommon.Converter.toInt(dr["isCharge"]).ToString();

                    string tmp     = "";
                    double dChange = 0;
                    foreach (DataRow tmpDr in dt.Rows)
                    {
                        tmp = tmpDr["tProcedureCode__bodypart"] as string;
                        if (tmp != null)
                        {
                            ri.bodypart += tmp + ", ";
                        }

                        tmp = tmpDr["tRegProcedure__ProcedureCode"] as string;
                        if (tmp != null)
                        {
                            ri.procedureCode += tmp + ", ";
                        }

                        tmp = tmpDr["tProcedureCode__Description"] as string;
                        if (tmp != null)
                        {
                            ri.procedureDesc += tmp + ", ";
                        }

                        double dTmp = System.Convert.ToDouble(tmpDr["charge"]);
                        dChange += dTmp;
                    }
                    ri.bodypart      = ri.bodypart.Trim(", ".ToCharArray());
                    ri.procedureCode = ri.procedureCode.Trim(", ".ToCharArray());
                    ri.procedureDesc = ri.procedureDesc.Trim(", ".ToCharArray());
                    ri.charge        = dChange.ToString();

                    ri.reportCreater_LocalName   = ServerPubFun.GetLocalName(ri.reportCreater);
                    ri.reportSubmitter_LocalName = ServerPubFun.GetLocalName(ri.reportSubmitter);
                    ri.reportApprover_LocalName  = ServerPubFun.GetLocalName(ri.reportApprover);
                    ri.technician__LocalName     = ServerPubFun.GetLocalName(ri.technician);

                    ri.duration = System.Convert.ToString(ri.examineDt - ri.registerDt);

                    Byte[] buff = dr["wys"] as Byte[];
                    if (buff == null)
                    {
                        ri.wys = "";
                    }
                    else
                    {
                        ri.wys = ReportCommon.Converter.GetStringFromBytes(buff);
                    }

                    buff = dr["wyg"] as Byte[];
                    if (buff == null)
                    {
                        ri.wyg = "";
                    }
                    else
                    {
                        ri.wyg = ReportCommon.Converter.GetStringFromBytes(buff);
                    }

                    //buff = dr["wysText"] as Byte[];
                    //if (buff == null)
                    ri.wysText = dr["wysText"] as string;
                    //else
                    //  ri.wysText = ReportCommon.Converter.GetStringFromBytes(buff);

                    // buff = dr["wygText"] as Byte[];
                    //if (buff == null)
                    ri.wygText = dr["wygText"] as string;
                    //else
                    //  ri.wygText = ReportCommon.Converter.GetStringFromBytes(buff);

                    ri.techinfo = System.Convert.ToString(dr["techinfo"]);
                }
            }

            return(ri);
        }