04 กรกฎาคม 2560

คำสั่ง mysql เกี่ยวกับ ระบบงานห้องคลอด

1.เลขที่ หนังสือรับรองการเกิด
document_born_id
select * from serial where name like "%born%"
select document_born_id from ipt_labour_infant where ipt_labour_id = 274


2. mysql ดึงข้อมูล หนังสือรับรองการเกิด

select ili.sex, ili.birth_date, ili.birth_time, concat(p.pname,p.fname," ",p.lname)  as mother_name,a.hn as mother_hn, a.age_y as mother_age, p.cid as mother_cid,
il.g-1+ip.child_count as child_no, il.l+1 as living_child, il.a, ili.hn, ili.labour_doctor, ip.ga,ili.birth_weight, ili.document_born_id,
concat(pt.pname,pt.fname) as infant_name, pt.lname as infant_lname, pt.cid as infant_cid, na.name as infant_citizenship,
if(pt.sex is null,ili.sex,pt.sex) as infant_sex, if(pt.fathername is null,concat(p.spsname," ",p.spslname),concat("นาย",pt.fathername," ",pt.fatherlname)) as father_name, pt.father_cid,
ili.ipt_labour_id, ip.deliver_type, ip.deliver_abnormal_type, ldat.labour_deliver_abnormal_name, ip.child_count

from ipt_labour_infant ili
join ipt_labour il on il.ipt_labour_id = ili.ipt_labour_id
join ipt_pregnancy ip on ip.an = il.an
join ipt i on i.an = il.an
join an_stat a on a.an=i.an
join patient p on p.hn = i.hn
left join patient pt on pt.hn=ili.hn
left join nationality na on na.nationality=pt.citizenship
left join labour_deliver_abnormal_type ldat on ldat.labour_deliver_abnormal_type=ip.deliver_abnormal_type
where ili.ipt_labour_infant_id = "221"
อ้างอิง : http://jda-memo.blogspot.com/2017/02/mysql.html?view=magazine

คำสั่ง Update patient ของ รพ.

 UPDATE patient SET type_area = "4"  WHERE chwpart = "31" AND amppart = "11" AND tmbpart = "02"  AND...