Commit 1e4cababc3a1f75af6d2b0a46ecbdb0c6bff6059

Authored by jiangjiazhi

Merge remote-tracking branch 'origin/master'

Showing 9 changed files

platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/CouponMapper.java View file @ 1e4caba
... ... @@ -57,7 +57,7 @@
57 57  
58 58 Map<String,Object> findHospitalName(Map<String, Object> param);
59 59  
60   - String findUserName(String prodDoctor);
  60 + String findUserName(String userId);
61 61  
62 62 String findPhone(String s);
63 63  
... ... @@ -74,5 +74,11 @@
74 74 List<Map<String, Object>> findHospitalNames(List<String> ids);
75 75  
76 76 Map<String,Object> findHospitalSendInfo(Map<String, Object> param);
  77 +
  78 + List<Map<String,Object>> couponInfo(Map<String, Object> param);
  79 +
  80 + List<String> findCouponTitleByTemp(Map<String, Object> param);
  81 +
  82 + List<Map<String,Object>> findUserSendInfo(Map<String, Object> param);
77 83 }
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml View file @ 1e4caba
... ... @@ -299,7 +299,27 @@
299 299 select phone from users where id = #{id}
300 300 </select>
301 301  
302   - <select id="findCouponInfo" parameterType="map" resultType="map">
  302 + <select id="couponInfo" parameterType="map" resultType="map">
  303 + select a.used_hospital_id, c.type, b.coupon_order, a.sequence_id, d.name as send_hospital, a.use_date, a.used_id
  304 + from coupon_info a, coupon_template b, coupon_type c, organization d
  305 + where a.coupon_template_id = b.id and b.type_id = c.id and a.create_hospital_id = d.id
  306 + and a.used_hospital_id in
  307 + <foreach collection="hospitalId" open="(" close=")" separator="," item="hid">
  308 + #{hid}
  309 + </foreach>
  310 + and c.type in
  311 + <foreach collection="couponType" open="(" close=")" separator="," item="type">
  312 + #{type}
  313 + </foreach>
  314 + <if test="startDate != null">
  315 + and a.use_date >= #{startDate}
  316 + </if>
  317 + <if test="endDate != null">
  318 + and a.use_date <![CDATA[ < ]]> #{endDate}
  319 + </if>
  320 + limit #{currentPage},#{pageSize}
  321 + </select>
  322 + <!-- <select id="findCouponInfo" parameterType="map" resultType="map">
303 323 select c.type, a.sequence_id, d.name, e.name as send_hospital, a.use_date, a.used_id, b.coupon_order
304 324 from coupon_info a, coupon_template b, coupon_type c, users d, organization e, hospital_coupon_template_group f
305 325 where a.coupon_template_id = b.id and b.type_id = c.id and a.user_id = d.id and a.status=2 and a.create_hospital_id = e.id
306 326  
... ... @@ -321,26 +341,27 @@
321 341 and f.coupon_template_group_id = #{tempId}
322 342 </if>
323 343 limit #{currentPage},#{pageSize}
324   - </select>
  344 + </select>-->
325 345  
326 346 <select id="findCouponInfoCount" parameterType="map" resultType="integer">
327 347 select count(1) from (
328   - select c.type, a.sequence_id, d.name
329   - from coupon_info a, coupon_template b, coupon_type c, users d, organization e, hospital_coupon_template_group f
330   - where a.coupon_template_id = b.id and b.type_id = c.id and a.user_id = d.id and a.status=2 and a.create_hospital_id = e.id
331   - and a.used_hospital_id = #{hospitalId} and f.hospital_id = a.used_hospital_id and c.type in
332   - <foreach collection="couponType" open="(" close=")" separator="," item="type">
333   - #{type}
334   - </foreach>
335   - <if test="startDate != null">
336   - and a.create_date >= #{startDate}
337   - </if>
338   - <if test="endDate != null">
339   - and a.create_date <![CDATA[ < ]]> #{endDate}
340   - </if>
341   - <if test="tempId != null and tempId != ''">
342   - and f.coupon_template_group_id = #{tempId}
343   - </if>
  348 + select a.used_hospital_id, c.type, b.coupon_order, a.sequence_id, d.name as send_hospital, a.use_date, a.used_id
  349 + from coupon_info a, coupon_template b, coupon_type c, organization d
  350 + where a.coupon_template_id = b.id and b.type_id = c.id and a.create_hospital_id = d.id
  351 + and a.used_hospital_id in
  352 + <foreach collection="hospitalId" open="(" close=")" separator="," item="hid">
  353 + #{hid}
  354 + </foreach>
  355 + and c.type in
  356 + <foreach collection="couponType" open="(" close=")" separator="," item="type">
  357 + #{type}
  358 + </foreach>
  359 + <if test="startDate != null">
  360 + and a.use_date >= #{startDate}
  361 + </if>
  362 + <if test="endDate != null">
  363 + and a.use_date <![CDATA[ < ]]> #{endDate}
  364 + </if>
344 365 ) a
345 366 </select>
346 367  
... ... @@ -369,6 +390,43 @@
369 390 <foreach collection="list" open="(" close=")" separator="," item="hid">
370 391 #{hid}
371 392 </foreach>
  393 + </select>
  394 +
  395 + <select id="findCouponTitleByTemp" parameterType="map" resultType="string">
  396 + select concat(b.type, "_", a.coupon_order)
  397 + from coupon_template a, coupon_type b, (
  398 + select distinct(b.coupon_template_group_id)
  399 + from organization a, hospital_coupon_template_group b
  400 + where a.id = b.hospital_id
  401 + and b.coupon_template_group_id = #{tempId}
  402 + and a.id in
  403 + <foreach collection="hospitalId" open="(" close=")" separator="," item="hid">
  404 + #{hid}
  405 + </foreach>
  406 + <if test="provinceId != null and provinceId != ''">
  407 + and a.province_id = #{provinceId}
  408 + </if>
  409 + <if test="cityId != null and cityId != '' ">
  410 + and a.city_id = #{cityId}
  411 + </if>
  412 + <if test="areaId != null and areaId != ''">
  413 + and a.area_id = #{areaId}
  414 + </if>
  415 + ) c
  416 + where a.type_id = b.id
  417 + and a.group_id = c.coupon_template_group_id
  418 + and b.type in
  419 + <foreach collection="couponType" open="(" close=")" separator="," item="type">
  420 + #{type}
  421 + </foreach>
  422 + </select>
  423 +
  424 + <select id="findUserSendInfo" parameterType="map" resultType="map">
  425 + select a.user_id, a.create_date, e.name as username, d.name as send_hospital, f.name as doctoer_name
  426 + from
  427 + coupon_info a, coupon_template b, coupon_type c, organization d, users e, users f
  428 + where a.coupon_template_id = b.id and b.type_id = c.id
  429 + and a.create_hospital_id = d.id and a.user_id = e.id and a.create_user_id = f.id
