Commit 3604709a by 钟博

Cof_drugtype表中补全HospitalId字段内容

parent 4030fe47
......@@ -258,7 +258,7 @@ public ConfigController(ConfigService configService, AllotService allotService)
[HttpPost]
public ApiResponse GetDrugtypeList([CustomizeValidator(RuleSet = "Select"), FromBody] DrugpropRequest request)
{
var list = _configService.GetDrugtypeList(request.AllotID);
var list = _configService.GetDrugtypeList(request.HospitalId,request.AllotID);
return new ApiResponse(ResponseType.OK, "ok", list);
}
......
......@@ -9,6 +9,8 @@ public class DrugpropRequest
{
public int ID { get; set; }
public int HospitalId { get; set; }
public int AllotID { get; set; }
/// <summary>
/// 药占比最大范围(小于)
......@@ -43,6 +45,7 @@ public DrugpropRequestValidator()
RuleSet("Insert", () =>
{
RuleFor(x => x.HospitalId).NotNull().GreaterThan(0);
RuleFor(x => x.AllotID).NotNull().GreaterThan(0);
});
......
......@@ -24,6 +24,11 @@ public class cof_drugtype
/// <summary>
///
/// </summary>
public Nullable<int> HospitalId { get; set; }
/// <summary>
///
/// </summary>
public Nullable<int> AllotID { get; set; }
/// <summary>
......
......@@ -318,9 +318,9 @@ public class ConfigService : IAutoInjection
/// 获取cof_drugprop列表
/// </summary>
/// <returns></returns>
public List<cof_drugtype> GetDrugtypeList(int allotId)
public List<cof_drugtype> GetDrugtypeList(int HospitalId, int allotId)
{
var list = _drugtypeRepository.GetEntities(t => t.AllotID == allotId);
var list = _drugtypeRepository.GetEntities(t => t.AllotID == allotId && t.HospitalId==HospitalId);
return list;
}
......@@ -333,6 +333,7 @@ public cof_drugtype DrugtypeInsert(DrugpropRequest request)
{
var entity = new cof_drugtype
{
HospitalId = request.HospitalId,
AllotID = request.AllotID,
Charge = request.Charge,
ChargeType = request.ChargeType
......@@ -715,7 +716,7 @@ public void Copy(per_allot allot)
if (cofDrugtype == null || cofDrugtype.Count == 0)
{
var drugtype = _drugtypeRepository.GetEntities(t => t.AllotID == allotId) ?? _drugtypeRepository.GetEntities(t => t.AllotID == -1);
var newAgains = drugtype.Select(t => new cof_drugtype { AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
var newAgains = drugtype.Select(t => new cof_drugtype {HospitalId=allot.HospitalId, AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
_drugtypeRepository.AddRange(newAgains.ToArray());
}
......@@ -838,7 +839,7 @@ private void CopyAprData(int prevAllotId, int allotId)
}
}
public HandsonTable GetHrpDeptHands(int HospitalId,int AllotId)
public HandsonTable GetHrpDeptHands(int HospitalId, int AllotId)
{
var result = new HandsonTable((int)SheetType.Unidentifiable, HrpDept.Select(t => t.Value).ToArray(), HrpDept.Select(t => new collect_permission
{
......@@ -866,9 +867,9 @@ public HandsonTable GetHrpDeptHands(int HospitalId,int AllotId)
return result;
}
public void SaveDepttypeHands(int hospitalId, int allotId,SaveCollectData request)
public void SaveDepttypeHands(int hospitalId, int allotId, SaveCollectData request)
{
var dicData = CreateDataRow(hospitalId,allotId, request, HrpDept);
var dicData = CreateDataRow(hospitalId, allotId, request, HrpDept);
List<cof_hrp_department> depts = new List<cof_hrp_department>();
foreach (var item in dicData)
......@@ -884,7 +885,7 @@ public void SaveDepttypeHands(int hospitalId, int allotId,SaveCollectData reques
}
perforCofHrpDeptRepository.Execute("delete from cof_hrp_department where HospitalId=@hospitalId and allotid = @allotid"
, new {hospitalId, allotId });
, new { hospitalId, allotId });
perforCofHrpDeptRepository.AddRange(depts.ToArray());
}
......@@ -897,7 +898,7 @@ public void SaveDepttypeHands(int hospitalId, int allotId,SaveCollectData reques
// 创建固定数据列
Dictionary<string, string> baseData = CreateBaseData(request, config, r);
baseData.Add(nameof(cof_hrp_department.AllotId), allotId.ToString());
baseData.Add(nameof(cof_hrp_department.HospitalId),hospitalId.ToString());
baseData.Add(nameof(cof_hrp_department.HospitalId), hospitalId.ToString());
allData.Add(baseData);
}
......
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