form.dart 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. class FormObject {
  2. String? label;
  3. dynamic defaultValue;
  4. int? span;
  5. String? key;
  6. String? type;
  7. bool? border;
  8. dynamic disabledValue;
  9. List<Option>? options;
  10. List<FormObject>? children;
  11. String? append;
  12. String? placeholder;
  13. bool? required;
  14. bool? showLimit;
  15. String? parentKey;
  16. String? buttonName;
  17. List? childrenKey;
  18. List? groupKeys;
  19. List? exclusiveValue;
  20. int? maxItems;
  21. FormObject({
  22. this.label,
  23. this.defaultValue,
  24. this.span,
  25. this.key,
  26. this.type,
  27. this.border,
  28. this.disabledValue,
  29. this.options,
  30. this.children,
  31. this.append,
  32. this.placeholder,
  33. this.required,
  34. this.showLimit,
  35. this.parentKey,
  36. this.buttonName,
  37. this.childrenKey,
  38. this.groupKeys,
  39. this.exclusiveValue,
  40. this.maxItems,
  41. });
  42. factory FormObject.fromJson(Map<String, dynamic> json) {
  43. var optionsList = json['options'] == null ? null : json['options'] as List;
  44. List<Option>? options =
  45. optionsList?.map((item) => Option.fromJson(item)).toList();
  46. List<FormObject>? childrenItems;
  47. var children = json['children'];
  48. if (children is List) {
  49. childrenItems = [];
  50. for (var c in children) {
  51. if (c is FormObject) {
  52. childrenItems.add(c);
  53. } else {
  54. childrenItems.add(FormObject.fromJson(c as Map<String, dynamic>));
  55. }
  56. }
  57. } else {
  58. childrenItems = json['children'] != null
  59. ? List<FormObject>.from(json['children'])
  60. : null;
  61. }
  62. return FormObject(
  63. label: json['label'],
  64. defaultValue: json['defaultValue'],
  65. span: json['span'],
  66. key: json['key'],
  67. type: json['type'],
  68. border: json['border'],
  69. disabledValue: json['disabledValue'],
  70. options: options,
  71. children: childrenItems,
  72. append: json['append'],
  73. placeholder: json['placeholder'],
  74. required: json['required'],
  75. showLimit: json['show-limit'],
  76. parentKey: json['parentKey'],
  77. buttonName: json['buttonName'],
  78. childrenKey:
  79. json['childrenKey'] == null ? null : json['childrenKey'] as List,
  80. groupKeys: json['groupKeys'] == null ? null : json['groupKeys'] as List,
  81. exclusiveValue: json['exclusiveValue'] == null
  82. ? null
  83. : json['exclusiveValue'] as List,
  84. maxItems: json['maxItems'],
  85. );
  86. }
  87. Map<String, dynamic> toJson() {
  88. List<Map<String, dynamic>> optionsList =
  89. options != null ? options!.map((item) => item.toJson()).toList() : [];
  90. return {
  91. 'label': label,
  92. 'defaultValue': defaultValue,
  93. 'span': span,
  94. 'key': key,
  95. 'type': type,
  96. 'border': border,
  97. 'disabledValue': disabledValue,
  98. 'options': optionsList,
  99. 'children': children,
  100. 'append': append,
  101. 'placeholder': placeholder,
  102. 'required': required,
  103. 'show-limit': showLimit,
  104. 'parentKey': parentKey,
  105. 'buttonName': buttonName,
  106. 'childrenKey': childrenKey,
  107. 'groupKeys': groupKeys,
  108. 'exclusiveValue': exclusiveValue,
  109. 'maxItems': maxItems,
  110. };
  111. }
  112. }
  113. class Option {
  114. String? label;
  115. String? value;
  116. Option({this.label, this.value});
  117. factory Option.fromJson(Map<String, dynamic> json) {
  118. return Option(
  119. label: json['label'],
  120. value: json['value'],
  121. );
  122. }
  123. Map<String, dynamic> toJson() {
  124. return {
  125. 'label': label,
  126. 'value': value,
  127. };
  128. }
  129. }
  130. class ToxicSubstance {
  131. String? label;
  132. Map? value;
  133. ToxicSubstance({this.label, this.value});
  134. factory ToxicSubstance.fromJson(Map<String, dynamic> json) {
  135. return ToxicSubstance(
  136. label: json['label'],
  137. value: json['value'],
  138. );
  139. }
  140. Map<String, dynamic> toJson() {
  141. return {
  142. 'label': label,
  143. 'value': value,
  144. };
  145. }
  146. }
  147. class MenuItem {
  148. // 显示的文本
  149. String label;
  150. // 选中的值
  151. dynamic value;
  152. // 是否选中
  153. bool checked;
  154. MenuItem({this.label = '', this.value, this.checked = false});
  155. }
  156. /// 住院史表单数据类型
  157. class Admission {
  158. String? id;
  159. String? admissionDate;
  160. String? dischargeDate;
  161. String? reason;
  162. String? nameOfMedicalInstitution;
  163. String? patientNumber;
  164. Admission({
  165. this.id,
  166. this.admissionDate,
  167. this.dischargeDate,
  168. this.reason,
  169. this.nameOfMedicalInstitution,
  170. this.patientNumber,
  171. });
  172. factory Admission.fromJson(Map<String, dynamic> json) {
  173. return Admission(
  174. id: json['id'],
  175. admissionDate: json['Admission_Date'],
  176. dischargeDate: json['Discharge_Date'],
  177. reason: json['Reason'],
  178. nameOfMedicalInstitution: json['Name_Of_Medical_Institution'],
  179. patientNumber: json['Patient_Number'],
  180. );
  181. }
  182. Map<String, dynamic> toJson() {
  183. return {
  184. 'id': id ?? '',
  185. 'Admission_Date': admissionDate ?? '',
  186. 'Discharge_Date': dischargeDate ?? '',
  187. 'Reason': reason ?? '',
  188. 'Name_Of_Medical_Institution': nameOfMedicalInstitution ?? '',
  189. 'Patient_Number': patientNumber ?? '',
  190. };
  191. }
  192. }
  193. /// 家庭病床史
  194. class BedConstruction {
  195. String? id;
  196. String? bedConstructionDate;
  197. String? dischargeDate;
  198. String? reason;
  199. String? nameOfMedicalInstitution;
  200. String? patientNumber;
  201. BedConstruction({
  202. this.id,
  203. this.bedConstructionDate,
  204. this.dischargeDate,
  205. this.reason,
  206. this.nameOfMedicalInstitution,
  207. this.patientNumber,
  208. });
  209. factory BedConstruction.fromJson(Map<String, dynamic> json) {
  210. return BedConstruction(
  211. id: json['id'],
  212. bedConstructionDate: json['Bed_Construction_Date'],
  213. dischargeDate: json['Discharge_Date'],
  214. reason: json['Reason'],
  215. nameOfMedicalInstitution: json['Name_Of_Medical_Institution'],
  216. patientNumber: json['Patient_Number'],
  217. );
  218. }
  219. Map<String, dynamic> toJson() {
  220. return {
  221. 'id': id ?? '',
  222. 'Bed_Construction_Date': bedConstructionDate ?? '',
  223. 'Discharge_Date': dischargeDate ?? '',
  224. 'Reason': reason ?? '',
  225. 'Name_Of_Medical_Institution': nameOfMedicalInstitution ?? '',
  226. 'Patient_Number': patientNumber ?? '',
  227. };
  228. }
  229. }
  230. /// 主要用药情况
  231. class MainMedication {
  232. String? id;
  233. String? medicineName;
  234. String? medicineUsage;
  235. String? medicineDosage;
  236. String? medicineTime;
  237. String? medicineCompliance;
  238. MainMedication({
  239. this.id,
  240. this.medicineName,
  241. this.medicineUsage,
  242. this.medicineDosage,
  243. this.medicineTime,
  244. this.medicineCompliance,
  245. });
  246. factory MainMedication.fromJson(Map<String, dynamic> json) {
  247. return MainMedication(
  248. id: json['id'],
  249. medicineName: json['Medicine_Name'],
  250. medicineUsage: json['Medicine_Usage'],
  251. medicineDosage: json['Medicine_Dosage'],
  252. medicineTime: json['Medicine_Time'],
  253. medicineCompliance: json['Medicine_Compliance'],
  254. );
  255. }
  256. Map<String, dynamic> toJson() {
  257. return {
  258. 'id': id ?? '',
  259. 'Medicine_Name': medicineName ?? '',
  260. 'Medicine_Usage': medicineUsage ?? '',
  261. 'Medicine_Dosage': medicineDosage ?? '',
  262. 'Medicine_Time': medicineTime ?? '',
  263. 'Medicine_Compliance': medicineCompliance ?? '',
  264. };
  265. }
  266. }
  267. /// 预防接种史
  268. class VaccinationHistory {
  269. String? id;
  270. String? vaccinationDate;
  271. String? vaccinationFacility;
  272. String? vaccineName;
  273. VaccinationHistory({
  274. this.id,
  275. this.vaccinationDate,
  276. this.vaccinationFacility,
  277. this.vaccineName,
  278. });
  279. factory VaccinationHistory.fromJson(Map<String, dynamic> json) {
  280. return VaccinationHistory(
  281. id: json['id'],
  282. vaccinationDate: json['Vaccination_Date'],
  283. vaccinationFacility: json['Vaccination_Facility'],
  284. vaccineName: json['Vaccine_Name'],
  285. );
  286. }
  287. Map<String, dynamic> toJson() {
  288. return {
  289. 'id': id ?? '',
  290. 'Vaccination_Date': vaccinationDate ?? '',
  291. 'Vaccination_Facility': vaccinationFacility ?? '',
  292. 'Vaccine_Name': vaccineName ?? '',
  293. };
  294. }
  295. }
  296. class EditTableValue {
  297. int? id;
  298. Map<String, dynamic>? value;
  299. EditTableValue({
  300. this.id,
  301. this.value,
  302. });
  303. }
  304. class DangerFrequency {
  305. String? frequency;
  306. String? value;
  307. DangerFrequency({this.frequency, this.value});
  308. factory DangerFrequency.fromJson(Map<String, dynamic> json) {
  309. return DangerFrequency(
  310. frequency: json['frequency'],
  311. value: json['value'],
  312. );
  313. }
  314. Map<String, dynamic> toJson() {
  315. return {
  316. 'frequency': frequency,
  317. 'value': value,
  318. };
  319. }
  320. }
  321. class MedicationModel {
  322. ///名字
  323. String? name;
  324. ///用法
  325. String? usage;
  326. ///月或日
  327. String? monthOrDay;
  328. ///剂量
  329. String? dosages;
  330. MedicationModel({this.name, this.monthOrDay, this.usage, this.dosages});
  331. factory MedicationModel.fromJson(Map<String, dynamic> json) {
  332. return MedicationModel(
  333. name: json['name'] ?? "",
  334. usage: json['usage'] ?? "",
  335. monthOrDay: json['monthOrDay'] ?? "",
  336. dosages: json['dosages'] ?? "",
  337. );
  338. }
  339. Map<String, dynamic> toJson() {
  340. return {
  341. 'name': name ?? '',
  342. 'usage': usage ?? '',
  343. 'monthOrDay': monthOrDay ?? '',
  344. 'dosages': dosages ?? '',
  345. };
  346. }
  347. }