372 430 </select>
373 431 </mapper>
platform-biz-service/src/main/resources/mainOrm/master/MasterLis.xml View file @ 1e4caba
... ... @@ -2,65 +2,65 @@
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3 3 <mapper namespace="com.lyms.platform.permission.dao.master.MasterLisMapper">
4 4  
5   - <insert id="saveLisData" parameterType="com.lyms.platform.permission.model.LisReportQuery">
  5 + <insert id="saveLisData" parameterType="com.lyms.platform.permission.model.LisReportModel">
6 6 INSERT INTO LIS_REPORT_TBL(
7   - LIS_ID,
8   - TITLE,
9   - TYPE,
10   - VCCARDNO,
11   - NAME,
12   - BHNUM,
13   - AGE,
14   - SEX,
15   - APPLY_TIME,
16   - CHECK_TIME,
17   - PUBLISH_TIME,
18   - APPLY_DOCTOR,
19   - APPLY_DEPT,
20   - CHECKER,
21   - MODIFIED,
22   - CREATED,
23   - HOSPITAL_ID,
24   - PHONE,
25   - ITEM_JSON,
26   - STATUS
  7 + LIS_ID,
  8 + TITLE,
  9 + TYPE,
  10 + VCCARDNO,
  11 + NAME,
  12 + BHNUM,
  13 + AGE,
  14 + SEX,
  15 + APPLY_TIME,
  16 + CHECK_TIME,
  17 + PUBLISH_TIME,
  18 + APPLY_DOCTOR,
  19 + APPLY_DEPT,
  20 + CHECKER,
  21 + MODIFIED,
  22 + CREATED,
  23 + HOSPITAL_ID,
  24 + PHONE,
  25 + ITEM_JSON,
  26 + STATUS
27 27 ) VALUES (
28   - #{lisId},
29   - #{title},
30   - #{type},
31   - #{vcCardNo},
32   - #{name},
33   - #{ bhnum},
34   - #{age},
35   - #{sex},
36   - #{applyTime},
37   - #{checkTime},
38   - #{publishTime},
39   - #{applyDoctor},
40   - #{applyDept},
41   - #{checker},
42   - #{modified},
43   - #{created},
44   - #{hospitalId},
45   - #{phone},
46   - #{itemJson},
47   - #{status}
  28 + #{lisId},
  29 + #{title},
  30 + #{type},
  31 + #{vcCardNo},
  32 + #{name},
  33 + #{ bhnum},
  34 + #{age},
  35 + #{sex},
  36 + #{applyTime},
  37 + #{checkTime},
  38 + #{publishTime},
  39 + #{applyDoctor},
  40 + #{applyDept},
  41 + #{checker},
  42 + #{modified},
  43 + #{created},
  44 + #{hospitalId},
  45 + #{phone},
  46 + #{itemJson},
  47 + #{status}
48 48 )
49 49  
50 50 </insert>
51 51  
52 52 <insert id="saveLisItemsData" parameterType="java.util.List">
53 53 insert into LIS_REPORT_ITEM_TBL (
54   - LIS_ID,
55   - CODE,
56   - NAME,
57   - RESULT,
58   - RESULT_FLAG,
59   - REF,
60   - RESULT_TYPE,
61   - UNIT,
62   - PRINT_ORDER,
63   - HOSPITAL_ID
  54 + LIS_ID,
  55 + CODE,
  56 + NAME,
  57 + RESULT,
  58 + RESULT_FLAG,
  59 + REF,
  60 + RESULT_TYPE,
  61 + UNIT,
  62 + PRINT_ORDER,
  63 + HOSPITAL_ID
64 64 )
65 65 values
66 66 <foreach collection="list" item="item" index="index" separator="," >
67 67  
68 68  
69 69  
... ... @@ -83,106 +83,55 @@
83 83 DELETE FROM LIS_REPORT_TBL WHERE LIS_ID = #{lisId} AND HOSPITAL_ID = #{hospitalId}
84 84 </delete>
85 85  
86   - <select id="queryLisDataByModel" parameterType="com.lyms.platform.permission.model.LisReportModel"
  86 + <select id="queryLisDataByModel" parameterType="com.lyms.platform.permission.model.LisReportQuery"
