patient.m.dart 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. import 'liveConsultation.m.dart';
  2. import 'notification.m.dart';
  3. import 'package:fis_jsonrpc/utils.dart';
  4. class CreatePatientRequest extends TokenRequest{
  5. List<DataItemDTO >? patientData;
  6. List<String >? assignmentUserCodes;
  7. CreatePatientRequest({
  8. this.patientData,
  9. this.assignmentUserCodes,
  10. String? token,
  11. }) : super(
  12. token: token,
  13. );
  14. factory CreatePatientRequest.fromJson(Map<String, dynamic> map) {
  15. return CreatePatientRequest(
  16. patientData: map['PatientData'] != null ? (map['PatientData'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  17. assignmentUserCodes: map['AssignmentUserCodes'] != null ? map['AssignmentUserCodes'].cast<String>().toList() : null,
  18. token: map['Token'],
  19. );
  20. }
  21. Map<String, dynamic> toJson() {
  22. final map = super.toJson();
  23. if(patientData != null)
  24. map['PatientData'] = patientData;
  25. if(assignmentUserCodes != null)
  26. map['AssignmentUserCodes'] = assignmentUserCodes;
  27. return map;
  28. }
  29. }
  30. class CreatePatientByUnregisteredRequest extends TokenRequest{
  31. String? unregisteredPatientCode;
  32. String? patientName;
  33. CreatePatientByUnregisteredRequest({
  34. this.unregisteredPatientCode,
  35. this.patientName,
  36. String? token,
  37. }) : super(
  38. token: token,
  39. );
  40. factory CreatePatientByUnregisteredRequest.fromJson(Map<String, dynamic> map) {
  41. return CreatePatientByUnregisteredRequest(
  42. unregisteredPatientCode: map['UnregisteredPatientCode'],
  43. patientName: map['PatientName'],
  44. token: map['Token'],
  45. );
  46. }
  47. Map<String, dynamic> toJson() {
  48. final map = super.toJson();
  49. if(unregisteredPatientCode != null)
  50. map['UnregisteredPatientCode'] = unregisteredPatientCode;
  51. if(patientName != null)
  52. map['PatientName'] = patientName;
  53. return map;
  54. }
  55. }
  56. class UpdatePatientRequest extends TokenRequest{
  57. String? code;
  58. List<DataItemDTO >? patientData;
  59. List<String >? assignmentUserCodes;
  60. UpdatePatientRequest({
  61. this.code,
  62. this.patientData,
  63. this.assignmentUserCodes,
  64. String? token,
  65. }) : super(
  66. token: token,
  67. );
  68. factory UpdatePatientRequest.fromJson(Map<String, dynamic> map) {
  69. return UpdatePatientRequest(
  70. code: map['Code'],
  71. patientData: map['PatientData'] != null ? (map['PatientData'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  72. assignmentUserCodes: map['AssignmentUserCodes'] != null ? map['AssignmentUserCodes'].cast<String>().toList() : null,
  73. token: map['Token'],
  74. );
  75. }
  76. Map<String, dynamic> toJson() {
  77. final map = super.toJson();
  78. if(code != null)
  79. map['Code'] = code;
  80. if(patientData != null)
  81. map['PatientData'] = patientData;
  82. if(assignmentUserCodes != null)
  83. map['AssignmentUserCodes'] = assignmentUserCodes;
  84. return map;
  85. }
  86. }
  87. class PatientInfoBaseDTO extends BaseDTO{
  88. String? patientCode;
  89. String? name;
  90. String? phone;
  91. String? identityCard;
  92. String? insuranceCode;
  93. String? age;
  94. int gender;
  95. bool isValid;
  96. String? organizationCode;
  97. String? rootOrganizationCode;
  98. List<String >? assignmentUserCodes;
  99. List<DataItemDTO >? patientData;
  100. int unReadRecordCount;
  101. String? headImgUrl;
  102. String? patientType;
  103. bool isReferral;
  104. List<String >? devicePatientIDs;
  105. PatientInfoBaseDTO({
  106. this.patientCode,
  107. this.name,
  108. this.phone,
  109. this.identityCard,
  110. this.insuranceCode,
  111. this.age,
  112. this.gender = 0,
  113. this.isValid = false,
  114. this.organizationCode,
  115. this.rootOrganizationCode,
  116. this.assignmentUserCodes,
  117. this.patientData,
  118. this.unReadRecordCount = 0,
  119. this.headImgUrl,
  120. this.patientType,
  121. this.isReferral = false,
  122. this.devicePatientIDs,
  123. DateTime? createTime,
  124. DateTime? updateTime,
  125. }) : super(
  126. createTime: createTime,
  127. updateTime: updateTime,
  128. );
  129. factory PatientInfoBaseDTO.fromJson(Map<String, dynamic> map) {
  130. return PatientInfoBaseDTO(
  131. patientCode: map['PatientCode'],
  132. name: map['Name'],
  133. phone: map['Phone'],
  134. identityCard: map['IdentityCard'],
  135. insuranceCode: map['InsuranceCode'],
  136. age: map['Age'],
  137. gender: map['Gender'],
  138. isValid: map['IsValid'],
  139. organizationCode: map['OrganizationCode'],
  140. rootOrganizationCode: map['RootOrganizationCode'],
  141. assignmentUserCodes: map['AssignmentUserCodes'] != null ? map['AssignmentUserCodes'].cast<String>().toList() : null,
  142. patientData: map['PatientData'] != null ? (map['PatientData'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  143. unReadRecordCount: map['UnReadRecordCount'],
  144. headImgUrl: map['HeadImgUrl'],
  145. patientType: map['PatientType'],
  146. isReferral: map['IsReferral'],
  147. devicePatientIDs: map['DevicePatientIDs'] != null ? map['DevicePatientIDs'].cast<String>().toList() : null,
  148. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  149. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  150. );
  151. }
  152. Map<String, dynamic> toJson() {
  153. final map = super.toJson();
  154. if(patientCode != null)
  155. map['PatientCode'] = patientCode;
  156. if(name != null)
  157. map['Name'] = name;
  158. if(phone != null)
  159. map['Phone'] = phone;
  160. if(identityCard != null)
  161. map['IdentityCard'] = identityCard;
  162. if(insuranceCode != null)
  163. map['InsuranceCode'] = insuranceCode;
  164. if(age != null)
  165. map['Age'] = age;
  166. map['Gender'] = gender;
  167. map['IsValid'] = isValid;
  168. if(organizationCode != null)
  169. map['OrganizationCode'] = organizationCode;
  170. if(rootOrganizationCode != null)
  171. map['RootOrganizationCode'] = rootOrganizationCode;
  172. if(assignmentUserCodes != null)
  173. map['AssignmentUserCodes'] = assignmentUserCodes;
  174. if(patientData != null)
  175. map['PatientData'] = patientData;
  176. map['UnReadRecordCount'] = unReadRecordCount;
  177. if(headImgUrl != null)
  178. map['HeadImgUrl'] = headImgUrl;
  179. if(patientType != null)
  180. map['PatientType'] = patientType;
  181. map['IsReferral'] = isReferral;
  182. if(devicePatientIDs != null)
  183. map['DevicePatientIDs'] = devicePatientIDs;
  184. return map;
  185. }
  186. }
  187. class PatientInfoDTO extends PatientInfoBaseDTO{
  188. String? creatorCode;
  189. String? deviceCode;
  190. List<String >? updateUsers;
  191. PatientInfoDTO({
  192. this.creatorCode,
  193. this.deviceCode,
  194. this.updateUsers,
  195. String? patientCode,
  196. String? name,
  197. String? phone,
  198. String? identityCard,
  199. String? insuranceCode,
  200. String? age,
  201. int gender = 0,
  202. bool isValid = false,
  203. String? organizationCode,
  204. String? rootOrganizationCode,
  205. List<String >? assignmentUserCodes,
  206. List<DataItemDTO >? patientData,
  207. int unReadRecordCount = 0,
  208. String? headImgUrl,
  209. String? patientType,
  210. bool isReferral = false,
  211. List<String >? devicePatientIDs,
  212. DateTime? createTime,
  213. DateTime? updateTime,
  214. }) : super(
  215. patientCode: patientCode,
  216. name: name,
  217. phone: phone,
  218. identityCard: identityCard,
  219. insuranceCode: insuranceCode,
  220. age: age,
  221. gender: gender,
  222. isValid: isValid,
  223. organizationCode: organizationCode,
  224. rootOrganizationCode: rootOrganizationCode,
  225. assignmentUserCodes: assignmentUserCodes,
  226. patientData: patientData,
  227. unReadRecordCount: unReadRecordCount,
  228. headImgUrl: headImgUrl,
  229. patientType: patientType,
  230. isReferral: isReferral,
  231. devicePatientIDs: devicePatientIDs,
  232. createTime: createTime,
  233. updateTime: updateTime,
  234. );
  235. factory PatientInfoDTO.fromJson(Map<String, dynamic> map) {
  236. return PatientInfoDTO(
  237. creatorCode: map['CreatorCode'],
  238. deviceCode: map['DeviceCode'],
  239. updateUsers: map['UpdateUsers'] != null ? map['UpdateUsers'].cast<String>().toList() : null,
  240. patientCode: map['PatientCode'],
  241. name: map['Name'],
  242. phone: map['Phone'],
  243. identityCard: map['IdentityCard'],
  244. insuranceCode: map['InsuranceCode'],
  245. age: map['Age'],
  246. gender: map['Gender'],
  247. isValid: map['IsValid'],
  248. organizationCode: map['OrganizationCode'],
  249. rootOrganizationCode: map['RootOrganizationCode'],
  250. assignmentUserCodes: map['AssignmentUserCodes'] != null ? map['AssignmentUserCodes'].cast<String>().toList() : null,
  251. patientData: map['PatientData'] != null ? (map['PatientData'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  252. unReadRecordCount: map['UnReadRecordCount'],
  253. headImgUrl: map['HeadImgUrl'],
  254. patientType: map['PatientType'],
  255. isReferral: map['IsReferral'],
  256. devicePatientIDs: map['DevicePatientIDs'] != null ? map['DevicePatientIDs'].cast<String>().toList() : null,
  257. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  258. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  259. );
  260. }
  261. Map<String, dynamic> toJson() {
  262. final map = super.toJson();
  263. if(creatorCode != null)
  264. map['CreatorCode'] = creatorCode;
  265. if(deviceCode != null)
  266. map['DeviceCode'] = deviceCode;
  267. if(updateUsers != null)
  268. map['UpdateUsers'] = updateUsers;
  269. return map;
  270. }
  271. }
  272. class CreatePatientsRequest extends TokenRequest{
  273. List<PatientInfoDTO >? patients;
  274. CreatePatientsRequest({
  275. this.patients,
  276. String? token,
  277. }) : super(
  278. token: token,
  279. );
  280. factory CreatePatientsRequest.fromJson(Map<String, dynamic> map) {
  281. return CreatePatientsRequest(
  282. patients: map['Patients'] != null ? (map['Patients'] as List).map((e)=>PatientInfoDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  283. token: map['Token'],
  284. );
  285. }
  286. Map<String, dynamic> toJson() {
  287. final map = super.toJson();
  288. if(patients != null)
  289. map['Patients'] = patients;
  290. return map;
  291. }
  292. }
  293. enum PatientValidStatusEnum {
  294. All,
  295. CheckOut,
  296. CheckIn,
  297. }
  298. class FindPatientsPageRequest extends PageRequest{
  299. String? keyWord;
  300. DateTime? startTime;
  301. DateTime? endTime;
  302. PatientValidStatusEnum isValid;
  303. FindPatientsPageRequest({
  304. this.keyWord,
  305. this.startTime,
  306. this.endTime,
  307. this.isValid = PatientValidStatusEnum.All,
  308. int pageIndex = 0,
  309. int pageSize = 0,
  310. String? token,
  311. }) : super(
  312. pageIndex: pageIndex,
  313. pageSize: pageSize,
  314. token: token,
  315. );
  316. factory FindPatientsPageRequest.fromJson(Map<String, dynamic> map) {
  317. return FindPatientsPageRequest(
  318. keyWord: map['KeyWord'],
  319. startTime: map['StartTime'] != null ? DateTime.parse(map['StartTime']) : null,
  320. endTime: map['EndTime'] != null ? DateTime.parse(map['EndTime']) : null,
  321. isValid: PatientValidStatusEnum.values.firstWhere((e) => e.index == map['IsValid']),
  322. pageIndex: map['PageIndex'],
  323. pageSize: map['PageSize'],
  324. token: map['Token'],
  325. );
  326. }
  327. Map<String, dynamic> toJson() {
  328. final map = super.toJson();
  329. if(keyWord != null)
  330. map['KeyWord'] = keyWord;
  331. if(startTime != null)
  332. map['StartTime'] = JsonRpcUtils.dateFormat(startTime!);
  333. if(endTime != null)
  334. map['EndTime'] = JsonRpcUtils.dateFormat(endTime!);
  335. map['IsValid'] = isValid.index;
  336. return map;
  337. }
  338. }
  339. enum RecordStatusEnum {
  340. NotScanned,
  341. Uploaded,
  342. NotReport,
  343. Completed,
  344. }
  345. enum DiagnosisStatusEnum {
  346. NotRequired,
  347. Under,
  348. Completed,
  349. }
  350. enum DiagnosisReportStatusEnum {
  351. NotRequired,
  352. Reporting,
  353. Reported,
  354. }
  355. class DiagnosisInfoDTO {
  356. DiagnosisOrganEnum diagnosisOrgan;
  357. DiagnosisConclusionEnum conclusion;
  358. DiagnosisReportStatusEnum reportStatus;
  359. DiagnosisInfoDTO({
  360. this.diagnosisOrgan = DiagnosisOrganEnum.Null,
  361. this.conclusion = DiagnosisConclusionEnum.NotRequired,
  362. this.reportStatus = DiagnosisReportStatusEnum.NotRequired,
  363. });
  364. factory DiagnosisInfoDTO.fromJson(Map<String, dynamic> map) {
  365. return DiagnosisInfoDTO(
  366. diagnosisOrgan: DiagnosisOrganEnum.values.firstWhere((e) => e.index == map['DiagnosisOrgan']),
  367. conclusion: DiagnosisConclusionEnum.values.firstWhere((e) => e.index == map['Conclusion']),
  368. reportStatus: DiagnosisReportStatusEnum.values.firstWhere((e) => e.index == map['ReportStatus']),
  369. );
  370. }
  371. Map<String, dynamic> toJson() {
  372. final map = Map<String, dynamic>();
  373. map['DiagnosisOrgan'] = diagnosisOrgan.index;
  374. map['Conclusion'] = conclusion.index;
  375. map['ReportStatus'] = reportStatus.index;
  376. return map;
  377. }
  378. }
  379. enum ReferralStatusEnum {
  380. Wait,
  381. Withdrawn,
  382. TimedOut,
  383. Accepted,
  384. Rejected,
  385. }
  386. class GetRecordsPageDTO {
  387. DateTime? createTime;
  388. String? deptName;
  389. String? creatorName;
  390. String? deviceName;
  391. String? reportNum;
  392. String? recordCode;
  393. RecordStatusEnum recordStatus;
  394. bool isRead;
  395. List<RemedicalInfoDTO >? remedicalList;
  396. DiagnosisStatusEnum diagnosisStatus;
  397. List<DiagnosisInfoDTO >? diagnosisInfos;
  398. bool isReferral;
  399. ReferralStatusEnum referralStatus;
  400. bool canCreateReport;
  401. String? deviceCode;
  402. bool isCollecting;
  403. bool canCollcetImg;
  404. GetRecordsPageDTO({
  405. this.createTime,
  406. this.deptName,
  407. this.creatorName,
  408. this.deviceName,
  409. this.reportNum,
  410. this.recordCode,
  411. this.recordStatus = RecordStatusEnum.NotScanned,
  412. this.isRead = false,
  413. this.remedicalList,
  414. this.diagnosisStatus = DiagnosisStatusEnum.NotRequired,
  415. this.diagnosisInfos,
  416. this.isReferral = false,
  417. this.referralStatus = ReferralStatusEnum.Wait,
  418. this.canCreateReport = false,
  419. this.deviceCode,
  420. this.isCollecting = false,
  421. this.canCollcetImg = false,
  422. });
  423. factory GetRecordsPageDTO.fromJson(Map<String, dynamic> map) {
  424. return GetRecordsPageDTO(
  425. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  426. deptName: map['DeptName'],
  427. creatorName: map['CreatorName'],
  428. deviceName: map['DeviceName'],
  429. reportNum: map['ReportNum'],
  430. recordCode: map['RecordCode'],
  431. recordStatus: RecordStatusEnum.values.firstWhere((e) => e.index == map['RecordStatus']),
  432. isRead: map['IsRead'],
  433. remedicalList: map['RemedicalList'] != null ? (map['RemedicalList'] as List).map((e)=>RemedicalInfoDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  434. diagnosisStatus: DiagnosisStatusEnum.values.firstWhere((e) => e.index == map['DiagnosisStatus']),
  435. diagnosisInfos: map['DiagnosisInfos'] != null ? (map['DiagnosisInfos'] as List).map((e)=>DiagnosisInfoDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  436. isReferral: map['IsReferral'],
  437. referralStatus: ReferralStatusEnum.values.firstWhere((e) => e.index == map['ReferralStatus']),
  438. canCreateReport: map['CanCreateReport'],
  439. deviceCode: map['DeviceCode'],
  440. isCollecting: map['IsCollecting'],
  441. canCollcetImg: map['CanCollcetImg'],
  442. );
  443. }
  444. Map<String, dynamic> toJson() {
  445. final map = Map<String, dynamic>();
  446. if(createTime != null)
  447. map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!);
  448. if(deptName != null)
  449. map['DeptName'] = deptName;
  450. if(creatorName != null)
  451. map['CreatorName'] = creatorName;
  452. if(deviceName != null)
  453. map['DeviceName'] = deviceName;
  454. if(reportNum != null)
  455. map['ReportNum'] = reportNum;
  456. if(recordCode != null)
  457. map['RecordCode'] = recordCode;
  458. map['RecordStatus'] = recordStatus.index;
  459. map['IsRead'] = isRead;
  460. if(remedicalList != null)
  461. map['RemedicalList'] = remedicalList;
  462. map['DiagnosisStatus'] = diagnosisStatus.index;
  463. if(diagnosisInfos != null)
  464. map['DiagnosisInfos'] = diagnosisInfos;
  465. map['IsReferral'] = isReferral;
  466. map['ReferralStatus'] = referralStatus.index;
  467. map['CanCreateReport'] = canCreateReport;
  468. if(deviceCode != null)
  469. map['DeviceCode'] = deviceCode;
  470. map['IsCollecting'] = isCollecting;
  471. map['CanCollcetImg'] = canCollcetImg;
  472. return map;
  473. }
  474. }
  475. class ClientPatientInfoDTO extends ClientPatientInfoBaseDTO{
  476. String? creatorCode;
  477. String? creatorName;
  478. String? deviceCode;
  479. List<UserBaseDTO >? assignmentUserList;
  480. GetRecordsPageDTO? lastRecord;
  481. String? encryptFullName;
  482. ClientPatientInfoDTO({
  483. this.creatorCode,
  484. this.creatorName,
  485. this.deviceCode,
  486. this.assignmentUserList,
  487. this.lastRecord,
  488. this.encryptFullName,
  489. String? patientCode,
  490. bool isValid = false,
  491. List<DataItemDTO >? patientData,
  492. int unReadRecordCount = 0,
  493. bool isReferral = false,
  494. List<String >? devicePatientIDs,
  495. DateTime? createTime,
  496. DateTime? updateTime,
  497. }) : super(
  498. patientCode: patientCode,
  499. isValid: isValid,
  500. patientData: patientData,
  501. unReadRecordCount: unReadRecordCount,
  502. isReferral: isReferral,
  503. devicePatientIDs: devicePatientIDs,
  504. createTime: createTime,
  505. updateTime: updateTime,
  506. );
  507. factory ClientPatientInfoDTO.fromJson(Map<String, dynamic> map) {
  508. return ClientPatientInfoDTO(
  509. creatorCode: map['CreatorCode'],
  510. creatorName: map['CreatorName'],
  511. deviceCode: map['DeviceCode'],
  512. assignmentUserList: map['AssignmentUserList'] != null ? (map['AssignmentUserList'] as List).map((e)=>UserBaseDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  513. lastRecord: map['LastRecord'] != null ? GetRecordsPageDTO.fromJson(map['LastRecord']) : null,
  514. encryptFullName: map['EncryptFullName'],
  515. patientCode: map['PatientCode'],
  516. isValid: map['IsValid'],
  517. patientData: map['PatientData'] != null ? (map['PatientData'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  518. unReadRecordCount: map['UnReadRecordCount'],
  519. isReferral: map['IsReferral'],
  520. devicePatientIDs: map['DevicePatientIDs'] != null ? map['DevicePatientIDs'].cast<String>().toList() : null,
  521. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  522. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  523. );
  524. }
  525. Map<String, dynamic> toJson() {
  526. final map = super.toJson();
  527. if(creatorCode != null)
  528. map['CreatorCode'] = creatorCode;
  529. if(creatorName != null)
  530. map['CreatorName'] = creatorName;
  531. if(deviceCode != null)
  532. map['DeviceCode'] = deviceCode;
  533. if(assignmentUserList != null)
  534. map['AssignmentUserList'] = assignmentUserList;
  535. if(lastRecord != null)
  536. map['LastRecord'] = lastRecord;
  537. if(encryptFullName != null)
  538. map['EncryptFullName'] = encryptFullName;
  539. return map;
  540. }
  541. }
  542. class FindPatientByCodeRequest extends TokenRequest{
  543. String? code;
  544. FindPatientByCodeRequest({
  545. this.code,
  546. String? token,
  547. }) : super(
  548. token: token,
  549. );
  550. factory FindPatientByCodeRequest.fromJson(Map<String, dynamic> map) {
  551. return FindPatientByCodeRequest(
  552. code: map['Code'],
  553. token: map['Token'],
  554. );
  555. }
  556. Map<String, dynamic> toJson() {
  557. final map = super.toJson();
  558. if(code != null)
  559. map['Code'] = code;
  560. return map;
  561. }
  562. }
  563. class FindValidPatientsByNameRequest extends TokenRequest{
  564. String? name;
  565. FindValidPatientsByNameRequest({
  566. this.name,
  567. String? token,
  568. }) : super(
  569. token: token,
  570. );
  571. factory FindValidPatientsByNameRequest.fromJson(Map<String, dynamic> map) {
  572. return FindValidPatientsByNameRequest(
  573. name: map['Name'],
  574. token: map['Token'],
  575. );
  576. }
  577. Map<String, dynamic> toJson() {
  578. final map = super.toJson();
  579. if(name != null)
  580. map['Name'] = name;
  581. return map;
  582. }
  583. }
  584. class SetValidPatientRequest extends TokenRequest{
  585. String? newPatientCode;
  586. String? oldPatientCode;
  587. bool isFinishExam;
  588. SetValidPatientRequest({
  589. this.newPatientCode,
  590. this.oldPatientCode,
  591. this.isFinishExam = false,
  592. String? token,
  593. }) : super(
  594. token: token,
  595. );
  596. factory SetValidPatientRequest.fromJson(Map<String, dynamic> map) {
  597. return SetValidPatientRequest(
  598. newPatientCode: map['NewPatientCode'],
  599. oldPatientCode: map['OldPatientCode'],
  600. isFinishExam: map['IsFinishExam'],
  601. token: map['Token'],
  602. );
  603. }
  604. Map<String, dynamic> toJson() {
  605. final map = super.toJson();
  606. if(newPatientCode != null)
  607. map['NewPatientCode'] = newPatientCode;
  608. if(oldPatientCode != null)
  609. map['OldPatientCode'] = oldPatientCode;
  610. map['IsFinishExam'] = isFinishExam;
  611. return map;
  612. }
  613. }
  614. class RemovePatientsRequest extends TokenRequest{
  615. List<String >? patientCodes;
  616. RemovePatientsRequest({
  617. this.patientCodes,
  618. String? token,
  619. }) : super(
  620. token: token,
  621. );
  622. factory RemovePatientsRequest.fromJson(Map<String, dynamic> map) {
  623. return RemovePatientsRequest(
  624. patientCodes: map['PatientCodes'] != null ? map['PatientCodes'].cast<String>().toList() : null,
  625. token: map['Token'],
  626. );
  627. }
  628. Map<String, dynamic> toJson() {
  629. final map = super.toJson();
  630. if(patientCodes != null)
  631. map['PatientCodes'] = patientCodes;
  632. return map;
  633. }
  634. }