|
@@ -8,7 +8,7 @@ import 'package:vitalapp/managers/interfaces/template.dart';
|
|
|
import 'package:vitalapp/pages/form/form_info.dart';
|
|
|
import 'package:vitalapp/pages/form/form_view.dart';
|
|
|
import 'package:vitalapp/store/store.dart';
|
|
|
-
|
|
|
+import 'package:fis_common/logger/logger.dart';
|
|
|
import 'prescription_form_keys.dart';
|
|
|
|
|
|
///处方表
|
|
@@ -65,24 +65,29 @@ class PrescriptionFormState extends State<PrescriptionForm> {
|
|
|
}
|
|
|
|
|
|
void _initCurrentPatientInfo() {
|
|
|
- PatientDTO? currentPatient = Store.user.currentSelectPatientInfo;
|
|
|
- if (currentPatient != null) {
|
|
|
- if (!FormInfo.instance.formValue.containsKey("PatientName")) {
|
|
|
- FormInfo.instance.formValue["PatientName"] = currentPatient.patientName;
|
|
|
- }
|
|
|
- if (currentPatient.birthday != null &&
|
|
|
- !FormInfo.instance.formValue.containsKey("PatientAge")) {
|
|
|
- var age = DataTimeUtils.calculateAge(
|
|
|
- Store.user.currentSelectPatientInfo!.birthday!);
|
|
|
- FormInfo.instance.formValue["PatientAge"] = age;
|
|
|
- }
|
|
|
- if (!FormInfo.instance.formValue.containsKey("PatientGender")) {
|
|
|
- if (currentPatient.patientGender == GenderEnum.Male) {
|
|
|
- FormInfo.instance.formValue["PatientGender"] = "1";
|
|
|
- } else if (currentPatient.patientGender == GenderEnum.Female) {
|
|
|
- FormInfo.instance.formValue["PatientGender"] = "2";
|
|
|
+ try {
|
|
|
+ PatientDTO? currentPatient = Store.user.currentSelectPatientInfo;
|
|
|
+ if (currentPatient != null) {
|
|
|
+ if (!FormInfo.instance.formValue.containsKey("PatientName")) {
|
|
|
+ FormInfo.instance.formValue["PatientName"] =
|
|
|
+ currentPatient.patientName;
|
|
|
+ }
|
|
|
+ if (currentPatient.birthday != null &&
|
|
|
+ !FormInfo.instance.formValue.containsKey("PatientAge")) {
|
|
|
+ var age = DataTimeUtils.calculateAge(
|
|
|
+ Store.user.currentSelectPatientInfo!.birthday!);
|
|
|
+ FormInfo.instance.formValue["PatientAge"] = age;
|
|
|
+ }
|
|
|
+ if (!FormInfo.instance.formValue.containsKey("PatientGender")) {
|
|
|
+ if (currentPatient.patientGender == GenderEnum.Male) {
|
|
|
+ FormInfo.instance.formValue["PatientGender"] = "1";
|
|
|
+ } else if (currentPatient.patientGender == GenderEnum.Female) {
|
|
|
+ FormInfo.instance.formValue["PatientGender"] = "2";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ } catch (e) {
|
|
|
+ logger.e('PrescriptionForm _initCurrentPatientInfo ex:', e);
|
|
|
}
|
|
|
}
|
|
|
}
|