示例#1
0
        /// <summary>
        ///直接收费
        /// </summary>
        /// <returns></returns>
        private bool IdirectFee(Neusoft.HISFC.Models.Registration.Register r, DateTime FeeTime, ref string errText)
        {
            //删除申请数据
            #region  除申请表
            ArrayList drugLists  = new ArrayList();
            ArrayList undrugList = new ArrayList();
            Dictionary <string, string> dicRecipe = new Dictionary <string, string>();
            string keyStr = string.Empty;
            foreach (FeeItemList f in noFeeList)
            {
                if (f.Item.ItemType == EnumItemType.Drug)
                {
                    #region  除药品申请表数据

                    if (!f.IsConfirmed)
                    {
                        if (!f.Item.IsNeedConfirm)
                        {
                            if (string.IsNullOrEmpty(f.RecipeNO))
                            {
                                if (pharmarcyManager.DelApplyOut(f.RecipeNO, f.SequenceNO.ToString()) < 0)
                                {
                                    errText = "删除发药申请信息细失败!" + confirmIntegrate.Err;
                                    return(false);
                                }


                                keyStr = f.RecipeNO + "||" + f.ExecOper.Dept.ID;
                                if (!dicRecipe.ContainsKey(keyStr))
                                {
                                    dicRecipe.Add(keyStr, f.ExecOper.Dept.ID);
                                }
                                else
                                {
                                    if (dicRecipe[keyStr] != f.ExecOper.Dept.ID)
                                    {
                                        dicRecipe.Add(keyStr, f.ExecOper.Dept.ID);
                                    }
                                }
                                drugLists.Add(f);
                            }
                        }
                    }
                    #endregion
                }
                else
                {
                    #region  除非药品申请表数据
                    if (!f.IsConfirmed)
                    {
                        if (f.Item.IsNeedConfirm)
                        {
                            if (f.Order.ID == null || f.Order.ID == string.Empty)
                            {
                                f.Order.ID = orderManager.GetNewOrderID();
                            }
                            if (f.Order.ID == null || f.Order.ID == string.Empty)
                            {
                                errText = "获得医嘱流水号出错!";

                                return(false);
                            }

                            if (confirmIntegrate.DelTecApply(f.RecipeNO, f.SequenceNO.ToString()) < 0)
                            {
                                errText = "删除终端申请信息失败!" + confirmIntegrate.Err;
                                return(false);
                            }
                            undrugList.Add(f);
                        }
                    }
                    #endregion
                }
            }
            #endregion

            #region  除药品调剂头表
            foreach (string strKey in dicRecipe.Keys)
            {
                string recipeNO = strKey.Substring(0, strKey.IndexOf("||"));

                if (pharmarcyManager.DeleteDrugStoRecipe(recipeNO, dicRecipe[strKey]) < 0)
                {
                    errText = "删除调剂头表信息失败!" + pharmarcyManager.Err;
                    return(false);
                }
            }
            #endregion

            #region 收费
            //划价
            if (!feeIntegrate.SetChargeInfo(r, noFeeList, FeeTime, ref errText))
            {
                return(false);
            }
            //更新收费标记
            string operCode = outPatientFee.Operator.ID;
            foreach (FeeItemList f in noFeeList)
            {
                f.FeeOper.OperTime = FeeTime;
                f.FeeOper.ID       = operCode;
                f.PayType          = PayTypes.Balanced;
                if (outPatientFee.UpdateFeeDetailFeeFlag(f) <= 0)
                {
                    errText = "更新费用明细失败!" + outPatientFee.Err;
                    return(false);
                }
            }
            #endregion

            #region 插入药品申请表
            string drugSendInfo = null;
            //插入发药申请信息,返回发药窗口,显示在发票上
            if (drugLists.Count > 0)
            {
                foreach (FeeItemList f in drugLists)
                {
                    if (((Register)f.Patient).DoctorInfo.Templet.Doct.ID == null || ((Register)f.Patient).DoctorInfo.Templet.Doct.ID == string.Empty)
                    {
                        ((Register)f.Patient).DoctorInfo.Templet.Doct = this.outPatientFee.Operator;
                    }
                }

                int iReturn = pharmarcyManager.ApplyOut(r, drugLists, string.Empty, FeeTime, false, out drugSendInfo);
                if (iReturn == -1)
                {
                    errText = "处理药品明细失败!" + pharmarcyManager.Err;

                    return(false);
                }
            }
            #endregion

            #region 插入终端项目申请
            foreach (FeeItemList f in undrugList)
            {
                Neusoft.HISFC.BizProcess.Integrate.Terminal.Result result = confirmIntegrate.ServiceInsertTerminalApply(f, r);

                if (result != Neusoft.HISFC.BizProcess.Integrate.Terminal.Result.Success)
                {
                    errText = "处理终端申请确认表失败!" + confirmIntegrate.Err;

                    return(false);
                }
            }
            #endregion

            return(true);
        }