111 lines
2.9 KiB
C#
111 lines
2.9 KiB
C#
using IRaCIS.Core.Domain.Models;
|
|
using IRaCIS.Core.Domain.Share;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
namespace IRaCIS.Core.Infra.EFCore.Common
|
|
{
|
|
public static class ReadingCommon
|
|
{
|
|
|
|
public static Dictionary<ReadingCategory, decimal> TaskNumDic = new Dictionary<ReadingCategory, decimal>()
|
|
{
|
|
{ReadingCategory.Visit, 0 },
|
|
{ReadingCategory.Global,(decimal) 0.03 },
|
|
{ReadingCategory.Judge,(decimal) 0.02 },
|
|
{ReadingCategory.Oncology, (decimal)0.06 },
|
|
|
|
};
|
|
|
|
public const string EvaluationReason = "肿瘤学阅片评估原因请依据临床数据填写,在与影像学结果不一致时必填。";
|
|
|
|
public static bool IsNullOrEmpty(this string value)
|
|
{
|
|
if (value == null || value == string.Empty)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 字符匹配枚举
|
|
/// </summary>
|
|
/// <typeparam name="T"></typeparam>
|
|
/// <param name="value"></param>
|
|
/// <param name="enumValue"></param>
|
|
/// <returns></returns>
|
|
public static bool EqEnum<T>(this string value, T enumValue) where T:Enum
|
|
{
|
|
try
|
|
{
|
|
return int.Parse(value) == int.Parse(enumValue.ToString());
|
|
}
|
|
catch (Exception)
|
|
{
|
|
|
|
return false;
|
|
}
|
|
}
|
|
public static decimal NullChange0(this decimal? value)
|
|
{
|
|
if (value == null)
|
|
{
|
|
return 0;
|
|
|
|
}
|
|
else
|
|
{
|
|
return value.Value;
|
|
}
|
|
}
|
|
|
|
public static decimal IsNullOrEmptyReturn0(this string value)
|
|
{
|
|
try
|
|
{
|
|
if (value == null || value == string.Empty || value == "NA")
|
|
{
|
|
return 0;
|
|
|
|
}
|
|
else
|
|
{
|
|
return decimal.Parse(value);
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
|
|
return 0;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 获取DisplayName
|
|
/// </summary>
|
|
/// <param name="enumName"></param>
|
|
/// <returns></returns>
|
|
public static string GetDisplayName(this Enum enumName)
|
|
{
|
|
var type = enumName.GetType();//先获取这个枚举的类型
|
|
var field = type.GetField(enumName.ToString());//通过这个类型获取到值
|
|
var obj = (DisplayAttribute)field.GetCustomAttribute(typeof(DisplayAttribute));//得到特性
|
|
return obj.Name ?? "";
|
|
}
|
|
}
|
|
}
|