vitalReport.m.dart 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. import 'liveConsultation.m.dart';
  2. import 'notification.m.dart';
  3. import 'vitalHealthExamBooking.m.dart';
  4. import 'device.m.dart';
  5. enum ReportStateEnum {
  6. Unchecked,
  7. Invalid,
  8. Reported,
  9. }
  10. class CreateReportRequest extends TokenRequest{
  11. String? code;
  12. String? key;
  13. String? patientCode;
  14. String? contractedDoctor;
  15. String? reportData;
  16. ReportStateEnum reportState;
  17. String? templateCode;
  18. CreateReportRequest({
  19. this.code,
  20. this.key,
  21. this.patientCode,
  22. this.contractedDoctor,
  23. this.reportData,
  24. this.reportState = ReportStateEnum.Unchecked,
  25. this.templateCode,
  26. String? token,
  27. }) : super(
  28. token: token,
  29. );
  30. factory CreateReportRequest.fromJson(Map<String, dynamic> map) {
  31. return CreateReportRequest(
  32. code: map['Code'],
  33. key: map['Key'],
  34. patientCode: map['PatientCode'],
  35. contractedDoctor: map['ContractedDoctor'],
  36. reportData: map['ReportData'],
  37. reportState: ReportStateEnum.values.firstWhere((e) => e.index == map['ReportState']),
  38. templateCode: map['TemplateCode'],
  39. token: map['Token'],
  40. );
  41. }
  42. Map<String, dynamic> toJson() {
  43. final map = super.toJson();
  44. if (code != null)
  45. map['Code'] = code;
  46. if (key != null)
  47. map['Key'] = key;
  48. if (patientCode != null)
  49. map['PatientCode'] = patientCode;
  50. if (contractedDoctor != null)
  51. map['ContractedDoctor'] = contractedDoctor;
  52. if (reportData != null)
  53. map['ReportData'] = reportData;
  54. map['ReportState'] = reportState.index;
  55. if (templateCode != null)
  56. map['TemplateCode'] = templateCode;
  57. return map;
  58. }
  59. }
  60. class ReportDTO2 extends BaseDTO{
  61. String? code;
  62. String? key;
  63. String? patientCode;
  64. String? contractedDoctor;
  65. Map<String,String>? reportData;
  66. ExamStateEnum examState;
  67. String? templateCode;
  68. ReportDTO2({
  69. this.code,
  70. this.key,
  71. this.patientCode,
  72. this.contractedDoctor,
  73. this.reportData,
  74. this.examState = ExamStateEnum.Unchecked,
  75. this.templateCode,
  76. DateTime? createTime,
  77. DateTime? updateTime,
  78. }) : super(
  79. createTime: createTime,
  80. updateTime: updateTime,
  81. );
  82. factory ReportDTO2.fromJson(Map<String, dynamic> map) {
  83. return ReportDTO2(
  84. code: map['Code'],
  85. key: map['Key'],
  86. patientCode: map['PatientCode'],
  87. contractedDoctor: map['ContractedDoctor'],
  88. reportData: map['ReportData']?.cast<String,String>(),
  89. examState: ExamStateEnum.values.firstWhere((e) => e.index == map['ExamState']),
  90. templateCode: map['TemplateCode'],
  91. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  92. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  93. );
  94. }
  95. Map<String, dynamic> toJson() {
  96. final map = super.toJson();
  97. if (code != null)
  98. map['Code'] = code;
  99. if (key != null)
  100. map['Key'] = key;
  101. if (patientCode != null)
  102. map['PatientCode'] = patientCode;
  103. if (contractedDoctor != null)
  104. map['ContractedDoctor'] = contractedDoctor;
  105. if (reportData != null)
  106. map['ReportData'] = reportData;
  107. map['ExamState'] = examState.index;
  108. if (templateCode != null)
  109. map['TemplateCode'] = templateCode;
  110. return map;
  111. }
  112. }
  113. class GetReportRequest extends TokenRequest{
  114. String? code;
  115. GetReportRequest({
  116. this.code,
  117. String? token,
  118. }) : super(
  119. token: token,
  120. );
  121. factory GetReportRequest.fromJson(Map<String, dynamic> map) {
  122. return GetReportRequest(
  123. code: map['Code'],
  124. token: map['Token'],
  125. );
  126. }
  127. Map<String, dynamic> toJson() {
  128. final map = super.toJson();
  129. if (code != null)
  130. map['Code'] = code;
  131. return map;
  132. }
  133. }
  134. class GetReportByKeyRequest extends TokenRequest{
  135. String? key;
  136. String? value;
  137. GetReportByKeyRequest({
  138. this.key,
  139. this.value,
  140. String? token,
  141. }) : super(
  142. token: token,
  143. );
  144. factory GetReportByKeyRequest.fromJson(Map<String, dynamic> map) {
  145. return GetReportByKeyRequest(
  146. key: map['Key'],
  147. value: map['Value'],
  148. token: map['Token'],
  149. );
  150. }
  151. Map<String, dynamic> toJson() {
  152. final map = super.toJson();
  153. if (key != null)
  154. map['Key'] = key;
  155. if (value != null)
  156. map['Value'] = value;
  157. return map;
  158. }
  159. }
  160. class ReportPageRequest extends PageRequest{
  161. ReportPageRequest({
  162. int pageIndex = 0,
  163. int pageSize = 0,
  164. String? token,
  165. }) : super(
  166. pageIndex: pageIndex,
  167. pageSize: pageSize,
  168. token: token,
  169. );
  170. factory ReportPageRequest.fromJson(Map<String, dynamic> map) {
  171. return ReportPageRequest(
  172. pageIndex: map['PageIndex'],
  173. pageSize: map['PageSize'],
  174. token: map['Token'],
  175. );
  176. }
  177. Map<String, dynamic> toJson() {
  178. final map = super.toJson();
  179. return map;
  180. }
  181. }
  182. class RemoveReportRequest extends TokenRequest{
  183. String? code;
  184. RemoveReportRequest({
  185. this.code,
  186. String? token,
  187. }) : super(
  188. token: token,
  189. );
  190. factory RemoveReportRequest.fromJson(Map<String, dynamic> map) {
  191. return RemoveReportRequest(
  192. code: map['Code'],
  193. token: map['Token'],
  194. );
  195. }
  196. Map<String, dynamic> toJson() {
  197. final map = super.toJson();
  198. if (code != null)
  199. map['Code'] = code;
  200. return map;
  201. }
  202. }
  203. class GetReportListRequest extends TokenRequest{
  204. List<String>? codes;
  205. GetReportListRequest({
  206. this.codes,
  207. String? token,
  208. }) : super(
  209. token: token,
  210. );
  211. factory GetReportListRequest.fromJson(Map<String, dynamic> map) {
  212. return GetReportListRequest(
  213. codes: map['Codes']?.cast<String>().toList(),
  214. token: map['Token'],
  215. );
  216. }
  217. Map<String, dynamic> toJson() {
  218. final map = super.toJson();
  219. if (codes != null)
  220. map['Codes'] = codes;
  221. return map;
  222. }
  223. }
  224. class UpdateReportRequest extends TokenRequest{
  225. String? code;
  226. String? key;
  227. String? patientCode;
  228. String? contractedDoctor;
  229. String? reportData;
  230. ReportStateEnum? reportState;
  231. String? templateCode;
  232. UpdateReportRequest({
  233. this.code,
  234. this.key,
  235. this.patientCode,
  236. this.contractedDoctor,
  237. this.reportData,
  238. this.reportState,
  239. this.templateCode,
  240. String? token,
  241. }) : super(
  242. token: token,
  243. );
  244. factory UpdateReportRequest.fromJson(Map<String, dynamic> map) {
  245. return UpdateReportRequest(
  246. code: map['Code'],
  247. key: map['Key'],
  248. patientCode: map['PatientCode'],
  249. contractedDoctor: map['ContractedDoctor'],
  250. reportData: map['ReportData'],
  251. reportState: map['ReportState'] != null ? ReportStateEnum.values.firstWhere((e) => e.index == map['ReportState']) : null,
  252. templateCode: map['TemplateCode'],
  253. token: map['Token'],
  254. );
  255. }
  256. Map<String, dynamic> toJson() {
  257. final map = super.toJson();
  258. if (code != null)
  259. map['Code'] = code;
  260. if (key != null)
  261. map['Key'] = key;
  262. if (patientCode != null)
  263. map['PatientCode'] = patientCode;
  264. if (contractedDoctor != null)
  265. map['ContractedDoctor'] = contractedDoctor;
  266. if (reportData != null)
  267. map['ReportData'] = reportData;
  268. if (reportState != null)
  269. map['ReportState'] = reportState;
  270. if (templateCode != null)
  271. map['TemplateCode'] = templateCode;
  272. return map;
  273. }
  274. }