remedical.m.dart 9.6 KB

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