aboutsummaryrefslogtreecommitdiffstats
path: root/97suifangqa/apps/figure/models.py
blob: 30c027a0becca1635d8d4c261f304643f948cbcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib import admin

# Create your models here.

class Figure(models.Model):

    legend      = models.CharField(u"图例", max_length=100, null=True, blank= True)
    title       = models.CharField(u"标题", max_length=100, null=True, blank= True)
    ori_img     = models.ImageField(upload_to="upload/ori-imgs/",verbose_name = u"原始图片")
    revised_img = models.ImageField(upload_to="upload/revised-imgs/",verbose_name = u"修改图片")
    comment     = models.TextField(u"注释", null=True, blank=True)

    class Meta:
        verbose_name_plural = u"图片"

    def __unicode__(self):
        return "< Figure: %s >" % self.id
    

class Chart(models.Model):
    u'''
        柱状图里的一个柱子
    '''

    value  = models.FloatField(u"数值")
    figure = models.ForeignKey("Figure", verbose_name=u"图片", related_name="charts", null=True, blank=True)
    sample = models.OneToOneField("subjects.Sample", verbose_name=u"人群", related_name="charts", null=True, blank=True)

    class Meta:
        verbose_name_plural = u"柱子"

    def __unicode__(self):
        return "< Chart: %s >" % self.id
    

class FollowupCurve(models.Model):
    u'''
        随访曲线里的某一根曲线提取出来,对应某个人群
    '''

    x      = models.CharField(u"x轴标签", max_length=100, blank=True)
    y      = models.CharField(u"y轴标签", max_length=100, blank=True)
    z      = models.CharField(u"z轴标签", max_length=100, blank=True)

    sample = models.OneToOneField("subjects.Sample", verbose_name=u"人群", related_name="followup_curves", null=True, blank=True)
    figure = models.ForeignKey("Figure", verbose_name=u"图片", related_name="followup_curves", null=True, blank=True)


    class Meta:
        verbose_name_plural = u"随访曲线"

    def __unicode__(self):
        return "< FollowupCurve: %s >" % self.id
    

class ValuesOfXYZ(models.Model):
    u'''
        一根曲线上的各个值 
    '''

    x = models.FloatField(u"x值")
    y = models.FloatField(u"y值")
    z = models.FloatField(u"z值")

    followup_curve = models.ForeignKey("FollowupCurve", verbose_name=u"随访曲线", related_name="xyz_values", null=True, blank=True)


    class Meta:
        verbose_name_plural = u"曲线上各点"

    def __unicode__(self):
        return "< ValuesOfXYZ: (%s,%s,%s) >" % (self.x, self.y, self.z)


admin.site.register([
                     Figure,
                     Chart,
                     FollowupCurve,
                     ValuesOfXYZ,
                    ])