Merge branch 'master' of dev.netforce.com:netforce-customized/clinic

conv_bal
watcha.h 2014-10-29 12:02:31 +07:00
commit 8ddb2e5533
9 changed files with 28 additions and 31 deletions

View File

@ -2,6 +2,6 @@
<field name="string">Patients</field>
<field name="view_cls">multi_view</field>
<field name="model">clinic.patient</field>
<field name="tabs">[["All",[]],["Archived",[["active","=",false]]],["Medical Goverment",[["type","=","mg"]]],["Social Security",[["type","=","sc"]]],["NHSO(30฿)",[["type","=","nhso"]]],["Personal",[["type","=","personal"]]],["Others",[["type","=","others"]]]]</field>
<field name="tabs">[["All",[]],["Medical Goverment",[["type","=","mg"]]],["Social Security",[["type","=","sc"]]],["NHSO(30฿)",[["type","=","nhso"]]],["Personal",[["type","=","personal"]]],["Others",[["type","=","others"]]],["Archived",[["active","=","False"]]]]</field>
<field name="menu">clinic_menu</field>
</action>

View File

@ -1,7 +1,7 @@
<form model="clinic.report.hd.detail">
<group>
<field name="patient_id" span="3"/>
<field name="type" span="3"/>
<!--<field name="type" span="3"/>-->
<field name="doctor_id" span="3"/>
<field name="nurse_id" span="3"/>
<newline/>

View File

@ -10,13 +10,15 @@ class GenVisit(Model):
_name="clinic.gen.visit"
_transient=True
def _get_duration(self,ids,context={}):
res={}
for obj in self.browse(ids):
duration=datetime.strptime(obj.date_to,FMT_DATETIME)-datetime.strptime(obj.date_from,FMT_DATETIME)
res[obj.id]=duration.days
return res
_fields={
'date_from': fields.DateTime("From", required=True),
'date_to': fields.DateTime("To", required=True),
@ -35,6 +37,7 @@ class GenVisit(Model):
'duration': fields.Integer("Duration (hrs)", function="_get_duration"),
}
def _get_lines(self,context={}):
ids=context.get("ids")
if not ids:

View File

@ -76,7 +76,8 @@ class Patient(Model):
"hd_cases": fields.One2Many("clinic.hd.case","patient_id","HD Cases"),
"partner_id": fields.Many2One("partner","Contact"),
"dialyzers": fields.One2Many("clinic.dialyzer","patient_id","Dialyzers"),
'active': fields.Boolean("Active"),
"active":fields.Boolean("Active"),
}
def _get_number(self,context={}):
@ -93,19 +94,27 @@ class Patient(Model):
return num
get_model("sequence").increment_number(seq_id,context=context)
def _get_cause_line(self,context={}):
cause_ids=get_model("clinic.cause.chronic").search([])
return cause_ids
_defaults={
"type": "mg",
"reg_date": lambda *a: time.strftime("%Y-%m-%d"),
"number": _get_number,
"company_id": lambda *a: get_active_company(),
#'cause_lines': _get_cause_line,
"active" : True,
}
_order="date desc,number desc"
def void(self,ids,context={}):
def void(self,ids, context={}):
obj=self.browse(ids)[0]
obj.write({"state":"voided"})
def get_partner_id(self,patient_type,data):
def get_partner_id( self,patient_type,data):
partner_obj=get_model("partner")
categ_name=PATIENT_TYPE.get(patient_type)
categ_ids=get_model("partner.categ").search([['name','=',categ_name]])
@ -140,9 +149,9 @@ class Patient(Model):
if patient_type:
partner_id=self.get_partner_id(patient_type,data)
data['partner_id']=partner_id
return data
return data
def create(self,vals,**kw):
def create(self, vals,**kw):
obj_id=super(Patient,self).create(vals,**kw)
obj=self.browse(obj_id)
partner_id=obj.partner_id
@ -248,7 +257,7 @@ class Patient(Model):
print("call simple address ")
for obj in self.browse(ids):
if not obj.addresses:
addr_id=get_model("address").create({
address_id=get_model("address").create({
'patient_id': obj.id,
'partner_id': obj.partner_id.id,
'type': 'shipping',

View File

@ -28,19 +28,11 @@ class ReportHDDetail(Model):
def get_report_data(self,ids,context={}):
# company_id=get_active_company
# comp=get_model("company").browse(company_id)
# context=> dict
# inside context => keys => defaults => type => dict
# dict => key: value => '', 1, [], {}
# context['default'] => defaults(dict) => key => inside key => value => '2014-10-22'
for item in get_model("company").search_browse([]):
company_name=item.name
date_from=time.strftime("%Y-%m-%d")
date_to=time.strftime("%Y-%m-%d")
defaults=context.get("defaults")
if defaults:
if defaults.get("date_from"):
@ -80,10 +72,10 @@ class ReportHDDetail(Model):
dom.append([
'doctor_id','=',obj.doctor_id.id,
])
if obj.type_id:
"""if obj.patient_id:
dom.append([
'type','=',obj.type_id.name,
])
'type','=',obj.patient_id.type,
])"""
dom.append(['time_start', ">=", date_from+" 00:00:00"])
dom.append(['time_stop',"<=", date_to+" 23:59:59"])

View File

@ -56,9 +56,7 @@ class ReportHDMedical(Model):
vals={
'product_code' : product_code,
'medical' : product_name,
'mg' : '-',
'uc' : '-',
'sc' : '-',
'buy' : '-',
'amount' : product_amount,
'product_id': product_id,

View File

@ -48,6 +48,8 @@ class ReportHDSummary(Model):
time_start='2014-%s-01'%(month) # 2014-10-20
time_stop='2014-%s-%s'%(month,total_day)
dom=[]
dom.append(['type','=','mg'])
patients_mg=len(get_model("clinic.patient").search(dom))
@ -61,14 +63,14 @@ class ReportHDSummary(Model):
patients_pn=len(get_model("clinic.patient").search(dom))
#New Patients
#dom.append(['type','=','All'])
patients=len(get_model("clinic.patient").search_browse(['type','=','All']))
#patients=len(get_model("clinic.patient").search_browse(['type','=','All']))
dom=[]
dom.append(['state','=','completed'])
dom.append(['time_start','>=',time_start])
dom.append(['time_stop','<=',time_stop])
cur_total_case=len(get_model("clinic.hd.case").search(dom))
patients=len(get_model("clinic.patient").search_browse(['type','=','All']))
weekday, prev_total_day=monthrange(year, previous_month)
time_start_pre='2014-%s-01'%(previous_month) # 2014-10-20
@ -157,7 +159,6 @@ class ReportHDSummary(Model):
'lines': lines,
'company_name': company_name,
}
print("data", data)
return data

View File

@ -14,9 +14,7 @@
<tr>
<th>Product ID</th>
<th>Product Name</th>
<th>MG</th>
<th>UC</th>
<th>NHSO (30B)</th>
<th>Pay</th>
<th>Total</th>
</tr>
@ -26,9 +24,7 @@
<tr>
<td>{{product_code}}</td>
<td><a style="text-decoration: underline" href=ui#name=product&mode=form&active_id={{product_id}}>{{medical}}</a></td>
<td>{{mg}}</td>
<td>{{uc}}</td>
<td>{{sc}}</td>
<td style color="red"></style>{{buy}}</td>
<td style color="blue"></style>{{amount}}</td>
</tr>
@ -40,8 +36,6 @@
<td></td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td><b>32</b></td>
</tr>
</tfoot>