merge
commit
5c897e2cdf
|
@ -18,5 +18,6 @@
|
|||
</field>
|
||||
<foot>
|
||||
<button string="Generate" type="success" method="gen_visit"/>
|
||||
<button string="Clear" type="danger" icon="remove" method="clear_visit"/>
|
||||
</foot>
|
||||
</form>
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
<list model="clinic.hd.case">
|
||||
<search>
|
||||
<field name="number"/>
|
||||
<field name="time_start"/>
|
||||
<field name="time_stop"/>
|
||||
<field name="patient_id"/>
|
||||
<field name="cycle_id"/>
|
||||
<field name="doctor_id"/>
|
||||
<field name="nurse_id"/>
|
||||
</search>
|
||||
<field name="number"/>
|
||||
<field name="time_start"/>
|
||||
<field name="time_stop"/>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<!--<calendar model="clinic.visit" states='waiting_treatment' date_field="date_visit" colors='{"#090":[["cycle","=",1]],"#2400ff":[["cycle","=",2]],"#ebff00":[["cycle","=",3]],"#f20000":[["cycle","=",4]]}'>-->
|
||||
<calendar model="clinic.visit" states='waiting_treatment' start_field="time_start" end_field="time_stop" colors='{"#090":[["cycle","=",1]],"#2400ff":[["cycle","=",2]],"orange":[["cycle","=",3]],"#f20000":[["cycle","=",4]]}'>
|
||||
<calendar model="clinic.visit" states='draft' start_field="time_start" end_field="time_stop" colors='{"#090":[["cycle","=",1]],"#2400ff":[["cycle","=",2]],"orange":[["cycle","=",3]],"#f20000":[["cycle","=",4]]}'>
|
||||
<field name="patient_id"/>
|
||||
<field name="cycle_id"/>
|
||||
<field name="number"/>
|
||||
|
|
|
@ -13,7 +13,6 @@ from . import patient_cause_line
|
|||
from . import patient_comorbidity_line
|
||||
from . import patient_morbidity_line
|
||||
from . import race
|
||||
from . import report_dialyzer_drop
|
||||
from . import schedule
|
||||
from . import setting
|
||||
from . import visit
|
||||
|
|
|
@ -85,7 +85,7 @@ class GenVisit(Model):
|
|||
|
||||
def gen_visit(self,ids,context):
|
||||
obj=self.browse(ids)[0]
|
||||
#time_stop=obj.date_to[11:]
|
||||
visit_obj=get_model('clinic.visit')
|
||||
days=[
|
||||
obj.monday and 1 or 0,
|
||||
obj.tuesday and 2 or 0,
|
||||
|
@ -94,17 +94,12 @@ class GenVisit(Model):
|
|||
obj.friday and 5 or 0,
|
||||
]
|
||||
days=[day for day in days if day]
|
||||
print("days ", days)
|
||||
if not days:
|
||||
raise Exception("Please select Day")
|
||||
#duration=datetime.strptime(obj.date_to,FMT_DATETIME)-datetime.strptime(obj.date_from,FMT_DATETIME)
|
||||
# loop patient
|
||||
visit_vals=[]
|
||||
date_from=datetime.strptime(obj.date_from,FMT_DATETIME)
|
||||
date_to=datetime.strptime(obj.date_to,FMT_DATETIME)
|
||||
#total_days=(date_to-date_from).days
|
||||
for line in obj.lines:
|
||||
# loop days in weekend
|
||||
ntoday=1
|
||||
day_total=(date_to-date_from).days+ntoday
|
||||
for weekday in days:
|
||||
|
@ -114,7 +109,7 @@ class GenVisit(Model):
|
|||
start_date+=timedelta(days=1)
|
||||
wd=start_date.weekday()
|
||||
|
||||
#XXX should gen only in scoop
|
||||
#XXX should gen only in scope
|
||||
if start_date.strftime(FMT_DATE) > date_to.strftime(FMT_DATE):
|
||||
continue
|
||||
count=0
|
||||
|
@ -131,23 +126,18 @@ class GenVisit(Model):
|
|||
}
|
||||
visit_vals.append(vals)
|
||||
count+=7
|
||||
|
||||
dom=[]
|
||||
dom.append(['time_start','>=','%s %s'%(tmp.strftime(FMT_DATE)[0:10],' 00:00:00')])
|
||||
dom.append(['time_stop','<=','%s %s'%(tmp.strftime(FMT_DATE)[0:10],' 23:59:59')])
|
||||
dom.append(['patient_id', '=', line.patient_id.id])
|
||||
dom.append(['state','=','draft'])
|
||||
vids=visit_obj.search(dom)
|
||||
visit_obj.delete(vids)
|
||||
start_date=tmp
|
||||
|
||||
if visit_vals:
|
||||
dom=[]
|
||||
dom.append(['time_start','>=','%s %s'%(date_from.strftime(FMT_DATE)[0:10],' 00:00:00')])
|
||||
dom.append(['time_stop','<=','%s %s'%(start_date.strftime(FMT_DATE)[0:10],' 23:59:59')])
|
||||
# search patient
|
||||
dom.append(['state','=','draft'])
|
||||
patient_ids=[visit['patient_id'] for visit in visit_vals]
|
||||
dom.append(['patient_id', 'in', tuple(patient_ids)])
|
||||
print("dom ", dom)
|
||||
visit_obj=get_model('clinic.visit')
|
||||
visit_ids=visit_obj.search(dom)
|
||||
# delete old visit (same duration)
|
||||
visit_obj.delete(visit_ids)
|
||||
for vals in visit_vals:
|
||||
visit_obj.create(vals)
|
||||
for vals in visit_vals:
|
||||
visit_obj.create(vals)
|
||||
|
||||
return {
|
||||
'next': {
|
||||
|
@ -157,5 +147,95 @@ class GenVisit(Model):
|
|||
'flash': 'Generate OK',
|
||||
}
|
||||
|
||||
def clear_visit(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
days=[
|
||||
obj.monday and 1 or 0,
|
||||
obj.tuesday and 2 or 0,
|
||||
obj.wednesday and 3 or 0,
|
||||
obj.thursday and 4 or 0,
|
||||
obj.friday and 5 or 0,
|
||||
]
|
||||
days=[day for day in days if day]
|
||||
visit_ids=[]
|
||||
date_from=datetime.strptime(obj.date_from,FMT_DATETIME)
|
||||
date_to=datetime.strptime(obj.date_to,FMT_DATETIME)
|
||||
visit_obj=get_model("clinic.visit")
|
||||
if days:
|
||||
for line in obj.lines:
|
||||
# loop days in weekend
|
||||
ntoday=1
|
||||
day_total=(date_to-date_from).days+ntoday
|
||||
for weekday in days:
|
||||
wd=date_from.weekday()
|
||||
start_date=date_from
|
||||
while wd != weekday-1:
|
||||
start_date+=timedelta(days=1)
|
||||
wd=start_date.weekday()
|
||||
|
||||
#XXX should gen only in scop
|
||||
if start_date.strftime(FMT_DATE) > date_to.strftime(FMT_DATE):
|
||||
continue
|
||||
count=0
|
||||
while count < day_total:
|
||||
tmp=start_date+timedelta(days=count)
|
||||
time_start="%s 00:00:00" % (tmp.strftime(FMT_DATE))
|
||||
time_stop="%s 23:59:59" % (tmp.strftime(FMT_DATE))
|
||||
patient_id=line.patient_id.id
|
||||
dom=[]
|
||||
dom.append(['time_start','>=','%s'%time_start])
|
||||
dom.append(['time_stop','<=','%s'%time_stop])
|
||||
dom.append(['patient_id','=','%s'%patient_id])
|
||||
dom.append(['state','=','draft'])
|
||||
count+=7
|
||||
print(dom)
|
||||
vids=visit_obj.search(dom)
|
||||
if vids:
|
||||
visit_ids.append(vids[0])
|
||||
start_date=tmp
|
||||
else:
|
||||
time_start=obj.date_from
|
||||
time_stop=obj.date_to
|
||||
for line in obj.lines:
|
||||
patient_id=line.patient_id.id
|
||||
dom=[]
|
||||
dom.append(['time_start','>=','%s'%time_start])
|
||||
dom.append(['time_stop','<=','%s'%time_stop])
|
||||
dom.append(['patient_id','=','%s'%patient_id])
|
||||
dom.append(['state','=','draft'])
|
||||
vids=visit_obj.search(dom)
|
||||
if vids:
|
||||
visit_ids.append(vids[0])
|
||||
if visit_ids:
|
||||
print("visit_ids ", len(visit_ids))
|
||||
get_model("clinic.visit").delete(visit_ids)
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_patient',
|
||||
'mode': 'list',
|
||||
},
|
||||
'flash': 'Clear OK',
|
||||
}
|
||||
|
||||
def _clear_visit(self,ids,context):
|
||||
obj=self.browse(ids)[0]
|
||||
visit_obj=get_model("clinic.visit")
|
||||
for line in obj.lines:
|
||||
patient_id=line.patient_id
|
||||
dom=[]
|
||||
dom.append(['patient_id','=',patient_id.id])
|
||||
dom.append(['state','=','draft'])
|
||||
# clear
|
||||
# only from to and day
|
||||
visit_ids=visit_obj.search(dom)
|
||||
visit_obj.delete(visit_ids)
|
||||
return {
|
||||
'next': {
|
||||
'name': 'clinic_patient',
|
||||
'mode': 'list',
|
||||
},
|
||||
'flash': 'Clear OK',
|
||||
}
|
||||
|
||||
GenVisit.register()
|
||||
|
||||
|
|
|
@ -96,7 +96,9 @@ class HDcase(Model):
|
|||
"time_stop": lambda *a: time.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
'nurse_id': _get_nurse,
|
||||
"number": _get_number,
|
||||
"company_id": lambda *a: get_active_company()
|
||||
"company_id": lambda *a: get_active_company(),
|
||||
"fee": 1500,
|
||||
'show_pop': False,
|
||||
}
|
||||
_order="date desc,number desc"
|
||||
|
||||
|
@ -454,6 +456,7 @@ class HDcase(Model):
|
|||
data['fee']=0.0
|
||||
return data
|
||||
|
||||
|
||||
def onchange_hct(self,context={}):
|
||||
data=context['data']
|
||||
hct_alert=data.get("hct","")
|
||||
|
|
|
@ -146,15 +146,6 @@ class Patient(Model):
|
|||
data['partner_id']=partner_id
|
||||
return data
|
||||
|
||||
def _create(self,vals,**kw):
|
||||
obj_id=super(Patient,self).create(vals,**kw)
|
||||
obj=self.browse(obj_id)
|
||||
partner_id=self.get_partner_id(patient_type=obj.type,data={'name': obj.name})
|
||||
obj.write({
|
||||
'partner_id': partner_id,
|
||||
})
|
||||
return obj_id
|
||||
|
||||
def create(self,vals,**kw):
|
||||
obj_id=super(Patient,self).create(vals,**kw)
|
||||
obj=self.browse(obj_id)
|
||||
|
@ -199,8 +190,5 @@ class Patient(Model):
|
|||
vals['partner_id']=partner_id
|
||||
super().write(ids,vals,**kw)
|
||||
|
||||
def generate_visit(self,ids,context={}):
|
||||
obj=self.browse(ids)[0]
|
||||
pass
|
||||
|
||||
Patient.register()
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
import time
|
||||
|
||||
from netforce.model import Model, fields, get_model
|
||||
|
||||
class DialyzerDrop(Model):
|
||||
_name="report.dialyzer.drop"
|
||||
_string="Dialyzer [Drop]"
|
||||
_transient=True
|
||||
|
||||
_fields={
|
||||
"date": fields.Date("Date"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'date': lambda *a: time.strftime("%Y-%m-%d"),
|
||||
}
|
||||
|
||||
def get_report_data(self,ids,context={}):
|
||||
lines=[]
|
||||
|
||||
hd_cases=get_model("clinic.dialyzer").search_browse(['state','=','drop'])
|
||||
for dialyzer_ids in hd_cases:
|
||||
lines.append({
|
||||
'number' : dialyzer_ids.number,
|
||||
'usetime': dialyzer_ids.use_time,
|
||||
'maxuse' : dialyzer_ids.max_use_time,
|
||||
'createdate' : dialyzer_ids.date,
|
||||
'expdate' : dialyzer_ids.exp_date,
|
||||
'patient' : dialyzer_ids.patient_id.name,
|
||||
})
|
||||
|
||||
data={
|
||||
'lines': lines or "Dialyzer Drop [Empty]",
|
||||
}
|
||||
return data
|
||||
|
||||
DialyzerDrop.register()
|
|
@ -36,6 +36,12 @@ class ReportHDDialy(Model):
|
|||
date_from=time.strftime("%Y-%m-%d")
|
||||
date_to=time.strftime("%Y-%m-%d")
|
||||
|
||||
defaults=context.get("defaults")
|
||||
if defaults.get("date_from"):
|
||||
date_from=defaults.get("date_from")
|
||||
if defaults.get("date_to"):
|
||||
date_to=defaults.get("date_to")
|
||||
|
||||
dom=[]
|
||||
dom.append(['state','=','completed'])
|
||||
if ids:
|
||||
|
@ -66,8 +72,6 @@ class ReportHDDialy(Model):
|
|||
for hd_case in get_model("clinic.hd.case").search_browse(dom,order="cycle_id.sequence"):
|
||||
patient_type=hd_case.patient_id.type
|
||||
patient_type=PATIENT_TYPE.get(patient_type)
|
||||
#dialyzer_name=hd_case.dialyzers.id
|
||||
#dialyzer_name=DIALYZER_NAME.get(dialyzer_name)
|
||||
cycle_name=hd_case.cycle_id.name or ""
|
||||
show_cycle=False
|
||||
if not cycle_name in cycles:
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,58 +0,0 @@
|
|||
<center>
|
||||
<h2>
|
||||
Dialyzers [Drop]
|
||||
</h2>
|
||||
</center>
|
||||
<table class="table table-striped">
|
||||
<thead class="scroll-header">
|
||||
<tr>
|
||||
<th>
|
||||
Number
|
||||
</th>
|
||||
<th>
|
||||
Use (Time)
|
||||
</th>
|
||||
<th>
|
||||
Max Use (Time)
|
||||
</th>
|
||||
<th>
|
||||
Create Date
|
||||
</th>
|
||||
<th>
|
||||
Expire Date
|
||||
</th>
|
||||
<th>
|
||||
Patient
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each lines context=context}}
|
||||
<tr>
|
||||
<td>
|
||||
{{number}}
|
||||
</td>
|
||||
<td>
|
||||
{{usetime}}
|
||||
</td>
|
||||
<td>
|
||||
{{maxuse}}
|
||||
</td>
|
||||
<td>
|
||||
{{createdate}}
|
||||
</td>
|
||||
<td>
|
||||
{{expdate}}
|
||||
</td>
|
||||
<td>
|
||||
{{patient}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr style="font-weight:bold">
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
|
@ -18,7 +18,7 @@
|
|||
<tr>
|
||||
<td>{{topic}}</td>
|
||||
<td>{{month}}</td>
|
||||
<td><a style="text-decoration: underline" href="ui#name=clinic_hd_case&tab_no=3">{{amount}}</a></td>
|
||||
<td><a style="text-decoration: underline" href="ui#name=clinic_report_hd_dialy&defaults.date_from='2014-10-17'&defaults.date_to='2014-10-18'">{{amount}}</a></td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
<h1>Hello HBS</h1>
|
|
@ -1,7 +1,12 @@
|
|||
===
|
||||
- skip holiday
|
||||
====
|
||||
- import data
|
||||
- payment
|
||||
- NHSO
|
||||
- SSO
|
||||
=====
|
||||
select diaylizer at treatment page
|
||||
|
||||
|
||||
select diaylizer at treatment page -> ok
|
||||
=====
|
||||
step:
|
||||
nurse
|
||||
|
@ -19,7 +24,6 @@
|
|||
3. go to hd case
|
||||
- select dialyzer
|
||||
- if not we can no do treament
|
||||
|
||||
===== todo
|
||||
######
|
||||
- import payment
|
||||
|
|
Loading…
Reference in New Issue