ข้อมูล OPD

Update Delete

ID732
Parent ID46
Table Nameopdcard
Titleข้อมูล OPD
Description
Script#SQL_OPTIONS#
PROVIDERS=1
PROVIDER1=HOSXP

PROVIDER1_VALIDATE_TABLES=person_anc_service,ovst,ovst_seq
SCRIPT_FLOW=SQL
#SQL_OPTIONS#

#PROVIDER1_SQL#


SET @provcode = :provcode;
SET @rep_year = :rep_year;
SET @hoscode = :hoscode;
SET @hosname = :hosname;
SET @hostype = :hostype;
SET @address = :address;
SET @subdistcode = :subdistcode;
SET @distcode = :distcode;
SET @level_service = :level_service;

/*SQL Script สำหรับ HOSxP เริ่มที่นี่ */
select
(select hospitalcode from opdconfig ) as hospcode ,
d1.doctor_order_print_code,d1.vn,d1.patient_name,d1.drug_name,d1.qty_name,d1.line1,d1.line2,d1.line3,d1.line4,d1.shortlist
,d1.hn,d1.item_price,d1.qty_int ,d1.patient_age,d1.patient_pttype_name,d1.patient_address,d1.doctor_name,d1.diagnosis_name,d1.patient_type
,v1.vstdate,v1.hospmain,v1.hospsub ,v1.pttypeno ,v1.accident_code ,v1.sex,v1.age_y,v1.age_m,v1.age_d,v1.aid,v1.pttype,v1.income ,v1.paid_money
,v1.remain_money,v1.uc_money,v1.item_money,v1.spclty,v1.pdx,v1.op0,v1.op1,v1.op2,v1.op3,v1.op4,v1.op5,
o1.diag_text
,s.bpd,s.bps,s.bw,s.height,s.cc ,s.hr,s.pe,s.pulse,s.temperature,s.rr ,s.cc_begin_date,s.cc_cause_of_visit,s.cc_sign,s.cc_duration,s.cc_position,cc_note
,s.his_begin_date,s.his_frequency,s.his_severity,s.his_cause,s.his_expand,s.his_cause_increase,s.his_cause_decrease,s.screen_dep
,s.pe_ga ,s.pe_heent,s.pe_heart,s.pe_lung,s.pe_ab,s.pe_ext,s.pe_neuro
,s.pe_ga_text,s.pe_heent_text,s.pe_heart_text,s.pe_lung_text,s.pe_ab_text,s.pe_ext_text,s.pe_neuro_text
,s.bmi,s.tg,s.hdl,s.glucurine,s.blank1,s.bun,s.creatinine,s.ua,s.hba1c,s.riskdm,s.skin_color,s.found_amphetamine,s.pregnancy,s.advice7_note,s.er_note,s.checkup,s.found_allergy
,s.hpi
,s.pmh,s.fh,s.sh,s.ros,s.tc,s.ldl,s.ast,s.alt,s.symptom,s.walk_id
,s.peak_flow,s.cholesterol
,s.waist,s.advice8,s.breast_feeding,s.cradle_lie
,s.pain_score,s.pefr,s.opdscreen_patient_type_id,s.creatinine_kidney_percent,s.sodium,s.chloride,s.potassium,s.tco2,s.smoking_type_id,s.drinking_type_id,
s.pulse_regulation_type_id,s.spo2,s.urine_albumin,s.urine_creatinine,s.pefr_percent,s.macro_albumin,s.micro_albumin,s.egfr,s.hb,
s.upcr,s.bicarb,s.phosphate,s.pth,s.pe_gy,s.pe_gy_text,s.pe_gu,s.pe_gu_text,s.bsa,s.pe_head,s.pe_head_text,s.pe_skin,s.pe_skin_text,s.g6pd,s.pe_rtf,s.o2sat,
s.pe_pv,s.pe_pv_text,s.pe_pr,s.pe_pr_text,s.pe_gen,s.pe_gen_text,s.pre_pain_score,s.post_pain_score,s.head_cricumference,s.fev1_percent,s.pe_rtf_blob,
s.bp_stable,s.pe_chest,s.pe_chest_text,
pe.*,
oa.*,
p.drugallergy,p.clinic,p.nationality,p.hometel as pt_tel,
p2.pttype as pttype_pttype,p2.name as pttype_name,p2.pcode as pttype_pcode,
p2.requirecode as pttype_requirecode,p2.require_hcode as pttype_require_hcode,
concat(if(d1.patient_address is null,'',d1.patient_address),' â·Ã. ',
if((p.hometel is null or p.hometel = ''),' - ',p.hometel)) as patient_address_tel,
oo.observe_id,oo.send_date_time as observe_intime,oo.leave_date_time as observe_outtime,
oo.symptom as observe_symptom,oo.nurse_activity as observe_activity,oo.note as observe_note,
oo.ward as observe_ward,pp.name as pt_priority_name,pw.name as pt_walk_name,
concat(help3_icode,' # ',if(help3_qty is null,'',help3_qty)) as help3_drug_name
,x1.vn as xray_vn
/*from doctor_order_print d1
left outer join ovst o1 on o1.vn = d1.vn */
from ovst o1
left outer join doctor_order_print d1 on o1.vn = d1.vn
left outer join vn_stat v1 on v1.vn = o1.vn
left outer join opdscreen s on s.vn = o1.vn
left outer join pe_image pe on pe.vn = o1.vn
left outer join opd_observe oo on oo.vn = o1.vn
left outer join oapp oa on oa.vn = o1.vn
left outer join patient p on p.hn = o1.hn
left outer join xray_head x1 on x1.vn = o1.vn
left outer join pttype p2 on p2.pttype = v1.pttype
left outer join pt_priority pp on pp.id = o1.pt_priority
left outer join pt_walk pw on pw.walk_id = s.walk_id
where o1.vstdate between '2016-10-01' and '2017-01-31'
;
/*SQL Script สำหรับ HOSxP สิ้นสุดที่นี่ */


#PROVIDER1_SQL#


Script Cron
Force Script Cron0
Active1
Client Office Type
Create Date2016-12-14 02:11:00
Last Update2017-02-10 11:07:59