xxxxx
parent
d1e01e048a
commit
7f6d74ff83
|
@ -16,6 +16,7 @@
|
|||
</list>
|
||||
</field>
|
||||
</tab>
|
||||
<!--
|
||||
<tab string="Docor">
|
||||
<field name="doctors" nolabel="1" span="6">
|
||||
<list>
|
||||
|
@ -24,11 +25,12 @@
|
|||
</list>
|
||||
</field>
|
||||
</tab>
|
||||
-->
|
||||
</tabs>
|
||||
<foot>
|
||||
</foot>
|
||||
<related>
|
||||
<field name="hd_cases"/>
|
||||
<field name="visits"/>
|
||||
<field name="hd_cases"/>
|
||||
</related>
|
||||
</form>
|
||||
|
|
|
@ -24,13 +24,13 @@
|
|||
</item>
|
||||
<item string="Cycles">
|
||||
<item string="Cycles" action="clinic_cycle"/>
|
||||
<item string="Cycle Dialy" action="clinic_cycle_dialy"/>
|
||||
<item string="Cycle Items" action="clinic_cycle_item"/>
|
||||
</item>
|
||||
<item string="Schedules" action="clinic_schedule"/>
|
||||
<item string="Visits" action="clinic_visit"/>
|
||||
<item string="HD Cases" action="clinic_hd_case"/>
|
||||
<item string="Reports">
|
||||
<item string="Cycle Dialy" action="clinic_cycle_dialy"/>
|
||||
<item string="Visit Dialy" action="clinic_visit_dialy"/>
|
||||
<item string="HD Detail" action="clinic_report_hd_detail"/>
|
||||
<item string="HD Summary" action="clinic_report_hd_summary"/>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import time
|
||||
|
||||
from netforce.model import Model, fields
|
||||
from netforce.model import Model, fields, get_model
|
||||
from netforce.access import get_active_company
|
||||
|
||||
class CycleItem(Model):
|
||||
|
@ -27,6 +27,7 @@ class CycleItem(Model):
|
|||
'visits': fields.One2Many("clinic.visit","cycle_item_id", "Visits"),
|
||||
'nurses': fields.One2Many("clinic.cycle.item.nurse",'cycle_item_id','Nurses'),
|
||||
'doctors': fields.One2Many("clinic.cycle.item.doctor",'cycle_item_id','Doctors'),
|
||||
'sequence': fields.Char("Sequence"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
|
@ -35,6 +36,20 @@ class CycleItem(Model):
|
|||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
}
|
||||
|
||||
_order="date asc"
|
||||
_order="sequence"
|
||||
|
||||
def create(self, vals,**kw):
|
||||
date=vals['date']
|
||||
cycle_id=vals['cycle_id']
|
||||
cycle=get_model("clinic.cycle").browse(cycle_id)
|
||||
vals['sequence']='%s-%s'%(date,cycle.sequence) #date-sequence
|
||||
obj_id=super().create(vals,**kw)
|
||||
return obj_id
|
||||
|
||||
def write(self,ids,vals,**kw):
|
||||
obj=self.browse(ids)[0]
|
||||
cycle=obj.cycle_id
|
||||
vals['sequence']='%s-%s'%(obj.date,cycle.sequence) #date-sequence
|
||||
super().write(ids,vals,**kw)
|
||||
|
||||
CycleItem.register()
|
||||
|
|
|
@ -128,6 +128,14 @@ class GenVisit(Model):
|
|||
else:
|
||||
raise Exception("Please select some patient or patient type")
|
||||
|
||||
nurse_ids=[]
|
||||
for nurse_line in obj.nurse_lines:
|
||||
nurse_id=nurse_line.nurse_id.id
|
||||
# None
|
||||
if nurse_id:
|
||||
nurse_ids.append(nurse_id)
|
||||
if not nurse_ids:
|
||||
nurse_ids=get_model("clinic.personal").search([['type','=','nurse'],['categ_id','=',obj.nurse_categ_id.id]])
|
||||
schedules={}
|
||||
for patient_id in patients:
|
||||
patient=get_model("clinic.patient").browse(patient_id)
|
||||
|
@ -180,17 +188,8 @@ class GenVisit(Model):
|
|||
start_date=tmp
|
||||
|
||||
for vals in visit_vals:
|
||||
vals['nurse_ids']=nurse_ids
|
||||
visit_obj.create(vals)
|
||||
|
||||
nurse_ids=[]
|
||||
for nurse_line in obj.nurse_lines:
|
||||
nurse_id=nurse_line.nurse_id.id
|
||||
# None
|
||||
if nurse_id:
|
||||
nurse_ids.append(nurse_id)
|
||||
if not nurse_ids:
|
||||
nurse_ids=get_model("clinic.personal").search([['type','=','nurse'],['categ_id','=',obj.nurse_categ_id.id]])
|
||||
|
||||
dom=[]
|
||||
dom.append(['time_start','>=','%s %s'%(obj.date_from[0:10],' 00:00:00')])
|
||||
dom.append(['time_stop','<=','%s %s'%(start_date.strftime(FMT_DATE)[0:10],' 23:59:59')])
|
||||
|
|
|
@ -35,7 +35,7 @@ class Visit(Model):
|
|||
"comments": fields.One2Many("message","related_id","Comments"),
|
||||
'visit_date': fields.Date('Visit Date'),
|
||||
'print_date': fields.Date('Print Date',function="_get_print_date"),
|
||||
'cycle_item_id': fields.Many2One("clinic.cycle.item","Cycle Item"), # on_delete="cascade" -> rm visit from cycle item
|
||||
'cycle_item_id': fields.Many2One("clinic.cycle.item","Cycle Item", on_delete="cascade"), #XXX on_delete="cascade" -> rm visit from cycle item
|
||||
'sequence': fields.Char("Sequence"),
|
||||
}
|
||||
|
||||
|
@ -114,6 +114,12 @@ class Visit(Model):
|
|||
'state': 'draft',
|
||||
}
|
||||
|
||||
vals['personals'].append(('create',{
|
||||
'personal_id': obj.doctor_id.id,
|
||||
'type': 'doctor',
|
||||
'priop': 'owner',
|
||||
}))
|
||||
|
||||
products=get_model("product").search_browse([['code','=','FEE']])
|
||||
for product in products:
|
||||
vals['lines'].append(('create',{
|
||||
|
@ -290,10 +296,16 @@ class Visit(Model):
|
|||
item_obj=get_model('clinic.cycle.item')
|
||||
item_ids=item_obj.search(dom)
|
||||
item_id=None
|
||||
# XXX
|
||||
nurse_ids=[]
|
||||
if 'nurse_ids' in vals.keys():
|
||||
nurse_ids=vals['nurse_ids']
|
||||
del vals['nurse_ids']
|
||||
if not item_ids:
|
||||
item_id=item_obj.create({
|
||||
'cycle_id': cycle_id,
|
||||
'date': date,
|
||||
'nurses': [('create',{'nurse_id': nurse_id}) for nurse_id in nurse_ids]
|
||||
})
|
||||
else:
|
||||
item_id=item_ids[0]
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
======
|
||||
flow:
|
||||
planing schedule
|
||||
plaining visit
|
||||
- generate visit
|
||||
======
|
||||
missing:
|
||||
- search calendar
|
||||
- color calendar
|
||||
- can not move calendar's schedule
|
||||
- order's visit report dialy
|
||||
- same model & mode (list) but use diffent target
|
||||
|
||||
dashboard
|
||||
: hd summary report -> click and go direct
|
||||
cycle item:
|
||||
|
|
Loading…
Reference in New Issue