/// <summary> /// 获得update或者insert人员属性变动信息表的传入参数数组 /// </summary> /// <param name="employeeRecord">人员属性变动信息实体</param> /// <returns>字符串数组</returns> private string[] myGetParmEmployeeRecord(Neusoft.HISFC.Models.Base.EmployeeRecord employeeRecord) { if (employeeRecord.State == "0") { //如果是申请状态,则申请人是操作人 employeeRecord.ApplyOperator.ID = this.Operator.ID; employeeRecord.ApplyTime = this.GetDateTimeFromSysDateTime(); } string[] strParm = { employeeRecord.ID, //台帐记录流水号 employeeRecord.Employee.ID, //员工代码 employeeRecord.ShiftType.ID, //变动类型(DEPT科室,NURSE护士站等) employeeRecord.OldData.ID, //原资料代号 employeeRecord.OldData.Name, //原资料名称 employeeRecord.NewData.ID, //新资料代号 employeeRecord.NewData.Name, //新资料名称 employeeRecord.State, //当前状态(0申请,1确认,2作废) employeeRecord.Memo, //备注 employeeRecord.ApplyOperator.ID, //申请操作员 employeeRecord.ApplyTime.ToString(), //申请时间 this.Operator.ID //操作员(核准,作废) }; return(strParm); }
/// <summary> /// 向人员属性变动信息表中插入一条记录 /// </summary> /// <param name="employeeRecord">科室扩展属性类</param> /// <returns>0没有更新 1成功 -1失败</returns> public int InsertEmployeeRecord(Neusoft.HISFC.Models.Base.EmployeeRecord employeeRecord) { string strSQL = ""; //取插入操作的SQL语句 if (this.Sql.GetSql("Manager.EmployeeRecord.InsertEmployeeRecord", ref strSQL) == -1) { this.Err = "没有找到Manager.EmployeeRecord.InsertEmployeeRecord字段!"; return(-1); } try { //取流水号 employeeRecord.ID = this.GetSequence("Manager.GetConstantID"); if (employeeRecord.ID == "") { return(-1); } string[] strParm = myGetParmEmployeeRecord(employeeRecord); //取参数列表 strSQL = string.Format(strSQL, strParm); //替换SQL语句中的参数。 } catch (Exception ex) { this.Err = "格式化SQL语句时出错Manager.EmployeeRecord.InsertEmployeeRecord:" + ex.Message; this.WriteErr(); return(-1); } return(this.ExecNoQuery(strSQL)); }
private void lvEmployeeRecord_SelectedIndexChanged(object sender, EventArgs e) { //取当前选中的人员变动记录 if (this.lvEmployeeRecord.SelectedItems.Count == 0) { this.EmployeeRecord = new Neusoft.HISFC.Models.Base.EmployeeRecord(); } else { this.EmployeeRecord = this.lvEmployeeRecord.SelectedItems[0].Tag as Neusoft.HISFC.Models.Base.EmployeeRecord; } }
/// <summary> /// 取人员属性变动信息列表,可能是一条或者多条 /// 私有方法,在其他方法中调用 /// </summary> /// <param name="SQLString">SQL语句</param> /// <returns>人员属性变动信息信息对象数组</returns> private ArrayList myGetEmployeeRecord(string SQLString) { ArrayList al = new ArrayList(); Neusoft.HISFC.Models.Base.EmployeeRecord employeeRecord; //人员属性变动信息实体 this.ProgressBarText = "正在检索人员属性变动信息..."; this.ProgressBarValue = 0; //执行查询语句 if (this.ExecQuery(SQLString) == -1) { this.Err = "获得人员属性变动信息时,执行SQL语句出错!" + this.Err; this.ErrCode = "-1"; return(null); } try { while (this.Reader.Read()) { //取查询结果中的记录 employeeRecord = new Neusoft.HISFC.Models.Base.EmployeeRecord(); employeeRecord.ID = this.Reader[0].ToString(); //0 台帐记录流水号 employeeRecord.Employee.ID = this.Reader[1].ToString(); //1 员工代码 employeeRecord.ShiftType.ID = this.Reader[2].ToString(); //2 变动类型(DEPT科室,NURSE护士站等) employeeRecord.OldData.ID = this.Reader[3].ToString(); //3 原资料代号 employeeRecord.OldData.Name = this.Reader[4].ToString(); //4 原资料名称 employeeRecord.NewData.ID = this.Reader[5].ToString(); //5 新资料代号 employeeRecord.NewData.Name = this.Reader[6].ToString(); //6 新资料名称 employeeRecord.State = this.Reader[7].ToString(); //7 当前状态(0申请,1确认,2作废) employeeRecord.Memo = this.Reader[8].ToString(); //8 备注 employeeRecord.ApplyOperator.ID = this.Reader[9].ToString(); //9 申请操作员 employeeRecord.ApplyTime = NConvert.ToDateTime(this.Reader[10].ToString()); //10申请时间 employeeRecord.OperEnvironment.ID = this.Reader[11].ToString(); //11 操作员(核准,作废) employeeRecord.OperDate = NConvert.ToDateTime(this.Reader[12].ToString()); //12 操作时间(核准,作废) employeeRecord.Employee.Name = this.Reader[13].ToString(); //13 员工代码 this.ProgressBarValue++; al.Add(employeeRecord); } } //抛出错误 catch (Exception ex) { this.Err = "获得人员属性变动信息信息时出错!" + ex.Message; this.ErrCode = "-1"; return(null); } this.Reader.Close(); this.ProgressBarValue = -1; return(al); }
/// <summary> /// 申请转科 /// </summary> private void ApplyTransfer() { if (this.myPerson.ID == "") { return; } Neusoft.HISFC.Models.Base.EmployeeRecord record = new Neusoft.HISFC.Models.Base.EmployeeRecord(); //取人员未核准的科室变动记录 ArrayList al = recordManager.GetEmployeeRecordListByEmpl(this.myPerson.ID, "0"); if (al == null) { MessageBox.Show(recordManager.Err, "错误提示"); return; } if (al.Count > 0) { //如果存在在,显示申请的记录。不能同时存在两天申请记录。 record = al[0] as Neusoft.HISFC.Models.Base.EmployeeRecord; } else { record.Employee = this.myPerson; record.OldData.ID = this.myPerson.Dept.ID; record.OldData.Name = this.objHelper.GetName(this.myPerson.Dept.ID); record.ShiftType.ID = "DEPT"; } ucEmployeeRecord temp = new ucEmployeeRecord(); temp.EmployeeRecord = record; temp.IsApply = true; //取窗口返回参数 DialogResult dlg = Neusoft.FrameWork.WinForms.Classes.Function.PopShowControl(temp); if (dlg == DialogResult.OK) { //刷新人员属性变动数据 this.RefreshData(); } }
/// <summary> /// 转科确认 /// </summary> private void ConfirmTransfer() { Neusoft.HISFC.Models.Base.EmployeeRecord record = new Neusoft.HISFC.Models.Base.EmployeeRecord(); Neusoft.HISFC.Models.Base.EmployeeRecord newRecord = new Neusoft.HISFC.Models.Base.EmployeeRecord(); record.ShiftType.ID = "DEPT"; //record.NewData.ID = (this.personManager.Operator as Neusoft.HISFC.Models.Base.Employee).Dept.ID; //record.NewData.Name = (this.personManager.Operator as Neusoft.HISFC.Models.Base.Employee).Dept.Name; ArrayList al = recordManager.GetEmployeeRecordListByEmpl(this.myPerson.ID, "0"); if (al == null) { MessageBox.Show(recordManager.Err, "错误提示"); return; } //if (al.Count >= 0) if (al.Count > 0) { newRecord = al[0] as Neusoft.HISFC.Models.Base.EmployeeRecord; record.NewData.ID = newRecord.NewData.ID; record.NewData.Name = newRecord.NewData.Name; } else { return; } ucEmployeeRecord temp = new ucEmployeeRecord(); temp.EmployeeRecord = new Neusoft.HISFC.Models.Base.EmployeeRecord(); temp.EmployeeRecord = record; temp.IsApply = false; //取窗口返回参数 DialogResult dlg = Neusoft.FrameWork.WinForms.Classes.Function.PopShowControl(temp); if (dlg == DialogResult.OK) { //确认之后刷新人员列表 this.ShowEmployee(); } }
/// <summary> /// 更新人员属性变动信息表中一条记录 /// </summary> /// <param name="employeeRecord">科室扩展属性类</param> /// <returns>0没有更新 1成功 -1失败</returns> public int UpdateEmployeeRecord(Neusoft.HISFC.Models.Base.EmployeeRecord employeeRecord) { string strSQL = ""; //取更新操作的SQL语句 if (this.Sql.GetSql("Manager.EmployeeRecord.UpdateEmployeeRecord", ref strSQL) == -1) { this.Err = "没有找到Manager.EmployeeRecord.UpdateEmployeeRecord字段!"; return(-1); } try { string[] strParm = myGetParmEmployeeRecord(employeeRecord); //取参数列表 strSQL = string.Format(strSQL, strParm); //替换SQL语句中的参数。 } catch (Exception ex) { this.Err = "格式化SQL语句时出错Manager.EmployeeRecord.UpdateEmployeeRecord:" + ex.Message; this.WriteErr(); return(-1); } return(this.ExecNoQuery(strSQL)); }
/// <summary> /// 人员转科后更新人员新的科室和护理站 /// </summary> /// <param name="record">人员转科信息</param> /// <returns>1:成功 -1:失败</returns> public int Update(Neusoft.HISFC.Models.Base.EmployeeRecord record) { string sql = ""; if (this.Sql.GetSql("Person.UpdateDept", ref sql) == -1) { return(-1); } /* * UPDATE com_employee --员工代码表 * SET * dept_code='{0}', --所属科室号 * nurse_cell_code = (select t.pardep_code from com_deptstat t where t.dept_code='{0}' and t.stat_code='01' and rownum=1), --所属护理站 * oper_code = '{1}', * oper_date = sysdate * WHERE empl_code='{2}' --员工代码 * and * dept_code='{3}' */ try { sql = string.Format(sql, record.NewData.ID, this.Operator.ID, record.Employee.ID, record.OldData.ID); } catch (Exception ex) { this.ErrCode = ex.Message; this.Err = "接口错误!" + ex.Message; this.WriteErr(); return(-1); } if (this.ExecNoQuery(sql) <= 0) { return(-1); } return(1); }
/// <summary> /// 保存人员属性变动数据--先执行更新操作,如果没有找到可以更新的数据,则插入一条新记录 /// </summary> /// <param name="employeeRecord">人员属性变动信息实体</param> /// <returns>0没有更新 1成功 -1失败</returns> public int SetEmployeeRecord(Neusoft.HISFC.Models.Base.EmployeeRecord employeeRecord) { // int parm; // //执行更新操作 // parm = UpdateEmployeeRecord(employeeRecord); // // //如果没有找到可以更新的数据,则插入一条新记录 // if (parm == 0 ) { // parm = InsertEmployeeRecord(employeeRecord); // } // if (parm == -1 ) { // return -1; // } // // //如果变动数据被核准,则同时更新人员信息表中对应数据项。 // if (employeeRecord.State == "1") { // //人员实体 // Neusoft.HISFC.Models.RADT.Person person = new Neusoft.HISFC.Models.RADT.Person(); // //人员管理类 // Neusoft.HISFC.Management.Manager.Person personManager = new Person(); //传递trans // personManager.SetTrans(this.command.Transaction); //取人员全部信息 // person = personManager.GetPersonByID(employeeRecord.Empl.ID); // if (person == null) { // this.Err = personManager.Err; // return -1; // } // // //处理科室变动 // if (employeeRecord.ShiftType.ID == "DEPT") // { // person.Dept.ID = employeeRecord.NewData.ID ; //科室编码 // person.Dept.Name = employeeRecord.NewData.Name ; //科室名称 // //在进行科室变动的同时要进行护理站变动 // //if (person.PersonType.ID.ToString() == "N") { // Neusoft.HISFC.Management.Manager.Department departMent = new Department(); // //传递trans // departMent.SetTrans(this.command.Transaction); // //处理护士站变动 // try // { // person.Nurse = departMent.GetNurseStationFromDept(person.Dept)[0] as Neusoft.FrameWork.Models.NeuObject; // } // catch{} // //} // } // // //处理护士站变动 // if (employeeRecord.ShiftType.ID == "NURSE") { // person.Nurse.ID = employeeRecord.NewData.ID; //科室编码 // person.Nurse.Name = employeeRecord.NewData.Name; //科室名称 // } // // //用变动后的数据更新人员信息 // parm = personManager.Update(person); // this.Err = personManager.Err; // } //返回 //return parm; return(1); }
/// <summary> /// 保存人员数据 /// </summary> public void Save() { //如果变动后名称的tag属性有数据,则将此数据付给变动后的编码 if (this.txtNewDataName.Tag.ToString() != "") { this.txtNewDataID.Text = this.txtNewDataName.Tag.ToString(); } //取控件中的数据 Neusoft.HISFC.Models.Base.EmployeeRecord record = this.EmployeeRecord; //验证数据是否有效 //人员编码 if (record.Employee.ID == "") { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("人员编码不能为空")); return; } //变动类型 if (record.ShiftType.ID == "") { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("变动类型不能为空")); return; } //变动前编码 if (record.OldData.ID == "") { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("变动前编码不能为空")); return; } //变动后编码 if (record.NewData.ID == "") { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("变动后编码不能为空")); return; } //变动后名称 if (record.NewData.Name == "") { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("变动后名称不能为空")); return; } if (record.OldData.ID == record.NewData.ID || record.OldData.Name == record.NewData.Name) { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("变动前后的数据不能相同")); return; } if (this.myIsApply) { //科室和护理站变动时需要先申请,后审核 if (this.myEmployeeRecord.ShiftType.ID == "DEPT" || this.myEmployeeRecord.ShiftType.ID == "NURSE") { this.myEmployeeRecord.State = "0"; } else { this.myEmployeeRecord.State = "1"; } } else { //核准状态 this.myEmployeeRecord.State = "1"; } Neusoft.FrameWork.Management.PublicTrans.BeginTransaction(); //Neusoft.FrameWork.Management.Transaction t = new Neusoft.FrameWork.Management.Transaction(Neusoft.FrameWork.Management.Connection.Instance); //t.BeginTransaction(); recordManager.SetTrans(Neusoft.FrameWork.Management.PublicTrans.Trans); //保存变动数据(如果state="1"即核准状态,程序会同时用变动后的数据更新人员基本信息) if (this.myIsApply)//申请 { if (/*recordManager.SetEmployeeRecord(record)*/ recordManager.InsertEmployeeRecord(record) != 1) { Neusoft.FrameWork.Management.PublicTrans.RollBack();; MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg(recordManager.Err)); return; } Neusoft.FrameWork.Management.PublicTrans.Commit();; MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("转科申请成功")); } else { if (recordManager.UpdateEmployeeRecord(record) != 1) { Neusoft.FrameWork.Management.PublicTrans.RollBack();; MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg(recordManager.Err)); return; } if (recordManager.Update(record) != 1) { Neusoft.FrameWork.Management.PublicTrans.RollBack();; MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg(personManager.Err)); return; } Neusoft.FrameWork.Management.PublicTrans.Commit();; MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("确认转科成功")); } this.FindForm().DialogResult = DialogResult.OK; }