import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/vital_sign/vital_sign_res_model.dart';

import '../base_service.dart';

class VitalSignService extends BaseService {
  List<VitalSignResModel> vitalSignResModelList = List();
  Map<String, dynamic> body = Map();
  String weightKg = "";
  String heightCm = "";
  String bloadType = "";

  Future getPatientRadOrders({int appointmentNo, int projectID}) async {
    hasError = false;

    if (appointmentNo != null && projectID != null) {
      body['TransNo'] = appointmentNo;
      body['ProjectID'] = projectID;
    }

    await baseAppClient.post(GET_PATIENT_VITAL_SIGN,
        onSuccess: (dynamic response, int statusCode) {
      vitalSignResModelList.clear();
      response['List_DoctorPatientVitalSign'].forEach((vital) {
        vitalSignResModelList.add(VitalSignResModel.fromJson(vital));
      });
      vitalSignResModelList.forEach((element) {
        weightKg = '${element.weightKg}';
        heightCm = '${element.heightCm}';
      });
    }, onFailure: (String error, int statusCode) {
      hasError = true;
      super.error = error;
    }, body: body);
  }
}
