public ServiceResponseData GetGroupMax() { SerialNumberSource serialNumberSource = NewObject <SerialNumberSource>(); string groupID = serialNumberSource.GetSerialNumber(SnType.医嘱组号); responseData.AddData(groupID); return(responseData); }
/// <summary> /// 出院/死亡医嘱 /// </summary> /// <param name="patlistid">病人ID</param> /// <param name="list">需自动停嘱对象</param> /// <param name="outDate">出院日期</param> /// <param name="outDiseaseName">出院诊断</param> /// <param name="outDiseaseCode">诊断编码</param> /// <param name="outSituation">出院情况</param> /// <param name="oprator">操作员</param> /// <param name="spciRecord">出院医嘱</param> public void OutHospOrder(int patlistid, List <IPD_OrderRecord> list, DateTime outDate, string outDiseaseName, string outDiseaseCode, string outSituation, int oprator, IPD_OrderRecord spciRecord) { //医嘱自动停保存 foreach (IPD_OrderRecord record in list) { this.BindDb(record); record.save(); } IP_PatList patlist = NewObject <IP_PatList>().getmodel(patlistid) as IP_PatList; if (patlist.Status != 2 || patlist.IsLeaveHosOrder == 1) { throw new Exception("病人状态已经不在床或已经开出院医嘱,不能开出院医嘱"); } SerialNumberSource serialNumberSource = NewObject <SerialNumberSource>(); string groupID = serialNumberSource.GetSerialNumber(SnType.医嘱组号); //生成说明性临嘱保存 spciRecord.GroupID = Convert.ToInt32(groupID); spciRecord.PatDeptID = patlist.CurrDeptID; spciRecord.WardID = patlist.CurrWardID; spciRecord.Dosage = 1; this.BindDb(spciRecord); spciRecord.save(); //病人状态修改 // patlist.Status = 5; patlist.IsLeaveHosOrder = 1; patlist.OutSituation = outSituation; patlist.LeaveHDate = outDate; this.BindDb(patlist); patlist.save(); //诊断表保存 IPD_Diagnosis ipdDiag = new IPD_Diagnosis(); ipdDiag.PatListID = patlist.PatListID; ipdDiag.DeptID = patlist.CurrDeptID; ipdDiag.DgsDocID = oprator; ipdDiag.DiagnosisTime = DateTime.Now; ipdDiag.DiagnosisName = outDiseaseName; ipdDiag.ICDCode = outDiseaseCode; ipdDiag.OrderID = spciRecord.OrderID; if (spciRecord.OrderType == 5) { //出院诊断 ipdDiag.DiagnosisClass = 67334; } else if (spciRecord.OrderType == 6) { //死亡诊断 ipdDiag.DiagnosisClass = 67342; } this.BindDb(ipdDiag); ipdDiag.save(); }
/// <summary> /// 转科医嘱 /// </summary> /// <param name="patlistid">病人ID</param> /// <param name="list">需自动停嘱对象</param> /// <param name="transDate">转科日期</param> /// <param name="transDeptID">转科科室</param> /// <param name="oprator">操作员</param> /// <param name="spciRecord">转科医嘱对象</param> public void TransDeptOrder(int patlistid, List <IPD_OrderRecord> list, DateTime transDate, int transDeptID, int oprator, IPD_OrderRecord spciRecord) { //医嘱自动停保存 foreach (IPD_OrderRecord record in list) { this.BindDb(record); record.save(); } IP_PatList patlist = NewObject <IP_PatList>().getmodel(patlistid) as IP_PatList; if (patlist.Status != 2 || patlist.IsLeaveHosOrder == 1) { throw new Exception("病人状态已经不在床或已经开出院医嘱,不能开转科医嘱"); } List <IPD_TransDept> listTrans = NewObject <IPD_TransDept>().getlist <IPD_TransDept>(" patlistid=" + patlistid + " and cancelFlag=0 and finishFlag=0"); if (listTrans.Count > 0) { throw new Exception("该病人存在未完成的转科医嘱,不能再开转科医嘱"); } SerialNumberSource serialNumberSource = NewObject <SerialNumberSource>(); string groupID = serialNumberSource.GetSerialNumber(SnType.医嘱组号); //生成说明性临嘱保存 spciRecord.GroupID = Convert.ToInt32(groupID); spciRecord.PatDeptID = patlist.CurrDeptID; spciRecord.WardID = patlist.CurrWardID; spciRecord.Dosage = 1; this.BindDb(spciRecord); spciRecord.save(); //转入信息保存 IPD_TransDept transDept = new IPD_TransDept(); transDept.Operator = oprator; transDept.PatListID = patlistid; transDept.OldDeptID = patlist.CurrDeptID; transDept.NewDeptID = transDeptID; transDept.TransDate = transDate; transDept.OrderID = spciRecord.OrderID; transDept.OperDate = DateTime.Now; transDept.FinishFlag = 0; this.BindDb(transDept); transDept.save(); }
/// <summary> /// 挂号提交 /// </summary> /// <param name="curPatlist">病人对象</param> /// <param name="paymentInfoList">支付对象</param> /// <param name="totalFee">总金额</param> /// <param name="cashFee">现金金额</param> /// <param name="posFee">POS金额</param> /// <param name="dtPrint">返回的打印数据</param> /// <param name="promFee">优惠金额</param> /// <returns>true成功false失败</returns> public bool SaveRegInfo(OP_PatList curPatlist, PayMentInfoList paymentInfoList, decimal totalFee, decimal cashFee, decimal posFee, out DataTable dtPrint, decimal promFee) { try { dtPrint = new DataTable(); bool result = false; //插入挂号就诊表记录 #region 插入挂号就诊表记录 SerialNumberSource serialNumberSource = NewObject <SerialNumberSource>(); curPatlist.VisitNO = serialNumberSource.GetSerialNumber(SnType.门诊流水号); curPatlist.CureDeptID = curPatlist.RegDeptID; curPatlist.CureEmpID = curPatlist.RegEmpID; curPatlist.RegDate = DateTime.Now; curPatlist.VisitStatus = 0; curPatlist.RegStatus = 0; curPatlist.RegCategory = 0; DataTable dtOld = NewObject <OP_PatList>().gettable(" MemberID=" + curPatlist.MemberID); if (dtOld != null && dtOld.Rows.Count > 0) { curPatlist.IsNew = 0; } else { curPatlist.IsNew = 1; } this.BindDb(curPatlist); curPatlist.save(); #endregion int iAccountType = 0; //得到当前结账ID int curAccountId = NewObject <CommonMethod>().GetAccountId(curPatlist.OperatorID, iAccountType); //插入结算主表对象 #region 插入结算主表对象 OP_CostHead costHead = new OP_CostHead(); SetRegCostHead(costHead, curPatlist); costHead.CashFee = cashFee; costHead.PosFee = posFee; costHead.TotalFee = totalFee; costHead.PromFee = promFee; costHead.AccountID = curAccountId; this.BindDb(costHead); costHead.save(); #endregion #region 插入费用表 //插入费用主表 OP_FeeItemHead OP_FeeItemHead feeItemHead = new OP_FeeItemHead(); SetRegFeeHeadValue(feeItemHead, costHead, curPatlist); this.BindDb(feeItemHead); feeItemHead.save(); //插入费用明细表 OP_FeeItemDetail List <OP_FeeItemDetail> feeDetials = SetRegFeeDetailValue(feeItemHead.FeeItemHeadID, curPatlist); foreach (OP_FeeItemDetail feeDetial in feeDetials) { this.BindDb(feeDetial); feeDetial.save(); } #endregion //插入结算明细表 #region 插入结算明细表 DataTable dtRegFeeDetail = NewDao <IOPManageDao>().GetRegItemFeeByStat(curPatlist.RegTypeID); for (int rowindex = 0; rowindex < dtRegFeeDetail.Rows.Count; rowindex++) { OP_CostDetail costDetail = new OP_CostDetail(); costDetail.CostHeadID = costHead.CostHeadID; costDetail.FeeItemHeadID = feeItemHead.FeeItemHeadID; costDetail.ExeDeptID = curPatlist.RegDeptID; costDetail.PresEmpID = curPatlist.RegEmpID; costDetail.PresDeptID = curPatlist.RegDeptID; costDetail.TotalFee = Convert.ToDecimal(dtRegFeeDetail.Rows[rowindex]["statFee"]); costDetail.StatID = Convert.ToInt32(dtRegFeeDetail.Rows[rowindex]["statId"]); this.BindDb(costDetail); costDetail.save(); } #endregion //插入结算支付方式明细表 #region 插入结算支付方式明细表 foreach (OP_CostPayMentInfo costpaymentinfo in paymentInfoList.paymentInfolist) { if (costpaymentinfo.PayMentMoney > 0) { costpaymentinfo.AccountID = curAccountId; costpaymentinfo.CostHeadID = costHead.CostHeadID; costpaymentinfo.PatListID = curPatlist.PatListID; costpaymentinfo.PatName = curPatlist.PatName; costpaymentinfo.PatType = costHead.PatTypeID.ToString(); this.BindDb(costpaymentinfo); costpaymentinfo.save(); } } #endregion //挂号记录表回写costheadid curPatlist.CostHeadID = costHead.CostHeadID; curPatlist.ChargeFlag = 1; this.BindDb(curPatlist); curPatlist.save(); //结账表插入汇总金额 NewObject <CommonMethod>().AddAccoutFee(costHead, curAccountId, 1, 0); //查数据库得到打印dtPrint dtPrint = NewObject <IOPManageDao>().GetRegPrint(curPatlist.PatListID); result = true; return(result); } catch (Exception err) { throw new Exception(err.Message); } }
/// <summary> /// 保存医技申请 /// </summary> /// <param name="head">申请头实体</param> /// <param name="itemData">项目数据</param> /// <param name="dt">明细数据</param> /// <returns>申请头id</returns> public int SaveMedicalApply(EXA_MedicalApplyHead head, DataTable itemData, DataTable dt) { DataRow dr = null; head.Remark = GetItemName(itemData); DeleteData(itemData, dt); if (dt != null) { head.ApplyHeadID = Convert.ToInt32(dt.Rows[0]["ApplyHeadID"].ToString()); } this.BindDb(head); head.save(); int headid = head.ApplyHeadID; OPD_PresHead presHead = new OPD_PresHead(); if (head.SystemType == 0) { if (dt != null) { presHead.PresHeadID = Convert.ToInt32(dt.Rows[0]["PresHeadID"].ToString()); } presHead.MemberID = head.MemberID; presHead.PatListID = head.PatListID; presHead.PresType = 4; BindDb(presHead); int presheadid = presHead.save(); NewObject <PrescriptionProcess>().UpdatePatCurrentDoctorID(head.PatListID, head.ApplyDoctorID, head.ApplyDeptID); } for (int i = 0; i < itemData.Rows.Count; i++) { dr = NewDao <IOPDDao>().GetPresNO().Rows[0]; int predetailid = 0; OPD_PresDetail presdetail = new OPD_PresDetail(); IPD_OrderRecord orderRecord = new IPD_OrderRecord(); DataRow detaildr = null; DataTable orderdt = NewDao <IOPDDao>().GetStatID(itemData.Rows[i]["ExamItemID"].ToString()); if (dt != null) { detaildr = dt.Select("ItemID=" + Convert.ToInt32(itemData.Rows[i]["ExamItemID"].ToString())).FirstOrDefault(); } if (head.SystemType == 0) { if (detaildr != null) { presdetail.PresDetailID = Convert.ToInt32(detaildr["PresDetailID"]); } if (head.ApplyType == 2) { presdetail.Price = Convert.ToDecimal(itemData.Rows[i]["Price"].ToString()) * Convert.ToInt32(itemData.Rows[i]["Amount"].ToString()); presdetail.ChargeAmount = Convert.ToInt32(itemData.Rows[i]["Amount"].ToString()); presdetail.PresAmount = Convert.ToInt32(itemData.Rows[i]["Amount"].ToString()); } else { presdetail.Price = Convert.ToDecimal(itemData.Rows[i]["Price"].ToString()); presdetail.ChargeAmount = 1; presdetail.PresAmount = 1; } presdetail.DoseNum = 1; presdetail.PresHeadID = presHead.PresHeadID; presdetail.ItemID = Convert.ToInt32(itemData.Rows[i]["ExamItemID"].ToString()); presdetail.ItemName = itemData.Rows[i]["ExamItemName"].ToString(); presdetail.ExecDeptID = head.ExecuteDeptID; presdetail.StatID = Convert.ToInt32(orderdt.Rows[0]["StatID"]); if (dr != null) { if (dr["PresNO"] == null || dr["PresNO"].ToString() == string.Empty) { presdetail.PresNO = 1; } else { presdetail.PresNO = Convert.ToInt32(dr["PresNO"]) + 1; } } presdetail.IsEmergency = 0; presdetail.IsLunacyPosion = 0; presdetail.PresDate = head.ApplyDate; presdetail.PresDeptID = head.ApplyDeptID; presdetail.PresDoctorID = head.ApplyDoctorID; BindDb(presdetail); predetailid = presdetail.save(); if (presdetail.PresDetailID > 0) { predetailid = presdetail.PresDetailID; } } else { if (detaildr != null) { orderRecord.OrderID = Convert.ToInt32(detaildr["PresDetailID"]); } DataTable ipPatlist = NewDao <IOPDDao>().GetInBedPatient(head.PatListID); SerialNumberSource serialNumberSource = NewObject <SerialNumberSource>(); string groupID = serialNumberSource.GetSerialNumber(SnType.医嘱组号); orderRecord.GroupID = Convert.ToInt32(groupID); orderRecord.ExecDeptID = head.ExecuteDeptID; orderRecord.OrderCategory = 1; orderRecord.CancelFlag = 0; orderRecord.DeleteFlag = 0; orderRecord.AstFlag = -1; orderRecord.DoseNum = 1; orderRecord.Dosage = 1; // orderRecord.DosageUnit = itemData.Rows[i][""].ToString(); orderRecord.OrderStatus = 1; orderRecord.PatDeptID = Convert.ToInt32(ipPatlist.Rows[0]["CurrDeptID"]); orderRecord.WardID = Convert.ToInt32(ipPatlist.Rows[0]["EnterWardID"]); orderRecord.StatID = Convert.ToInt32(orderdt.Rows[0]["StatID"]); orderRecord.ItemID = Convert.ToInt32(itemData.Rows[i]["ExamItemID"].ToString()); orderRecord.PresDeptID = head.ApplyDeptID; orderRecord.OrderDoc = head.ApplyDoctorID; orderRecord.ItemName = itemData.Rows[i]["ExamItemName"].ToString(); orderRecord.Amount = Convert.ToInt32(itemData.Rows[i]["Amount"].ToString()); orderRecord.OrderBdate = head.CheckDate; //DateTime.Now; 20170418改成检查时间 if (head.ApplyType == 2) { orderRecord.ItemPrice = Convert.ToDecimal(itemData.Rows[i]["Price"].ToString()) * Convert.ToInt32(itemData.Rows[i]["Amount"].ToString()); } else { orderRecord.ItemPrice = Convert.ToDecimal(itemData.Rows[i]["Price"].ToString()); } orderRecord.ItemType = 4; orderRecord.PatListID = head.PatListID; BindDb(orderRecord); predetailid = orderRecord.save(); //插入费用明细 FeeItemDataSource feeDataSource = NewObject <FeeItemDataSource>(); DataTable dtDetailItem = feeDataSource.GetExamItemDetailDt(orderRecord.ItemID); for (int index = 0; index < dtDetailItem.Rows.Count; index++) { int feeitemId = Convert.ToInt32(dtDetailItem.Rows[index]["ITEMID"]); DataTable dtDrugItem = NewDao <IOPDDao>().GetFeeItemData(feeitemId); decimal amount = Convert.ToDecimal(dtDetailItem.Rows[index]["ItemAmount"]); DataRow[] rows = dtDrugItem.Select(" ItemID=" + feeitemId); if (rows.Length < 1) { continue; } IP_FeeItemGenerate feeItem = GenerateRecordFee(amount, 1, orderRecord, ipPatlist, rows[0]); feeItem.FeeSource = 1; feeItem.CalCostMode = 0; this.BindDb(feeItem); feeItem.save(); } } EXA_MedicalApplyDetail detail = new EXA_MedicalApplyDetail(); if (detaildr != null) { detail.ApplyDetailID = Convert.ToInt32(detaildr["ApplyDetailID"]); } detail.SystemType = head.SystemType; detail.PresDetailID = predetailid; detail.ApplyHeadID = head.ApplyHeadID; detail.ItemID = Convert.ToInt32(itemData.Rows[i]["ExamItemID"].ToString()); detail.ItemName = itemData.Rows[i]["ExamItemName"].ToString(); detail.Price = Convert.ToDecimal(itemData.Rows[i]["Price"].ToString()); if (head.ApplyType == 2) { detail.Amount = Convert.ToInt32(itemData.Rows[i]["Amount"].ToString()); detail.TotalFee = Convert.ToDecimal(itemData.Rows[i]["Price"].ToString()) * detail.Amount; } else { detail.Amount = 1; detail.TotalFee = Convert.ToDecimal(itemData.Rows[i]["Price"].ToString()); } BindDb(detail); detail.save(); } return(headid); }
/// <summary> /// 插入皮试医嘱 /// </summary> /// <param name="dtDrugItem">药品项目数据</param> /// <param name="astOrderRecord">皮试医嘱</param> /// <param name="ipPatlist">病人对象</param> private void InsertPSYZ(DataTable dtDrugItem, IPD_OrderRecord astOrderRecord, IP_PatList ipPatlist) { DataRow[] rows = dtDrugItem.Select(" ItemID=" + astOrderRecord.ItemID); if (rows.Length <= 0) { return; } DataRow row = rows[0]; List <IPD_OrderRecord> data = new List <IPD_OrderRecord>(); IPD_OrderRecord record = new IPD_OrderRecord(); record.ItemID = Convert.ToInt32(row["itemid"]); record.ItemName = row["itemname"].ToString(); record.ChannelName = "皮试"; record.ChannelID = 34; record.FrenquencyID = 22; record.Frequency = "q.d."; record.Amount = 1; record.Unit = row["MiniUnitName"].ToString(); record.UnitNO = 1; record.StatID = Convert.ToInt32(row["StatID"]); record.DoseNum = 1; record.OrderBdate = DateTime.Now; record.OrderCategory = 1; record.OrderType = 0; record.Dosage = 1; record.AstOrderID = astOrderRecord.OrderID; record.Factor = Convert.ToDecimal(row["DoseConvertNum"]); record.ItemType = Convert.ToInt32(row["ItemClass"]); record.ExecDeptID = astOrderRecord.ExecDeptID; record.AstFlag = 0; record.ItemPrice = Convert.ToDecimal(row["SellPrice"]); record.OrderStatus = 0; record.PatListID = astOrderRecord.PatListID; record.PresDeptID = astOrderRecord.PresDeptID; record.OrderDoc = astOrderRecord.OrderDoc; record.OrderID = 0; record.PatDeptID = ipPatlist.CurrDeptID; record.WardID = ipPatlist.CurrWardID; SerialNumberSource serialNumberSource = NewObject <SerialNumberSource>(); string groupID = serialNumberSource.GetSerialNumber(SnType.医嘱组号); record.GroupID = Convert.ToInt32(groupID); this.BindDb(record); record.save(); GenerateFee(record, dtDrugItem, ipPatlist); GenerateChannelFee(record, dtDrugItem, ipPatlist); int actDrugid = Convert.ToInt32(_getActDrugId()); if (actDrugid != 0) { DataRow[] drugrows = dtDrugItem.Select("ItemID=" + actDrugid); if (drugrows.Length > 0) { IPD_OrderRecord recordDrug = new IPD_OrderRecord(); recordDrug.ItemID = Convert.ToInt32(drugrows[0]["itemid"]); recordDrug.ItemName = drugrows[0]["itemname"].ToString(); recordDrug.ChannelName = record.ChannelName; recordDrug.ChannelID = record.ChannelID; recordDrug.FrenquencyID = record.FrenquencyID; recordDrug.OrderBdate = record.OrderBdate; recordDrug.Frequency = record.Frequency; recordDrug.Amount = 1; recordDrug.Unit = rows[0]["MiniUnitName"].ToString(); recordDrug.UnitNO = 1; recordDrug.StatID = Convert.ToInt32(rows[0]["StatID"]); recordDrug.DoseNum = 1; recordDrug.OrderStatus = 0; recordDrug.OrderCategory = 1; recordDrug.OrderType = 0; recordDrug.GroupID = record.GroupID; recordDrug.Dosage = 1; recordDrug.AstOrderID = astOrderRecord.OrderID; recordDrug.Factor = Convert.ToDecimal(rows[0]["DoseConvertNum"]); recordDrug.ItemType = Convert.ToInt32(rows[0]["ItemClass"]); recordDrug.ExecDeptID = astOrderRecord.ExecDeptID;// Convert.ToInt32(rows[0]["ExecDeptId"]); recordDrug.AstFlag = -1; recordDrug.ItemPrice = Convert.ToDecimal(rows[0]["SellPrice"]); recordDrug.PatListID = ipPatlist.PatListID; recordDrug.PresDeptID = record.PresDeptID; recordDrug.OrderDoc = record.OrderDoc; recordDrug.OrderID = 0; recordDrug.Memo = "PsDrug"; recordDrug.PatDeptID = ipPatlist.CurrDeptID; recordDrug.WardID = ipPatlist.CurrWardID; this.BindDb(recordDrug); recordDrug.save(); GenerateFee(recordDrug, dtDrugItem, ipPatlist); } } }