初始化单项流程

1.1初始化单项InitSynExamItem,

sfjy00:0单项启用
sfjy00:1单项禁用

同步单项

  1. select * from TBL_ITEM_V
  2. 转指定耗材
  3. select KEYNAME from tbl_handlelog where BUSCODE='CONITEMTOMATERIAL' and status=0

1.2初始化科室和单项的关系InitDepartmentExamItemRelation

  1. select BMBH00 as hisDepartmentId,concat(BMMC00,BMBH00) as departmentName, (select WM_CONCAT(SQXMID) as myhisItemIds from HM_ZD_TJSQXM where SFJY00=0
  2. and SFJCXM=1 and SFKSID=BMBH00) as myhisItemIds,0 as operateType from PT_BMBM00 where YXBZ00=1

1.3初始化分类和单项的关系 InitSpeciesExamItemRelation

  1. select KDFLID as hisSpeciesId,FLMC00 as speciesName,(select WM_CONCAT(SQXMID) as myhisItemIds from HM_ZD_TJSQXM where SFJY00=0
  2. and SFJCXM=1 and KDFLID=HM_ZD_KDFL00.KDFLID) as myhisItemIds,0 as operateType from HM_ZD_KDFL00 where YXBZ00=1

1.4初始化单项关系InitExamItemRelation

  1. select sqxmid as hisItemId,(select WM_CONCAT(a.dcxmid) as myrelationHisItemIds from HM_ZD_SQXMDC a inner join HM_ZD_TJSQXM b on a.dcxmid=b.sqxmid and b.SFJY00=0 and b. SFJCXM=1
  2. where a.sqxmid=HM_ZD_TJSQXM.SQXMID) as myrelationHisItemIds,3 as relationType from HM_ZD_TJSQXM where SFJY00=0 and SFJCXM=1 and SQXMID in(select SQXMID from HM_ZD_SQXMDC where DCXMID
  3. in (select sqxmid from HM_ZD_TJSQXM where SFJY00=0 and SFJCXM=1))
  4. union all
  5. select sqxmid as hisItemId,(select WM_CONCAT(a.CTXMID) as myrelationHisItemIds from HM_ZD_KDXMCT a inner join HM_ZD_TJSQXM b on a.CTXMID=b.sqxmid and b.SFJY00=0 and b. SFJCXM=1
  6. where a.sqxmid=HM_ZD_TJSQXM.SQXMID) as myrelationHisItemIds,2 as relationType from HM_ZD_TJSQXM where SFJY00=0 and SFJCXM=1 and SQXMID in(select SQXMID from HM_ZD_KDXMCT where CTXMID
  7. in (select sqxmid from HM_ZD_TJSQXM where SFJY00=0 and SFJCXM=1))
  8. union all
  9. select sqxmid as hisItemId,(select WM_CONCAT(a.ZXMID0) as myrelationHisItemIds from HM_ZD_SQDXGL a inner join HM_ZD_TJSQXM b on a.ZXMID0=b.sqxmid and b.SFJY00=0 and b. SFJCXM=1
  10. where a.ZHXMID=HM_ZD_TJSQXM.SQXMID) as myrelationHisItemIds,4 as relationType from HM_ZD_TJSQXM where SFJY00=0 and SFJCXM=1 and SQXMID in(select ZHXMID from HM_ZD_SQDXGL where ZXMID0
  11. in (select sqxmid from HM_ZD_TJSQXM where SFJY00=0 and SFJCXM=1))

1.6初始化耗材的分组InitMaterialGroup

  1. select TXMQZ0 as hisMaterialGroupId,TXMMC0 as groupName,1 as operationType from HM_ZD_TXMLB0 where YXBZ00=1

1.7初始化耗材和分组的关系InitMaterialAndGroupRelation

  1. select hisMaterialGroupId,myhisItemMaterialIds from (
  2. select TXMQZ0 as hisMaterialGroupId,(select WM_CONCAT(SQXMID) from HM_ZD_TJSQXM where TMQZ00=HM_ZD_TXMLB0.TXMQZ0 and SFJY00=0 and SFJCXM=0) as myhisItemMaterialIds
  3. from HM_ZD_TXMLB0 where YXBZ00=1 ) where myhisItemMaterialIds is not null

根据数据库版本,如果不支持会切换成下面语句

  1. select hisMaterialGroupId,myhisItemMaterialIds from (
  2. select TXMQZ0 as hisMaterialGroupId,(select (listagg(SQXMID,',') within group(order by SQXMID)) from HM_ZD_TJSQXM where TMQZ00=HM_ZD_TXMLB0.TXMQZ0 and SFJY00=0 and SFJCXM=0) as myhisItemMaterialIds from HM_ZD_TXMLB0 where YXBZ00=1 ) where myhisItemMaterialIds is not null

1.8初始化单项与耗材关系数据InitMaterialAndExamItemRelation

  1. select a.sqxmid as hisItemId,a.dcxmid as hisItemMaterialId,b.tmqz00 as hisMaterialGroupId
  2. from HM_ZD_SQXMDC a inner join HM_ZD_TJSQXM b on a.dcxmid=b.sqxmid and b.SFJY00 =0 and b.SFJCXM=0

单项关联耗材,耗材关联分组,只有在同一个分组的耗材,在添加套餐时,该分组下的耗材仅会出现一次


文档更新时间: 2023-08-10 20:28