Bläddra i källkod

1.修改药品自动映射sql

zjh 2 år sedan
förälder
incheckning
86c99537de

BIN
cbkj_web_parameter/src/main/java/com/jiuzhekan/cbkj/beans/drug/TMaterialStandVO.java


BIN
cbkj_web_parameter/src/main/java/com/jiuzhekan/cbkj/controller/drug/BMaterialController.java


BIN
cbkj_web_parameter/src/main/java/com/jiuzhekan/cbkj/controller/drug/TCenterHisMappingController.java


BIN
cbkj_web_parameter/src/main/java/com/jiuzhekan/cbkj/controller/drug/TDrugListController.java


+ 1 - 1
cbkj_web_parameter/src/main/resources/mappers/drug/TAppMaterialMappingMapper.xml

@@ -54,7 +54,7 @@
         FROM t_material_price tmp
                  JOIN t_material AS tm2 ON ( tm2.status = '1' AND tm2.is_del='0' AND tm2.mat_id = tmp.mat_id )
                  LEFT JOIN b_material m ON m.k_mat_name = substring_index(substring_index(substring_index(substring_index(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(REPLACE(tm2.mat_name,'【配送】',''),'5',''),'1',''),'*',''),'d',''),'K',''),'G',''),'P',''),'Z',''),'配方颗粒',''),'颗粒',''),'(',1),'(',1),'[',1),'<',1)
-                 LEFT JOIN t_app_material_mapping p ON p.mat_price_id = tmp.mat_price_id
+                 LEFT JOIN t_app_material_mapping p (ON p.mat_price_id = tmp.mat_price_id and p.k_mat_id=m.k_mat_id)
         WHERE tm2.is_del = '0' and tm2.drug_id = #{drugId} AND p.mat_price_id IS NULL AND m.k_mat_id IS NOT NULL
     </insert>
 

+ 1 - 1
cbkj_web_parameter/src/main/resources/mappers/drug/TCenterHisMappingMapper.xml

@@ -62,7 +62,7 @@
             m.mat_name = substring_index(substring_index(substring_index(substring_index(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(REPLACE(tm2.mat_name,'【配送】',''),'5',''),'1',''),'*',''),'d',''),'K',''),'G',''),'P',''),'Z',''),'配方颗粒',''),'颗粒',''),'(',1),'(',1),'[',1),'&lt;',1)
             )
             left join t_drug_list as tdl on( tdl.drug_id=m.drug_id and tdl.drug_type='1' )
-            LEFT JOIN t_center_his_mapping p ON p.mat_price_id = tmp.mat_price_id
+            LEFT JOIN t_center_his_mapping p ON (p.mat_price_id = tmp.mat_price_id and p.mat_price_id_his=tmp2.mat_price_id)
         WHERE  tm2.drug_id = #{drugId} AND p.mat_price_id IS NULL AND m.mat_id IS NOT NULL
     </insert>
 

+ 11 - 5
cbkj_web_parameter/src/main/resources/mappers/drug/TStandardMaterialMappingMapper.xml

@@ -85,6 +85,10 @@
 
     <resultMap id="BaseResultMap2" type="com.jiuzhekan.cbkj.beans.drug.TMaterialStandVO">
         <id column="matId" jdbcType="VARCHAR"  property="matId" />
+        <id column="sMatCode" jdbcType="VARCHAR"  property="sMatCode" />
+        <id column="sMatName" jdbcType="VARCHAR"  property="sMatName" />
+        <id column="sId" jdbcType="VARCHAR"  property="sId" />
+        <id column="mapId" jdbcType="VARCHAR"  property="mapId" />
 
     </resultMap>
 
@@ -101,20 +105,22 @@
         tm2.drug_id as drugId
         FROM
         t_drug_list AS tdl
-        LEFT JOIN t_pharmacy AS tp ON(tdl.drug_id = tp.drug_id and tp.status = '1')
         JOIN t_material AS tm2 ON (tm2.drug_id = tdl.drug_id AND tm2.status = '1' and tm2.is_del='0')
         LEFT JOIN t_standard_material_mapping AS tsmm ON(tsmm.drug_id = tm2.drug_id AND tsmm.mat_id = tm2.mat_id AND tsmm.s_mat_type='2')
         LEFT JOIN b_standard_mat AS bsm ON(bsm.s_id=tsmm.s_id AND bsm.s_mat_type='2')
         <where>
             tdl.status='1' and tdl.drug_type='0'
+            <if test=" drugId !=null and drugId !=''">
+                 and tdl.drug_id = #{drugId}
+            </if>
             <if test=" isMapping == 1">
-                 and bsm.s_id is not null
+                and bsm.s_id is not null
             </if>
             <if test=" isMapping == 2">
                  and bsm.s_id is null
             </if>
-            <if test=" phaType != null and phaType !=''">
-                and tp.pha_type =#{phaType}
+            <if test=" matClass != null and matClass !=''">
+                 and tm2.mat_class = #{matClass}
             </if>
             <if test=" keyWord != null and keyWord !=''">
                 and (tm2.mat_name like CONCAT('%',trim(#{keyWord}),'%') or tm2.mat_standard like CONCAT('%',trim(#{keyWord}),'%') )
@@ -156,7 +162,7 @@ group by tm2.mat_id
                #{createUserName}
         FROM t_material mx
                  LEFT JOIN b_standard_mat m ON  m.s_mat_type='2' and m.s_mat_name = substring_index(substring_index(substring_index(substring_index(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(REPLACE(mx.mat_name,'【配送】',''),'5',''),'1',''),'*',''),'d',''),'K',''),'G',''),'P',''),'Z',''),'配方颗粒',''),'颗粒',''),'(',1),'(',1),'[',1),'&lt;',1)
-                 LEFT JOIN t_standard_material_mapping p ON p.mat_id = mx.mat_id
+                 LEFT JOIN t_standard_material_mapping p ON (p.mat_id = mx.mat_id AND p.s_id=m.s_id)
         WHERE mx.is_del = '0' and mx.drug_id = #{drugId} AND p.mat_id IS NULL AND m.s_id IS NOT NULL
 
     </insert>