/// <summary> /// 身份变更确认操作 /// </summary> /// <returns></returns> protected virtual int ChangePact() { if (this.IsValid() < 0) { return(-1); } Neusoft.FrameWork.WinForms.Classes.Function.ShowWaitForm("正在处理明细数据……"); Application.DoEvents(); Neusoft.FrameWork.Models.NeuObject newObj = new Neusoft.FrameWork.Models.NeuObject(); Neusoft.FrameWork.Models.NeuObject oldObj = new Neusoft.FrameWork.Models.NeuObject(); Neusoft.FrameWork.Models.NeuObject obj = new Neusoft.FrameWork.Models.NeuObject(); //备份收费药品信息 ArrayList alDruglistBackUp = new ArrayList(); //备份收费药品信息 ArrayList alUndruglistBackUp = new ArrayList(); obj = this.GetPactUnitByID(this.cmbNewPact.SelectedItem.ID); this.medcareInterfaceProxy.SetPactCode(this.cmbNewPact.SelectedItem.ID); //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(Neusoft.FrameWork.Management.Connection.Instance); Neusoft.FrameWork.Management.PublicTrans.BeginTransaction(); Neusoft.HISFC.BizProcess.Integrate.Pharmacy pharmacyIntegrate = new Neusoft.HISFC.BizProcess.Integrate.Pharmacy(); pharmacyIntegrate.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); this.InpatientManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); this.myPactUnit.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); this.radtIntegrate.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); this.feeIntegrate.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); newObj.ID = this.cmbNewPact.SelectedItem.ID; //1 合同单位代码 newObj.Name = this.cmbNewPact.SelectedItem.Name; //2 合同单位名称 newObj.User01 = obj.ID; //3 结算类别代码 newObj.User02 = obj.Name; //4 结算类别名称 newObj.User03 = this.patientInfo.SSN; //医疗证号 oldObj.ID = this.txtOldPact.Tag.ToString(); oldObj.Name = this.txtOldPact.Text; #region 退费 #region 处理非药品 //处理非药品 if (this.fpUndrug_Sheet1.RowCount > 0) { for (int i = 0; i < fpUndrug_Sheet1.RowCount; i++) { Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList undrugItem = new Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList(); Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList oldUndrugItem = new Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList(); if (this.fpUndrug_Sheet1.Rows[i].Tag != null) { undrugItem = (Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList) this.fpUndrug_Sheet1.Rows[i].Tag; oldUndrugItem = undrugItem.Clone(); undrugItem.ExtFlag2 = "3";//变更标志 //退费 undrugItem.IsNeedUpdateNoBackQty = true; if (this.feeIntegrate.QuitItem(this.patientInfo, undrugItem) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err); this.Clear(); return(-1); } //收费 oldUndrugItem.RecipeNO = this.InpatientManager.GetUndrugRecipeNO(); oldUndrugItem.Patient.Pact.ID = this.cmbNewPact.SelectedItem.ID; oldUndrugItem.FeeOper.ID = this.InpatientManager.Operator.ID; oldUndrugItem.FeeOper.OperTime = this.InpatientManager.GetDateTimeFromSysDateTime(); //备份非药品信息 alUndruglistBackUp.Add(oldUndrugItem); //if (this.feeIntegrate.FeeItem(this.oENewPatientInfo, oldUndrugItem) == -1) //{ // t.RollBack(); // Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); // MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err); // this.Clear(); // return -1; //} } else { Neusoft.FrameWork.Management.PublicTrans.RollBack(); Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err); this.Clear(); return(-1); } } } #endregion #region 处理药品 //处理药品 if (this.fpDrug_Sheet1.RowCount > 0) { for (int i = 0; i < fpDrug_Sheet1.RowCount; i++) { Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList medicineItem = new Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList(); Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList oldMedicineItem = new Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList(); if (this.fpDrug_Sheet1.Rows[i].Tag != null) { medicineItem = (Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList) this.fpDrug_Sheet1.Rows[i].Tag; oldMedicineItem = medicineItem.Clone(); medicineItem.ExtFlag2 = "3";//变更标志 //退费 ////这里是否更改成未摆药的更新发药申请的记录addbyhuazb //if (string.IsNullOrEmpty(medicineItem.ExecOper.ID)) //{ // Neusoft.FrameWork.Management.PublicTrans.RollBack(); // Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); // MessageBox.Show("保存出错出错" + "该患者有药未摆,请通知药房摆药以后再进行变更!"); // this.Clear(); // return -1; //} medicineItem.IsNeedUpdateNoBackQty = true; if (this.feeIntegrate.QuitItem(this.patientInfo, medicineItem) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err); this.Clear(); return(-1); } //收费 //存储旧处方号 oldMedicineItem.BalanceOper.User01 = oldMedicineItem.RecipeNO; oldMedicineItem.RecipeNO = this.InpatientManager.GetDrugRecipeNO(); oldMedicineItem.Patient.Pact.ID = this.cmbNewPact.SelectedItem.ID; oldMedicineItem.FeeOper.ID = this.InpatientManager.Operator.ID; oldMedicineItem.FeeOper.OperTime = this.InpatientManager.GetDateTimeFromSysDateTime(); //备份药品信息 alDruglistBackUp.Add(oldMedicineItem); //if (this.feeIntegrate.FeeItem(this.oENewPatientInfo, oldMedicineItem) == -1) //{ // t.RollBack(); // Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); // MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err); // this.Clear(); // return -1; //} } else { Neusoft.FrameWork.Management.PublicTrans.RollBack(); Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err); this.Clear(); return(-1); } } } #endregion #endregion if (this.radtIntegrate.SetPactShiftData(this.patientInfo, newObj, oldObj) != 0) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show("调用中间层出错"); this.Clear(); return(-1); } //获得更改后得患者信息 this.oENewPatientInfo = this.radtIntegrate.GetPatientInfomation(this.patientInfo.ID); if (this.oENewPatientInfo == null) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show("获得变更后患者信息出错!!", "提示"); this.Clear(); return(-1); } #region 重新收费 #region 处理非药品 long returnValue = 0; this.medcareInterfaceProxy.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); returnValue = this.medcareInterfaceProxy.Connect(); if (returnValue < 0) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); this.medcareInterfaceProxy.Rollback(); //{0C35F3E3-2E72-4ae3-8809-FF3809DA2A16} Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show("请确保待遇接口存在或正常初始化初始化失败" + this.medcareInterfaceProxy.ErrMsg); this.Clear(); return(-1); } returnValue = this.medcareInterfaceProxy.GetRegInfoInpatient(oENewPatientInfo); if (returnValue < 0) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); this.medcareInterfaceProxy.Rollback(); //{0C35F3E3-2E72-4ae3-8809-FF3809DA2A16} Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show("待遇接口获得患者信息失败" + this.medcareInterfaceProxy.ErrMsg); this.Clear(); return(-1); } returnValue = this.medcareInterfaceProxy.UploadRegInfoInpatient(oENewPatientInfo); if (returnValue < 0) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); this.medcareInterfaceProxy.Rollback(); //{0C35F3E3-2E72-4ae3-8809-FF3809DA2A16} Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show("待遇接口上传住院登记信息失败" + this.medcareInterfaceProxy.ErrMsg); this.Clear(); return(-1); } //处理非药品 if (alUndruglistBackUp.Count > 0) { for (int i = 0; i < alUndruglistBackUp.Count; i++) { Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList oldUndrugItem = new Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList(); oldUndrugItem = (Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList)alUndruglistBackUp[i]; if (this.feeIntegrate.FeeItem(this.oENewPatientInfo, oldUndrugItem) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); this.medcareInterfaceProxy.Rollback(); Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err); this.Clear(); return(-1); } } } #endregion #region 处理药品 //处理药品 if (alDruglistBackUp.Count > 0) { for (int i = 0; i < alDruglistBackUp.Count; i++) { Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList oldMedicineItem = new Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList(); oldMedicineItem = (Neusoft.HISFC.Models.Fee.Inpatient.FeeItemList)alDruglistBackUp[i]; if (oldMedicineItem != null) { if (this.feeIntegrate.FeeItem(this.oENewPatientInfo, oldMedicineItem.Clone()) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); this.medcareInterfaceProxy.Rollback(); Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err); this.Clear(); return(-1); } //这里收费完已经发药的senddrug_flag未更新。addbyhuazb if (this.InpatientManager.UpdateMedItemExecInfo(oldMedicineItem.RecipeNO, oldMedicineItem.SequenceNO , oldMedicineItem.UpdateSequence, oldMedicineItem.SendSequence, (int)oldMedicineItem.PayType, oldMedicineItem.StockOper.Dept.ID, oldMedicineItem.ExecOper.ID, oldMedicineItem.ExecOper.OperTime) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); this.medcareInterfaceProxy.Rollback(); Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show("调用中间层出错" + this.feeIntegrate.Err); this.Clear(); return(-1); } //更新处方号 if (pharmacyIntegrate.UpdateApplyOutRecipe(oldMedicineItem.BalanceOper.User01, oldMedicineItem.SequenceNO, oldMedicineItem.RecipeNO, oldMedicineItem.SequenceNO) == -1) { Neusoft.FrameWork.Management.PublicTrans.RollBack(); Neusoft.FrameWork.Management.PublicTrans.RollBack(); Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); MessageBox.Show("更新药品申请表处方号信息发生错误!" + pharmacyIntegrate.Err); this.Clear(); return(-1); } } } } #endregion #endregion Neusoft.FrameWork.Management.PublicTrans.Commit(); this.medcareInterfaceProxy.Commit(); MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("变更成功")); Neusoft.FrameWork.WinForms.Classes.Function.HideWaitForm(); //重新显示介面 this.SetpatientInfo(this.oENewPatientInfo); //重新显示费用明细 this.DisplayDetail(this.oENewPatientInfo.ID); return(1); }