remedical.m.dart 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. import 'package:fis_jsonrpc/utils.dart';
  2. import 'package:fis_common/json_convert.dart';
  3. class BaseRequest {
  4. String? token;
  5. BaseRequest({
  6. this.token,
  7. });
  8. factory BaseRequest.fromJson(Map<String, dynamic> map) {
  9. return BaseRequest(
  10. token: map['Token'],
  11. );
  12. }
  13. Map<String, dynamic> toJson() {
  14. final map = Map<String, dynamic>();
  15. if(token != null)
  16. map['Token'] = token;
  17. return map;
  18. }
  19. }
  20. class BaseEntity {
  21. DateTime? createTime;
  22. DateTime? updateTime;
  23. BaseEntity({
  24. this.createTime,
  25. this.updateTime,
  26. });
  27. factory BaseEntity.fromJson(Map<String, dynamic> map) {
  28. return BaseEntity(
  29. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  30. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  31. );
  32. }
  33. Map<String, dynamic> toJson() {
  34. final map = Map<String, dynamic>();
  35. if(createTime != null)
  36. map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!);
  37. if(updateTime != null)
  38. map['UpdateTime'] = JsonRpcUtils.dateFormat(updateTime!);
  39. return map;
  40. }
  41. }
  42. enum GenderTypeEnum {
  43. Male,
  44. Female,
  45. }
  46. enum PatientTypeEnum {
  47. Default,
  48. }
  49. class PatientInfo extends BaseEntity{
  50. String? patientCode;
  51. String? firstName;
  52. String? lastName;
  53. String? patientCardNo;
  54. DateTime? birthday;
  55. GenderTypeEnum genderType;
  56. String? patientCaseHistory;
  57. String? patientPhone;
  58. PatientTypeEnum patientType;
  59. PatientInfo({
  60. this.patientCode,
  61. this.firstName,
  62. this.lastName,
  63. this.patientCardNo,
  64. this.birthday,
  65. this.genderType = GenderTypeEnum.Male,
  66. this.patientCaseHistory,
  67. this.patientPhone,
  68. this.patientType = PatientTypeEnum.Default,
  69. DateTime? createTime,
  70. DateTime? updateTime,
  71. }) : super(
  72. createTime: createTime,
  73. updateTime: updateTime,
  74. );
  75. factory PatientInfo.fromJson(Map<String, dynamic> map) {
  76. return PatientInfo(
  77. patientCode: map['PatientCode'],
  78. firstName: map['FirstName'],
  79. lastName: map['LastName'],
  80. patientCardNo: map['PatientCardNo'],
  81. birthday: map['Birthday'] != null ? DateTime.parse(map['Birthday']) : null,
  82. genderType: GenderTypeEnum.values.firstWhere((e) => e.index == map['GenderType']),
  83. patientCaseHistory: map['PatientCaseHistory'],
  84. patientPhone: map['PatientPhone'],
  85. patientType: PatientTypeEnum.values.firstWhere((e) => e.index == map['PatientType']),
  86. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  87. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  88. );
  89. }
  90. Map<String, dynamic> toJson() {
  91. final map = super.toJson();
  92. if(patientCode != null)
  93. map['PatientCode'] = patientCode;
  94. if(firstName != null)
  95. map['FirstName'] = firstName;
  96. if(lastName != null)
  97. map['LastName'] = lastName;
  98. if(patientCardNo != null)
  99. map['PatientCardNo'] = patientCardNo;
  100. if(birthday != null)
  101. map['Birthday'] = JsonRpcUtils.dateFormat(birthday!);
  102. map['GenderType'] = genderType.index;
  103. if(patientCaseHistory != null)
  104. map['PatientCaseHistory'] = patientCaseHistory;
  105. if(patientPhone != null)
  106. map['PatientPhone'] = patientPhone;
  107. map['PatientType'] = patientType.index;
  108. return map;
  109. }
  110. }
  111. class CreatePatientInfoRequest extends BaseRequest{
  112. PatientInfo? info;
  113. CreatePatientInfoRequest({
  114. this.info,
  115. String? token,
  116. }) : super(
  117. token: token,
  118. );
  119. factory CreatePatientInfoRequest.fromJson(Map<String, dynamic> map) {
  120. return CreatePatientInfoRequest(
  121. info: map['Info'],
  122. token: map['Token'],
  123. );
  124. }
  125. Map<String, dynamic> toJson() {
  126. final map = super.toJson();
  127. if(info != null)
  128. map['Info'] = info;
  129. return map;
  130. }
  131. }
  132. enum DeviceDataTypeEnum {
  133. Default,
  134. }
  135. class DeviceData extends BaseEntity{
  136. String? deviceDataCode;
  137. String? deviceCode;
  138. String? deviceFileCode;
  139. String? recordCode;
  140. String? patientCode;
  141. String? previewImageToken;
  142. String? dataToken;
  143. DeviceDataTypeEnum deviceDataType;
  144. String? processResult;
  145. DeviceData({
  146. this.deviceDataCode,
  147. this.deviceCode,
  148. this.deviceFileCode,
  149. this.recordCode,
  150. this.patientCode,
  151. this.previewImageToken,
  152. this.dataToken,
  153. this.deviceDataType = DeviceDataTypeEnum.Default,
  154. this.processResult,
  155. DateTime? createTime,
  156. DateTime? updateTime,
  157. }) : super(
  158. createTime: createTime,
  159. updateTime: updateTime,
  160. );
  161. factory DeviceData.fromJson(Map<String, dynamic> map) {
  162. return DeviceData(
  163. deviceDataCode: map['DeviceDataCode'],
  164. deviceCode: map['DeviceCode'],
  165. deviceFileCode: map['DeviceFileCode'],
  166. recordCode: map['RecordCode'],
  167. patientCode: map['PatientCode'],
  168. previewImageToken: map['PreviewImageToken'],
  169. dataToken: map['DataToken'],
  170. deviceDataType: DeviceDataTypeEnum.values.firstWhere((e) => e.index == map['DeviceDataType']),
  171. processResult: map['ProcessResult'],
  172. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  173. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  174. );
  175. }
  176. Map<String, dynamic> toJson() {
  177. final map = super.toJson();
  178. if(deviceDataCode != null)
  179. map['DeviceDataCode'] = deviceDataCode;
  180. if(deviceCode != null)
  181. map['DeviceCode'] = deviceCode;
  182. if(deviceFileCode != null)
  183. map['DeviceFileCode'] = deviceFileCode;
  184. if(recordCode != null)
  185. map['RecordCode'] = recordCode;
  186. if(patientCode != null)
  187. map['PatientCode'] = patientCode;
  188. if(previewImageToken != null)
  189. map['PreviewImageToken'] = previewImageToken;
  190. if(dataToken != null)
  191. map['DataToken'] = dataToken;
  192. map['DeviceDataType'] = deviceDataType.index;
  193. if(processResult != null)
  194. map['ProcessResult'] = processResult;
  195. return map;
  196. }
  197. }
  198. class CreateDeviceDataRequest extends BaseRequest{
  199. DeviceData? info;
  200. CreateDeviceDataRequest({
  201. this.info,
  202. String? token,
  203. }) : super(
  204. token: token,
  205. );
  206. factory CreateDeviceDataRequest.fromJson(Map<String, dynamic> map) {
  207. return CreateDeviceDataRequest(
  208. info: map['Info'],
  209. token: map['Token'],
  210. );
  211. }
  212. Map<String, dynamic> toJson() {
  213. final map = super.toJson();
  214. if(info != null)
  215. map['Info'] = info;
  216. return map;
  217. }
  218. }
  219. enum RecordTypeEnum {
  220. Ultrasound,
  221. Electrocardio,
  222. }
  223. enum CheckTypeEnum {
  224. Default,
  225. }
  226. enum RecordStatusEnum {
  227. Default,
  228. }
  229. class RecordInfo extends BaseEntity{
  230. String? recordCode;
  231. String? patientCode;
  232. String? patientName;
  233. String? orgName;
  234. RecordTypeEnum recordType;
  235. CheckTypeEnum checkType;
  236. String? localRecordCode;
  237. RecordStatusEnum recordStatus;
  238. String? recordRemark;
  239. String? tags;
  240. RecordInfo({
  241. this.recordCode,
  242. this.patientCode,
  243. this.patientName,
  244. this.orgName,
  245. this.recordType = RecordTypeEnum.Ultrasound,
  246. this.checkType = CheckTypeEnum.Default,
  247. this.localRecordCode,
  248. this.recordStatus = RecordStatusEnum.Default,
  249. this.recordRemark,
  250. this.tags,
  251. DateTime? createTime,
  252. DateTime? updateTime,
  253. }) : super(
  254. createTime: createTime,
  255. updateTime: updateTime,
  256. );
  257. factory RecordInfo.fromJson(Map<String, dynamic> map) {
  258. return RecordInfo(
  259. recordCode: map['RecordCode'],
  260. patientCode: map['PatientCode'],
  261. patientName: map['PatientName'],
  262. orgName: map['OrgName'],
  263. recordType: RecordTypeEnum.values.firstWhere((e) => e.index == map['RecordType']),
  264. checkType: CheckTypeEnum.values.firstWhere((e) => e.index == map['CheckType']),
  265. localRecordCode: map['LocalRecordCode'],
  266. recordStatus: RecordStatusEnum.values.firstWhere((e) => e.index == map['RecordStatus']),
  267. recordRemark: map['RecordRemark'],
  268. tags: map['Tags'],
  269. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  270. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  271. );
  272. }
  273. Map<String, dynamic> toJson() {
  274. final map = super.toJson();
  275. if(recordCode != null)
  276. map['RecordCode'] = recordCode;
  277. if(patientCode != null)
  278. map['PatientCode'] = patientCode;
  279. if(patientName != null)
  280. map['PatientName'] = patientName;
  281. if(orgName != null)
  282. map['OrgName'] = orgName;
  283. map['RecordType'] = recordType.index;
  284. map['CheckType'] = checkType.index;
  285. if(localRecordCode != null)
  286. map['LocalRecordCode'] = localRecordCode;
  287. map['RecordStatus'] = recordStatus.index;
  288. if(recordRemark != null)
  289. map['RecordRemark'] = recordRemark;
  290. if(tags != null)
  291. map['Tags'] = tags;
  292. return map;
  293. }
  294. }
  295. class CreateRecordInfoRequest extends BaseRequest{
  296. RecordInfo? info;
  297. CreateRecordInfoRequest({
  298. this.info,
  299. String? token,
  300. }) : super(
  301. token: token,
  302. );
  303. factory CreateRecordInfoRequest.fromJson(Map<String, dynamic> map) {
  304. return CreateRecordInfoRequest(
  305. info: map['Info'],
  306. token: map['Token'],
  307. );
  308. }
  309. Map<String, dynamic> toJson() {
  310. final map = super.toJson();
  311. if(info != null)
  312. map['Info'] = info;
  313. return map;
  314. }
  315. }
  316. class GetDeviceDataDetailRequest extends BaseRequest{
  317. String? deviceDataCode;
  318. GetDeviceDataDetailRequest({
  319. this.deviceDataCode,
  320. String? token,
  321. }) : super(
  322. token: token,
  323. );
  324. factory GetDeviceDataDetailRequest.fromJson(Map<String, dynamic> map) {
  325. return GetDeviceDataDetailRequest(
  326. deviceDataCode: map['DeviceDataCode'],
  327. token: map['Token'],
  328. );
  329. }
  330. Map<String, dynamic> toJson() {
  331. final map = super.toJson();
  332. if(deviceDataCode != null)
  333. map['DeviceDataCode'] = deviceDataCode;
  334. return map;
  335. }
  336. }
  337. class GetRecordInfoDetailRequest extends BaseRequest{
  338. String? recordCode;
  339. GetRecordInfoDetailRequest({
  340. this.recordCode,
  341. String? token,
  342. }) : super(
  343. token: token,
  344. );
  345. factory GetRecordInfoDetailRequest.fromJson(Map<String, dynamic> map) {
  346. return GetRecordInfoDetailRequest(
  347. recordCode: map['RecordCode'],
  348. token: map['Token'],
  349. );
  350. }
  351. Map<String, dynamic> toJson() {
  352. final map = super.toJson();
  353. if(recordCode != null)
  354. map['RecordCode'] = recordCode;
  355. return map;
  356. }
  357. }
  358. class PageCollection<T> {
  359. int currentPage;
  360. int pageSize;
  361. int dataCount;
  362. List<T>? pageData;
  363. PageCollection({
  364. this.currentPage = 0,
  365. this.pageSize = 0,
  366. this.dataCount = 0,
  367. this.pageData,
  368. });
  369. factory PageCollection.fromJson(Map<String, dynamic> map) {
  370. List<T> pageDataList = [];
  371. if (map['PageData'] != null) {
  372. pageDataList.addAll(
  373. (map['PageData'] as List).map((e) => FJsonConvert.fromJson<T>(e)!));
  374. }
  375. return PageCollection(
  376. currentPage: map['CurrentPage'],
  377. pageSize: map['PageSize'],
  378. dataCount: map['DataCount'],
  379. pageData: pageDataList,
  380. );
  381. }
  382. Map<String, dynamic> toJson() {
  383. final map = Map<String, dynamic>();
  384. map['CurrentPage'] = currentPage;
  385. map['PageSize'] = pageSize;
  386. map['DataCount'] = dataCount;
  387. if(pageData != null)
  388. map['PageData'] = pageData;
  389. return map;
  390. }
  391. }
  392. class PageRequest extends BaseRequest{
  393. int currentPage;
  394. int pageSize;
  395. Map<String,String>? filter;
  396. bool isFuzzy;
  397. PageRequest({
  398. this.currentPage = 0,
  399. this.pageSize = 0,
  400. this.filter,
  401. this.isFuzzy = false,
  402. String? token,
  403. }) : super(
  404. token: token,
  405. );
  406. factory PageRequest.fromJson(Map<String, dynamic> map) {
  407. return PageRequest(
  408. currentPage: map['CurrentPage'],
  409. pageSize: map['PageSize'],
  410. filter: map['Filter'].cast<String,String>(),
  411. isFuzzy: map['IsFuzzy'],
  412. token: map['Token'],
  413. );
  414. }
  415. Map<String, dynamic> toJson() {
  416. final map = super.toJson();
  417. map['CurrentPage'] = currentPage;
  418. map['PageSize'] = pageSize;
  419. if(filter != null)
  420. map['Filter'] = filter;
  421. map['IsFuzzy'] = isFuzzy;
  422. return map;
  423. }
  424. }
  425. class GetPatientInfoRequest extends BaseRequest{
  426. String? patientCode;
  427. GetPatientInfoRequest({
  428. this.patientCode,
  429. String? token,
  430. }) : super(
  431. token: token,
  432. );
  433. factory GetPatientInfoRequest.fromJson(Map<String, dynamic> map) {
  434. return GetPatientInfoRequest(
  435. patientCode: map['PatientCode'],
  436. token: map['Token'],
  437. );
  438. }
  439. Map<String, dynamic> toJson() {
  440. final map = super.toJson();
  441. if(patientCode != null)
  442. map['PatientCode'] = patientCode;
  443. return map;
  444. }
  445. }