Commit cdb40172 by 李承祥

二次绩效更改、orcale修改

parent 05853650
......@@ -13,42 +13,47 @@ namespace Performance.EntityModels
///
/// </summary>
[Table("sys_hospitalconfig")]
public class sys_hospitalconfig
public class sys_hospitalconfig
{
/// <summary>
///
/// </summary>
[Key]
public int Id { get; set; }
public int Id { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> HospitalId { get; set; }
/// <summary>
///
/// </summary>
public string DbSource { get; set; }
/// <summary>
///
/// </summary>
public string DbName { get; set; }
/// <summary>
///
/// </summary>
public string DbUser { get; set; }
/// <summary>
///
/// </summary>
public string DbPassword { get; set; }
/// <summary>
/// 1 标准库 2 绩效库
/// </summary>
public Nullable<int> Type { get; set; }
/// <summary>
/// 1、Sql Server 2、Orcale
/// </summary>
public int DataBaseType{get;set;}
}
}
......@@ -6,8 +6,8 @@ namespace Performance.Repository
{
public enum DatabaseType
{
MySql,
SqlServer,
Oracle
MySql = 0,
SqlServer = 1,
Oracle = 2
}
}
......@@ -136,17 +136,19 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
var usetemp = perforAgusetempRepository.GetEntity(t => t.HospitalId == request.HospitalId && t.Department == request.Department && t.UnitType == request.UnitType);
if (usetemp == null)
throw new PerformanceException("当前科室暂未配置绩效模板");
var second = perforAgsecondallotRepository.GetEntity(t => t.Id == request.SecondId);
//获取固定模板列 + 工作量列
var headItems = GetHeadItems(usetemp.UseTempId.Value, usetemp.HospitalId.Value, usetemp.Department, usetemp.UnitType);
var result = new SecondResponse { HeadItems = headItems, BodyItems = new List<BodyItem>() };
//获取已录入数据
var fixatList = perforAgfixatitemRepository.GetEntities(t => t.SecondId == request.SecondId && t.RowNumber.HasValue);
if (request.IsArchive == 1) //归档
if (request.IsArchive == 1 || new List<int> { 2, 3 }.Contains(second.Status ?? 1)) //归档 等待审核、审核通过
{
#region 已归档数据,根据数据获取
if (fixatList == null || fixatList.Where(t => t.RowNumber != -1).Count() == 0)
throw new PerformanceException("绩效归档时,尚未添加数据。");
throw new PerformanceException("提交时未添加数据。");
else
{
var existHead = fixatList.Select(t => new { FiledName = t.ItemName, Sort = t.Sort.Value, SourceType = t.SourceType.Value, Type = t.Type.Value, FactorValue = t.FactorValue.Value }).Distinct().ToList();
......@@ -154,11 +156,11 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
{
FiledId = headItems.FirstOrDefault(h => h.FiledName == t.FiledName && h.Type == t.Type)?.FiledId ?? "无FiledId",
FiledName = t.FiledName,
Sort = t.Sort,
Sort = headItems.FirstOrDefault(h => h.FiledName == t.FiledName && h.Type == t.Type)?.Sort ?? 0,
SourceType = t.SourceType,
Type = t.Type,
FactorValue = t.FactorValue
}).Where(t => t.FiledId != "无FiledId").ToList();
FactorValue = headItems.FirstOrDefault(h => h.FiledName == t.FiledName && h.Type == t.Type)?.FactorValue ?? 0
}).ToList();
result.HeadItems = headItems;
}
#endregion
......@@ -200,7 +202,6 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
}
if (fixatList == null || (fixatList != null && fixatList.Where(t => t.RowNumber == -1).Count() == 0))
{
var second = perforAgsecondallotRepository.GetEntity(t => t.Id == request.SecondId);
var config = perforCofagainRepository.GetEntities(t => t.AllotID == second.AllotId && t.Department == request.Department) ?? new List<cof_again>();
#region 补充顶部数据
......@@ -353,10 +354,11 @@ public bool UseTemp(UseTempRequest request)
var addList = new List<ag_fixatitem>();
var allotList = perforPerallotRepository.GetEntities(t => t.HospitalId == request.HospitalId);
var secondList = Mapper.Map<List<SecondListResponse>>(perforAgsecondallotRepository.GetEntities(t => allotList.Select(a => a.ID).Contains(t.AllotId.Value)));
var secondList = Mapper.Map<List<SecondListResponse>>(perforAgsecondallotRepository.GetEntities(t => allotList.Select(a => a.ID).Contains(t.AllotId.Value) && new List<int> { 1, 4 }.Contains(t.Status ?? 1)));
secondList?.ForEach(t => t.IsArchive = allotList.FirstOrDefault(a => a.ID == t.AllotId).States == 8 ? 1 : 0);
var secondId = secondList.Where(s => s.IsArchive == 0)?.Select(s => s.Id); //获取未归档的二次绩效
//获取未归档 未提交 驳回 的二次绩效
var secondId = secondList.Where(s => s.IsArchive == 0)?.Select(s => s.Id);
if (secondId == null || secondId.Count() <= 0)
return result;
......@@ -367,7 +369,7 @@ public bool UseTemp(UseTempRequest request)
{
foreach (var head in headItems)
{
if (second.IsArchive == 0)
if (second.IsArchive == 0 && new List<int> { 1, 4 }.Contains(second.Status ?? 1))
{
var exist = fixatList?.Where(t => t.ItemName == head.FiledName && t.Type == head.Type && t.SecondId == second.Id);
if (exist != null && exist.Count() > 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment