def on_model_change(self, form, model, is_created=False): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_don_vi_tinh_toi_da = dao.SoLuongDonVi() if so_luong_don_vi_tinh_toi_da > cac_quy_dinh.so_luong_don_vi_tinh_toi_da: self.can_create = False else: self.can_create = True
def after_model_delete(self, model): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_don_vi_tinh_toi_da = dao.SoLuongDonVi() if so_luong_don_vi_tinh_toi_da > cac_quy_dinh.so_luong_don_vi_tinh_toi_da: self.can_create = False else: self.can_create = True
def on_model_change(self, form, model, is_created=False): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_thuoc_toi_da = dao.SoLuongLoaiThuoc() if so_luong_thuoc_toi_da > cac_quy_dinh.so_luong_thuoc_toi_da: self.can_create = False else: self.can_create = True
def after_model_delete(self, model): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_thuoc_toi_da = dao.SoLuongLoaiThuoc() if so_luong_thuoc_toi_da > cac_quy_dinh.so_luong_thuoc_toi_da: self.can_create = False else: self.can_create = True
class LoaiBenhView(ModelView): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_loai_benh = dao.SoLuongLoaiBenh() # can_create = True if so_luong_loai_benh <= cac_quy_dinh.so_luong_loai_benh_toi_da else False can_edit = True column_display_pk = True can_view_details = True can_set_page_size = 50 column_labels = dict(loai_benh_id="Mã loại bệnh", ten_loai_benh="Tên loại bệnh") column_exclude_list = [ 'detele_at', 'create_at', ] def is_accessible(self): return current_user.is_authenticated def on_model_change(self, form, model, is_created=False): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_loai_benh = dao.SoLuongLoaiBenh() if so_luong_loai_benh > cac_quy_dinh.so_luong_loai_benh_toi_da: self.can_create = False else: self.can_create = True def after_model_delete(self, model): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_loai_benh = dao.SoLuongLoaiBenh() if so_luong_loai_benh > cac_quy_dinh.so_luong_loai_benh_toi_da: self.can_create = False else: self.can_create = True
def after_model_delete(self, model): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_loai_benh = dao.SoLuongLoaiBenh() if so_luong_loai_benh > cac_quy_dinh.so_luong_loai_benh_toi_da: self.can_create = False else: self.can_create = True
def on_model_change(self, form, model, is_created=False): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_phieu_kham_benh_trong_ngay = dao.SoLuongPhieuKhamBenhTrongNgay( ) if so_luong_phieu_kham_benh_trong_ngay > cac_quy_dinh.so_luong_benh_nhan_kham_trong_ngay: self.can_create = False else: self.can_create = True
def after_model_delete(self, model): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_phieu_kham_benh_trong_ngay = dao.SoLuongPhieuKhamBenhTrongNgay( ) if so_luong_phieu_kham_benh_trong_ngay > cac_quy_dinh.so_luong_benh_nhan_kham_trong_ngay: self.can_create = False else: self.can_create = True
class PhieuKhamBenhView(ModelView): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_phieu_kham_benh_trong_ngay = dao.SoLuongPhieuKhamBenhTrongNgay() # can_create = True if so_luong_phieu_kham_benh_trong_ngay <= cac_quy_dinh.so_luong_benh_nhan_kham_trong_ngay else False can_edit = True column_display_pk = True can_view_details = True can_set_page_size = 50 column_labels = dict(benh_nhan="Bệnh nhân", ngay_kham="Ngày khám", trieu_chung="Triệu chứng", loai_benh="Loại bệnh", loai_benh_du_doan_id="Loại bệnh dự đoán") column_exclude_list = [ 'detele_at', 'create_at', ] column_filters = ['benh_nhan'] def is_accessible(self): return current_user.is_authenticated def on_model_change(self, form, model, is_created=False): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_phieu_kham_benh_trong_ngay = dao.SoLuongPhieuKhamBenhTrongNgay( ) if so_luong_phieu_kham_benh_trong_ngay > cac_quy_dinh.so_luong_benh_nhan_kham_trong_ngay: self.can_create = False else: self.can_create = True def after_model_delete(self, model): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_phieu_kham_benh_trong_ngay = dao.SoLuongPhieuKhamBenhTrongNgay( ) if so_luong_phieu_kham_benh_trong_ngay > cac_quy_dinh.so_luong_benh_nhan_kham_trong_ngay: self.can_create = False else: self.can_create = True
class ChiDanView(ModelView): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_don_vi_tinh_toi_da = dao.SoLuongDonVi() # can_create = True if so_luong_don_vi_tinh_toi_da <=( cac_quy_dinh.so_luong_don_vi_tinh_toi_da or 0 )else False can_edit = True column_display_pk = True can_view_details = True can_set_page_size = 50 column_labels = dict( chi_dan_id="Mã chỉ dẫn", noi_dung="Nội dung chỉ dẫn", ) column_exclude_list = [ 'detele_at', 'create_at', ] def is_accessible(self): return current_user.is_authenticated def on_model_change(self, form, model, is_created=False): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_cach_dung_toi_da = dao.SoLuongDonVi() if so_luong_cach_dung_toi_da > cac_quy_dinh.so_luong_cach_dung_toi_da: self.can_create = False else: self.can_create = True def after_model_delete(self, model): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_cach_dung_toi_da = dao.SoLuongDonVi() if so_luong_cach_dung_toi_da > cac_quy_dinh.so_luong_cach_dung_toi_da: self.can_create = False else: self.can_create = True
class ThuocView(ModelView): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_thuoc_toi_da = dao.SoLuongLoaiThuoc() # can_create = True if so_luong_thuoc_toi_da <= cac_quy_dinh.so_luong_thuoc_toi_da else False can_edit = True column_display_pk = True can_view_details = True can_set_page_size = 50 column_labels = dict(thuoc_id="Mã thuốc", ten_thuoc="Tên thuốc", don_gia="Đơn giá") column_exclude_list = [ 'detele_at', 'create_at', ] def is_accessible(self): return current_user.is_authenticated def on_model_change(self, form, model, is_created=False): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_thuoc_toi_da = dao.SoLuongLoaiThuoc() if so_luong_thuoc_toi_da > cac_quy_dinh.so_luong_thuoc_toi_da: self.can_create = False else: self.can_create = True def after_model_delete(self, model): cac_quy_dinh = dao.LayCacQuyDinh() so_luong_thuoc_toi_da = dao.SoLuongLoaiThuoc() if so_luong_thuoc_toi_da > cac_quy_dinh.so_luong_thuoc_toi_da: self.can_create = False else: self.can_create = True