87 87 resultType="com.lyms.platform.permission.model.LisReportModel">
88   - SELECT
89   - ID AS id,
90   - LIS_ID AS lisId,
91   - TITLE AS title,
92   - TYPE AS type,
93   - VCCARDNO AS vcCardNo,
94   - NAME AS name,
95   - BHNUM AS bhnum,
96   - AGE AS age,
97   - SEX AS sex,
98   - APPLY_TIME AS applyTime,
99   - CHECK_TIME AS checkTime,
100   - PUBLISH_TIME AS publishTime,
101   - APPLY_DOCTOR AS applyDoctor,
102   - APPLY_DEPT AS applyDept,
103   - CHECKER AS checker,
104   - MODIFIED AS modified,
105   - CREATED AS created,
106   - HOSPITAL_ID AS hospitalId,
107   - PHONE AS phone,
108   - ITEM_JSON AS itemJson
109   - FROM LIS_REPORT_TBL
110   - WHERE 1 = 1
111   - <if test="lisId != null and lisId != ''">
112   - AND LIS_ID = #{lisId}
113   - </if>
114   - <if test="vcCardNo != null">
115   - AND VCCARDNO = #{vcCardNo}
116   - </if>
117   - <if test="vcCardNo == null">
118   - AND VCCARDNO = ''
119   - </if>
120   - <if test="hospitalId != null and hospitalId != ''">
121   - AND HOSPITAL_ID = #{hospitalId}
122   - </if>
  88 + SELECT
  89 + ID AS id,
  90 + LIS_ID AS lisId,
  91 + TITLE AS title,
  92 + TYPE AS type,
  93 + VCCARDNO AS vcCardNo,
  94 + NAME AS name,
  95 + BHNUM AS bhnum,
  96 + AGE AS age,
  97 + SEX AS sex,
  98 + APPLY_TIME AS applyTime,
  99 + CHECK_TIME AS checkTime,
  100 + PUBLISH_TIME AS publishTime,
  101 + APPLY_DOCTOR AS applyDoctor,
  102 + APPLY_DEPT AS applyDept,
  103 + CHECKER AS checker,
  104 + MODIFIED AS modified,
  105 + CREATED AS created,
  106 + HOSPITAL_ID AS hospitalId,
  107 + PHONE AS phone,
  108 + ITEM_JSON AS itemJson
  109 + FROM LIS_REPORT_TBL
  110 + WHERE 1 = 1
  111 + <if test="lisId != null and lisId != ''">
  112 + AND LIS_ID = #{lisId}
  113 + </if>
  114 + <if test="vcCardNo != null and vcCardNo != ''">
  115 + AND VCCARDNO = #{vcCardNo}
  116 + </if>
  117 + <if test="phone != null and phone != ''">
  118 + AND PHONE = #{phone}
  119 + </if>
  120 + <if test="hospitalId != null and hospitalId != ''">
  121 + AND HOSPITAL_ID = #{hospitalId}
  122 + </if>
