83 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			Python
		
	
	
	
			
		
		
	
	
			83 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			Python
		
	
	
	
| from datetime import MAXYEAR
 | |
| from django.db import models
 | |
| from django.db.models.fields import related
 | |
| from utils.model import BaseModel
 | |
| from apps.system.models import Organization, User
 | |
| # Create your models here.
 | |
| from django.contrib.postgres.fields import JSONField
 | |
| 
 | |
| class QueryRecord(BaseModel):
 | |
|     user = models.ForeignKey(User, related_name='record_user', on_delete=models.CASCADE)
 | |
|     path = models.CharField('访问地址', max_length=200)
 | |
|     ip = models.CharField('IP地址', max_length=200, null=True, blank=True)
 | |
|     method = models.CharField('方法', max_length=100, default='GET')
 | |
|     query = JSONField(null=True,blank=True)
 | |
|     search = models.TextField('搜索字符', null=True, blank=True)
 | |
| 
 | |
|     class Meta:
 | |
|         verbose_name = '查询记录'
 | |
|         verbose_name_plural = verbose_name
 | |
| 
 | |
| 
 | |
| class CMA(BaseModel):
 | |
|     """
 | |
|     CMA检测能力表
 | |
|     """
 | |
|     type_choices = (
 | |
|         ('center', '总部'),
 | |
|         ('sub', '分子公司')
 | |
|     )
 | |
|     dlxh = models.TextField('大类序号', null=True,blank=True)
 | |
|     dlmc = models.TextField('大类', null=True,blank=True)
 | |
|     lbxh = models.TextField('类别序号', null=True,blank=True)
 | |
|     lbmc = models.TextField('类别名称', null=True,blank=True)
 | |
|     xmxh = models.TextField('项目序号', null=True,blank=True)
 | |
|     xmmc = models.TextField('项目名称', null=True,blank=True)
 | |
|     bzmc = models.TextField('标准名称', null=True,blank=True)
 | |
|     bzbh = models.TextField('标准编号', null=True,blank=True)
 | |
|     xzfw = models.TextField('限制范围',null=True,blank=True)
 | |
|     bz = models.TextField('备注',null=True,blank=True)
 | |
|     sszx = models.TextField('所属中心',null=True,blank=True)
 | |
|     type = models.CharField('所属类型', max_length=50,
 | |
|                              choices=type_choices, default='center')
 | |
|     glzz = models.TextField('关联资质', null=True, blank=True)
 | |
| 
 | |
| class Inspection(BaseModel):
 | |
|     """
 | |
|     检验能力表
 | |
|     """
 | |
|     
 | |
|     dlxh = models.TextField('大类序号', null=True,blank=True)
 | |
|     dlmc = models.TextField('大类名称', null=True,blank=True)
 | |
|     dxxh = models.TextField('对象序号', null=True,blank=True)
 | |
|     jydx = models.TextField('检验对象', null=True,blank=True)
 | |
|     jyxmxh = models.TextField('检验项目序号', null=True,blank=True)
 | |
|     jyxmmc = models.TextField('检验项目名称', null=True,blank=True)
 | |
|     jybz = models.TextField('检验标准', null=True,blank=True)
 | |
|     sm = models.TextField('说明', null=True,blank=True)
 | |
|     sxrq = models.TextField('生效日期', null=True,blank=True)
 | |
|     sszx = models.TextField('所属中心',null=True,blank=True)
 | |
| 
 | |
| class CNAS(BaseModel):
 | |
|     """
 | |
|     CNAS检测能力表
 | |
|     """
 | |
|     lbmc = models.TextField('类别名称', null=True,blank=True)
 | |
|     xmmc = models.TextField('项目名称', null=True,blank=True)
 | |
|     bzmc = models.TextField('标准名称', null=True,blank=True)
 | |
|     bzbh = models.TextField('标准编号', null=True,blank=True)
 | |
|     bztk = models.TextField('标准条款', null=True,blank=True)
 | |
|     sszx = models.TextField('所属中心',null=True,blank=True)
 | |
| 
 | |
| class Qualification(BaseModel):
 | |
|     sszx = models.TextField('所属中心', null=True, blank=True)
 | |
|     ssbm = models.ForeignKey(Organization, on_delete=models.CASCADE, null=True, blank=True, related_name='system_ssbm')
 | |
|     cma = models.TextField('cma资质', null=True, blank=True)
 | |
|     cnas = models.TextField('cnas资质', null=True, blank=True)
 | |
|     other = models.TextField('检验检测相关其它资质', null=True, blank=True)
 | |
|     service = models.TextField('主要检验检测服务', null=True, blank=True)
 | |
| 
 | |
| class Qualificationother(BaseModel):
 | |
|     qualification = models.ForeignKey(Qualification, on_delete=models.CASCADE, related_name='other_qualification')
 | |
|     name = models.TextField('其他资质', null=True, blank=True)
 | |
|     description = models.TextField('资质范围', null=True, blank=True) |