Ejemplo n.º 1
0
        public static async Task <int> CallLabService()
        {
            var service = new LaboratoryServiceClient();

            var header = new MessageHeader()
            {
                MessageID           = "101",
                TransactionID       = "101",
                SenderID            = "101",
                SenderApplication   = "Debug",
                ReceiverID          = "101",
                ReceiverApplication = "Effica",
                CharacterSet        = "UTF-16"
            };

            var common = new LisCommon()
            {
                ContractKey   = ContractKey,
                UserId        = UserId,
                CallingSystem = CallingSystem,
                CallingUserId = UserId
            };

            // Initialize Request
            var req = new LaboratoryRequest()
            {
                Area = new Code()
                {
                    CodeSetName = "Effica/Lifecare", CodeValue = "kotih"
                },
                Organisation = new Code {
                    CodeSetName = "Effica/Lifecare", CodeValue = "317"
                },
                PatientId = new PatientId()
                {
                    Identifier = "010101-0101"
                },
                EffectiveTime = new EffectiveTime()
                {
                    StartDateTime = DateTime.Now.AddDays(-365.0), EndDateTime = DateTime.Now
                }
            };

            // Structure for return data
            var rsp1 = new PatientId();
            var rsp2 = new LaboratoryResult[100];

            try
            {
                service.GetPatientLaboratoryResults(ref header, common, req, out rsp1, out rsp2);
            }
            catch (Exception e)
            {
                Debug.Write(e.Message);
            }

            return(0);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 检验报告保存数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public IHttpActionResult SaveResult([FromBody] Request <LabResultResponse> request)
        {
            //获取参数
            LaboratoryResult           _model      = request.Data.LabResult;
            IList <LaboratoryTestItem> _itemsModel = request.Data.LabItems;

            //申明检查项BLL
            LaboratoryTestItemBLL ltItemBLL = new LaboratoryTestItemBLL();

            try
            {
                string _labresultId = string.Empty;
                if (string.IsNullOrEmpty(_model.LabresultId))//新增插入
                {
                    _labresultId = bll.Add(_model);
                    if (string.IsNullOrEmpty(_labresultId))
                    {
                        throw new Exception("新增失败!");
                    }
                }
                else//修改更新
                {
                    _labresultId = _model.LabresultId;
                    bll.Edit(_model);
                }

                //获取原有具体检查项目
                List <LaboratoryTestItem> oldItems = ltItemBLL.GetListByRId(_labresultId);
                foreach (LaboratoryTestItem item in _itemsModel)
                {
                    if (string.IsNullOrEmpty(item.TestitemId))
                    {
                        item.LabresultId = _labresultId;
                        ltItemBLL.Add(item);
                    }
                    else
                    {
                        ltItemBLL.Edit(item);

                        oldItems.RemoveAll(p => p.TestitemId == item.TestitemId);
                    }
                }

                foreach (LaboratoryTestItem item in oldItems)
                {
                    ltItemBLL.Delete(item.TestitemId);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteError(ex.ToString());
                return(BadRequest(ex.Message));
            }

            return(Ok());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Edit(LaboratoryResult model)
        {
            if (model == null)
            {
                return(false);
            }
            using (LaboratoryResultDAL dal = new LaboratoryResultDAL())
            {
                HR_LABORATORYRESULT entitys = ModelToEntity(model);

                return(dal.Edit(entitys));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public string Add(LaboratoryResult model)
        {
            if (model == null)
            {
                return(string.Empty);
            }

            using (LaboratoryResultDAL dal = new LaboratoryResultDAL())
            {
                HR_LABORATORYRESULT entity = ModelToEntity(model);
                entity.LABRESULTID = string.IsNullOrEmpty(model.LabresultId) ? Guid.NewGuid().ToString("N") : model.LabresultId;

                return(dal.Add(entity));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Entity转Model
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private LaboratoryResult EntityToModel(HR_LABORATORYRESULT entity)
        {
            if (entity != null)
            {
                var model = new LaboratoryResult()
                {
                    LabresultId     = entity.LABRESULTID,
                    HistoryId       = entity.HISTORYID,
                    DiagnosisTime   = entity.DIAGNOSISTIME,
                    Diagnosis       = entity.DIAGNOSIS,
                    Hospital        = entity.HOSPITAL,
                    DiagnosisReport = entity.DIAGNOSISREPORT,
                    CI = entity.CI,
                    MedicalhisAttachment = entity.MEDICALHISATTACHMENT,
                    LabmodelId           = entity.LABMODELID,
                    LabtabelName         = entity.LABTABELNAME,
                    Teststandard         = entity.TESTSTANDARD
                };

                return(model);
            }
            return(null);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Model转Entity
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private HR_LABORATORYRESULT ModelToEntity(LaboratoryResult model)
        {
            if (model != null)
            {
                var entity = new HR_LABORATORYRESULT()
                {
                    LABRESULTID     = model.LabresultId,
                    HISTORYID       = model.HistoryId,
                    DIAGNOSISTIME   = model.DiagnosisTime,
                    DIAGNOSIS       = model.Diagnosis,
                    HOSPITAL        = model.Hospital,
                    DIAGNOSISREPORT = model.DiagnosisReport,
                    CI = model.CI,
                    MEDICALHISATTACHMENT = model.MedicalhisAttachment,
                    LABMODELID           = model.LabmodelId,
                    LABTABELNAME         = model.LabtabelName,
                    TESTSTANDARD         = model.Teststandard
                };

                return(entity);
            }
            return(null);
        }