Browse Source

Merge remote-tracking branch 'origin/dev/20210326_2.0.3' into dev/20210326_2.0.3

zhanghang 4 years ago
parent
commit
2f4720c29d
1 changed files with 27 additions and 0 deletions
  1. 27 0
      src/main/resources/mapper/BehospitalInfoMapper.xml

+ 27 - 0
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -714,6 +714,33 @@
         order by b.order_no, a.order_no;
         order by b.order_no, a.order_no;
     </select>
     </select>
 
 
+    <!--获取同期管理人员实际工作月数明细-->
+    <select id="getManageMouth"  parameterType="com.diagbot.vo.FilterVO" resultType="java.util.Map">
+       select
+    sum(case when b.department = 1 or b.department = 2 then IFNULL(firDate,0)+ IFNULL(secDate,0)+ IFNULL(thrcDate,0)+
+    IFNULL(fouDate,0) end)/30 as firNum,
+    sum(case when b.department = 0 or b.department = 2 then IFNULL(firDate,0)+ IFNULL(secDate,0)+ IFNULL(thrcDate,0)+
+    IFNULL(fouDate,0) end)/30 as secNum,
+    sum(case when b.position = 2 then IFNULL(firDate,0)+ IFNULL(secDate,0)+ IFNULL(thrcDate,0)+ IFNULL(fouDate,0) end)
+    /30 as thrNum
+    from (
+       SELECT
+       a.department,
+       a.position,
+        sum(case when <![CDATA[a.hire_date>#{startDate}]]> and  <![CDATA[a.resignation_time<#{endDate}]]>
+        THEN TIMESTAMPDIFF(day,a.hire_date,a.resignation_time) END) as firDate,
+         sum( case when <![CDATA[a.hire_date<#{startDate}]]> and  <![CDATA[a.resignation_time<#{endDate}]]>
+        THEN TIMESTAMPDIFF(day,#{startDate},a.resignation_time) END) as secDate,
+          sum(case when <![CDATA[a.hire_date>#{startDate}]]> and  <![CDATA[a.resignation_time>#{endDate}]]>
+        THEN TIMESTAMPDIFF(day,a.hire_date,#{endDate}) END) as thrcDate,
+        sum(case when <![CDATA[a.hire_date<#{startDate}]]> and  <![CDATA[a.resignation_time>#{endDate}]]>
+        THEN TIMESTAMPDIFF(day,#{startDate},#{endDate}) END) as fouDate
+        FROM `med_management_info` a
+        where a.is_deleted = 'N'
+        group by a.department,a.position
+        )b
+    </select>
+
     <!-- 各科室缺陷占比-全院-首页 -->
     <!-- 各科室缺陷占比-全院-首页 -->
     <select id="entryByDept" parameterType="com.diagbot.vo.FilterVO"
     <select id="entryByDept" parameterType="com.diagbot.vo.FilterVO"
             resultType="com.diagbot.dto.NumDTO">
             resultType="com.diagbot.dto.NumDTO">