Example #1
0
        /// <summary>
        /// 住院单人发药
        /// </summary>
        /// <param name="listOrder">发药单明细列表</param>
        /// <param name="dispMaster">发药单表头</param>
        /// <param name="uniformId">统领ID</param>
        private void SingleDisp(List <BillOrder> listOrder, YP_DRMaster dispMaster, int uniformId)
        {
            dispMaster.RetailFee = Decimal.Round(dispMaster.RetailFee + (decimal)0.00000000001, 2);
            BindEntity <HIS.Model.YP_DRMaster> .CreateInstanceDAL(oleDb, Tables.YF_DRMASTER).Add(dispMaster);

            HIS.Interface.IZY_Data zyInterFace = new HIS.Interface.ZY_Data();
            //将生成的发药单据表头标识ID赋给所有发药明细
            for (int index = 0; index < listOrder.Count; index++)
            {
                YP_DROrder order = (YP_DROrder)listOrder[index];
                order.MasterDrugOCID = dispMaster.MasterDrugOCID;
                order.UniformID      = uniformId;
                if (order.DrugOCNum != 0)
                {
                    BindEntity <HIS.Model.YP_DROrder> .CreateInstanceDAL(oleDb, Tables.YF_DRORDER).Add(order);
                }
                else
                {
                    listOrder.Remove(order);
                    index--;// add zenghao 20100823
                }
                if (order.DrugOC_Flag == 1)
                {
                    zyInterFace.UpdateSendFlag(order.OrderRecipeID, order.DrugOC_Flag, order.DrugOCNum, order.RetailFee);
                }
                else
                {
                    zyInterFace.UpdateSendFlag(order.OrderRecipeID, 2, -order.DrugOCNum, -order.RetailFee);
                }
            }
            Hashtable storeTable = StoreFactory.GetProcessor(dispMaster.OpType).ChangeStoreNum(dispMaster, listOrder);

            foreach (YP_StoreNum storeInfo in storeTable.Values)
            {
                if (storeInfo.storeNum == -1)
                {
                    noStoreList.Add(storeInfo);
                }
            }
            AccountFactory.GetWriter(dispMaster.OpType).WriteAccount(dispMaster, listOrder, storeTable);
        }
Example #2
0
        /// <summary>
        /// 打印摆药单据
        /// </summary>
        /// <param name="printCondition">打印头信息</param>
        /// <param name="orderDt">打印明细</param>
        /// <param name="path">报表路径</param>
        public override void PrintReport(YP_PrintCondition printCondition, System.Data.DataTable orderDt, string path)
        {
            if (orderDt == null)
            {
                return;
            }
            if (orderDt.Rows.Count > 0)
            {
                HIS.Interface.IZY_Data zyInterFace = new HIS.Interface.ZY_Data();
                _printOrder = new DataTable();
                DateTime currentTime = XcDate.ServerDateTime;
                _printOrder.Columns.Add("OrderContents", Type.GetType("System.String"));
                _printOrder.Columns.Add("PatName", Type.GetType("System.String"));
                _printOrder.Columns.Add("PatAge", Type.GetType("System.String"));
                _printOrder.Columns.Add("BedNo", Type.GetType("System.String"));
                _printOrder.Columns.Add("OrderId", Type.GetType("System.Int32"));
                _printOrder.Columns.Add("ChargeDate", Type.GetType("System.DateTime"));
                _printOrder.Columns.Add("UnitName", Type.GetType("System.String"));
                _printOrder.Columns.Add("CureNo", Type.GetType("System.String"));
                _printOrder.Columns.Add("DrugNum", Type.GetType("System.Decimal"));
                _printOrder.Columns.Add("PresDeptName", Type.GetType("System.String"));
                _printOrder.Columns.Add("SortNum", Type.GetType("System.Int32"));
                _printOrder.PrimaryKey = new DataColumn[] { _printOrder.Columns["OrderId"], _printOrder.Columns["CureNo"] };
                //如果只打口服摆药单
                if (printCondition.drugType == "口服药")
                {
                    for (int index = 0; index < orderDt.Rows.Count; index++)
                    {
                        //按医嘱ID获取用法对应执行单表
                        DataTable useTypeDt = zyInterFace.GetUseType(Convert.ToInt32(orderDt.Rows[index]["docorderid"]));                        if (useTypeDt != null)
                        {
                            //如果是口服药
                            if (useTypeDt.Select("TYPE_NAME='服药单'").Count() == 0)
                            {
                                orderDt.Rows[index]["ISDISPENSE"] = 0;
                            }
                        }
                    }
                }
                for (int index = 0; index < orderDt.Rows.Count; index++)
                {
                    DataRow currentRow = orderDt.Rows[index];
                    if (currentRow["ISDISPENSE"] == DBNull.Value)
                    {
                        continue;
                    }
                    if (Convert.ToInt32(currentRow["ISDISPENSE"]) == 0)
                    {
                        continue;
                    }
                    DataRow findRow = _printOrder.Rows.Find(new object[] { currentRow["docorderid"], currentRow["cureno"] });
                    if (findRow != null)
                    {
                        findRow["DrugNum"] = Convert.ToDecimal(findRow["DrugNum"])
                                             + Convert.ToDecimal(currentRow["DrugNum"]);
                    }
                    else
                    {
                        DataRow newRow = _printOrder.NewRow();
                        newRow["OrderContents"] = zyInterFace.GetDocOrderInfo(Convert.ToInt32(currentRow["docorderid"]));
                        newRow["PatName"]       = currentRow["patname"];
                        string bedNo = currentRow["bedno"].ToString();
                        newRow["SortNum"]      = Convert.ToInt32(bedNo.Replace("加", "100").ToString());
                        newRow["BedNo"]        = bedNo;
                        newRow["OrderId"]      = currentRow["docorderid"];
                        newRow["ChargeDate"]   = currentRow["chargedate"];
                        newRow["UnitName"]     = currentRow["unitname"];
                        newRow["CureNo"]       = currentRow["cureno"];
                        newRow["DrugNum"]      = currentRow["drugnum"];
                        newRow["PresDeptName"] = currentRow["presdeptname"];
                        newRow["PatAge"]       = zyInterFace.GetPatAge(newRow["CureNo"].ToString(), currentTime);
                        _printOrder.Rows.Add(newRow);
                    }
                }
                DataRow[] dRows = _printOrder.Select("", "SortNum");
                DataTable newDt = _printOrder.Clone();
                foreach (DataRow dRow in dRows)
                {
                    newDt.Rows.Add(dRow.ItemArray);
                }
                _printOrder = newDt;
                if (_printOrder.Rows.Count > 0)
                {
                    report = new grproLib.GridppReport();
                    report.LoadFromFile(path);
                    report.FetchRecord += new grproLib._IGridppReportEvents_FetchRecordEventHandler(report_FetchRecord);
                    string type = "";
                    switch (printCondition.queyType)
                    {
                    case 0:
                        type = "长期";
                        break;

                    case 1:
                        type = "临时";
                        break;

                    default:
                        break;
                    }
                    report.ParameterByName("HospitalName").AsString = HIS.SYSTEM.BussinessLogicLayer.Classes.BaseData.WorkName
                                                                      + type + "住院药品摆药单";
                    report.ParameterByName("PrintTime").AsDateTime = HIS.SYSTEM.PubicBaseClasses.XcDate.ServerDateTime;
                    report.ParameterByName("Printer").AsString     = BaseData.GetUserName(printCondition.userId);
                    report.PrintPreview(false);
                }
            }
        }