dropviewifexists v_follow_up;createview v_follow_up(物理主键,病人号,住院流水号,姓名,性别,年龄,手机,民族,职业,联系人姓名,联系人关系,联系人电话,主治医生,出院科室,出院日期,治疗方式,治疗药物)asselect a.BASE_ID,a.PATIENT_ID,a.INP_NO,a.NAME,a.SEX_NAME,a.AGE_YEAR,a.PATIENT_TEL,a.NATION_NAME,a.OCCUP_NAME,a.CONTACT_NAME,a.RELATION_NAME,a.CONTACT_TEL,a.ATTEND_DOCT_NAME,a.OUTHOS_DEPT_NAME,a.OUTHOS_DTIME,b.OPS_NAME,c.ITEM_NAME from(S_MRS_BASE as a innerjoin S_MRS_OPS as b on a.PATIENT_ID = b.PATIENT_ID)innerjoin S_INH_ORDER as c on a.PATIENT_ID = c.PATIENT_ID
where(b.OPS_NAME like"%起%"or b.OPS_NAME like"%消%"or b.OPS_NAME like"%封%")and(c.ITEM_NAME like"%华法%"or c.ITEM_NAME like"%达比%"or c.ITEM_NAME like"%拜瑞%");
触发器
CREATETRIGGER demo AFTERINSERTON home_view FOR EACH ROWBEGINupdate home_view set mobile=nullwhere mobile='NULL';END
触发器修改本表中的出生日期,数字转日期字符串:
DELIMITER||CREATETRIGGER convert_birth_date BEFORE INSERTON test FOR EACH ROWBEGINset new.birth_date =(select date_add('1840-12-31',interval new.birth_date day));END||DELIMITER;
mysql视图,触发器,存储过程日常积累视图触发器视图drop view if exists v_follow_up;create view v_follow_up(物理主键,病人号,住院流水号,姓名,性别,年龄,手机,民族,职业,联系人姓名,联系人关系,联系人电话,主治医生,出院科室,出院日期,治疗方式,治疗药物) as select a.BASE_ID,a.PATIENT_ID,a.I...