科室二次收入工作量

parent 66b19ddc
......@@ -8,6 +8,7 @@ namespace Performance.DtoModels
public class WorkDetailRequest
{
public int AllotId { get; set; }
public int SecondId { get; set; }
public string AccountingUnit { get; set; }
}
......@@ -19,6 +20,7 @@ public WorkDetailRequestValidator()
RuleSet("Select", () =>
{
RuleFor(x => x.AllotId).NotNull().NotEmpty().GreaterThan(0);
RuleFor(x => x.SecondId).NotNull().NotEmpty().GreaterThan(0);
RuleFor(x => x.AccountingUnit).NotNull().NotEmpty();
});
}
......
......@@ -158,14 +158,23 @@ public void ImportWorkloadData(per_allot allot, object parameters)
/// 查询工作量数据
/// </summary>
/// <param name="allotid"></param>
public IEnumerable<report_original_workload> QueryWorkloadData(int allotid, string accountingunit, string[] unittype)
public IEnumerable<report_original_workload> QueryWorkloadData(int allotid, string accountingunit, string unittype)
{
using (var connection = context.Database.GetDbConnection())
{
if (connection.State != ConnectionState.Open) connection.Open();
try
{
string clear = "select t1.* from report_original_workload t1 join per_employee t2 on t1.doctorname = t2.doctorname and t1.personnelnumber = t2.personnelnumber where t1.allotid = @allotid and t2.allotid = @allotid and t1.accountingunit = @accountingunit and t2.unittype in @unittype order by fee desc,convert(t1.doctorname using gbk);";
string clear = @"SELECT t3.AccountingUnit as Department,t1.DoctorName,t1.PersonnelNumber,t1.Category,t1.Fee FROM ex_result t1
JOIN per_employee t2 on t1.doctorname = t2.doctorname and t1.personnelnumber = t2.personnelnumber
JOIN (select distinct AccountingUnit,HISDeptName,unittype from per_dept_dic where HospitalId = 45) t3 ON t1.Department = t3.HISDeptName
WHERE t1.allotid = @allotid
AND t2.allotid = @allotid
AND t3.unittype = @unittype
AND t3.accountingunit = @accountingunit
AND t1.Source LIKE CONCAT('%',@unittype,'工作量%')
AND T1.IsDelete = 0
ORDER BY t1.doctorname,t1.Category;";
return connection.Query<report_original_workload>(clear, new { allotid, accountingunit, unittype }, commandTimeout: 60 * 60);
}
catch (Exception ex)
......@@ -179,28 +188,24 @@ public IEnumerable<report_original_workload> QueryWorkloadData(int allotid, stri
/// 查询门诊收入数据
/// </summary>
/// <param name="allotid"></param>
public IEnumerable<ex_result> QueryIncomeData(int hospitalId, int allotid, string accountingunit, string[] unittype)
public IEnumerable<ex_result> QueryIncomeData(int allotid, string accountingunit, string unittype)
{
using (var connection = context.Database.GetDbConnection())
{
if (connection.State != ConnectionState.Open) connection.Open();
try
{
string clear = @"SELECT t3.AccountingUnit Department,t1.DoctorName,t1.PersonnelNumber,t1.Category,ifnull(t1.Fee,0) Fee
FROM
ex_result t1
string clear = @"SELECT t3.AccountingUnit as Department,t1.DoctorName,t1.PersonnelNumber,t1.Category,t1.Fee FROM ex_result t1
JOIN per_employee t2 on t1.doctorname = t2.doctorname and t1.personnelnumber = t2.personnelnumber
JOIN per_dept_dic t3 ON t1.Department = t3.Department
WHERE
t1.allotid = @allotid
AND t3.HospitalId = @hospitalId
AND t3.Source = '门诊'
JOIN (select distinct AccountingUnit,HISDeptName,unittype from per_dept_dic where HospitalId = 45) t3 ON t1.Department = t3.HISDeptName
WHERE t1.allotid = @allotid
AND t2.allotid = @allotid
AND t3.unittype = @unittype
AND t3.accountingunit = @accountingunit
AND t1.Source like '%门诊开单%'
AND t2.unittype in @unittype
AND t2.allotid = @allotid
ORDER BY fee DESC,CONVERT ( t1.doctorname USING gbk );";
return connection.Query<ex_result>(clear, new { hospitalId, allotid, accountingunit, unittype }, commandTimeout: 60 * 60);
AND T1.IsDelete = 0
ORDER BY t1.doctorname,t1.Category;";
return connection.Query<ex_result>(clear, new { allotid, accountingunit, unittype }, commandTimeout: 60 * 60);
}
catch (Exception ex)
{
......
......@@ -24,6 +24,7 @@ public class PersonService : IAutoInjection
private readonly PerforUserRepository perforUserRepository;
private readonly PerforUserroleRepository perforUserroleRepository;
private readonly PerforRoleRepository perforRoleRepository;
private readonly PerforAgsecondallotRepository agsecondallotRepository;
private readonly Application application;
private readonly Dictionary<string, (string, string)> dict = new Dictionary<string, (string, string)>
{
......@@ -44,6 +45,7 @@ public class PersonService : IAutoInjection
PerforUserRepository perforUserRepository,
PerforUserroleRepository perforUserroleRepository,
PerforRoleRepository perforRoleRepository,
PerforAgsecondallotRepository agsecondallotRepository,
IOptions<Application> application)
{
this.logger = logger;
......@@ -53,6 +55,7 @@ public class PersonService : IAutoInjection
this.perforUserRepository = perforUserRepository;
this.perforUserroleRepository = perforUserroleRepository;
this.perforRoleRepository = perforRoleRepository;
this.agsecondallotRepository = agsecondallotRepository;
this.application = application.Value;
}
......@@ -490,8 +493,11 @@ public List<TitleValue> DeptDics(int hospitalId, int type)
/// <returns></returns>
public object DeptWorkloadDetail(WorkDetailRequest request, int userId)
{
var (dept, unittype) = GetDeptByUser(userId);
var data = perallotRepository.QueryWorkloadData(request.AllotId, request.AccountingUnit, unittype);
var second = agsecondallotRepository.GetEntity(w => w.Id == request.SecondId);
if (second == null)
return null;
var data = perallotRepository.QueryWorkloadData(request.AllotId, request.AccountingUnit, second.UnitType);
if (data != null && data.Any())
{
return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category })
......@@ -515,12 +521,11 @@ public object DeptWorkloadDetail(WorkDetailRequest request, int userId)
/// <returns></returns>
public object DeptIncomeDetail(WorkDetailRequest request, int userId)
{
var (dept, unittype) = GetDeptByUser(userId);
var allot = perallotRepository.GetEntity(w => w.ID == request.AllotId);
if (allot == null)
var second = agsecondallotRepository.GetEntity(w => w.Id == request.SecondId);
if (second == null)
return null;
var data = perallotRepository.QueryIncomeData(allot.HospitalId, request.AllotId, request.AccountingUnit, unittype);
var data = perallotRepository.QueryIncomeData(request.AllotId, request.AccountingUnit, second.UnitType);
if (data != null && data.Any())
{
return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category })
......
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