示例#1
0
        public StatusTransaction WS_GetPTPackageAllStation(ref List <StationStatus> list_StationStatus, int tpr_id)
        {
            try
            {
                using (InhCheckupDataContext cdc = new InhCheckupDataContext())
                {
                    trn_patient_regi patient_regis = cdc.trn_patient_regis.Where(x => x.tpr_id == tpr_id).FirstOrDefault();
                    int en_rowid = Convert.ToInt32(patient_regis.tpr_en_rowid);
                    using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
                    {
                        var result_datatable = ws.GetPTPackage(en_rowid).AsEnumerable();
                        var result           = result_datatable
                                               .Where(x => (x.Field <string>("OSTAT_Code") == "V" ||
                                                            x.Field <string>("OSTAT_Code") == "E") &&
                                                      x.Field <string>("ARCOS_RowId") != null)
                                               .Select(x => new EntityGetPTPackage
                        {
                            ARCOS_RowId = x.Field <string>("ARCOS_RowId"),
                            ARCOS_Code  = x.Field <string>("ARCOS_Code"),
                            ARCOS_Desc  = x.Field <string>("ARCOS_Desc"),

                            ARCIM_RowId           = x.Field <string>("ARCIM_RowId"),
                            ARCIM_Code            = x.Field <string>("ARCIM_Code"),
                            ARCIM_Desc            = x.Field <string>("ARCIM_Desc"),
                            OEORI_LabTestSetRow   = x.Field <string>("OEORI_LabTestSetRow"),
                            OEORI_AccessionNumber = x.Field <string>("OEORI_AccessionNumber"),
                            ARCIM_Text1           = x.Field <string>("ARCIM_Text1"),
                            OSTAT_Code            = x.Field <string>("OSTAT_Code")
                        }).ToList();
                        var grpStatus = result.GroupBy(x => x.OSTAT_Code);
                        List <StationStatus> list_station = new List <StationStatus>();
                        foreach (var grp in grpStatus)
                        {
                            foreach (var item in grp)
                            {
                                List <int> _mvt_id = cdc.mst_order_plans.Where(x => x.mop_item_row_id == item.ARCIM_RowId).Select(x => x.mvt_id).ToList();
                                foreach (int val in _mvt_id)
                                {
                                    list_station.Add(new StationStatus {
                                        mvt_id = val, status = grp.Key
                                    });
                                }
                            }
                        }
                        list_StationStatus = list_station.GroupBy(x => x.mvt_id).Select(x => new StationStatus
                        {
                            mvt_id = x.Key,
                            status = x.Any(y => y.status == "E") ? "E" : "V"
                        }).ToList();
                        return(StatusTransaction.True);
                    }
                }
            }
            catch (Exception ex)
            {
                Program.MessageError("GetDataFromWSTrakCare", "GetPatientAllStation", ex, false);
                return(StatusTransaction.Error);
            }
        }
示例#2
0
 public EnumerableRowCollection <DataRow> GetPTPackage(int enRowID)
 {
     try
     {
         using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
         {
             return(ws.GetPTPackage(enRowID).AsEnumerable());
         }
     }
     catch (Exception ex)
     {
         Class.globalCls.MessageError("GetPTPackageCls", "GetPTPackage(int enRowID)", ex.Message);
         return(null);
     }
 }
示例#3
0
 public List <PatientOrderSet> ByGetPTPackage(int enRowID)
 {
     try
     {
         using (InhCheckupDataContext cdc = new InhCheckupDataContext())
         {
             using (Service.WS_TrakcareCls ws = new Service.WS_TrakcareCls())
             {
                 var LinkPacSheet = Class.GetDBConfigCls.GetConfig("LinkPacSheet");
                 var PathPatho    = Class.GetDBConfigCls.GetConfig("PathPatho");
                 var RawMateWS    = ws.GetPTPackage(enRowID).AsEnumerable();
                 var MappingOrder = (from mate in RawMateWS
                                     join mst in cdc.mst_order_plans
                                     on mate.Field <string>("ARCIM_RowId") equals mst.mop_item_row_id
                                     where mst.mop_status == 'A'
                                     group new { mate, mst }
                                     by new
                 {
                     hn = mate.Field <string>("PAPMI_No"),
                     en = mate.Field <string>("PAADM_ADMNo"),
                     rowid = mate.Field <string>("ARCOS_RowId"),
                     code = mate.Field <string>("ARCOS_Code"),
                     name = mate.Field <string>("ARCOS_Desc")
                 } into set
                                     select new PatientOrderSet
                 {
                     hn = set.Key.hn,
                     en = set.Key.en,
                     orderset_rowid = set.Key.rowid,
                     orderset_code = set.Key.code,
                     orderset_name = set.Key.name,
                     orderset_status = set.All(x => x.mate.Field <string>("OSTAT_Code") == "D") ? false : true,
                     orderitems = set.Select(x => new PatientOrderItem
                     {
                         rowid = x.mate.Field <string>("OEORI_RowId"),
                         mop_id = x.mst.mop_id,
                         mvt_id = x.mst.mvt_id,
                         mvt_code = x.mst.mst_event.mvt_code,
                         orderitem_rowid = x.mate.Field <string>("ARCIM_RowId"),
                         orderitem_code = x.mate.Field <string>("ARCIM_Code"),
                         orderitem_name = x.mate.Field <string>("ARCIM_Desc"),
                         orderitem_status = x.mate.Field <string>("OSTAT_Code"),
                         use_pacsheet = x.mate.Field <string>("ARCIM_Text1") != null ? true : false,
                         pacsheet = x.mate.Field <string>("OEORI_AccessionNumber") != null
                                                        ? string.Format(LinkPacSheet, x.mate.Field <string>("OEORI_AccessionNumber").Replace("/", "-"), set.Key.hn.Replace("-", ""))
                                                        : null,
                         patho = x.mst.mst_event.mvt_code == "PT" && x.mate.Field <DateTime?>("ExecuteDate") != null && x.mate.Field <string>("OEORI_LabTestSetRow") != null
                                                     ? PathPatho + x.mate.Field <DateTime?>("ExecuteDate").Value.Date.ToString("yyyyMM") + @"\" + x.mate.Field <string>("OEORI_LabTestSetRow").Replace("||", "_") + ".doc"
                                                     : null,
                         excute_date = x.mate.Field <DateTime?>("ExecuteDate")
                     }).ToList()
                 }).ToList();
                 return(MappingOrder);
             }
         }
     }
     catch (Exception ex)
     {
         Class.globalCls.MessageError("GetPatientOrderCls", "ByGetPTPackage", ex.Message);
         throw ex;
     }
 }