TerminalDatas.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. using MongoDB.Bson.Serialization.Attributes;
  2. using SharpCompress.Common;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace Flyinsono.DBCopy.Tool.Entities
  9. {
  10. internal class TerminalDatas
  11. {
  12. public string Id { get; private set; }
  13. public DateTime CreateTime { get; private set; }
  14. public DateTime UpdateTime { get; set; }
  15. public VidType DataType { get; set; }
  16. public string Application { get; set; }
  17. public string PreviewImageFileToken { get; set; }
  18. public string PatientInfoId { get; set; }
  19. public IList<TerminalDataFile> Files { get; set; }
  20. public IList<TerminalDataComment> Comments { get; set; }
  21. public string TerminalRecordId { get; set; }
  22. /// <summary>
  23. /// Gets the image location.
  24. /// </summary>
  25. public ImageLocation ImageLocation { get; set; }
  26. /// <summary>
  27. /// 图像质控内容
  28. /// </summary>
  29. [BsonIgnoreIfNull]
  30. public ICollection<QualityControlData> QualityControlDatas { get; set; }
  31. /// <summary>
  32. /// 器官识别结果
  33. /// </summary>
  34. public List<EnumOrgans> OrganDiagnosisResult { get; set; }
  35. }
  36. internal class TerminalData
  37. {
  38. public string Id { get; set; }
  39. public string PreviewImageFileToken { get; set; }
  40. public IList<TerminalDataFile> Files { get; set; }
  41. }
  42. /// <summary>
  43. /// The base class for image location, different application has different implementation.
  44. /// </summary>
  45. [BsonKnownTypes(typeof(BreastImageLocation), typeof(LiverImageLocation), typeof(PositionImageLocation))]
  46. class ImageLocation
  47. {
  48. }
  49. /// <summary>
  50. /// Define the BreastImageLocation stored in database
  51. /// </summary>
  52. class BreastImageLocation : ImageLocation
  53. {
  54. public Position Position { get; set; }
  55. public QuadrantEnum Quadrant { get; set; }
  56. public bool Equals(BreastImageLocation other)
  57. {
  58. if (other == null)
  59. {
  60. return false;
  61. }
  62. return Position == other.Position && Quadrant == other.Quadrant;
  63. }
  64. public override bool Equals(object obj)
  65. {
  66. if (ReferenceEquals(null, obj)) return false;
  67. return obj is BreastImageLocation && Equals((BreastImageLocation)obj);
  68. }
  69. public override int GetHashCode()
  70. {
  71. unchecked
  72. {
  73. var hashCode = Position.GetHashCode();
  74. hashCode = (hashCode * 397) ^ Quadrant.GetHashCode();
  75. return hashCode;
  76. }
  77. }
  78. }
  79. class LiverImageLocation : ImageLocation
  80. {
  81. public LiverPosition Position { get; set; }
  82. public bool Equals(LiverImageLocation other)
  83. {
  84. if (other == null)
  85. {
  86. return false;
  87. }
  88. return Position == other.Position;
  89. }
  90. public override bool Equals(object obj)
  91. {
  92. if (ReferenceEquals(null, obj)) return false;
  93. return obj is LiverImageLocation && Equals((LiverImageLocation)obj);
  94. }
  95. public override int GetHashCode()
  96. {
  97. unchecked
  98. {
  99. var hashCode = Position.GetHashCode();
  100. return hashCode;
  101. }
  102. }
  103. }
  104. class PositionImageLocation : ImageLocation
  105. {
  106. public string Group { get; set; }
  107. public string Position { get; set; }
  108. public bool Equals(PositionImageLocation other)
  109. {
  110. if (other == null)
  111. {
  112. return false;
  113. }
  114. return Position == other.Position && Group == other.Group;
  115. }
  116. public override bool Equals(object obj)
  117. {
  118. if (ReferenceEquals(null, obj)) return false;
  119. return obj is PositionImageLocation && Equals((PositionImageLocation)obj);
  120. }
  121. public override int GetHashCode()
  122. {
  123. unchecked
  124. {
  125. var hashCode = Position.GetHashCode();
  126. hashCode = (hashCode * 397) ^ Group.GetHashCode();
  127. return hashCode;
  128. }
  129. }
  130. }
  131. public enum QuadrantEnum
  132. {
  133. OuterUpper,
  134. InnerUpper,
  135. OuterLower,
  136. InnerLower
  137. }
  138. /// <summary>
  139. /// left or right position
  140. /// </summary>
  141. public enum Position
  142. {
  143. None,
  144. Left,
  145. Right
  146. }
  147. public enum LiverPosition
  148. {
  149. LeftLobe,
  150. RightLobeOfUnder,
  151. RightLobeOfInter
  152. }
  153. internal class TerminalDataComment
  154. {
  155. public string Id { get; set; }
  156. public DateTime CreateTime { get; set; }
  157. public DateTime UpdateTime { get; set; }
  158. public AdminInfo User { get; set; }
  159. public double Score { get; set; }
  160. public string Description { get; set; }
  161. }
  162. internal class TerminalDataFile
  163. {
  164. public string Id { get; set; }
  165. public DateTime CreateTime { get; set; }
  166. public DateTime UpdateTime { get; set; }
  167. /// <summary>
  168. /// Indicate report file name
  169. /// </summary>
  170. public string FileName { get; set; }
  171. public ImageQuality ImageQuality { get; set; }
  172. }
  173. public enum ImageQuality
  174. {
  175. High,
  176. Low
  177. }
  178. public enum VidType
  179. {
  180. VinnoVidSingle,
  181. ThirdVidSingle,
  182. VinnoVidMovie,
  183. ThirdVidMovie,
  184. Image
  185. }
  186. }