recordInfo.m.dart 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. import 'authentication.m.dart';
  2. import 'patient.m.dart';
  3. import 'device.m.dart';
  4. import 'organization.m.dart';
  5. import 'package:fis_jsonrpc/utils.dart';
  6. class PatientInfoExt {
  7. String? patientScanType;
  8. List<DataItemDTO>? content;
  9. PatientInfoExt({
  10. this.patientScanType,
  11. this.content,
  12. });
  13. factory PatientInfoExt.fromJson(Map<String, dynamic> map) {
  14. return PatientInfoExt(
  15. patientScanType: map['PatientScanType'],
  16. content: map['Content'] != null ? (map['Content'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  17. );
  18. }
  19. Map<String, dynamic> toJson() {
  20. final map = Map<String, dynamic>();
  21. if(patientScanType != null)
  22. map['PatientScanType'] = patientScanType;
  23. if(content != null)
  24. map['Content'] = content;
  25. return map;
  26. }
  27. }
  28. class CreateRecordRequest extends TokenRequest{
  29. String? patientCode;
  30. String? deviceCode;
  31. List<PatientInfoExt>? patientInfoExtList;
  32. CreateRecordRequest({
  33. this.patientCode,
  34. this.deviceCode,
  35. this.patientInfoExtList,
  36. String? token,
  37. }) : super(
  38. token: token,
  39. );
  40. factory CreateRecordRequest.fromJson(Map<String, dynamic> map) {
  41. return CreateRecordRequest(
  42. patientCode: map['PatientCode'],
  43. deviceCode: map['DeviceCode'],
  44. patientInfoExtList: map['PatientInfoExtList'] != null ? (map['PatientInfoExtList'] as List).map((e)=>PatientInfoExt.fromJson(e as Map<String,dynamic>)).toList() : null,
  45. token: map['Token'],
  46. );
  47. }
  48. Map<String, dynamic> toJson() {
  49. final map = super.toJson();
  50. if(patientCode != null)
  51. map['PatientCode'] = patientCode;
  52. if(deviceCode != null)
  53. map['DeviceCode'] = deviceCode;
  54. if(patientInfoExtList != null)
  55. map['PatientInfoExtList'] = patientInfoExtList;
  56. return map;
  57. }
  58. }
  59. enum RecordStatusEnum {
  60. NotScanned,
  61. NotReport,
  62. Completed,
  63. }
  64. class GetRecordsPageResult {
  65. DateTime? createTime;
  66. String? deptName;
  67. String? creatorName;
  68. String? deviceName;
  69. String? reportNum;
  70. String? recordCode;
  71. RecordStatusEnum recordStatus;
  72. bool isRead;
  73. GetRecordsPageResult({
  74. this.createTime,
  75. this.deptName,
  76. this.creatorName,
  77. this.deviceName,
  78. this.reportNum,
  79. this.recordCode,
  80. this.recordStatus = RecordStatusEnum.NotScanned,
  81. this.isRead = false,
  82. });
  83. factory GetRecordsPageResult.fromJson(Map<String, dynamic> map) {
  84. return GetRecordsPageResult(
  85. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  86. deptName: map['DeptName'],
  87. creatorName: map['CreatorName'],
  88. deviceName: map['DeviceName'],
  89. reportNum: map['ReportNum'],
  90. recordCode: map['RecordCode'],
  91. recordStatus: RecordStatusEnum.values.firstWhere((e) => e.index == map['RecordStatus']),
  92. isRead: map['IsRead'],
  93. );
  94. }
  95. Map<String, dynamic> toJson() {
  96. final map = Map<String, dynamic>();
  97. if(createTime != null)
  98. map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!);
  99. if(deptName != null)
  100. map['DeptName'] = deptName;
  101. if(creatorName != null)
  102. map['CreatorName'] = creatorName;
  103. if(deviceName != null)
  104. map['DeviceName'] = deviceName;
  105. if(reportNum != null)
  106. map['ReportNum'] = reportNum;
  107. if(recordCode != null)
  108. map['RecordCode'] = recordCode;
  109. map['RecordStatus'] = recordStatus.index;
  110. map['IsRead'] = isRead;
  111. return map;
  112. }
  113. }
  114. enum QueryRecordStatusEnum {
  115. All,
  116. NotScanned,
  117. NotReport,
  118. Completed,
  119. NotCompleted,
  120. }
  121. enum QueryRecordCreateTypeEnum {
  122. All,
  123. Reservation,
  124. Normal,
  125. }
  126. class GetRecordsPageRequest extends PageRequest{
  127. String? patientCode;
  128. QueryRecordStatusEnum queryRecordStatus;
  129. QueryRecordCreateTypeEnum queryRecordCreateType;
  130. GetRecordsPageRequest({
  131. this.patientCode,
  132. this.queryRecordStatus = QueryRecordStatusEnum.All,
  133. this.queryRecordCreateType = QueryRecordCreateTypeEnum.All,
  134. int pageIndex = 0,
  135. int pageSize = 0,
  136. String? token,
  137. }) : super(
  138. pageIndex: pageIndex,
  139. pageSize: pageSize,
  140. token: token,
  141. );
  142. factory GetRecordsPageRequest.fromJson(Map<String, dynamic> map) {
  143. return GetRecordsPageRequest(
  144. patientCode: map['PatientCode'],
  145. queryRecordStatus: QueryRecordStatusEnum.values.firstWhere((e) => e.index == map['QueryRecordStatus']),
  146. queryRecordCreateType: QueryRecordCreateTypeEnum.values.firstWhere((e) => e.index == map['QueryRecordCreateType']),
  147. pageIndex: map['PageIndex'],
  148. pageSize: map['PageSize'],
  149. token: map['Token'],
  150. );
  151. }
  152. Map<String, dynamic> toJson() {
  153. final map = super.toJson();
  154. if(patientCode != null)
  155. map['PatientCode'] = patientCode;
  156. map['QueryRecordStatus'] = queryRecordStatus.index;
  157. map['QueryRecordCreateType'] = queryRecordCreateType.index;
  158. return map;
  159. }
  160. }
  161. class QueryRecordResult {
  162. DateTime? createTime;
  163. String? deptName;
  164. String? patientName;
  165. String? patientAge;
  166. int patientSex;
  167. String? creatorName;
  168. String? deviceName;
  169. RecordStatusEnum recordStatus;
  170. List<PatientInfoExt>? patientInfoExtList;
  171. QueryRecordResult({
  172. this.createTime,
  173. this.deptName,
  174. this.patientName,
  175. this.patientAge,
  176. this.patientSex = 0,
  177. this.creatorName,
  178. this.deviceName,
  179. this.recordStatus = RecordStatusEnum.NotScanned,
  180. this.patientInfoExtList,
  181. });
  182. factory QueryRecordResult.fromJson(Map<String, dynamic> map) {
  183. return QueryRecordResult(
  184. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  185. deptName: map['DeptName'],
  186. patientName: map['PatientName'],
  187. patientAge: map['PatientAge'],
  188. patientSex: map['PatientSex'],
  189. creatorName: map['CreatorName'],
  190. deviceName: map['DeviceName'],
  191. recordStatus: RecordStatusEnum.values.firstWhere((e) => e.index == map['RecordStatus']),
  192. patientInfoExtList: map['PatientInfoExtList'] != null ? (map['PatientInfoExtList'] as List).map((e)=>PatientInfoExt.fromJson(e as Map<String,dynamic>)).toList() : null,
  193. );
  194. }
  195. Map<String, dynamic> toJson() {
  196. final map = Map<String, dynamic>();
  197. if(createTime != null)
  198. map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!);
  199. if(deptName != null)
  200. map['DeptName'] = deptName;
  201. if(patientName != null)
  202. map['PatientName'] = patientName;
  203. if(patientAge != null)
  204. map['PatientAge'] = patientAge;
  205. map['PatientSex'] = patientSex;
  206. if(creatorName != null)
  207. map['CreatorName'] = creatorName;
  208. if(deviceName != null)
  209. map['DeviceName'] = deviceName;
  210. map['RecordStatus'] = recordStatus.index;
  211. if(patientInfoExtList != null)
  212. map['PatientInfoExtList'] = patientInfoExtList;
  213. return map;
  214. }
  215. }
  216. class QueryRecordRequest extends TokenRequest{
  217. String? recordCode;
  218. QueryRecordRequest({
  219. this.recordCode,
  220. String? token,
  221. }) : super(
  222. token: token,
  223. );
  224. factory QueryRecordRequest.fromJson(Map<String, dynamic> map) {
  225. return QueryRecordRequest(
  226. recordCode: map['RecordCode'],
  227. token: map['Token'],
  228. );
  229. }
  230. Map<String, dynamic> toJson() {
  231. final map = super.toJson();
  232. if(recordCode != null)
  233. map['RecordCode'] = recordCode;
  234. return map;
  235. }
  236. }
  237. class PushRecordCodesToDeviceRequest extends TokenRequest{
  238. List<String>? recordCodes;
  239. String? deviceCode;
  240. PushRecordCodesToDeviceRequest({
  241. this.recordCodes,
  242. this.deviceCode,
  243. String? token,
  244. }) : super(
  245. token: token,
  246. );
  247. factory PushRecordCodesToDeviceRequest.fromJson(Map<String, dynamic> map) {
  248. return PushRecordCodesToDeviceRequest(
  249. recordCodes: map['RecordCodes'] != null ? map['RecordCodes'].cast<String>().toList() : null,
  250. deviceCode: map['DeviceCode'],
  251. token: map['Token'],
  252. );
  253. }
  254. Map<String, dynamic> toJson() {
  255. final map = super.toJson();
  256. if(recordCodes != null)
  257. map['RecordCodes'] = recordCodes;
  258. if(deviceCode != null)
  259. map['DeviceCode'] = deviceCode;
  260. return map;
  261. }
  262. }
  263. class ProcessRecordDataResult {
  264. List<DataItemDTO>? content;
  265. ProcessRecordDataResult({
  266. this.content,
  267. });
  268. factory ProcessRecordDataResult.fromJson(Map<String, dynamic> map) {
  269. return ProcessRecordDataResult(
  270. content: map['Content'] != null ? (map['Content'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  271. );
  272. }
  273. Map<String, dynamic> toJson() {
  274. final map = Map<String, dynamic>();
  275. if(content != null)
  276. map['Content'] = content;
  277. return map;
  278. }
  279. }
  280. enum AnimalSpeciesEnum {
  281. Bovine,
  282. Canidae,
  283. Equidae,
  284. Felidae,
  285. Caprinae,
  286. Suidae,
  287. }
  288. class ProcessRecordDataRequest extends TokenRequest{
  289. String? methodName;
  290. List<DataItemDTO>? content;
  291. OrganizationPatientTypeEnum patientType;
  292. AnimalSpeciesEnum speciesEnum;
  293. ProcessRecordDataRequest({
  294. this.methodName,
  295. this.content,
  296. this.patientType = OrganizationPatientTypeEnum.Person,
  297. this.speciesEnum = AnimalSpeciesEnum.Bovine,
  298. String? token,
  299. }) : super(
  300. token: token,
  301. );
  302. factory ProcessRecordDataRequest.fromJson(Map<String, dynamic> map) {
  303. return ProcessRecordDataRequest(
  304. methodName: map['MethodName'],
  305. content: map['Content'] != null ? (map['Content'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  306. patientType: OrganizationPatientTypeEnum.values.firstWhere((e) => e.index == map['PatientType']),
  307. speciesEnum: AnimalSpeciesEnum.values.firstWhere((e) => e.index == map['SpeciesEnum']),
  308. token: map['Token'],
  309. );
  310. }
  311. Map<String, dynamic> toJson() {
  312. final map = super.toJson();
  313. if(methodName != null)
  314. map['MethodName'] = methodName;
  315. if(content != null)
  316. map['Content'] = content;
  317. map['PatientType'] = patientType.index;
  318. map['SpeciesEnum'] = speciesEnum.index;
  319. return map;
  320. }
  321. }
  322. class RelevanceRecordRequest extends TokenRequest{
  323. String? examCode;
  324. String? rservationCode;
  325. RelevanceRecordRequest({
  326. this.examCode,
  327. this.rservationCode,
  328. String? token,
  329. }) : super(
  330. token: token,
  331. );
  332. factory RelevanceRecordRequest.fromJson(Map<String, dynamic> map) {
  333. return RelevanceRecordRequest(
  334. examCode: map['ExamCode'],
  335. rservationCode: map['RservationCode'],
  336. token: map['Token'],
  337. );
  338. }
  339. Map<String, dynamic> toJson() {
  340. final map = super.toJson();
  341. if(examCode != null)
  342. map['ExamCode'] = examCode;
  343. if(rservationCode != null)
  344. map['RservationCode'] = rservationCode;
  345. return map;
  346. }
  347. }