公司员工新增领导与普通员工之分
This commit is contained in:
@@ -39,5 +39,8 @@ namespace SimpleAdmin.Application.Entity
|
|||||||
/// <summary>单位 cm,保留两位小数</summary>
|
/// <summary>单位 cm,保留两位小数</summary>
|
||||||
[SugarColumn(ColumnDescription = "身高(cm)", IsNullable = true)]
|
[SugarColumn(ColumnDescription = "身高(cm)", IsNullable = true)]
|
||||||
public decimal? Height { get; set; }
|
public decimal? Height { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(ColumnDescription = "1领导,2普通员工,3其他", IsNullable = true)]
|
||||||
|
public int? Type { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||||
//
|
//
|
||||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||||
@@ -44,6 +44,7 @@ namespace SimpleAdmin.Application.Services.Prescription.Dto
|
|||||||
public DateTime CreateTime { get; set; }
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
public decimal TotalMedicineCost { get; set; }
|
public decimal TotalMedicineCost { get; set; }
|
||||||
|
public int? Type { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
// 辅助类:存储FIFO计算所需的入库记录信息
|
// 辅助类:存储FIFO计算所需的入库记录信息
|
||||||
@@ -89,6 +90,7 @@ namespace SimpleAdmin.Application.Services.Prescription.Dto
|
|||||||
public string EmployeeName { get; set; }
|
public string EmployeeName { get; set; }
|
||||||
public long? RelationShip { get; set; }
|
public long? RelationShip { get; set; }
|
||||||
public string RelationShipName { get; set; }
|
public string RelationShipName { get; set; }
|
||||||
|
public int? Type { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处方药材DTO
|
// 处方药材DTO
|
||||||
@@ -131,6 +133,7 @@ namespace SimpleAdmin.Application.Services.Prescription.Dto
|
|||||||
/// 当 EmployeeIsTemp 为 true 或者前端直接传了员工名字时,后端可用此字段创建员工
|
/// 当 EmployeeIsTemp 为 true 或者前端直接传了员工名字时,后端可用此字段创建员工
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string EmployeeName { get; set; }
|
public string EmployeeName { get; set; }
|
||||||
|
public int? Type { get; set; }
|
||||||
}
|
}
|
||||||
// 处方药材输入DTO
|
// 处方药材输入DTO
|
||||||
public class PrescriptionHerbInputDto
|
public class PrescriptionHerbInputDto
|
||||||
@@ -150,6 +153,7 @@ namespace SimpleAdmin.Application.Services.Prescription.Dto
|
|||||||
public decimal? Height { get; set; }
|
public decimal? Height { get; set; }
|
||||||
|
|
||||||
public long? RelationShip { get; set; }
|
public long? RelationShip { get; set; }
|
||||||
|
public int? Type { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关系类型DTO
|
// 关系类型DTO
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||||
//
|
//
|
||||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||||
@@ -213,7 +213,8 @@ public class PrescriptionService : DbRepository<Prescription>, IPrescriptionServ
|
|||||||
CreateTime = p.CreateTime.Value,
|
CreateTime = p.CreateTime.Value,
|
||||||
EmployeeName = emp.Name,
|
EmployeeName = emp.Name,
|
||||||
CanEdit = false,
|
CanEdit = false,
|
||||||
TotalMedicineCost = 0
|
TotalMedicineCost = 0,
|
||||||
|
Type = pe.Type
|
||||||
}).ToPagedListAsync(input.PageNum, input.PageSize);
|
}).ToPagedListAsync(input.PageNum, input.PageSize);
|
||||||
if (!prescriptionPage.List.Any()) return prescriptionPage;
|
if (!prescriptionPage.List.Any()) return prescriptionPage;
|
||||||
// 获取当前页所有处方的 Id
|
// 获取当前页所有处方的 Id
|
||||||
@@ -294,8 +295,8 @@ public class PrescriptionService : DbRepository<Prescription>, IPrescriptionServ
|
|||||||
item.CanEdit = true;
|
item.CanEdit = true;
|
||||||
}
|
}
|
||||||
//all += item.TotalMedicineCost;
|
//all += item.TotalMedicineCost;
|
||||||
// 家属加价 10%
|
// 家属和普通员工加价 10%
|
||||||
if (item.PersonType == PersonType.Relative)
|
if (item.PersonType == PersonType.Relative || item.Type == 2)
|
||||||
{
|
{
|
||||||
item.TotalMedicineCost = Math.Round(item.TotalMedicineCost * 1.1m, 2, MidpointRounding.AwayFromZero);
|
item.TotalMedicineCost = Math.Round(item.TotalMedicineCost * 1.1m, 2, MidpointRounding.AwayFromZero);
|
||||||
}
|
}
|
||||||
@@ -369,13 +370,14 @@ public class PrescriptionService : DbRepository<Prescription>, IPrescriptionServ
|
|||||||
.Select((p, pe) => new
|
.Select((p, pe) => new
|
||||||
{
|
{
|
||||||
Id = p.Id,
|
Id = p.Id,
|
||||||
IsRelative = pe.EmployeeId != null
|
IsRelative = pe.EmployeeId != null,
|
||||||
|
Type = pe.Type
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
// 明确转换 key 为 long(处理 nullable)
|
// 明确转换 key 为 long(处理 nullable)
|
||||||
var personInfoDict = personTmp
|
var personInfoDict = personTmp
|
||||||
.ToDictionary(x => Convert.ToInt64(x.Id), x => x.IsRelative);
|
.ToDictionary(x => Convert.ToInt64(x.Id), x => new { x.IsRelative, x.Type });
|
||||||
|
|
||||||
// 7) FIFO 成本计算(按时间顺序已由 allIdsLong 保持)
|
// 7) FIFO 成本计算(按时间顺序已由 allIdsLong 保持)
|
||||||
foreach (var pidObj in allIdsLong)
|
foreach (var pidObj in allIdsLong)
|
||||||
@@ -402,9 +404,11 @@ public class PrescriptionService : DbRepository<Prescription>, IPrescriptionServ
|
|||||||
// 处方级别保留 4 位小数
|
// 处方级别保留 4 位小数
|
||||||
presCost = Math.Round(presCost, 4, MidpointRounding.AwayFromZero);
|
presCost = Math.Round(presCost, 4, MidpointRounding.AwayFromZero);
|
||||||
|
|
||||||
// 家属加价 10%(若字典缺失,默认不是家属)
|
// 家属和普通员工加价 10%
|
||||||
var isRelative = personInfoDict.TryGetValue(pid, out var rel) && rel;
|
personInfoDict.TryGetValue(pid, out var personInfo);
|
||||||
if (isRelative)
|
var isRelative = personInfo?.IsRelative ?? false;
|
||||||
|
var isOrdinary = personInfo?.Type == 2;
|
||||||
|
if (isRelative || isOrdinary)
|
||||||
{
|
{
|
||||||
presCost = Math.Round(presCost * 1.1m, 2, MidpointRounding.AwayFromZero);
|
presCost = Math.Round(presCost * 1.1m, 2, MidpointRounding.AwayFromZero);
|
||||||
}
|
}
|
||||||
@@ -554,7 +558,8 @@ public class PrescriptionService : DbRepository<Prescription>, IPrescriptionServ
|
|||||||
EmployeeId = person.EmployeeId,
|
EmployeeId = person.EmployeeId,
|
||||||
EmployeeName = employee?.Name,
|
EmployeeName = employee?.Name,
|
||||||
RelationShip = person.RelationShip,
|
RelationShip = person.RelationShip,
|
||||||
RelationShipName = RelationShipName.FirstOrDefault(t => t.Id == person.RelationShip)?.Name
|
RelationShipName = RelationShipName.FirstOrDefault(t => t.Id == person.RelationShip)?.Name,
|
||||||
|
Type = person.Type
|
||||||
},
|
},
|
||||||
DiagnosisResult = prescription.DiagnosisResult,
|
DiagnosisResult = prescription.DiagnosisResult,
|
||||||
UserMedicinaAdvice = prescription.UserMedicinaAdvice,
|
UserMedicinaAdvice = prescription.UserMedicinaAdvice,
|
||||||
@@ -689,16 +694,38 @@ public class PrescriptionService : DbRepository<Prescription>, IPrescriptionServ
|
|||||||
if (input.Person.IsEmployee)
|
if (input.Person.IsEmployee)
|
||||||
mappedEmployeeId = null;
|
mappedEmployeeId = null;
|
||||||
|
|
||||||
var person = new Person
|
var dbPerson = await Context.Queryable<Person>().FirstAsync(p => p.Id == personId);
|
||||||
|
if (dbPerson != null)
|
||||||
{
|
{
|
||||||
Id = personId,
|
dbPerson.Name = input.Person?.Name ?? dbPerson.Name;
|
||||||
Name = input.Person?.Name,
|
dbPerson.Birthday = input.Person?.Birthday ?? dbPerson.Birthday;
|
||||||
Birthday = input.Person?.Birthday,
|
dbPerson.Height = input.Person?.Height ?? dbPerson.Height;
|
||||||
Height = input.Person?.Height,
|
dbPerson.RelationShip = input.Person?.RelationShip ?? dbPerson.RelationShip;
|
||||||
RelationShip = input.Person?.RelationShip,
|
dbPerson.EmployeeId = mappedEmployeeId;
|
||||||
EmployeeId = mappedEmployeeId
|
if (input.Person != null && input.Person.IsEmployee)
|
||||||
};
|
{
|
||||||
await Context.Storageable(person).ExecuteCommandAsync();
|
dbPerson.Type = input.Person?.Type;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dbPerson.Type = null;
|
||||||
|
}
|
||||||
|
await Context.Updateable(dbPerson).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var person = new Person
|
||||||
|
{
|
||||||
|
Id = personId,
|
||||||
|
Name = input.Person?.Name,
|
||||||
|
Birthday = input.Person?.Birthday,
|
||||||
|
Height = input.Person?.Height,
|
||||||
|
RelationShip = input.Person?.RelationShip,
|
||||||
|
EmployeeId = mappedEmployeeId,
|
||||||
|
Type = input.Person.IsEmployee ? input.Person?.Type : null
|
||||||
|
};
|
||||||
|
await Context.Insertable(person).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
// ---------- 4. 处方保存/编辑逻辑----------
|
// ---------- 4. 处方保存/编辑逻辑----------
|
||||||
Prescription prescription;
|
Prescription prescription;
|
||||||
@@ -831,7 +858,8 @@ public class PrescriptionService : DbRepository<Prescription>, IPrescriptionServ
|
|||||||
Name = pe.Name,
|
Name = pe.Name,
|
||||||
Birthday = pe.Birthday,
|
Birthday = pe.Birthday,
|
||||||
Height = pe.Height,
|
Height = pe.Height,
|
||||||
RelationShip = pe.RelationShip
|
RelationShip = pe.RelationShip,
|
||||||
|
Type = pe.Type
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ public class StatisticsService : DbRepository<Prescription>, IStatisticsService
|
|||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
p.PersonId,
|
p.PersonId,
|
||||||
IsRelative = pe.EmployeeId != null
|
IsRelative = pe.EmployeeId != null,
|
||||||
|
Type = pe.Type
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
@@ -75,6 +76,11 @@ public class StatisticsService : DbRepository<Prescription>, IStatisticsService
|
|||||||
familyCost += Math.Round(cost * 1.1m, 2, MidpointRounding.AwayFromZero);
|
familyCost += Math.Round(cost * 1.1m, 2, MidpointRounding.AwayFromZero);
|
||||||
familyQty++;
|
familyQty++;
|
||||||
}
|
}
|
||||||
|
else if (pInfo.Type == 2)
|
||||||
|
{
|
||||||
|
staffCost += Math.Round(cost * 1.1m, 2, MidpointRounding.AwayFromZero);
|
||||||
|
staffQty++;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
staffCost += Math.Round(cost, 2, MidpointRounding.AwayFromZero);
|
staffCost += Math.Round(cost, 2, MidpointRounding.AwayFromZero);
|
||||||
@@ -176,7 +182,8 @@ public class StatisticsService : DbRepository<Prescription>, IStatisticsService
|
|||||||
p.Id,
|
p.Id,
|
||||||
p.VisitDate,
|
p.VisitDate,
|
||||||
p.CreateTime,
|
p.CreateTime,
|
||||||
IsRelative = pe.EmployeeId != null
|
IsRelative = pe.EmployeeId != null,
|
||||||
|
Type = pe.Type
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
@@ -276,6 +283,12 @@ public class StatisticsService : DbRepository<Prescription>, IStatisticsService
|
|||||||
monthlyFamilyCost[month] += cost;
|
monthlyFamilyCost[month] += cost;
|
||||||
monthlyFamilyQty[month]++;
|
monthlyFamilyQty[month]++;
|
||||||
}
|
}
|
||||||
|
else if (pInfo.Type == 2)
|
||||||
|
{
|
||||||
|
cost = Math.Round(cost * 1.1m, 2, MidpointRounding.AwayFromZero);
|
||||||
|
monthlyStaffCost[month] += cost;
|
||||||
|
monthlyStaffQty[month]++;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cost = Math.Round(cost, 2, MidpointRounding.AwayFromZero);
|
cost = Math.Round(cost, 2, MidpointRounding.AwayFromZero);
|
||||||
@@ -337,7 +350,8 @@ public class StatisticsService : DbRepository<Prescription>, IStatisticsService
|
|||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
p.PersonId,
|
p.PersonId,
|
||||||
IsRelative = pe.EmployeeId != null
|
IsRelative = pe.EmployeeId != null,
|
||||||
|
Type = pe.Type
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
@@ -418,6 +432,11 @@ public class StatisticsService : DbRepository<Prescription>, IStatisticsService
|
|||||||
familyCost += Math.Round(cost * 1.1m, 2, MidpointRounding.AwayFromZero);
|
familyCost += Math.Round(cost * 1.1m, 2, MidpointRounding.AwayFromZero);
|
||||||
familyQty++;
|
familyQty++;
|
||||||
}
|
}
|
||||||
|
else if (pInfo.Type == 2)
|
||||||
|
{
|
||||||
|
staffCost += Math.Round(cost * 1.1m, 2, MidpointRounding.AwayFromZero);
|
||||||
|
staffQty++;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
staffCost += Math.Round(cost, 2, MidpointRounding.AwayFromZero);
|
staffCost += Math.Round(cost, 2, MidpointRounding.AwayFromZero);
|
||||||
|
|||||||
Reference in New Issue
Block a user