订单数据同步
  • 表结构
    1. insert into tbl_order_new
    2. (
    3. ordernum , name , gender, age , birthday,
    4. idcard , marriagestatus, mobile , onlinepaymoney, hiscompid ,
    5. hiscompname, myexamdate, upload, inserttime , uploadtime,
    6. hisexamineenum, ordermoney, examperiod, address , mealclassifyname ,
    7. receiptstatus, handlereceipttime , arrivalstatus, handlearrivaltime,healthnum,
    8. healthlevel, employeeid, department, addaccounttype, ordercreatetime,
    9. remark, examcompany, companyid, offlinepaymoney, vip,
    10. mymealid , mealname, paytype, guidestatus, handleguidetime)
    11. select
    12. ORDER_NUM,NAME,GENDER,AGE,BIRTHDAY,
    13. IDCARD,MARRIAGE_STATUS,MOBILE,ONLINE_PAY_MONEY,HIS_COMPANY_CODE,
    14. HIS_COMPANY_NAME,'','',IMPORT_TIME,'',
    15. HIS_BM,ORDER_MONEY,'','','',
    16. 0,'',0,'',HEALTH_NUM,
    17. HEALTH_LEVEL,WORKNO,DEPARTMENT,'',IMPORT_TIME,
    18. REMARK,EXAM_COMPANY_NAME,EXAM_COMPANY_CODE,OFFLINE_PAY_MONEY,IS_VIP,
    19. MEAL_CODE,MEAL_NAME,FEE_TYPE,0,''
    20. from tbl_order where rownm<2

  1. insert into tbl_order_new_item
  2. ( ordernum ,hisid,originalprice,price,typetomeal)
  3. select
  4. b.order_num,ITEM_CODE,ITEM_INIT_PRICE,ITEM_DISCOUNT_PRICE,
  5. case ITEM_TYPE when '套餐项目' then 1 when '增加' then 3 else 2 end as typetomeal
  6. from tbl_order_item a left join tbl_order b on a.order_id = b.id where b.order_num in (select ordernum from tbl_order_new)

  • 存储过程
    升级
文档更新时间: 2023-05-05 14:26