科室二次分配门诊收入

parent af3f79e1
......@@ -169,5 +169,17 @@ public ApiResponse DeptWorkloadDetail([CustomizeValidator(RuleSet = "Select"), F
var data = personService.DeptWorkloadDetail(request, claimService.GetUserId());
return new ApiResponse(ResponseType.OK, data);
}
/// <summary>
/// 门诊开单收入详情
/// </summary>
/// <returns></returns>
[HttpPost]
[Route("dept/incomedetail")]
public ApiResponse DeptIncomeDetail([CustomizeValidator(RuleSet = "Select"), FromBody] WorkDetailRequest request)
{
var data = personService.DeptIncomeDetail(request, claimService.GetUserId());
return new ApiResponse(ResponseType.OK, data);
}
}
}
......@@ -941,6 +941,12 @@
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.PersonController.DeptIncomeDetail(Performance.DtoModels.WorkDetailRequest)">
<summary>
门诊开单收入详情
</summary>
<returns></returns>
</member>
<member name="T:Performance.Api.Controllers.ReportController">
<summary>
报表
......
......@@ -2489,6 +2489,11 @@
<member name="P:Performance.DtoModels.DetailModuleExtend.ItemValue2">
<summary> 结算值 </summary>
</member>
<member name="T:Performance.DtoModels.DeptIncomeResponse">
<summary>
查看科室绩效详情
</summary>
</member>
<member name="P:Performance.DtoModels.DeptResponse.ID">
<summary>
......
using FluentValidation;
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.DtoModels
{
/// <summary>
/// 查看科室绩效详情
/// </summary>
public class DeptIncomeResponse
{
public string Department { get; set; }
public string DoctorName { get; set; }
public string PersonnelNumber { get; set; }
public string Category { get; set; }
public decimal Fee { get; set; }
}
}
......@@ -174,5 +174,39 @@ public IEnumerable<report_original_workload> QueryWorkloadData(int allotid, stri
}
}
}
/// <summary>
/// 查询门诊收入数据
/// </summary>
/// <param name="allotid"></param>
public IEnumerable<ex_result> QueryIncomeData(int hospitalId, 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
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 = '门诊'
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);
}
catch (Exception ex)
{
throw ex;
}
}
}
}
}
......@@ -494,14 +494,44 @@ public object DeptWorkloadDetail(WorkDetailRequest request, int userId)
var data = perallotRepository.QueryWorkloadData(request.AllotId, request.AccountingUnit, unittype);
if (data != null && data.Any())
{
return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category }).Select(t => new
{
t.Key.Department,
t.Key.DoctorName,
t.Key.PersonnelNumber,
t.Key.Category,
Fee = t.Sum(group => group.Fee ?? 0)
}).OrderBy(t => t.PersonnelNumber).ThenBy(t => t.Category);
return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category })
.Select(t => new DeptIncomeResponse
{
Department = t.Key.Department,
DoctorName = t.Key.DoctorName,
PersonnelNumber = t.Key.PersonnelNumber,
Category = t.Key.Category,
Fee = t.Sum(group => group.Fee ?? 0)
}).OrderBy(t => t.PersonnelNumber).ThenBy(t => t.Category);
}
return new string[] { };
}
/// <summary>
/// 科室工作量数据详情
/// </summary>
/// <param name="request"></param>
/// <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)
return null;
var data = perallotRepository.QueryIncomeData(allot.HospitalId, request.AllotId, request.AccountingUnit, unittype);
if (data != null && data.Any())
{
return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category })
.Select(t => new DeptIncomeResponse
{
Department = t.Key.Department,
DoctorName = t.Key.DoctorName,
PersonnelNumber = t.Key.PersonnelNumber,
Category = t.Key.Category,
Fee = t.Sum(group => group.Fee ?? 0)
}).OrderBy(t => t.PersonnelNumber).ThenBy(t => t.Category);
}
return new string[] { };
......
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