new patient
parent
d5f07de974
commit
be2a43a37d
|
@ -0,0 +1,5 @@
|
||||||
|
<action>
|
||||||
|
<field name="view_cls">form_view</field>
|
||||||
|
<field name="model">new.patient</field>
|
||||||
|
<field name="menu">clinic_menu</field>
|
||||||
|
</action>
|
|
@ -1,5 +1,5 @@
|
||||||
<action>
|
<action>
|
||||||
<field name="string">HDCase Summary(v2)</field>
|
<field name="string">HDCase Summary</field>
|
||||||
<field name="view_cls">report</field>
|
<field name="view_cls">report</field>
|
||||||
<field name="model">report.hdcase.summary</field>
|
<field name="model">report.hdcase.summary</field>
|
||||||
<field name="report_template">report_hdcase_summary</field>
|
<field name="report_template">report_hdcase_summary</field>
|
||||||
|
|
|
@ -173,4 +173,8 @@
|
||||||
<field name="documents"/>
|
<field name="documents"/>
|
||||||
<field name="comments"/>
|
<field name="comments"/>
|
||||||
</related>
|
</related>
|
||||||
|
<foot>
|
||||||
|
<button string="Dispose" type="danger" action="do_disposte" attrs='{"invisible":[["dispose","=",true]]}'/>
|
||||||
|
<!--<button string="Restore" method="do_restore" icon="repeat" attrs='{"invisible":[["dispose","=",false]]}'/>-->
|
||||||
|
</foot>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<list model="clinic.patient" colors='{"#cfc":[["state","=","confirmed"]],"#dbdbdb":[["state","=","dispose"]]}'>
|
<list model="clinic.patient" colors='{"#cfc":[["state","=","confirmed"]],"#dbdbdb":[["state","=","dispose"]]}'>
|
||||||
|
<top replace="1">
|
||||||
|
<button string="New Patient" action="new_patient"/>
|
||||||
|
</top>
|
||||||
<field name="reg_date"/>
|
<field name="reg_date"/>
|
||||||
<field name="hn_no"/>
|
<field name="hn_no"/>
|
||||||
<field name="trt_no"/>
|
<field name="trt_no"/>
|
||||||
|
|
|
@ -8,8 +8,9 @@
|
||||||
<field name="branch_id" onchange="onchange_branch" span="2"/>
|
<field name="branch_id" onchange="onchange_branch" span="2"/>
|
||||||
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
|
<field name="department_id" domain='[["branch_id","=",branch_id]]' span="2"/>
|
||||||
<field name="state" span="2"/>
|
<field name="state" span="2"/>
|
||||||
<button string='Confirm Visits' method="confirm" type="success" icon="arrow-right"/>
|
<button string='Confirm Visits' method="confirm" type="success" icon="ok"/>
|
||||||
<field name="gen_back" perm="clinic_admin" span="2"/>
|
<field name="gen_back" perm="clinic_admin" span="2"/>
|
||||||
|
<!--
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
@ -19,4 +20,5 @@
|
||||||
</group>
|
</group>
|
||||||
<group span="6" columns="1">
|
<group span="6" columns="1">
|
||||||
</group>
|
</group>
|
||||||
|
-->
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
<form model="new.patient" title="New Patient">
|
||||||
|
<top replace="1">
|
||||||
|
</top>
|
||||||
|
<group attrs='{"invisible": [["state","in",["step2","step3"]]]}'>
|
||||||
|
<field name="name"/>
|
||||||
|
</group>
|
||||||
|
<field name="state" invisible="1"/>
|
||||||
|
<group attrs='{"invisible": [["state","in",["step1","step3"]]]}'>
|
||||||
|
<template>
|
||||||
|
<!--<p>กรุณาเลือกผู้ป่วย (1 คนเท่านั้น) ถ้าไม่มีผู้ป่วยในตารางด้านล่างให้กดปุ่ม Next</p>-->
|
||||||
|
<p>หากผู้ป่วยปรากฎในตารางด้านล่างนั้นหมายความว่าผู้ป่วยเคยอยู่ในระบบมาก่อนแต่ถูกจำหน่ายไป ต้องนำผู้ป่วยเข้ามาใหม่โดยเลือก 1 คน(เท่่านั้น) จากนั้นกดปุ่ม Next</p>
|
||||||
|
<p>หากไม่มีข้อมูลในตารางให้กดปุ่ม Next จากนั้นให้ใส่รายละเอียดผู้ป่วยให้ครบแล้วกดปุ่ม Save</p>
|
||||||
|
</template>
|
||||||
|
<field name="lines" nolabel="1">
|
||||||
|
<list>
|
||||||
|
<field name="choose"/>
|
||||||
|
<field name="patient_id"/>
|
||||||
|
</list>
|
||||||
|
</field>
|
||||||
|
</group>
|
||||||
|
<foot replace="1">
|
||||||
|
<button string="Next" method="step1" states="step1" type="success" icon="arrow-right"/>
|
||||||
|
|
||||||
|
<button string="Back" method="back_step1" states="step2" icon="arrow-left"/>
|
||||||
|
<button string="Next" method="step2" states="step2" type="primary" icon="arrow-right"/>
|
||||||
|
|
||||||
|
<button string="Back" method="back_step2" states="step3" icon="arrow-left"/>
|
||||||
|
<button string="Next" method="step3" states="step3" type="primary" icon="arrow-right"/>
|
||||||
|
</foot>
|
||||||
|
</form>
|
|
@ -149,3 +149,5 @@ from . import create_invoice_payment
|
||||||
from . import report_stock_card
|
from . import report_stock_card
|
||||||
from . import report_receipt_summary
|
from . import report_receipt_summary
|
||||||
from . import report_hdcase_summary
|
from . import report_hdcase_summary
|
||||||
|
from . import new_patient
|
||||||
|
from . import new_patient_line
|
||||||
|
|
|
@ -0,0 +1,123 @@
|
||||||
|
from netforce.model import Model, fields, get_model
|
||||||
|
|
||||||
|
class NewPatient(Model):
|
||||||
|
_name="new.patient"
|
||||||
|
_transient=True
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
'name': fields.Char("Patient Name", required=True),
|
||||||
|
'lines': fields.One2Many("new.patient.line","new_id","Lines"),
|
||||||
|
'state': fields.Selection([['step1','Step1'],['step2','Step2']], 'State'),
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults={
|
||||||
|
'state': 'step1',
|
||||||
|
}
|
||||||
|
|
||||||
|
def find_patient(self, ids, context={}):
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
get_model("new.patient.line").delete([l.id for l in obj.lines])
|
||||||
|
lines=[]
|
||||||
|
cond=[
|
||||||
|
['name','ilike',obj.name],
|
||||||
|
]
|
||||||
|
for patient_id in get_model("clinic.patient").search(cond+[["dispose","=",True]]):
|
||||||
|
vals={
|
||||||
|
'patient_id': patient_id,
|
||||||
|
}
|
||||||
|
lines.append(('create',vals))
|
||||||
|
if not lines:
|
||||||
|
for patient_id in get_model("clinic.patient").search(cond):
|
||||||
|
return {
|
||||||
|
'next': {
|
||||||
|
'name': "clinic_patient",
|
||||||
|
"mode": "form",
|
||||||
|
"active_id": patient_id,
|
||||||
|
},
|
||||||
|
'flash': "ผู้ป่วยนี้มีอยู่แล้วในระบบ",
|
||||||
|
}
|
||||||
|
obj.write({
|
||||||
|
'lines': lines,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
def step1(self, ids, context={}):
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
res=obj.find_patient()
|
||||||
|
if res:
|
||||||
|
return res
|
||||||
|
obj.write({
|
||||||
|
'state': 'step2',
|
||||||
|
})
|
||||||
|
|
||||||
|
def back_step1(self, ids, context={}):
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
obj.write({
|
||||||
|
'state': 'step1',
|
||||||
|
})
|
||||||
|
print("back step1")
|
||||||
|
|
||||||
|
def step2(self, ids, context={}):
|
||||||
|
print("step2")
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
if not obj.lines:
|
||||||
|
res=obj.name.split(" ")
|
||||||
|
fname=''
|
||||||
|
lname=''
|
||||||
|
if len(res)>1:
|
||||||
|
fname=res[0]
|
||||||
|
lname=res[1]
|
||||||
|
else:
|
||||||
|
fname=obj.name
|
||||||
|
return {
|
||||||
|
'next': {
|
||||||
|
'name': 'clinic_patient',
|
||||||
|
'mode': 'form',
|
||||||
|
'defaults': {
|
||||||
|
'first_name': fname,
|
||||||
|
'last_name': lname,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
select_lines=[]
|
||||||
|
for line in obj.lines:
|
||||||
|
if line.choose:
|
||||||
|
select_lines.append(line)
|
||||||
|
if not select_lines:
|
||||||
|
raise Exception("Please choose patient!")
|
||||||
|
if len(select_lines)>1:
|
||||||
|
raise Exception("Can not select patient more than 1!")
|
||||||
|
obj.write({
|
||||||
|
'state': 'step3',
|
||||||
|
})
|
||||||
|
|
||||||
|
def back_step2(self, ids, context={}):
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
obj.write({
|
||||||
|
'state': 'step2',
|
||||||
|
})
|
||||||
|
print("back step2")
|
||||||
|
|
||||||
|
def step3(self, ids, context={}):
|
||||||
|
obj=self.browse(ids)[0]
|
||||||
|
line=[line for line in obj.lines if line.choose][0]
|
||||||
|
patient=line.patient_id
|
||||||
|
patient_id=patient.id
|
||||||
|
location_code=patient.location.split(",")[-1]
|
||||||
|
location_from_id=None
|
||||||
|
for location_id in get_model("clinic.department").search([['code','=',location_code]]):
|
||||||
|
location_from_id=location_id
|
||||||
|
return {
|
||||||
|
'next': {
|
||||||
|
'name': 'clinic_patient_move',
|
||||||
|
'mode': 'form',
|
||||||
|
'defaults': {
|
||||||
|
'patient_id': patient_id,
|
||||||
|
'location_from_id': location_from_id,
|
||||||
|
'state': 'new',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NewPatient.register()
|
|
@ -0,0 +1,17 @@
|
||||||
|
from netforce.model import Model, fields
|
||||||
|
|
||||||
|
class NewPatientLine(Model):
|
||||||
|
_name="new.patient.line"
|
||||||
|
_transient=True
|
||||||
|
|
||||||
|
_fields={
|
||||||
|
'new_id': fields.Many2One("new.patient","New", required=True, on_delete="cascade"),
|
||||||
|
"choose": fields.Boolean("Choose"),
|
||||||
|
"patient_id": fields.Many2One("clinic.patient","Patient"),
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults={
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NewPatientLine.register()
|
|
@ -13,8 +13,8 @@ class PatientMove(Model):
|
||||||
_fields={
|
_fields={
|
||||||
'patient_id': fields.Many2One('clinic.patient','Patient',search=True),
|
'patient_id': fields.Many2One('clinic.patient','Patient',search=True),
|
||||||
'date': fields.Date("Date", required=True,search=True),
|
'date': fields.Date("Date", required=True,search=True),
|
||||||
'location_from_id': fields.Many2One("clinic.department","Location From",search=True),
|
'location_from_id': fields.Many2One("clinic.department","Location From",search=True,required=True),
|
||||||
'location_to_id': fields.Many2One("clinic.department","Location To",search=True),
|
'location_to_id': fields.Many2One("clinic.department","Location To",search=True,required=True),
|
||||||
"state": fields.Selection([['normal','Normal'],['new','New'],['dispose','Dispose']], "State"),
|
"state": fields.Selection([['normal','Normal'],['new','New'],['dispose','Dispose']], "State"),
|
||||||
'note': fields.Text("Note",search=True),
|
'note': fields.Text("Note",search=True),
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,12 +74,25 @@ class ReportHDCaseSummaryV2(Model):
|
||||||
year_thai=utils.date2thai(month, lang='th_TH').split("-")[0]
|
year_thai=utils.date2thai(month, lang='th_TH').split("-")[0]
|
||||||
month_thai=utils.MONTHS['th_TH'][int(crr_month)]
|
month_thai=utils.MONTHS['th_TH'][int(crr_month)]
|
||||||
|
|
||||||
|
context['defaults']={
|
||||||
|
'date': date_from,
|
||||||
|
'date_from': date_from,
|
||||||
|
'date_to': date_to,
|
||||||
|
'branch_id': branch_id,
|
||||||
|
'department_id': department_id,
|
||||||
|
}
|
||||||
|
medicals=get_model("clinic.report.medical.summary").get_report_data(ids=[],context=context)
|
||||||
|
medical_lines=medicals['lines']
|
||||||
|
medical_titles=medicals['titles']
|
||||||
|
|
||||||
data={
|
data={
|
||||||
'company_name': company.name,
|
'company_name': company.name,
|
||||||
'department_name': department.name,
|
'department_name': department.name,
|
||||||
'month_thai': month_thai,
|
'month_thai': month_thai,
|
||||||
'year_thai': year_thai,
|
'year_thai': year_thai,
|
||||||
'total_hdcase': len(hdcase_ids),
|
'total_hdcase': len(hdcase_ids),
|
||||||
|
'medicals': medical_lines,
|
||||||
|
'titles': medical_titles,
|
||||||
}
|
}
|
||||||
data2=get_model("clinic.patient.move").get_data(date=month, department_id=department_id)
|
data2=get_model("clinic.patient.move").get_data(date=month, department_id=department_id)
|
||||||
data.update(data2)
|
data.update(data2)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
</style>
|
</style>
|
||||||
<center>
|
<center>
|
||||||
<h2>
|
<h2>
|
||||||
HDCase Summary (V2)
|
HDCase Summary
|
||||||
</h2>
|
</h2>
|
||||||
<h3>
|
<h3>
|
||||||
{{company_name}}
|
{{company_name}}
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
{{#each current_items}}
|
{{#each current_items}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{no}}</td>
|
<td>{{no}}</td>
|
||||||
<td>{{date_move}}</td>
|
<td>{{date}}</td>
|
||||||
<td>{{patient_id.1.}}</td>
|
<td>{{patient_id.1.}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
{{#each dispose_items}}
|
{{#each dispose_items}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{no}}</td>
|
<td>{{no}}</td>
|
||||||
<td>{{date_move}}</td>
|
<td>{{date}}</td>
|
||||||
<td>{{patient_id.1.}}</td>
|
<td>{{patient_id.1.}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
@ -84,3 +84,32 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<center>
|
||||||
|
<h3>
|
||||||
|
รวมจำนวนยาที่ใช้ประจำเดือน
|
||||||
|
</h3>
|
||||||
|
</center>
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
{{#each titles}}
|
||||||
|
<th>{{name}}</th>
|
||||||
|
{{/each}}
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each medicals}}
|
||||||
|
<tr>
|
||||||
|
<td style="width:20%;">
|
||||||
|
<a href="/ui#name=product&active_id={{prod_id}}&mode=form"> {{prod_name}} </a>
|
||||||
|
</td>
|
||||||
|
{{#each sub_lines}}
|
||||||
|
<td style="text-align:center">
|
||||||
|
<a href="/ui#name=clinic_report_medical_detail&defaults.date_from={{time_start}}&defaults.date_to={{time_stop}}&defaults.types={{types}}&defaults.product_id={{product_id}}&defaults.product_categ_id={{product_categ_id}}&defaults.report_type={{../../report_type}}">{{qty}} </a>
|
||||||
|
</td>
|
||||||
|
{{/each}}
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue