using HL_FristAidPlatform_DataBase;
using HL_FristAidPlatform_Help;
using HL_FristAidPlatform_Help.Model;
using HL_FristAidPlatform_IDataBase;
using HL_FristAidPlatform_Models;
using System.Collections.Generic;
namespace HL_FristAidPlatform_Bussiness.Service
{
///
///
///
public class T_Service_FistAid_PersonnelBLL
{
private IT_Service_FirstAid_Personnel IService = new T_Service_FirstAid_PersonnelDB();
///
/// 新增
///
///
///
public T_Service_FirstAid_Personnel Add(T_Service_FirstAid_Personnel model)
{
return IService.Add(model);
}
///
/// 删除
///
///
///
public MessageModel Delete(string guid)
{
if (IService.Delete(guid) > 0)
{
return new MessageModel { Success = true, Msg = "操作成功" };
}
else
{
return new MessageModel { Success = false, Msg = "操作失败" };
}
}
///
/// 获取列表
///
///
///
///
///
///
///
public TableModel GetPageList(string hospitalGuid, string name, int gender, int currentState, int role, int pageIndex, int pageSize)
{
return IService.GetPageList(hospitalGuid, name, gender, currentState, role, pageIndex, pageSize);
}
///
/// 更新
///
///
///
public int Update(T_Service_FirstAid_Personnel model)
{
return IService.Update(model);
}
///
/// 获取空闲所有人员
///
///
public TableModel GetPersonnel()
{
return IService.GetPersonnel();
}
///
/// 根据主键批量修改数据:人员状态
///
///
///
public int UpdateState(List list)
{
return IService.UpdateState(list);
}
///
/// 批量分配(车辆绑定人员)
///
///
///
///
public int VehiclePersonnelPlan(PlanDrvingPersonnelModel model)
{
List list = new List();
string[] str = model.PerList.Split(new char[] { ',' });
if (str.Length > 0)
{
for (int i = 0; i < str.Length; i++)
{
T_Service_FirstAid_Personnel per = new T_Service_FirstAid_Personnel();
per.GUID = str[i];
list.Add(per);
}
}
if (list.Count > 0 && !string.IsNullOrEmpty(model.GUID))
{
return IService.VehiclePersonnelPlan(list, model.GUID);
}
return 0;
}
///
/// 根据车辆GUID查询绑定人员
///
///
///
public TableModel GetPersonnelOfVehicle(string guid)
{
return IService.GetPersonnelOfVehicle(guid);
}
///
/// 保存派车单:多表操作 事务
///
/// 人员表
/// 出车统计
/// 出车记录
public bool SaveDispatchListTran(DispatchListModel model)
{
List perList = new List();
List recordList = new List();
string[] after = model.Str_GUID.Split(new char[] { ',' });
for (int i = 0; i < after.Length; i++)
{
T_Service_FirstAid_Personnel personnel = new T_Service_FirstAid_Personnel();
personnel.GUID = after[i];
perList.Add(personnel);
T_Service_FirstAid_DrivingRecord record = new T_Service_FirstAid_DrivingRecord();
record.PersonnelGUID = after[i];
record.PatientGUID = model.PatientGUID;
recordList.Add(record);
}
T_Service_FirstAid_DrivingCensus dringCensus = new T_Service_FirstAid_DrivingCensus();
dringCensus.CreateUser = model.DrivingCensus.CreateUser;
dringCensus.PersonnelSum = model.DrivingCensus.PersonnelSum;
dringCensus.PatientSum = model.DrivingCensus.PatientSum;
return IService.SaveDispatchListTran(perList, dringCensus, recordList);
}
///
/// 获取空闲且未绑定车辆人员
///
///
public TableModel GetOwnerlessPersonnel(string hospitalGuid)
{
return IService.GetOwnerlessPersonnel(hospitalGuid);
}
///
/// 根据车辆GUID查询绑定的人员
///
///
///
public List GetPerofAmbulance(string ambulanceGUID)
{
return IService.GetPerofAmbulance(ambulanceGUID);
}
///
/// 根据患者GUID获取患者院前时间信息
///
///
///
public FristAxisModel GetFristAxisByPatientGuid(string patientGuid)
{
return IService.GetFristAxisByPatientGuid(patientGuid);
}
}
}