Commit fb5ddc2c by 钟博

修改收入费用、科室类别,工作量、科室字典的显示和保存完整

parent 907c2da6
......@@ -301,6 +301,36 @@ public ApiResponse DrugtypeDelete([CustomizeValidator(RuleSet = "Delete"), FromB
return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 获取收入费用类别
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("GetDrugtypeHands")]
[HttpPost]
public ApiResponse GetDrugtypeHands([CustomizeValidator(RuleSet = "Select"), FromBody] DrugpropRequest request)
{
var list = _configService.GetDrugtypeHands(request.AllotID);
return new ApiResponse(ResponseType.OK, "ok", list);
}
/// <summary>
/// 保存收入费用类别
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("SaveDrugtypeHands/{allotId}")]
[HttpPost]
public ApiResponse SaveDrugtypeHands(int allotId, [FromBody] SaveConfigData request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
_configService.SaveDrugtypeHands(allotId, request);
return new ApiResponse(ResponseType.OK);
}
#endregion
#region cofagain
......@@ -411,6 +441,36 @@ public ApiResponse WorkItemDelete([CustomizeValidator(RuleSet = "Delete"), FromB
return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
///获取工作量绩效配置(hands)
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("GetWorkItemHands")]
[HttpPost]
public ApiResponse GetWorkItemHands([CustomizeValidator(RuleSet = "Select"), FromBody] WorkItemRequest request)
{
var list = _configService.GetWorkItemHands(request.AllotID,request.Type);
return new ApiResponse(ResponseType.OK, "ok", list);
}
/// <summary>
/// 保存工作量绩效配置(hands)
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("SaveWorkItemHands/{allotId}")]
[HttpPost]
public ApiResponse SaveWorkItemHands(int allotId, [FromBody] SaveConfigData request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
_configService.SaveWorkItemHands(allotId, request);
return new ApiResponse(ResponseType.OK);
}
#endregion
#region depttype
......@@ -466,6 +526,36 @@ public ApiResponse DepttypeDelete([CustomizeValidator(RuleSet = "Delete"), FromB
return new ApiResponse(ResponseType.Fail);
return new ApiResponse(ResponseType.OK);
}
/// <summary>
/// 获取科室类别配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Route("GetDepttypeHands")]
[HttpPost]
public ApiResponse GetDepttypeHands([CustomizeValidator(RuleSet = "Select"), FromBody] DrugpropRequest request)
{
var list = _configService.GetDepttypeHands(request.AllotID);
return new ApiResponse(ResponseType.OK, "ok", list);
}
/// <summary>
/// 保存科室类别配置
/// </summary>
/// <param name="allotId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("SaveDepttypeHands/{allotId}")]
[HttpPost]
public ApiResponse SaveDepttypeHands(int allotId, [FromBody] SaveConfigData request)
{
if (allotId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
_configService.SaveDepttypeHands(allotId, request);
return new ApiResponse(ResponseType.OK);
}
#endregion
#region cmi
......
......@@ -93,6 +93,19 @@ public ApiResponse GetDepartments(int hospitalId)
}
/// <summary>
/// 获取科室记录
/// </summary>
/// <param name="hospitalId"></param>
/// <returns></returns>
[Route("GetDepartmentHands/{hospitalId}")]
[HttpPost]
public ApiResponse GetDepartmentHands(int hospitalId)
{
var list = personService.GetDepartmentHands(hospitalId);
return new ApiResponse(ResponseType.OK, list);
}
/// <summary>
/// 新增科室信息
/// </summary>
/// <param name="request"></param>
......@@ -181,5 +194,22 @@ public ApiResponse DeptIncomeDetail([CustomizeValidator(RuleSet = "Select"), Fro
var data = personService.DeptIncomeDetail(request, claimService.GetUserId());
return new ApiResponse(ResponseType.OK, data);
}
/// <summary>
/// 保存科室字典(hands)
/// </summary>
/// <param name="HospitalId"></param>
/// <param name="request"></param>
/// <returns></returns>
[Route("SaveDepartmentHands/{HospitalId}")]
[HttpPost]
public ApiResponse SaveDeptDicHands(int HospitalId, [FromBody] SaveConfigData request)
{
if (HospitalId <= 0)
return new ApiResponse(ResponseType.ParameterError, "参数无效");
personService.SaveDeptDicHands(HospitalId, request);
return new ApiResponse(ResponseType.OK);
}
}
}
......@@ -25,4 +25,20 @@ public class Deptdic
public int Id { get; set; }
public string AccountingUnit { get; set; }
}
public class DeptdicHands
{
public int HospitalId { get; set; }
public string HISDeptName { get; set; }
public string Department { get; set; }
public string OutDoctorAccounting { get; set; }
public string OutNurseAccounting { get; set; }
public string OutTechnicAccounting { get; set; }
public string InpatDoctorAccounting { get; set; }
public string InpatNurseAccounting { get; set; }
public string InpatTechnicAccounting { get; set; }
public string LogisticsAccounting { get; set; }
public string SpecialAccounting { get; set; }
public DateTime? CreateTime { get; set; }
}
}
......@@ -11,4 +11,10 @@ public class SaveCollectData
public string[] ColHeaders { get; set; }
public string[][] Data { get; set; }
}
public class SaveConfigData
{
public string[] ColHeaders { get; set; }
public string[][] Data { get; set; }
}
}
......@@ -416,9 +416,13 @@ public void SaveDrugtypeHands(int allotId, SaveConfigData request)
{
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<cof_drugtype>(json);
if (!string.IsNullOrEmpty(data.Charge)|| !string.IsNullOrEmpty(data.ChargeType))
{
drugs.Add(data);
}
}
_drugtypeRepository.Execute("delete from cof_drugtype where allotid = @allotid", new{allotId});
_drugtypeRepository.AddRange(drugs.ToArray());
}
......@@ -546,8 +550,11 @@ public void SaveWorkItemHands(int allotId, SaveConfigData request)
{
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<cof_workitem>(json);
if (!string.IsNullOrEmpty(data.Item))
{
works.Add(data);
}
}
_workitemRepository.Execute("delete from cof_workitem where allotid = @allotid", new{allotId});
_workitemRepository.AddRange(works.ToArray());
......@@ -668,7 +675,7 @@ public void SaveDepttypeHands(int allotId, SaveConfigData request)
{
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<cof_depttype>(json);
if (data.Charge!=null && data.ChargeType!=null)
if (!string.IsNullOrEmpty(data.Charge) || !string.IsNullOrEmpty(data.ChargeType))
{
depts.Add(data);
}
......
......@@ -568,5 +568,248 @@ public object DeptIncomeDetail(WorkDetailRequest request, int userId)
return new string[] { };
}
public HandsonTable GetDepartmentHands(int hospitalId)
{
HandsonTable handson = new HandsonTable((int)SheetType.Unidentifiable, DeptDic.Select(c => c.Value).ToArray(), DeptDic.Select(t => new collect_permission
{
HeadName = t.Value,
Visible = 1,
Readnoly = 0
}).ToList());
if (handson.Columns != null && handson.Columns.Any())
{
foreach (var column in handson.Columns)
{
if (column.Data == "标准科室")
{
column.Type = "autocomplete";
column.Source = DeptDics(hospitalId, 2).Select(c => c.Value).ToArray();
column.Strict = true;
}
if (column.Data == "系统科室")
{
column.Type = "autocomplete";
column.Source = DeptDics(hospitalId, 1).Select(c => c.Value).ToArray();
column.Strict = true;
}
if (new[] { "住院·核算单元医生组", "住院·核算单元医生组", "住院·核算单元医技组", "门诊·核算单元医生组", "门诊·核算单元护理组", "门诊·核算单元医技组" }.Contains(column.Data))
{
column.Type = "autocomplete";
column.Source = DeptDics(hospitalId, 3).Select(c => c.Value).ToArray();
column.Strict = true;
}
if (column.Data == "行政后勤")
{
column.Type = "autocomplete";
column.Source = DeptDics(hospitalId, 4).Select(c => c.Value).ToArray();
column.Strict = true;
}
if (column.Data == "特殊核算组")
{
column.Type = "autocomplete";
column.Source = DeptDics(hospitalId, 5).Select(c => c.Value).ToArray();
column.Strict = true;
}
}
}
var getDept = GetDepartments(hospitalId);
var rowDatas = DeptHandsonRowData(getDept);
handson.SetRowData(rowDatas, rowDatas != null);
return handson;
}
private List<HandsonRowData> DeptHandsonRowData(IEnumerable<DeptdicResponse> getDept)
{
if (getDept == null) return null;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0;
foreach (var item in getDept)
{
DeptdicResponse tempDept = new DeptdicResponse()
{ Department = item.Department, HISDeptName = item.HISDeptName, HospitalId = item.HospitalId };
var temp = JsonHelper.Serialize(tempDept);
var tempDic = JsonHelper.Deserialize<Dictionary<string, Object>>(temp);
tempDic.Add(nameof(item.InpatNurseAccounting), item.InpatNurseAccounting.AccountingUnit);
tempDic.Add(nameof(item.InpatDoctorAccounting), item.InpatDoctorAccounting.AccountingUnit);
tempDic.Add(nameof(item.InpatTechnicAccounting), item.InpatTechnicAccounting.AccountingUnit);
tempDic.Add(nameof(item.OutNurseAccounting), item.OutNurseAccounting.AccountingUnit);
tempDic.Add(nameof(item.OutTechnicAccounting), item.OutTechnicAccounting.AccountingUnit);
tempDic.Add(nameof(item.OutDoctorAccounting), item.OutDoctorAccounting.AccountingUnit);
tempDic.Add(nameof(item.LogisticsAccounting), item.LogisticsAccounting.AccountingUnit); ;
tempDic.Add(nameof(item.SpecialAccounting), item.SpecialAccounting.AccountingUnit);
var cells = (from conf in DeptDic
join fst in tempDic on conf.Key.ToUpper() equals fst.Key.ToUpper()
select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i, cells));
}
return rowDatas;
}
public void SaveDeptDicHands(int HospitalId, SaveConfigData request)
{
var dicData = CreateDataRow(HospitalId, request, DeptDic);
List<per_dept_dic> deptDics = new List<per_dept_dic>();
foreach (var dic in dicData)
{
var json = JsonHelper.Serialize(dic);
var data = JsonHelper.Deserialize<DeptdicHands>(json);
var ss = "";
if (!string.IsNullOrEmpty(data.Department)|| !string.IsNullOrEmpty(data.HISDeptName))
{
DeptDicList(HospitalId, deptDics, data);
}
perdeptdicRepository.Execute("delete from per_dept_dic where HospitalId = @HospitalId", new {HospitalId});
perdeptdicRepository.AddRange(deptDics.ToArray());
}
}
private List<Dictionary<string, string>> CreateDataRow(int HospitalId, SaveConfigData request, Dictionary<string, string> config)
{
List<Dictionary<string, string>> allData = new List<Dictionary<string, string>>();
for (int r = 0; r < request.Data.Length; r++)
{
// 创建固定数据列
Dictionary<string, string> baseData = CreateBaseData(request, config, r);
//baseData.Add(nameof(collect_data), HospitalId.ToString());
allData.Add(baseData);
}
return allData;
}
private Dictionary<string, string> CreateBaseData(SaveConfigData request, Dictionary<string, string> config, int rownumber)
{
Dictionary<string, string> result = new Dictionary<string, string>();
for (int c = 0; c < request.ColHeaders.Length; c++)
{
var header = request.ColHeaders[c];
var first = config.FirstOrDefault(w => w.Value == header);
if (!default(KeyValuePair<string, string>).Equals(first)
&& !result.ContainsKey(header)
&& request.Data[rownumber].Length > c)
{
result.Add(first.Key, request.Data[rownumber][c]);
}
}
return result;
}
private void DeptDicList(int HospitalId, List<per_dept_dic> deptDics, DeptdicHands data)
{
var nowTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
#region 住院
if (data.InpatDoctorAccounting != "" || data.InpatNurseAccounting != "" || data.InpatTechnicAccounting != "")
{
per_dept_dic deptDic = new per_dept_dic() { Source = "住院", HospitalId = HospitalId, Department = data.Department, HISDeptName = data.HISDeptName, CreateTime = nowTime };
if (data.InpatDoctorAccounting != "")
{
deptDic.AccountingUnit = data.InpatDoctorAccounting;
deptDic.UnitType = "医生组";
deptDics.Add(deptDic);
}
if (data.InpatNurseAccounting != "")
{
deptDic.AccountingUnit = data.InpatNurseAccounting;
deptDic.UnitType = "护理组";
deptDics.Add(deptDic);
}
if (data.InpatTechnicAccounting != "")
{
deptDic.AccountingUnit = data.InpatTechnicAccounting;
deptDic.UnitType = "医技组";
deptDics.Add(deptDic);
}
}
#endregion
#region 门诊
if (data.OutDoctorAccounting != "" || data.OutNurseAccounting != "" || data.OutTechnicAccounting != "")
{
per_dept_dic deptDic = new per_dept_dic() { Source = "门诊", HospitalId = HospitalId, Department = data.Department, HISDeptName = data.HISDeptName, CreateTime = nowTime };
if (data.OutDoctorAccounting != "")
{
deptDic.AccountingUnit = data.OutDoctorAccounting;
deptDic.UnitType = "医生组";
deptDics.Add(deptDic);
}
if (data.OutNurseAccounting != "")
{
deptDic.AccountingUnit = data.OutNurseAccounting;
deptDic.UnitType = "护理组";
deptDics.Add(deptDic);
}
if (data.OutTechnicAccounting != "")
{
deptDic.AccountingUnit = data.OutTechnicAccounting;
deptDic.UnitType = "医技组";
deptDics.Add(deptDic);
}
}
#endregion
if (data.LogisticsAccounting != "")
{
per_dept_dic deptDic = new per_dept_dic()
{
HospitalId = HospitalId,
Department = data.Department,
HISDeptName = data.HISDeptName,
CreateTime = nowTime,
AccountingUnit=data.LogisticsAccounting,
UnitType = "行政后勤"
};
deptDics.Add(deptDic);
}
if (data.SpecialAccounting != "")
{
per_dept_dic deptDic = new per_dept_dic()
{
HospitalId = HospitalId,
Department = data.Department,
HISDeptName = data.HISDeptName,
CreateTime = nowTime,
AccountingUnit = data.LogisticsAccounting,
UnitType = "特殊核算组"
};
deptDics.Add(deptDic);
}
}
public static Dictionary<string, string> DeptDic { get; } = new Dictionary<string, string>
{
{ nameof(DeptdicResponse.Department), "标准科室" },
{ nameof(DeptdicResponse.HISDeptName), "系统科室" },
{ nameof(DeptdicResponse.InpatDoctorAccounting), "住院·核算单元医生组" },
{ nameof(DeptdicResponse.InpatNurseAccounting), "住院·核算单元护理组" },
{ nameof(DeptdicResponse.InpatTechnicAccounting), "住院·核算单元医技组" },
{ nameof(DeptdicResponse.LogisticsAccounting), "行政后勤" },
{ nameof(DeptdicResponse.OutDoctorAccounting), "门诊·核算单元医生组" },
{ nameof(DeptdicResponse.OutNurseAccounting), "门诊·核算单元护理组" },
{ nameof(DeptdicResponse.OutTechnicAccounting), "门诊·核算单元医技组" },
{ nameof(DeptdicResponse.SpecialAccounting), "特殊核算组" }
};
}
}
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