Commit 431675b4f246c7bffdf10dbbbdf154faf59da294
1 parent
10e74541da
Exists in
master
and in
6 other branches
秦皇岛 孕产妇围产管理--分娩管理 获取分娩数量
Showing 2 changed files with 93 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/QhdPuerService.java
View file @
431675b
1 | +package com.lyms.hospitalapi.qhdfy; | |
2 | + | |
3 | +import com.lyms.hospitalapi.qhdfy.ConnTools; | |
4 | +import com.lyms.platform.common.utils.ExceptionUtils; | |
5 | +import java.sql.Connection; | |
6 | +import java.util.ArrayList; | |
7 | +import java.util.List; | |
8 | +import java.util.Map; | |
9 | +import org.apache.commons.dbutils.DbUtils; | |
10 | +import org.apache.commons.dbutils.QueryRunner; | |
11 | +import org.apache.commons.dbutils.ResultSetHandler; | |
12 | +import org.apache.commons.dbutils.handlers.MapHandler; | |
13 | +import org.apache.commons.lang3.StringUtils; | |
14 | +import org.springframework.stereotype.Service; | |
15 | + | |
16 | +/** | |
17 | + * 获取秦皇岛服务 分娩相关数据 | |
18 | + */ | |
19 | +@Service("QhdPuerService") | |
20 | +public class QhdPuerService { | |
21 | + /** | |
22 | + * 获取分娩数量 | |
23 | + * @param startTimeP | |
24 | + * @param endTimeP | |
25 | + * @return | |
26 | + */ | |
27 | + public List<Map> queryPuerCnt(String startTimeP, String endTimeP) { | |
28 | + List<Map> rs = new ArrayList<>(); | |
29 | + Connection conn = ConnTools.makeHisConnection(); | |
30 | + QueryRunner queryRunner = new QueryRunner(); | |
31 | + StringBuffer sql = new StringBuffer("select count(1) cnt from BQ_HS_SSHLJLD_XETSQX1 t1,ZY_BRSYK t2 where t1.syxh=t2.syxh "); | |
32 | + if (StringUtils.isNotEmpty(startTimeP)) | |
33 | + sql.append(" and ssrq >= '" + startTimeP + "'"); | |
34 | + if (StringUtils.isNotEmpty(endTimeP)) | |
35 | + sql.append(" and ssrq <= '" + endTimeP + "'"); | |
36 | + System.out.println(sql); | |
37 | + try { | |
38 | + Map<String, Object> qrs = (Map<String, Object>)queryRunner.query(conn, sql.toString(), (ResultSetHandler)new MapHandler()); | |
39 | + rs.add(qrs); | |
40 | + } catch (Exception e) { | |
41 | + ExceptionUtils.catchException(e, "queryPuerCnt : sql="+sql); | |
42 | + e.printStackTrace(); | |
43 | + } finally { | |
44 | + DbUtils.closeQuietly(conn); | |
45 | + } | |
46 | + return rs; | |
47 | + } | |
48 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerContoller.java
View file @
431675b
1 | +package com.lyms.platform.operate.web.controller; | |
2 | + | |
3 | +import com.lyms.hospitalapi.qhdfy.QhdPuerService; | |
4 | +import com.lyms.platform.common.base.BaseController; | |
5 | +import com.lyms.platform.common.result.BaseResponse; | |
6 | +import com.lyms.platform.operate.web.controller.PuerContoller; | |
7 | +import java.util.List; | |
8 | +import java.util.Map; | |
9 | +import org.slf4j.Logger; | |
10 | +import org.slf4j.LoggerFactory; | |
11 | +import org.springframework.beans.factory.annotation.Autowired; | |
12 | +import org.springframework.stereotype.Controller; | |
13 | +import org.springframework.web.bind.annotation.RequestMapping; | |
14 | +import org.springframework.web.bind.annotation.RequestMethod; | |
15 | +import org.springframework.web.bind.annotation.ResponseBody; | |
16 | + | |
17 | + | |
18 | +/** | |
19 | + * 孕产妇围产管理--分娩管理--秦皇岛 | |
20 | + */ | |
21 | +@Controller | |
22 | +@RequestMapping({"/puer"}) | |
23 | +public class PuerContoller extends BaseController { | |
24 | + Logger logger = LoggerFactory.getLogger(getClass()); | |
25 | + | |
26 | + @Autowired | |
27 | + private QhdPuerService qhdPuerService; | |
28 | + | |
29 | + /** | |
30 | + * 获取秦皇岛分娩数量 | |
31 | + * @param startTimeP | |
32 | + * @param endTimeP | |
33 | + * @return | |
34 | + */ | |
35 | + @RequestMapping(method = {RequestMethod.POST}, value = {"/queryPuerCnt"}) | |
36 | + @ResponseBody | |
37 | + public BaseResponse queryPuerCnt(String startTimeP, String endTimeP) { | |
38 | + BaseResponse baseResponse = new BaseResponse(); | |
39 | + this.logger.info("startTime" + startTimeP + " " + endTimeP); | |
40 | + System.out.println("startTime" + startTimeP + " " + endTimeP); | |
41 | + List<Map> rs = this.qhdPuerService.queryPuerCnt(startTimeP.replaceAll("-", ""), endTimeP.replaceAll("-", "")); | |
42 | + baseResponse.setObject(rs); | |
43 | + return baseResponse; | |
44 | + } | |
45 | +} |