vitalHealthExamBooking.m.dart 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. import 'notification.m.dart';
  2. import 'appletAPI.m.dart';
  3. import 'liveConsultation.m.dart';
  4. import 'package:fis_jsonrpc/utils.dart';
  5. enum BookingTypeEnum {
  6. Personal,
  7. Group,
  8. }
  9. enum BookingStatusEnum {
  10. UnSubmitted,
  11. Booked,
  12. Canceled,
  13. }
  14. class HealthExamPersonDTO {
  15. String? name;
  16. PatientGenderEnum gender;
  17. String? identityCard;
  18. String? phone;
  19. HealthExamPersonDTO({
  20. this.name,
  21. this.gender = PatientGenderEnum.NotFilled,
  22. this.identityCard,
  23. this.phone,
  24. });
  25. factory HealthExamPersonDTO.fromJson(Map<String, dynamic> map) {
  26. return HealthExamPersonDTO(
  27. name: map['Name'],
  28. gender: PatientGenderEnum.values.firstWhere((e) => e.index == map['Gender']),
  29. identityCard: map['IdentityCard'],
  30. phone: map['Phone'],
  31. );
  32. }
  33. Map<String, dynamic> toJson() {
  34. final map = Map<String, dynamic>();
  35. if (name != null) {
  36. map['Name'] = name;
  37. }
  38. map['Gender'] = gender.index;
  39. if (identityCard != null) {
  40. map['IdentityCard'] = identityCard;
  41. }
  42. if (phone != null) {
  43. map['Phone'] = phone;
  44. }
  45. return map;
  46. }
  47. }
  48. class HealthExamItemDTO {
  49. String? name;
  50. String? content;
  51. HealthExamItemDTO({
  52. this.name,
  53. this.content,
  54. });
  55. factory HealthExamItemDTO.fromJson(Map<String, dynamic> map) {
  56. return HealthExamItemDTO(
  57. name: map['Name'],
  58. content: map['Content'],
  59. );
  60. }
  61. Map<String, dynamic> toJson() {
  62. final map = Map<String, dynamic>();
  63. if (name != null) {
  64. map['Name'] = name;
  65. }
  66. if (content != null) {
  67. map['Content'] = content;
  68. }
  69. return map;
  70. }
  71. }
  72. class HealthExamBookingDTO extends BaseDTO{
  73. String? code;
  74. BookingTypeEnum bookingType;
  75. String? name;
  76. String? location;
  77. DateTime? startDate;
  78. DateTime? endDate;
  79. String? subject;
  80. String? description;
  81. String? initiatorCode;
  82. String? orgCode;
  83. BookingStatusEnum status;
  84. List<HealthExamPersonDTO>? persons;
  85. List<HealthExamItemDTO>? examItems;
  86. HealthExamBookingDTO({
  87. this.code,
  88. this.bookingType = BookingTypeEnum.Personal,
  89. this.name,
  90. this.location,
  91. this.startDate,
  92. this.endDate,
  93. this.subject,
  94. this.description,
  95. this.initiatorCode,
  96. this.orgCode,
  97. this.status = BookingStatusEnum.UnSubmitted,
  98. this.persons,
  99. this.examItems,
  100. DateTime? createTime,
  101. DateTime? updateTime,
  102. }) : super(
  103. createTime: createTime,
  104. updateTime: updateTime,
  105. );
  106. factory HealthExamBookingDTO.fromJson(Map<String, dynamic> map) {
  107. return HealthExamBookingDTO(
  108. code: map['Code'],
  109. bookingType: BookingTypeEnum.values.firstWhere((e) => e.index == map['BookingType']),
  110. name: map['Name'],
  111. location: map['Location'],
  112. startDate: map['StartDate'] != null ? DateTime.parse(map['StartDate']) : null,
  113. endDate: map['EndDate'] != null ? DateTime.parse(map['EndDate']) : null,
  114. subject: map['Subject'],
  115. description: map['Description'],
  116. initiatorCode: map['InitiatorCode'],
  117. orgCode: map['OrgCode'],
  118. status: BookingStatusEnum.values.firstWhere((e) => e.index == map['Status']),
  119. persons: map['Persons'] != null ? (map['Persons'] as List).map((e)=>HealthExamPersonDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  120. examItems: map['ExamItems'] != null ? (map['ExamItems'] as List).map((e)=>HealthExamItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  121. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  122. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  123. );
  124. }
  125. Map<String, dynamic> toJson() {
  126. final map = super.toJson();
  127. if (code != null)
  128. map['Code'] = code;
  129. map['BookingType'] = bookingType.index;
  130. if (name != null)
  131. map['Name'] = name;
  132. if (location != null)
  133. map['Location'] = location;
  134. if (startDate != null)
  135. map['StartDate'] = JsonRpcUtils.dateFormat(startDate!);
  136. if (endDate != null)
  137. map['EndDate'] = JsonRpcUtils.dateFormat(endDate!);
  138. if (subject != null)
  139. map['Subject'] = subject;
  140. if (description != null)
  141. map['Description'] = description;
  142. if (initiatorCode != null)
  143. map['InitiatorCode'] = initiatorCode;
  144. if (orgCode != null)
  145. map['OrgCode'] = orgCode;
  146. map['Status'] = status.index;
  147. if (persons != null)
  148. map['Persons'] = persons;
  149. if (examItems != null)
  150. map['ExamItems'] = examItems;
  151. return map;
  152. }
  153. }
  154. class GetHealthExamBookingPageRequest extends PageRequest{
  155. String? keyword;
  156. List<String>? orgCodes;
  157. GetHealthExamBookingPageRequest({
  158. this.keyword,
  159. this.orgCodes,
  160. int pageIndex = 0,
  161. int pageSize = 0,
  162. String? token,
  163. }) : super(
  164. pageIndex: pageIndex,
  165. pageSize: pageSize,
  166. token: token,
  167. );
  168. factory GetHealthExamBookingPageRequest.fromJson(Map<String, dynamic> map) {
  169. return GetHealthExamBookingPageRequest(
  170. keyword: map['Keyword'],
  171. orgCodes: map['OrgCodes']?.cast<String>().toList(),
  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. if (keyword != null)
  180. map['Keyword'] = keyword;
  181. if (orgCodes != null)
  182. map['OrgCodes'] = orgCodes;
  183. return map;
  184. }
  185. }
  186. class SaveHealthExamBookingRequest extends TokenRequest{
  187. String? code;
  188. BookingTypeEnum bookingType;
  189. String? name;
  190. String? location;
  191. DateTime? startDate;
  192. DateTime? endDate;
  193. String? subject;
  194. String? description;
  195. String? initiatorCode;
  196. String? orgCode;
  197. BookingStatusEnum status;
  198. List<HealthExamPersonDTO>? persons;
  199. List<HealthExamItemDTO>? examItems;
  200. SaveHealthExamBookingRequest({
  201. this.code,
  202. this.bookingType = BookingTypeEnum.Personal,
  203. this.name,
  204. this.location,
  205. this.startDate,
  206. this.endDate,
  207. this.subject,
  208. this.description,
  209. this.initiatorCode,
  210. this.orgCode,
  211. this.status = BookingStatusEnum.UnSubmitted,
  212. this.persons,
  213. this.examItems,
  214. String? token,
  215. }) : super(
  216. token: token,
  217. );
  218. factory SaveHealthExamBookingRequest.fromJson(Map<String, dynamic> map) {
  219. return SaveHealthExamBookingRequest(
  220. code: map['Code'],
  221. bookingType: BookingTypeEnum.values.firstWhere((e) => e.index == map['BookingType']),
  222. name: map['Name'],
  223. location: map['Location'],
  224. startDate: map['StartDate'] != null ? DateTime.parse(map['StartDate']) : null,
  225. endDate: map['EndDate'] != null ? DateTime.parse(map['EndDate']) : null,
  226. subject: map['Subject'],
  227. description: map['Description'],
  228. initiatorCode: map['InitiatorCode'],
  229. orgCode: map['OrgCode'],
  230. status: BookingStatusEnum.values.firstWhere((e) => e.index == map['Status']),
  231. persons: map['Persons'] != null ? (map['Persons'] as List).map((e)=>HealthExamPersonDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  232. examItems: map['ExamItems'] != null ? (map['ExamItems'] as List).map((e)=>HealthExamItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  233. token: map['Token'],
  234. );
  235. }
  236. Map<String, dynamic> toJson() {
  237. final map = super.toJson();
  238. if (code != null)
  239. map['Code'] = code;
  240. map['BookingType'] = bookingType.index;
  241. if (name != null)
  242. map['Name'] = name;
  243. if (location != null)
  244. map['Location'] = location;
  245. if (startDate != null)
  246. map['StartDate'] = JsonRpcUtils.dateFormat(startDate!);
  247. if (endDate != null)
  248. map['EndDate'] = JsonRpcUtils.dateFormat(endDate!);
  249. if (subject != null)
  250. map['Subject'] = subject;
  251. if (description != null)
  252. map['Description'] = description;
  253. if (initiatorCode != null)
  254. map['InitiatorCode'] = initiatorCode;
  255. if (orgCode != null)
  256. map['OrgCode'] = orgCode;
  257. map['Status'] = status.index;
  258. if (persons != null)
  259. map['Persons'] = persons;
  260. if (examItems != null)
  261. map['ExamItems'] = examItems;
  262. return map;
  263. }
  264. }
  265. class GetHealthExamBookingRequest extends TokenRequest{
  266. String? code;
  267. GetHealthExamBookingRequest({
  268. this.code,
  269. String? token,
  270. }) : super(
  271. token: token,
  272. );
  273. factory GetHealthExamBookingRequest.fromJson(Map<String, dynamic> map) {
  274. return GetHealthExamBookingRequest(
  275. code: map['Code'],
  276. token: map['Token'],
  277. );
  278. }
  279. Map<String, dynamic> toJson() {
  280. final map = super.toJson();
  281. if (code != null)
  282. map['Code'] = code;
  283. return map;
  284. }
  285. }
  286. class DeleteHealthExamBookingRequest extends TokenRequest{
  287. String? code;
  288. DeleteHealthExamBookingRequest({
  289. this.code,
  290. String? token,
  291. }) : super(
  292. token: token,
  293. );
  294. factory DeleteHealthExamBookingRequest.fromJson(Map<String, dynamic> map) {
  295. return DeleteHealthExamBookingRequest(
  296. code: map['Code'],
  297. token: map['Token'],
  298. );
  299. }
  300. Map<String, dynamic> toJson() {
  301. final map = super.toJson();
  302. if (code != null)
  303. map['Code'] = code;
  304. return map;
  305. }
  306. }
  307. class SignUpHealthExamBookingRequest extends TokenRequest{
  308. String? code;
  309. String? name;
  310. PatientGenderEnum gender;
  311. String? identityCard;
  312. String? phone;
  313. SignUpHealthExamBookingRequest({
  314. this.code,
  315. this.name,
  316. this.gender = PatientGenderEnum.NotFilled,
  317. this.identityCard,
  318. this.phone,
  319. String? token,
  320. }) : super(
  321. token: token,
  322. );
  323. factory SignUpHealthExamBookingRequest.fromJson(Map<String, dynamic> map) {
  324. return SignUpHealthExamBookingRequest(
  325. code: map['Code'],
  326. name: map['Name'],
  327. gender: PatientGenderEnum.values.firstWhere((e) => e.index == map['Gender']),
  328. identityCard: map['IdentityCard'],
  329. phone: map['Phone'],
  330. token: map['Token'],
  331. );
  332. }
  333. Map<String, dynamic> toJson() {
  334. final map = super.toJson();
  335. if (code != null)
  336. map['Code'] = code;
  337. if (name != null)
  338. map['Name'] = name;
  339. map['Gender'] = gender.index;
  340. if (identityCard != null)
  341. map['IdentityCard'] = identityCard;
  342. if (phone != null)
  343. map['Phone'] = phone;
  344. return map;
  345. }
  346. }
  347. class GetExamBookingByIDCardRequest extends TokenRequest{
  348. String? iDCardNo;
  349. String? operatorCode;
  350. GetExamBookingByIDCardRequest({
  351. this.iDCardNo,
  352. this.operatorCode,
  353. String? token,
  354. }) : super(
  355. token: token,
  356. );
  357. factory GetExamBookingByIDCardRequest.fromJson(Map<String, dynamic> map) {
  358. return GetExamBookingByIDCardRequest(
  359. iDCardNo: map['IDCardNo'],
  360. operatorCode: map['OperatorCode'],
  361. token: map['Token'],
  362. );
  363. }
  364. Map<String, dynamic> toJson() {
  365. final map = super.toJson();
  366. if (iDCardNo != null)
  367. map['IDCardNo'] = iDCardNo;
  368. if (operatorCode != null)
  369. map['OperatorCode'] = operatorCode;
  370. return map;
  371. }
  372. }
  373. class AddRegiterInfoRequest {
  374. String? iDCardNo;
  375. String? name;
  376. String? sex;
  377. String? age;
  378. String? phone;
  379. String? adress;
  380. String? orgUniqueCode;
  381. AddRegiterInfoRequest({
  382. this.iDCardNo,
  383. this.name,
  384. this.sex,
  385. this.age,
  386. this.phone,
  387. this.adress,
  388. this.orgUniqueCode,
  389. });
  390. factory AddRegiterInfoRequest.fromJson(Map<String, dynamic> map) {
  391. return AddRegiterInfoRequest(
  392. iDCardNo: map['IDCardNo'],
  393. name: map['Name'],
  394. sex: map['Sex'],
  395. age: map['Age'],
  396. phone: map['Phone'],
  397. adress: map['Adress'],
  398. orgUniqueCode: map['OrgUniqueCode'],
  399. );
  400. }
  401. Map<String, dynamic> toJson() {
  402. final map = Map<String, dynamic>();
  403. if (iDCardNo != null) {
  404. map['IDCardNo'] = iDCardNo;
  405. }
  406. if (name != null) {
  407. map['Name'] = name;
  408. }
  409. if (sex != null) {
  410. map['Sex'] = sex;
  411. }
  412. if (age != null) {
  413. map['Age'] = age;
  414. }
  415. if (phone != null) {
  416. map['Phone'] = phone;
  417. }
  418. if (adress != null) {
  419. map['Adress'] = adress;
  420. }
  421. if (orgUniqueCode != null) {
  422. map['OrgUniqueCode'] = orgUniqueCode;
  423. }
  424. return map;
  425. }
  426. }
  427. class UpdateRegiterInfoRequest extends AddRegiterInfoRequest{
  428. String? code;
  429. UpdateRegiterInfoRequest({
  430. this.code,
  431. String? iDCardNo,
  432. String? name,
  433. String? sex,
  434. String? age,
  435. String? phone,
  436. String? adress,
  437. String? orgUniqueCode,
  438. }) : super(
  439. iDCardNo: iDCardNo,
  440. name: name,
  441. sex: sex,
  442. age: age,
  443. phone: phone,
  444. adress: adress,
  445. orgUniqueCode: orgUniqueCode,
  446. );
  447. factory UpdateRegiterInfoRequest.fromJson(Map<String, dynamic> map) {
  448. return UpdateRegiterInfoRequest(
  449. code: map['Code'],
  450. iDCardNo: map['IDCardNo'],
  451. name: map['Name'],
  452. sex: map['Sex'],
  453. age: map['Age'],
  454. phone: map['Phone'],
  455. adress: map['Adress'],
  456. orgUniqueCode: map['OrgUniqueCode'],
  457. );
  458. }
  459. Map<String, dynamic> toJson() {
  460. final map = super.toJson();
  461. if (code != null)
  462. map['Code'] = code;
  463. return map;
  464. }
  465. }
  466. enum ExamStateEnum {
  467. Unchecked,
  468. Invalid,
  469. Inspected,
  470. }
  471. class RegisterInfoDTO extends BaseDTO{
  472. String? code;
  473. String? physicalExamNumber;
  474. String? iDCardNo;
  475. String? name;
  476. String? sex;
  477. String? age;
  478. String? phone;
  479. String? adress;
  480. ExamStateEnum state;
  481. RegisterInfoDTO({
  482. this.code,
  483. this.physicalExamNumber,
  484. this.iDCardNo,
  485. this.name,
  486. this.sex,
  487. this.age,
  488. this.phone,
  489. this.adress,
  490. this.state = ExamStateEnum.Unchecked,
  491. DateTime? createTime,
  492. DateTime? updateTime,
  493. }) : super(
  494. createTime: createTime,
  495. updateTime: updateTime,
  496. );
  497. factory RegisterInfoDTO.fromJson(Map<String, dynamic> map) {
  498. return RegisterInfoDTO(
  499. code: map['Code'],
  500. physicalExamNumber: map['PhysicalExamNumber'],
  501. iDCardNo: map['IDCardNo'],
  502. name: map['Name'],
  503. sex: map['Sex'],
  504. age: map['Age'],
  505. phone: map['Phone'],
  506. adress: map['Adress'],
  507. state: ExamStateEnum.values.firstWhere((e) => e.index == map['State']),
  508. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  509. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  510. );
  511. }
  512. Map<String, dynamic> toJson() {
  513. final map = super.toJson();
  514. if (code != null)
  515. map['Code'] = code;
  516. if (physicalExamNumber != null)
  517. map['PhysicalExamNumber'] = physicalExamNumber;
  518. if (iDCardNo != null)
  519. map['IDCardNo'] = iDCardNo;
  520. if (name != null)
  521. map['Name'] = name;
  522. if (sex != null)
  523. map['Sex'] = sex;
  524. if (age != null)
  525. map['Age'] = age;
  526. if (phone != null)
  527. map['Phone'] = phone;
  528. if (adress != null)
  529. map['Adress'] = adress;
  530. map['State'] = state.index;
  531. return map;
  532. }
  533. }
  534. class GetRegiterInfoPageRequest extends PageRequest{
  535. String? keyword;
  536. String? operatorCode;
  537. GetRegiterInfoPageRequest({
  538. this.keyword,
  539. this.operatorCode,
  540. int pageIndex = 0,
  541. int pageSize = 0,
  542. String? token,
  543. }) : super(
  544. pageIndex: pageIndex,
  545. pageSize: pageSize,
  546. token: token,
  547. );
  548. factory GetRegiterInfoPageRequest.fromJson(Map<String, dynamic> map) {
  549. return GetRegiterInfoPageRequest(
  550. keyword: map['Keyword'],
  551. operatorCode: map['OperatorCode'],
  552. pageIndex: map['PageIndex'],
  553. pageSize: map['PageSize'],
  554. token: map['Token'],
  555. );
  556. }
  557. Map<String, dynamic> toJson() {
  558. final map = super.toJson();
  559. if (keyword != null)
  560. map['Keyword'] = keyword;
  561. if (operatorCode != null)
  562. map['OperatorCode'] = operatorCode;
  563. return map;
  564. }
  565. }