123 123  
124   - <if test="checkTime != null">
125   - AND date_format(CHECK_TIME,'%Y-%m-%d') = date_format(#{checkTime},'%Y-%m-%d')
126   - </if>
  124 + <if test="checkTime != null">
  125 + AND date_format(CHECK_TIME,'%Y-%m-%d') = date_format(#{checkTime},'%Y-%m-%d')
  126 + </if>
127 127  
128   - <if test="titles.size() !=0 ">
129   - AND TITLE IN
130   - <foreach collection="titles" item="title"
131   - index="index" open="(" close=")" separator=",">
132   - #{title}
133   - </foreach>
134   - </if>
135   -
136   -
137   - UNION
138   - SELECT
139   - ID AS id,
140   - LIS_ID AS lisId,
141   - TITLE AS title,
142   - TYPE AS type,
143   - VCCARDNO AS vcCardNo,
144   - NAME AS name,
145   - BHNUM AS bhnum,
146   - AGE AS age,
147   - SEX AS sex,
148   - APPLY_TIME AS applyTime,
149   - CHECK_TIME AS checkTime,
150   - PUBLISH_TIME AS publishTime,
151   - APPLY_DOCTOR AS applyDoctor,
152   - APPLY_DEPT AS applyDept,
153   - CHECKER AS checker,
154   - MODIFIED AS modified,
155   - CREATED AS created,
156   - HOSPITAL_ID AS hospitalId,
157   - PHONE AS phone,
158   - ITEM_JSON AS itemJson
159   - FROM LIS_REPORT_TBL
160   - WHERE 1 = 1
161   - <if test="lisId != null and lisId != ''">
162   - AND LIS_ID = #{lisId}
163   - </if>
164   - <if test="phone != null">
165   - AND PHONE = #{phone}
166   - </if>
167   - <if test="phone == null">
168   - AND PHONE = ''
169   - </if>
170   - <if test="hospitalId != null and hospitalId != ''">
171   - AND HOSPITAL_ID = #{hospitalId}
172   - </if>
173   -
174   - <if test="checkTime != null">
175   - AND date_format(CHECK_TIME,'%Y-%m-%d') = date_format(#{checkTime},'%Y-%m-%d')
176   - </if>
177   -
178   - <if test="titles.size() !=0 ">
179   - AND TITLE IN
180   - <foreach collection="titles" item="title"
181   - index="index" open="(" close=")" separator=",">
182   - #{title}
183   - </foreach>
184   - </if>
185   -
  128 + <if test="titles != null and titles.size() !=0 ">
  129 + AND TITLE IN
  130 + <foreach collection="titles" item="title"
  131 + index="index" open="(" close=")" separator=",">
  132 + #{title}
  133 + </foreach>
  134 + </if>
186 135 </select>
187 136  
188 137  
... ... @@ -214,9 +163,6 @@
214 163 <if test="lisId != null and lisId != ''">
215 164 AND LIS_ID = #{lisId}
216 165 </if>
217   - <if test="title != null and title != ''">
218   - AND TITLE = #{title}
219   - </if>
220 166 <if test="hospitalId != null and hospitalId != ''">
221 167 AND HOSPITAL_ID = #{hospitalId}
222 168 </if>
... ... @@ -226,16 +172,16 @@
226 172 <select id="queryLisItemByModel" parameterType="com.lyms.platform.permission.model.LisReportItemModel"
227 173 resultType="com.lyms.platform.permission.model.LisReportItemModel">
228 174 SELECT
229   - LIS_ID,
230   - CODE,
231   - NAME,
232   - RESULT,
233   - RESULT_FLAG,
234   - REF,
235   - RESULT_TYPE,
236   - UNIT,
237   - PRINT_ORDER,
238   - HOSPITAL_ID
  175 + LIS_ID,
  176 + CODE,
  177 + NAME,
  178 + RESULT,
  179 + RESULT_FLAG,
  180 + REF,
  181 + RESULT_TYPE,
  182 + UNIT,
  183 + PRINT_ORDER,
  184 + HOSPITAL_ID
239 185 FROM LIS_REPORT_ITEM_TBL
240 186 WHERE 1 = 1
241 187 <if test="lisId != null and lisId != ''">
... ... @@ -289,27 +235,27 @@
289 235  
290 236  
291 237 <resultMap id="queryListItemsMap" type="com.lyms.platform.permission.model.LisReportModel" >
292   - <id property="id" column="ID"/>
293   - <result property="lisId" column="LIS_ID"/>
294   - <result property="title" column="TITLE"/>
295   - <result property="type" column="TYPE"/>
296   - <result property="vcCardNo" column="VCCARDNO"/>
297   - <result property="name" column="NAME"/>
298   - <result property="bhnum" column="BHNUM"/>
299   - <result property="age" column="AGE"/>
300   - <result property="sex" column="SEX"/>
301   - <result property="applyTime" column="APPLY_TIME"/>
302   - <result property="checkTime" column="CHECK_TIME"/>
303   - <result property="publishTime" column="PUBLISH_TIME"/>
304   - <result property="applyDoctor" column="APPLY_DOCTOR"/>
305   - <result property="applyDept" column="APPLY_DEPT"/>
306   - <result property="checker" column="CHECKER"/>
307   - <result property="modified" column="MODIFIED"/>
308   - <result property="created" column="CREATED"/>
309   - <result property="hospitalId" column="HOSPITAL_ID"/>
310   - <result property="phone" column="PHONE"/>
311   - <result property="itemJson" column="ITEM_JSON"/>
312   - <result property="status" column="STATUS"/>
  238 + <id property="id" column="ID"/>
  239 + <result property="lisId" column="LIS_ID"/>
  240 + <result property="title" column="TITLE"/>
  241 + <result property="type" column="TYPE"/>
  242 + <result property="vcCardNo" column="VCCARDNO"/>
  243 + <result property="name" column="NAME"/>
  244 + <result property="bhnum" column="BHNUM"/>
  245 + <result property="age" column="AGE"/>
  246 + <result property="sex" column="SEX"/>
  247 + <result property="applyTime" column="APPLY_TIME"/>
  248 + <result property="checkTime" column="CHECK_TIME"/>
  249 + <result property="publishTime" column="PUBLISH_TIME"/>
  250 + <result property="applyDoctor" column="APPLY_DOCTOR"/>
  251 + <result property="applyDept" column="APPLY_DEPT"/>
  252 + <result property="checker" column="CHECKER"/>
  253 + <result property="modified" column="MODIFIED"/>
  254 + <result property="created" column="CREATED"/>
  255 + <result property="hospitalId" column="HOSPITAL_ID"/>
  256 + <result property="phone" column="PHONE"/>
  257 + <result property="itemJson" column="ITEM_JSON"/>
  258 + <result property="status" column="STATUS"/>
313 259 </resultMap>
314 260  
315 261  
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java View file @ 1e4caba
... ... @@ -878,19 +878,25 @@
878 878 return startTime < time && time < endTime ? true : false;
879 879 }
880 880  
881   - public static void main(String[] arg) throws Exception {
882   - Date now = new Date();
883   - Date start = y_m_d_h_m_s.parse("2017-04-30 11:11:11");
884   - Date end = y_m_d_h_m_s.parse("2017-04-30 11:11:11");
885   - System.out.println(isBetween(now, start, end));
  881 + /**
  882 + * 把一段时间 拼成 孕?周+?天
  883 + * @param start
  884 + * @param end
  885 + * @return
  886 + */
  887 + public static String getWeekDesc(Date start, Date end) {
  888 + Integer betweenDay = DateUtil.getDays(start, end);
  889 + Integer week = betweenDay / 7;
  890 + Integer day = betweenDay % 7;
  891 + return "孕" + week + "周+" + day + "天";
  892 + }
886 893  
887   - System.out.println(org.apache.commons.lang3.time.DateUtils.addMonths(start ,1).toLocaleString());
888   - long startTime = 1483372800000l;
889   - long endTime = end.getTime();
890   - System.out.println();
891   -
892   - Date d2 = new Date();
893   - System.out.println(isLtOrEq(start, end));
  894 + public static void main(String[] arg) throws Exception {
  895 + Date start = parseYMD("2016-05-01");
  896 + Date end = parseYMD("2016-05-11");
  897 + System.out.println(getWeekDesc(start, end));
  898 + String s = DateUtil.getyyyy_MM_dd_hms(new Date(1496829600000L));
  899 + System.out.println(s);
894 900 }
895 901 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LisFacade.java View file @ 1e4caba
... ... @@ -162,6 +162,7 @@
162 162 checkByDate.add(CheckByDate1);
163 163 }
164 164 }else{
  165 +
165 166 List<CheckResponse> result = new ArrayList<CheckResponse>();
166 167 if("7".equals(HIS_VERSION)){
167 168 //根据调用接口获取四川南充中心医院的Lis数据
... ... @@ -441,7 +442,7 @@
441 442 {
442 443 if (lis != null && reportModel != null)
443 444 {
444   - if (StringUtils.isNotEmpty(lis.getLisId()) && lis.getLisId().equals(reportModel.getLisId()))
  445 + if (StringUtils.isNotEmpty(lis.getLisId()) && !lis.getLisId().equals(reportModel.getLisId()))
445 446 {
446 447 isExist = true;
447 448 break;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ 1e4caba
... ... @@ -28,6 +28,7 @@
28 28 import scala.util.parsing.combinator.testing.Str;
29 29  
30 30 import javax.servlet.http.HttpServletResponse;
  31 +import java.lang.reflect.Method;
31 32 import java.sql.PreparedStatement;
32 33 import java.sql.ResultSet;
33 34 import java.sql.SQLException;
... ... @@ -107,6 +108,10 @@
107 108 couponReportMap.put("8_4", "<div class='ag-double-line'>儿童保健券(三)<div><div>使用人次</div></div>");
108 109 couponReportMap.put("8_5", "<div class='ag-double-line'>儿童保健券(四)<div>使用人次</div></div>");
109 110 couponReportMap.put("8_6", "<div class='ag-double-line'>儿童保健券(五)<div>使用人次</div></div>");
  111 + couponReportMap.put("8_7", "<div class='ag-double-line'>儿童保健券(六)<div>使用人次</div></div>");
  112 + couponReportMap.put("8_8", "<div class='ag-double-line'>儿童保健券(七)<div>使用人次</div></div>");
  113 + couponReportMap.put("8_9", "<div class='ag-double-line'>儿童保健券(八)<div>使用人次</div></div>");
  114 + couponReportMap.put("8_10", "<div class='ag-double-line'>儿童保健券(九)<div>使用人次</div></div>");
110 115 /** 产后 */
111 116 couponReportMap.put("3_1", "<div class='ag-double-line'>产后建档券<div>使用人次</div></div>");
112 117 couponReportMap.put("4_1", "<div class='ag-double-line'>分娩券<div>使用人次</div></div>");
... ... @@ -115,6 +120,8 @@
115 120 couponReportMap.put("6_2", "<div class='ag-double-line'>产后复查券(一)<div>使用人次</div></div>");
116 121 couponReportMap.put("6_3", "<div class='ag-double-line'>产后复查券(二)<div>使用人次</div></div>");
117 122 couponReportMap.put("6_4", "<div class='ag-double-line'>产后复查券(三)<div>使用人次</div></div>");
  123 + couponReportMap.put("6_5", "<div class='ag-double-line'>产后复查券(四)<div>使用人次</div></div>");
  124 + couponReportMap.put("6_6", "<div class='ag-double-line'>产后复查券(五)<div>使用人次</div></div>");
118 125  
119 126 /** 1=孕妇建档 2=孕妇产检 3=产妇建档 4=产妇分娩 5=产妇出院小结 6=产妇产后复查 7=儿童建档 8=儿童保健 */
120 127 couponDescMap.put(1, "孕妇建档券");
... ... @@ -376,12 +383,6 @@
376 383 rest.setErrorcode(500);
377 384 rest.setErrormsg(e.getMessage());
378 385 }
379   -
380   -
381   - // PageResult page = findPage(getDoctorInfoSql(startDate, endDate, childBirth, number, name, hospitalId, params), currentPage, pageSize, params);
382   -// List<Map<String, Object>> grid = (List<Map<String, Object>>) page.getGrid();
383   -// setColor(grid);
384   -// rest.setData(page);
385 386 return rest;
386 387 }
387 388  
388 389  
389 390  
... ... @@ -486,45 +487,26 @@
486 487 reportModel.setSeries(createSeries(couponReport));
487 488 reportModel.doMerge();
488 489  
  490 + /** 查询医院所绑定的type和coupon_order */
  491 + List<String> key = couponMapper.findCouponTitleByTemp(param);
  492 + setZeroDataByTemp(key, couponReport);
  493 +
489 494 Map<String, Object> titleMap = parseTitle(couponReport);
490 495 transNullToZero(couponReport, titleMap);
491 496  
492 497 return RespBuilder.buildSuccess("couponReport", couponReport, "couponReportMap", titleMap, "reportModel", reportModel);
493   - // return RespBuilder.buildSuccess(couponReport);
494   -// if(org.apache.commons.collections.CollectionUtils.isNotEmpty(couponReport) &&
495   -// org.apache.commons.collections.CollectionUtils.isNotEmpty(usedInfo)) {
496   -// if(CollectionUtils.putAll(couponReport, usedInfo, "used_hospital_id", "used_hospital_id")) {
497   -// for (Map<String, Object> map : couponReport) {
498   -// map.put("province_name", findName(map.get("province_id")));
499   -// map.put("city_name", findName(map.get("city_id")));
500   -//
501   -// String areaName = findName(map.get("area_id"));
502   -// map.put("area_name", areaName);
503   -// if(map.get("areaId") == null) { /** 没传区县 报表数据就为区域的 传了区县 报表数据就为市 */
504   -// xAxis.add(areaName);
505   -// } else {
506   -// Map<String, Object> m = couponMapper.findHospitalName(CollectionUtils.createMap("hospitalId", ""));
507   -// if(m.get("name") != null) {
508   -// xAxis.add(m.get("name").toString());
509   -// }
510   -// }
511   -// }
512   -// }
513   -// }
514   -//
515   -// ReportModel reportModel = new ReportModel();
516   -// reportModel.setxAxis(xAxis);
517   -// reportModel.setData(Arrays.asList("发放券数", "使用券数"));
518   -// reportModel.setSeries(createSeries(couponReport));
519   -// reportModel.doMerge();
520   -//
521   -// Map<String, Object> titleMap = parseTitle(couponReport);
522   -// transNullToZero(couponReport, titleMap);
523   -//
524   -//
525   -// return RespBuilder.buildSuccess("couponReport", couponReport, "couponReportMap", titleMap, "reportModel", reportModel);
526 498 }
527 499  
  500 + private void setZeroDataByTemp(List<String> key, List<Map<String, Object>> couponReport) {
  501 + for (Map<String, Object> map : couponReport) {
  502 + for (String s : key) {
  503 + if(map.get(s) == null) {
  504 + map.put(s, 0);
  505 + }
  506 + }
  507 + }
  508 + }
  509 +
528 510 private Map<String, Object> packCouponMap(Map<String, Object> sendInfo, Map<String, Object> usedInfo, Map<String, Object> hNameMap, String hid, List<String> xAxis, Map<String, Object> param) {
529 511 if(MapUtils.isEmpty(sendInfo) && MapUtils.isEmpty(usedInfo)) return null;
530 512  
531 513  
532 514  
533 515  
534 516  
535 517  
... ... @@ -683,29 +665,160 @@
683 665 @Override
684 666 public BaseObjectResponse couponInfo(Map<String, Object> param) {
685 667 PageUtil.setPageInfo(param);
686   - if(StringUtils.isEmpty(param.get("hospitalId") + "")) {
  668 + if(param.get("hospitalId") == null) {
687 669 param.put("hospitalId", accessPermissionFacade.getCurrentUserHospPermissions(Integer.parseInt(param.get("userId") + ""))); /** 根据登陆人id 查询出来的医院 */
688 670 }
689 671 doHospitalFilter(param);
690   - List<Map<String, Object>> couponInfos = couponMapper.findCouponInfo(param);
691   - for (Map<String, Object> couponInfo : couponInfos) {
692   - String desc = (String) couponReportMap.get(couponInfo.get("type") + "_" + couponInfo.get("coupon_order"));
693   - if(StringUtils.isNotBlank(desc)) {
694   - /** <div class='ag-double-line'>儿童保健券(五)<div>使用人次</div></div> */
695   - String s = desc.replace("使用人次", "")
696   - .replace("<div class='ag-double-line'>", "")
697   - .replace("<div>", "")
698   - .replace("</div>", "");
699   - couponInfo.put("type_desc", s);
  672 + if(param.get("hospitalId") == null) {
  673 + return RespBuilder.buildSuccess(new PageResult(0, (Integer) param.get("currentPage") ,(Integer) param.get("pageSize"), CollectionUtils.createMap("couponInfos", new ArrayList<>())));
  674 + }
  675 + Integer type = (Integer) param.get("type");
  676 + if(type == 4) { /** 使用详情统计 */
  677 + List<Map<String, Object>> couponInfos = couponMapper.couponInfo(param);
  678 + if(CollectionUtils.isNotEmpty(couponInfos)) {
  679 + for (Map<String, Object> couponInfo : couponInfos) {
  680 + String desc = (String) couponReportMap.get(couponInfo.get("type") + "_" + couponInfo.get("coupon_order"));
  681 + if(StringUtils.isNotBlank(desc)) {
  682 + /** <div class='ag-double-line'>儿童保健券(五)<div>使用人次</div></div> */
  683 + String s = desc.replace("使用人次", "")
  684 + .replace("<div class='ag-double-line'>", "")
  685 + .replace("<div>", "")
  686 + .replace("</div>", "");
  687 + couponInfo.put("type_desc", s);
  688 + }
  689 + Date useDate = (Date) couponInfo.get("use_date");
  690 + couponInfo.put("use_date", DateUtil.getyyyy_MM_dd(useDate));
  691 + /** 设置产检日期、姓名、产检孕周、产检第次、产检机构、产检医生、联系电话 */
  692 + setUsedInfo((Integer) couponInfo.get("type"), (String) couponInfo.get("used_id"),
  693 + (String) couponInfo.get("sequence_id"), useDate, couponInfo
  694 + );
  695 + }
700 696 }
  697 + int count = couponMapper.findCouponInfoCount(param);
  698 + PageResult pageResult = new PageResult(count, (Integer) param.get("currentPage") ,(Integer) param.get("pageSize"), CollectionUtils.createMap("couponInfos", couponInfos));
  699 + return RespBuilder.buildSuccess(pageResult);
  700 + } if(type == 1) { /** 发放人数统计 */
  701 + List<Map<String,Object>> userSendInfo = couponMapper.findUserSendInfo(param);
  702 + System.err.println(userSendInfo);
  703 + }
  704 + return RespBuilder.buildSuccess();
  705 + }
701 706  
702   - setUsedInfo(couponInfo);
  707 + /**
  708 + * type
  709 + * 1=孕妇建档 lyms_patient
  710 + * 2=孕妇产检 lyms_antexc(初诊),lyms_antex(复诊)
  711 + * 3=产妇建档 lyms_patient
  712 + * 4=产妇分娩 lyms_matdeliver
  713 + * 5=产妇出院小结 lyms_discharge_abstract_mother
  714 + * 6=产妇产后复查 lyms_postreview
  715 + * 7=儿童建档 lyms_baby
  716 + * 8=儿童保健 lyms_babycheck
  717 + */
  718 + private void setUsedInfo(Integer type, String usedId, String sequence_id, Date useDate, Map<String, Object> map) {
  719 + Date checkDate = null; /** 产检日期 */
  720 + String username = null; /** 姓名 */
  721 + String week = null; /** 产检孕周 = 产检时间 - 末次月经 */
  722 + Integer number = null; /** 产检第次 */
  723 + String operatorOrgName = null; /** 产检机构 */
  724 + String doctorName = null; /** 产检医生 */
  725 + String phone = null; /** 联系电话 */
  726 + if(type == 1) {
  727 + Patients patients = mongoTemplate.findById(usedId, Patients.class);
  728 + if(patients != null) {
  729 + checkDate = patients.getCreated();
  730 + username = patients.getUsername();
  731 + week = DateUtil.getWeekDesc(patients.getLastMenses(), checkDate);
  732 + List<Patients> patientsList = mongoTemplate.find(Query.query(Criteria.where("pid").is(patients.getPid())).with(new Sort(Sort.Direction.ASC, "created")), Patients.class);
  733 + for(int i = 0; i < patientsList.size(); i++) {
  734 + if(patientsList.get(i).getId().equals(patients.getId())) {
  735 + number = ++i;
  736 + }
  737 + }
  738 + operatorOrgName = couponMapper.findHospitalNameById(patients.getHospitalId());
  739 + doctorName = couponMapper.findUserName(patients.getLastCheckEmployeeId());
  740 + phone = patients.getPhone();
  741 + }
  742 + } else if(type == 2) {
  743 + AntExChuModel antexc = mongoTemplate.findById(usedId, AntExChuModel.class);
  744 + if(antexc != null) {
  745 + checkDate = antexc.getCheckTime();
  746 + username = findUserNameByPid(antexc.getPid());
  747 + week = DateUtil.getWeekDesc(antexc.getLastMenses(), antexc.getCheckTime());
  748 + number = findNumberByList("checkTime", "pid", antexc.getPid(), antexc, AntExChuModel.class);
  749 + operatorOrgName = couponMapper.findHospitalNameById(antexc.getHospitalId());
  750 + doctorName = couponMapper.findUserName(antexc.getProdDoctor());
  751 + phone = findPhoneByPid(antexc.getPid());
  752 + } else {
  753 + AntenatalExaminationModel antenatal = mongoTemplate.findOne(Query.query(Criteria.where("barCode").is(sequence_id)), AntenatalExaminationModel.class);
  754 + if(antenatal != null) {
  755 + checkDate = antenatal.getCheckDate();
  756 + username = findUserNameByPid(antenatal.getPid());
  757 + week = antenatal.getCurrentDueDate();
  758 + List<AntenatalExaminationModel> antExChuModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(antenatal.getPid())).with(new Sort(Sort.Direction.ASC, "created")), AntenatalExaminationModel.class);
  759 + if(CollectionUtils.isNotEmpty(antExChuModels)) {
  760 + for(int i = 0; i < antExChuModels.size(); i++) {
  761 + if(antExChuModels.get(i).getId().equals(antenatal.getId())) {
  762 + number = ++i;
  763 + }
  764 + }
  765 + }
  766 + doctorName = couponMapper.findUserName(antenatal.getCheckDoctor());
  767 + operatorOrgName = couponMapper.findHospitalNameById(antenatal.getHospitalId());
  768 + phone = findPhoneByPid(antenatal.getPid());
  769 + }
  770 + }
703 771 }
704   - int count = couponMapper.findCouponInfoCount(param);
705   - PageResult pageResult = new PageResult(count, (Integer) param.get("currentPage") ,(Integer) param.get("pageSize"), CollectionUtils.createMap("couponInfos", couponInfos));
706   - return RespBuilder.buildSuccess(pageResult);
  772 +
  773 + map.put("checkDate", checkDate == null ? null : DateUtil.getyyyy_MM_dd(checkDate));
  774 + map.put("username", username);
  775 + map.put("week", week);
  776 + map.put("number", number);
  777 + map.put("operatorOrgName", operatorOrgName);
  778 + map.put("doctorName", doctorName);
  779 + map.put("phone", phone);
707 780 }
708 781  
  782 + private String findUserNameByPid(String pid) {
  783 + if(StringUtils.isNotEmpty(pid)) {
  784 + PersonModel personModel = mongoTemplate.findById(pid, PersonModel.class);
  785 + if(personModel != null) {
  786 + return personModel.getName();
  787 + }
  788 + }
  789 + return null;
  790 + }
  791 +
  792 + private String findPhoneByPid(String pid) {
  793 + if(StringUtils.isNotEmpty(pid)) {
  794 + PersonModel personModel = mongoTemplate.findById(pid, PersonModel.class);
  795 + if(personModel != null) {
  796 + return personModel.getPhone();
  797 + }
  798 + }
  799 + return null;
  800 + }
  801 +
  802 + private <T> Integer findNumberByList(String sortField, String key, String value, T current, Class<T> clazz) {
  803 + Integer number = 1;
  804 + List<T> lists = mongoTemplate.find(Query.query(Criteria.where(key).is(value)).with(new Sort(Sort.Direction.ASC, sortField)), clazz);
  805 + if(CollectionUtils.isNotEmpty(lists)) {
  806 + try {
  807 + for(int i = 0; i < lists.size(); i++) {
  808 + T t = lists.get(i);
  809 + String tId = ReflectUtil.invoke(t, "getId") + "";
  810 + String currentId = ReflectUtil.invoke(current, "getId") + "";
  811 + if(StringUtils.isNotEmpty(tId) && StringUtils.isNotEmpty(currentId) && tId.equals(currentId)) {
  812 + number = ++i;
  813 + }
  814 + }
  815 + } catch (Exception e) {
  816 + e.printStackTrace();
  817 + }
  818 + }
  819 + return number;
  820 + }
  821 +
709 822 @Override
710 823 public void exportCouponInfo(Map<String, Object> param, HttpServletResponse response) {
711 824 BaseObjectResponse resp = couponInfo(param);
712 825  
713 826  
714 827  
715 828  
716 829  
717 830  
718 831  
... ... @@ -789,50 +902,40 @@
789 902 ResponseUtil.responseExcel(cnames, results, response);
790 903 }
791 904  
792   - private void setUsedInfo(Map<String, Object> map) {
  905 + /*private void setUsedInfo(Map<String, Object> map) {
793 906 String sequenceId = (String) map.get("sequence_id");
794 907 Integer type = (Integer) map.get("type");
795 908 if(StringUtils.isEmpty(sequenceId) || type == null) return;
796 909  
797   - /**
798   - * type
799   - 1=孕妇建档 lyms_patient
800   - 2=孕妇产检 lyms_antexc(初诊),lyms_antex(复诊)
801   - 3=产妇建档
802   - 4=产妇分娩 lyms_matdeliver
803   - 5=产妇出院小结 lyms_discharge_abstract_mother
804   - 6=产妇产后复查 lyms_postreview
805   - 7=儿童建档 lyms_baby
806   - 8=儿童保健 lyms_babycheck
807   - */
  910 +
808 911 if(type == 1) {
809 912 Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("").is(sequenceId)), Patients.class);
810 913 if(patients != null) {
811   - map.put("checkDate", patients.getCreated()); /** 产检日期 */
  914 + map.put("checkDate", patients.getCreated()); *//** 产检日期 *//*
812 915 }
813 916 }
814 917  
815 918 AntExChuModel antexc = mongoTemplate.findOne(Query.query(Criteria.where("barCode").is(sequenceId)), AntExChuModel.class);
816 919 if(antexc != null) {
817   - map.put("checkDate", antexc.getCheckTime()); /** 产检日期 */
  920 + map.put("checkDate", antexc.getCheckTime()); *//** 产检日期 *//*
818 921 Patients patients = mongoTemplate.findById(antexc.getParentId(), Patients.class);
819 922 if(patients != null) {
820   - map.put("username", patients.getUsername()); /** 姓名 */
  923 + map.put("username", patients.getUsername()); *//** 姓名 *//*
821 924 }
822   - map.put("week", DateUtil.getWeek(antexc.getLastMenses(), antexc.getCheckTime()));/** 产检孕周 = 产检时间 - 末次月经 */
  925 + map.put("week", DateUtil.getWeek(antexc.getLastMenses(), antexc.getCheckTime()));*//** 产检孕周 = 产检时间 - 末次月经 *//*
823 926  
824 927 List<AntExChuModel> antExChuModels = mongoTemplate.find(Query.query(Criteria.where("pid").is(antexc.getPid())).with(new Sort(Sort.Direction.ASC, "checkTime")), AntExChuModel.class);
825 928 if(org.apache.commons.collections.CollectionUtils.isNotEmpty(antExChuModels)) {
826 929 for(int i = 0; i < antExChuModels.size(); i++) {
827 930 if(antExChuModels.get(i).getId().equals(antexc.getId())) {
828   - map.put("number", ++i); /** 产检第几次 */
  931 + map.put("number", ++i); *//** 产检第几次 *//*
829 932 return;
830 933 }
831 934 }
832 935 }
833 936  
834   - map.put("doctorName", couponMapper.findUserName(antexc.getProdDoctor())); /** 产检医生 */
835   - map.put("operatorOrgName", couponMapper.findUserName(antexc.getOperator() + "")); /** 产检机构 */
  937 + map.put("doctorName", couponMapper.findUserName(antexc.getProdDoctor())); *//** 产检医生 *//*
  938 + map.put("operatorOrgName", couponMapper.findUserName(antexc.getOperator() + "")); *//** 产检机构 *//*
836 939 PersonModel personModel = mongoTemplate.findById(map.get("user_id"), PersonModel.class);
837 940 if(personModel != null) {
838 941 map.put("phone", personModel.getPhone());
839 942  
840 943  
... ... @@ -842,15 +945,15 @@
842 945 } else {
843 946 AntenatalExaminationModel antenatal = mongoTemplate.findOne(Query.query(Criteria.where("barCode").is(sequenceId)), AntenatalExaminationModel.class);
844 947 if(antenatal != null) {
845   - map.put("checkDate", antenatal.getCheckDate()); /** 产检日期 */
  948 + map.put("checkDate", antenatal.getCheckDate()); *//** 产检日期 *//*
846 949 Patients patients = mongoTemplate.findById(antenatal.getParentId(), Patients.class);
847 950 if(patients != null) {
848   - map.put("username", patients.getUsername()); /** 姓名 */
  951 + map.put("username", patients.getUsername()); *//** 姓名 *//*
849 952 }
850   - map.put("week", antenatal.getCurrentDueDate());/** 产检孕周 = 产检时间 - 末次月经 */
851   - map.put("number", antenatal.getYn()); /** 产检第几次 */
852   - map.put("doctorName", couponMapper.findUserName(antenatal.getCheckDoctor())); /** 产检医生 */
853   - map.put("operatorOrgName", couponMapper.findUserName(antenatal.getOperator() + "")); /** 产检机构 */
  953 + map.put("week", antenatal.getCurrentDueDate());*//** 产检孕周 = 产检时间 - 末次月经 *//*
  954 + map.put("number", antenatal.getYn()); *//** 产检第几次 *//*
  955 + map.put("doctorName", couponMapper.findUserName(antenatal.getCheckDoctor())); *//** 产检医生 *//*
  956 + map.put("operatorOrgName", couponMapper.findUserName(antenatal.getOperator() + "")); *//** 产检机构 *//*
854 957 map.put("phone", couponMapper.findPhone(antenatal.getOperator() + ""));
855 958 }
856 959 }
... ... @@ -865,7 +968,7 @@
865 968 map.put("use_day", "产后" + day + "天");
866 969 }
867 970 }
868   - }
  971 + }*/
869 972  
870 973 private String findName(Object id) {
871 974 if(id != null) {
... ... @@ -938,7 +1041,6 @@
938 1041 .append("D.DOCTOR_NAME ")
939 1042 .append("ORDER BY D.INSERT_DATE DESC");
940 1043  
941   - System.out.println(sql.toString());
942 1044 return sql.toString();
943 1045 }
944 1046  
... ... @@ -1198,7 +1300,6 @@
1198 1300 params.add(number);
1199 1301 }
1200 1302  
1201   - System.out.println(sql.toString());
1202 1303 return sql.toString();
1203 1304 }
1204 1305  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/CollectionUtils.java View file @ 1e4caba
... ... @@ -74,9 +74,11 @@
74 74 }
75 75  
76 76 public static <T> List<T> asList(String ids, Class<T> clazz) {
77   - Assert.notNull(ids);
78   - Assert.notNull(clazz);
  77 + if(StringUtils.isEmpty(ids)) {
  78 + return null;
  79 + }
79 80  
  81 + Assert.notNull(clazz);
80 82 List<T> list = new ArrayList<>();
81 83 String[] id = ids.split(",");
82 84 for (String s : id) {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/ReflectUtil.java View file @ 1e4caba
  1 +package com.lyms.platform.operate.web.utils;
  2 +
  3 +import java.lang.reflect.Method;
  4 +
  5 +/**
  6 + * 反射相关工具类
  7 + * @Author: litao
  8 + * @Date: 2017/6/7 0007 17:02
  9 + * @Version: V1.0
  10 + */
  11 +public class ReflectUtil {
  12 +
  13 + /**
  14 + * 调用getxxx获取到值
  15 + * @param obj
  16 + * @param methodName
  17 + * @return
  18 + */
  19 + public static Object invoke(Object obj, String methodName) {
  20 + Object rest = null;
  21 + try {
  22 + Method method = obj.getClass().getMethod(methodName, null);
  23 + rest = method.invoke(obj, null);
  24 + } catch (Exception e) {
  25 + e.printStackTrace();
  26 + }
  27 + return rest;
  28 + }
  29 +
  30 +}
platform-operate-api/src/main/resources/config.properties View file @ 1e4caba
... ... @@ -14,7 +14,7 @@
14 14  
15 15  
16 16 #His系统版本 0:未使用,1:桓台,2:新乐,3:青龙县医院,4:秦皇岛妇幼,5:抚宁妇幼, 6: 德州妇幼,7:南充中心医院
17   -his_version=6
  17 +his_version=0
18 18  
19 19 #统计中心url
20 20 center_statistics_url=http://api.healthbaby.com.cn/