aboutsummaryrefslogtreecommitdiffstats
path: root/97suifangqa/apps/medicine
diff options
context:
space:
mode:
authorAlvin Li <liweitianux@gmail.com>2013-08-13 14:13:24 +0800
committerAlvin Li <liweitianux@gmail.com>2013-08-13 14:13:24 +0800
commit9636d4a6767f49384d5c386bc3f1142c88b90613 (patch)
tree3a70f6d9e4be1791d36c87cc7cbfd1d5aa2b39dd /97suifangqa/apps/medicine
parent9383d9a8a5988d071766c3d08a5c946e9c5b02ae (diff)
download97dev-9636d4a6767f49384d5c386bc3f1142c88b90613.tar.bz2
cloned from 'bitbucket', 2013/08/13
Diffstat (limited to '97suifangqa/apps/medicine')
-rw-r--r--97suifangqa/apps/medicine/__init__.py0
-rw-r--r--97suifangqa/apps/medicine/models.py50
-rw-r--r--97suifangqa/apps/medicine/tests.py16
-rw-r--r--97suifangqa/apps/medicine/views.py1
4 files changed, 67 insertions, 0 deletions
diff --git a/97suifangqa/apps/medicine/__init__.py b/97suifangqa/apps/medicine/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/97suifangqa/apps/medicine/__init__.py
diff --git a/97suifangqa/apps/medicine/models.py b/97suifangqa/apps/medicine/models.py
new file mode 100644
index 0000000..e6cfc88
--- /dev/null
+++ b/97suifangqa/apps/medicine/models.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+from django.db import models
+from django.contrib import admin
+
+# Create your models here.
+class Medicine(models.Model):
+ name = models.CharField(u"名称", max_length=100)
+ category = models.CharField(u" 种类", max_length=100, null=True, blank= True)
+ pdaLink = models.CharField(u"FDA批准链接", max_length=200, null=True, blank= True)
+ dosageForm = models.CharField(u"剂型", max_length=100, null=True, blank= True)
+ specifications = models.ManyToManyField('Specification', related_name='medicines', verbose_name=u"药品规格", null=True, blank=True)
+ company = models.ForeignKey('Company', related_name='medicines', verbose_name = u"厂家", null=True, blank=True)
+ instruction = models.FileField(upload_to="upload/instructions", max_length=400, verbose_name = u"说明书", null=True, blank=True)
+
+ class Meta:
+ verbose_name_plural = u"药物"
+
+ def __unicode__(self):
+ return u"< Medicine: %s >" % self.id
+
+class Specification(models.Model):
+
+ value = models.FloatField(u"数值")
+ unit = models.OneToOneField('indicator.Unit', null=True, blank=True)
+
+ class Meta:
+ verbose_name_plural = u"药品规格"
+
+
+ def __unicode__(self):
+ return "< Specification: %s >" % self.id
+
+class Company(models.Model):
+
+ name = models.CharField(u"名称", max_length=100)
+ nation = models.ForeignKey('location.Nation', related_name='companys', verbose_name = u"国家", null=True, blank=True)
+
+ class Meta:
+ verbose_name_plural = u"厂家"
+
+ def __unicode__(self):
+ return "< Company: %s >" % self.id
+
+
+
+admin.site.register([
+ Medicine,
+ Specification,
+ Company,
+ ])
diff --git a/97suifangqa/apps/medicine/tests.py b/97suifangqa/apps/medicine/tests.py
new file mode 100644
index 0000000..501deb7
--- /dev/null
+++ b/97suifangqa/apps/medicine/tests.py
@@ -0,0 +1,16 @@
+"""
+This file demonstrates writing tests using the unittest module. These will pass
+when you run "manage.py test".
+
+Replace this with more appropriate tests for your application.
+"""
+
+from django.test import TestCase
+
+
+class SimpleTest(TestCase):
+ def test_basic_addition(self):
+ """
+ Tests that 1 + 1 always equals 2.
+ """
+ self.assertEqual(1 + 1, 2)
diff --git a/97suifangqa/apps/medicine/views.py b/97suifangqa/apps/medicine/views.py
new file mode 100644
index 0000000..60f00ef
--- /dev/null
+++ b/97suifangqa/apps/medicine/views.py
@@ -0,0 +1 @@
+# Create your views here.