Пример #1
0
        /// <summary>
        /// 获取handoverRecord记录,若指定日期存在该记录,则返回
        /// 若不存在 则先保存查询记录 再返回
        /// </summary>
        /// <param name="handoverDate"></param>
        /// <returns></returns>
        public BaseResponse <HandoverRecord> GetHandoverRecordByDate(DateTime handoverDate)
        {
            BaseResponse <HandoverRecord> response = new BaseResponse <HandoverRecord>();
            var record = unitOfWork.GetRepository <LTC_HANDOVERRECORD>().dbSet.Where(x => x.HANDOVERDATE == handoverDate).FirstOrDefault();

            if (record != null)
            {
                List <LTC_HandoverDtl> LTC_HandoverDtl = new List <LTC_HandoverDtl>();
                HandoverRecord         handoverRecord  = new HandoverRecord();
                if (record.LTC_HANDOVERDTL.Count > 0)
                {
                    Mapper.CreateMap <LTC_HANDOVERDTL, LTC_HandoverDtl>();
                    LTC_HandoverDtl = Mapper.Map <List <LTC_HandoverDtl> >(record.LTC_HANDOVERDTL);
                }
                Mapper.CreateMap <LTC_HANDOVERRECORD, HandoverRecord>();
                handoverRecord = Mapper.Map <HandoverRecord>(record);
                handoverRecord.LTC_HandoverDtl = LTC_HandoverDtl;
                response.Data = handoverRecord;
            }
            else
            {
                string           sql  = string.Format(@"SELECT I.INDATE AS Flag, 'N' AS Type FROM LTC_IPDREG I 
                                                WHERE I.IPDFLAG='I' AND ORGID='{0}' AND INDATE='{1}'
                                                UNION ALL
                                                SELECT  CASE WHEN ISNULL(I.RSTYPE) THEN '001' ELSE I.RSTYPE END Flag, 'O' AS Type  FROM LTC_IPDREG I 
                                                WHERE I.IPDFLAG='O' AND ORGID='{0}' AND OUTDATE<='{1}' 
                                                UNION ALL
                                                SELECT  CASE WHEN ISNULL(I.RSTYPE) THEN '001' ELSE I.RSTYPE END Flag, 'I' AS Type FROM LTC_IPDREG I 
                                                WHERE I.IPDFLAG='I' AND ORGID='{0}' AND INDATE<='{1}' 
                                                UNION ALL
                                                SELECT DISTINCT FEENO AS Flag ,'LR' AS type FROM LTC_LEAVEHOSP WHERE FEENO>0 
                                                UNION ALL
                                                SELECT DISTINCT FEENO AS Flag ,'L' AS type FROM LTC_LEAVEHOSP WHERE 
                                                FEENO>0  AND ORGID='{0}' AND ((STARTDATE<='{1}'  AND (RETURNDATE>='{1}'  OR RETURNDATE IS NULL))) ;", SecurityHelper.CurrentPrincipal.OrgId, handoverDate.ToShortDateString());
                List <OverallUU> list = unitOfWork.GetRepository <OverallUU>().SqlQuery(sql).ToList();
                if (list != null && list.Count > 0)
                {
                    HandoverRecord NewRecord = new HandoverRecord()
                    {
                        HandoverDate     = handoverDate,
                        NewComer         = list.Where(x => x.Type == "N").Count(),
                        TransferSociety  = list.Where(x => x.Type == "O" && x.Flag == "001").Count(),
                        TransferMiniter  = list.Where(x => x.Type == "O" && x.Flag == "002").Count(),
                        TransferDisabled = list.Where(x => x.Type == "O" && x.Flag == "003").Count(),
                        OutOverall       = list.Where(x => x.Type == "LR").Count(),
                        OutReturn        = list.Where(x => x.Type == "LR").Count() - list.Where(x => x.Type == "L").Count(),
                        OutStill         = list.Where(x => x.Type == "L").Count(),
                        ActualPopulation = list.Where(x => x.Type == "I").Count() - list.Where(x => x.Type == "L").Count(),
                        InnaiSociety     = list.Where(x => x.Type == "I" && x.Flag == "001").Count(),
                        InnaiDisabled    = list.Where(x => x.Type == "I" && x.Flag == "002").Count(),
                        InnaiMiniter     = list.Where(x => x.Type == "I" && x.Flag == "003").Count(),
                        InnaiOverall     = list.Where(x => x.Type == "I").Count()
                    };
                    var result = base.Save <LTC_HANDOVERRECORD, HandoverRecord>(NewRecord, (q) => q.ID == NewRecord.Id);
                    response.Data = result.Data;
                }
            }

            return(response);
        }
Пример #2
0
        public IList <ItemsPrice> GetItemsPriceByHandover(string dailyStatementNo, int workSequence)
        {
            HandoverRecord handoverRecord = new HandoverRecord();

            handoverRecord.DailyStatementNo = dailyStatementNo;
            handoverRecord.WorkSequence     = workSequence;

            return(ExecuteQueryForList <ItemsPrice>("GetItemsPriceByHandover", handoverRecord));
        }
Пример #3
0
        public IList <OrderPayoffSum> GetOrderPayoffSumByHandover(string dailyStatementNo, int workSequence)
        {
            HandoverRecord handoverRecord = new HandoverRecord();

            handoverRecord.DailyStatementNo = dailyStatementNo;
            handoverRecord.WorkSequence     = workSequence;

            return(ExecuteQueryForList <OrderPayoffSum>("GetPayoffSumByHandover", handoverRecord));
        }
Пример #4
0
        /// <summary>
        /// 添加病人里面的确认按钮点击后,往交班记录中添加数据
        /// </summary>
        /// <param name="handoverRecord"></param>
        /// <returns></returns>
        public int AddHandoverRecordTitle(string title, string wardId, string patientId, string recordUser)
        {
            HandoverRecord handoverRecord = new HandoverRecord();

            handoverRecord.title      = title;
            handoverRecord.wardId     = wardId;
            handoverRecord.patientId  = patientId;
            handoverRecord.recordUser = recordUser;
            return(handoverReportService.AddHandoverRecordTitle(handoverRecord));
        }
Пример #5
0
        /// <summary>
        /// 添加或者修改交班记录表中的信息
        /// </summary>
        /// <param name="handoverRecord"></param>
        /// <returns></returns>
        public int AddOrUpdateHandoverRecord(string content, string recordTime, string wardId, string patientId, string recordUser)
        {
            HandoverRecord handoverRecord = new HandoverRecord();

            handoverRecord.content    = content;
            handoverRecord.recordTime = recordTime;
            handoverRecord.wardId     = wardId;
            handoverRecord.patientId  = patientId;
            handoverRecord.recordUser = recordUser;
            return(handoverReportService.AddOrUpdateHandoverRecord(handoverRecord));
        }
Пример #6
0
        /// <summary>
        /// 在交班记录表中有无该条记录,有添加就修改无则添加,先判断
        /// </summary>
        /// <returns></returns>
        public int AddOrUpdateHandoverRecord(HandoverRecord handoverRecord)
        {
            string id = handoverReportDao.SelectPatientID(handoverRecord.patientId, handoverRecord.recordTime);

            //有数据修改,没有数据则添加
            if (id == null)
            {
                return(handoverReportDao.AddHandoverRecordContent(handoverRecord));
            }
            else
            {
                return(handoverReportDao.UpdateHandoverRecordContent(handoverRecord.content, id));
            }
        }
Пример #7
0
        public bool CreateHandover(HandoverInfo handover)
        {
            bool returnValue = false;

            _daoManager.BeginTransaction();
            try
            {
                //日结号
                string dailyStatementNo = _dailyStatementDao.GetCurrentDailyStatementNo();
                if (!string.IsNullOrEmpty(dailyStatementNo))
                {
                    //交班记录
                    HandoverRecord handoverRecord = handover.handoverRecord;
                    handoverRecord.DailyStatementNo = dailyStatementNo;
                    _handoverRecord.CreateHandoverRecord(handoverRecord);
                    //交班金额列表
                    if (handover.handoverTurnoverList != null && handover.handoverTurnoverList.Count > 0)
                    {
                        foreach (HandoverTurnover item in handover.handoverTurnoverList)
                        {
                            item.DailyStatementNo = dailyStatementNo;
                            _handoverTurnover.CreateHandoverTurnover(item);
                        }
                    }
                    returnValue = true;
                }
                _daoManager.CommitTransaction();
            }
            catch (Exception exception)
            {
                LogHelper.GetInstance().Error(string.Format("[CreateHandover]参数:handover_{0}", JsonConvert.SerializeObject(handover)), exception);
                _daoManager.RollBackTransaction();
                returnValue = false;
            }
            return(returnValue);
        }
Пример #8
0
 //向交班记录中添加信息,主要是添加病人时,数据库肯定无该条数据,只能添加,而且只添加标体
 public int AddHandoverRecordTitle(HandoverRecord handoverRecord)
 {
     return(handoverReportDao.AddHandoverRecordTitle(handoverRecord));
 }
Пример #9
0
        private void btnSalesReport_Click(object sender, EventArgs e)
        {
            if (bizReport != null && bizReport.BillTotalQty > 0)
            {
                if (m_ModelType == 1)
                {
                    //判断是否存在退款失败的账单
                    CardRefundPayService refundPayService  = new CardRefundPayService();
                    List <CardRefundPay> cardRefundPayList = refundPayService.GetCardRefundPayList();
                    if (cardRefundPayList != null && cardRefundPayList.Count > 0)
                    {
                        FormVIPCardRefundPay refundPayForm = new FormVIPCardRefundPay(cardRefundPayList);
                        refundPayForm.ShowDialog();
                    }
                    Guid           handoverRecordId = Guid.NewGuid();
                    HandoverRecord handoverRecord   = new HandoverRecord();
                    handoverRecord.HandoverRecordID = handoverRecordId;
                    handoverRecord.DeviceNo         = ConstantValuePool.BizSettingConfig.DeviceNo;
                    handoverRecord.EmployeeID       = ConstantValuePool.CurrentEmployee.EmployeeID;
                    IList <HandoverTurnover> handoverTurnoverList = new List <HandoverTurnover>();
                    foreach (OrderPayoffSum item in bizReport.orderPayoffSumList)
                    {
                        HandoverTurnover handoverTurnover = new HandoverTurnover();
                        handoverTurnover.HandoverRecordID = handoverRecordId;
                        handoverTurnover.PayoffID         = item.PayoffID;
                        handoverTurnover.SalesTurnover    = item.PayoffMoney;
                        handoverTurnoverList.Add(handoverTurnover);
                    }

                    HandoverInfo handover = new HandoverInfo();
                    handover.handoverRecord       = handoverRecord;
                    handover.handoverTurnoverList = handoverTurnoverList;
                    bool result = HandoverService.GetInstance().CreateHandover(handover);
                    if (result)
                    {
                        MessageBox.Show("交班成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        m_HandleSuccess = true;
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("出现异常错误,请重新交班!");
                    }
                }
                else if (m_ModelType == 2)
                {
                    //判断是否存在退款失败的账单
                    CardRefundPayService refundPayService  = new CardRefundPayService();
                    List <CardRefundPay> cardRefundPayList = refundPayService.GetCardRefundPayList();
                    if (cardRefundPayList != null && cardRefundPayList.Count > 0)
                    {
                        FormVIPCardRefundPay refundPayForm = new FormVIPCardRefundPay(cardRefundPayList);
                        refundPayForm.ShowDialog();
                    }
                    FormChooseDate form = new FormChooseDate(bizReport.LastDailyStatementTime);
                    form.ShowDialog();
                    if (form.DailyStatementDate != null)
                    {
                        string weather = this.cmbWeather.Text;
                        if (string.IsNullOrEmpty(weather))
                        {
                            MessageBox.Show("请先选择当天天气情况!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                        DateTime       belongToDate   = (DateTime)form.DailyStatementDate;
                        DailyStatement dailyStatement = new DailyStatement();
                        dailyStatement.DeviceNo     = ConstantValuePool.BizSettingConfig.DeviceNo;
                        dailyStatement.BelongToDate = belongToDate;
                        dailyStatement.Weather      = weather;
                        dailyStatement.EmployeeID   = ConstantValuePool.CurrentEmployee.EmployeeID;
                        DailyTurnover dailyTurnover = new DailyTurnover();
                        dailyTurnover.TotalRevenue       = bizReport.TotalRevenue;
                        dailyTurnover.CutOffTotalPrice   = bizReport.CutOffTotalPrice;
                        dailyTurnover.DiscountTotalPrice = bizReport.DiscountTotalPrice;
                        dailyTurnover.ActualTotalIncome  = bizReport.ActualTotalIncome;
                        dailyTurnover.TotalServiceFee    = bizReport.TotalServiceFee;
                        dailyTurnover.StoredTotalPrice   = 0;

                        DailyBalance dailyBalance = new DailyBalance();
                        dailyBalance.dailyStatement = dailyStatement;
                        dailyBalance.dailyTurnover  = dailyTurnover;
                        string unCheckDeviceNo;  //未结账的设备号
                        int    result = DailyBalanceService.GetInstance().CreateDailyBalance(dailyBalance, out unCheckDeviceNo);
                        if (result == 1)
                        {
                            MessageBox.Show("日结成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            m_HandleSuccess = true;
                            this.Close();
                        }
                        else if (result == 2)
                        {
                            MessageBox.Show("存在未结账单据,请先结完账!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else if (result == 3)
                        {
                            if (string.IsNullOrEmpty(unCheckDeviceNo))
                            {
                                MessageBox.Show("存在未交班的POS,请先交班!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            else
                            {
                                if (unCheckDeviceNo.IndexOf(',') == -1 && unCheckDeviceNo.IndexOf(ConstantValuePool.BizSettingConfig.DeviceNo) >= 0)
                                {
                                    MessageBox.Show("当前设备未交班,请交班后进行日结!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                                else
                                {
                                    MessageBox.Show(string.Format("设备【{0}】未交班,请先交班!", unCheckDeviceNo), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("出现异常错误,请重新日结!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }
Пример #10
0
 public void CreateHandoverRecord(HandoverRecord handoverRecord)
 {
     ExecuteInsert("InsertHandoverRecord", handoverRecord);
 }