Commit dbf057ba468198735fcafb3071c1d0a8eeb906ca
1 parent
1673f14dd1
Exists in
master
and in
6 other branches
新增诸城妇幼更换就诊卡方法
Showing 1 changed file with 71 additions and 2 deletions
platform-operate-api/src/main/java/com/lyms/hospitalapi/zcfy/DzfyHisService.java
View file @
dbf057b
| 1 | 1 | package com.lyms.hospitalapi.zcfy; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.hospitalapi.pojo.DzReplace; |
| 4 | +import com.lyms.platform.common.utils.ExceptionUtils; | |
| 5 | +import org.apache.commons.collections.CollectionUtils; | |
| 6 | +import org.apache.commons.dbutils.DbUtils; | |
| 7 | +import org.apache.commons.dbutils.QueryRunner; | |
| 8 | +import org.apache.commons.dbutils.handlers.BeanListHandler; | |
| 9 | +import org.apache.commons.lang.StringUtils; | |
| 4 | 10 | import org.springframework.stereotype.Service; |
| 5 | 11 | |
| 12 | +import java.sql.Connection; | |
| 13 | +import java.util.ArrayList; | |
| 6 | 14 | import java.util.List; |
| 7 | 15 | |
| 8 | 16 | /** |
| 9 | 17 | * Created by Administrator on 2017/12/18. |
| 10 | 18 | */ |
| 11 | -@Service("dzfyHisService") | |
| 19 | +@Service("zcfyHisService") | |
| 12 | 20 | public class DzfyHisService { |
| 13 | 21 | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 查询病人的换卡记录 | |
| 25 | + * @param vcCardNo | |
| 26 | + * @return | |
| 27 | + */ | |
| 14 | 28 | public List<DzReplace> findAllVcCarddNo(String vcCardNo){ |
| 15 | 29 | |
| 16 | - return null; | |
| 30 | + List<DzReplace> allCardNoList = new ArrayList<DzReplace>(); | |
| 31 | + if (StringUtils.isNotBlank(vcCardNo)) | |
| 32 | + { | |
| 33 | + System.out.println("vcCardNo = " + vcCardNo); | |
| 34 | + Connection conn = com.lyms.hospitalapi.zcfy.ConnTools.makeHisConnection(); | |
| 35 | + QueryRunner queryRunner = new QueryRunner(true); | |
| 36 | + String sql = "select ID as id from userzcfy.lyms_v_patientinfo where CARDNO = '"+vcCardNo+"'"; | |
| 37 | + try | |
| 38 | + { | |
| 39 | + List<DzReplace> hisDzReplaceList = queryRunner.query(conn,sql,new BeanListHandler<DzReplace>(DzReplace.class)); | |
| 40 | + if (CollectionUtils.isNotEmpty(hisDzReplaceList)) | |
| 41 | + { | |
| 42 | + String jzkSql = "select ID as id,VCCARDNO as cardNo from userzcfy.lyms_jiuzhenka where ID = '"+hisDzReplaceList.get(0).getId()+"'"; | |
| 43 | + allCardNoList = queryRunner.query(conn,jzkSql,new BeanListHandler<DzReplace>(DzReplace.class)); | |
| 44 | + System.out.println("vcCardNo list " + allCardNoList); | |
| 45 | + } | |
| 46 | + } | |
| 47 | + catch (Exception e) | |
| 48 | + { | |
| 49 | + DbUtils.closeQuietly(conn); | |
| 50 | + ExceptionUtils.catchException(e, "zc his exception "); | |
| 51 | + } | |
| 52 | + finally | |
| 53 | + { | |
| 54 | + DbUtils.closeQuietly(conn); | |
| 55 | + } | |
| 56 | + } | |
| 57 | + return allCardNoList; | |
| 58 | + } | |
| 59 | + | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 返回病人使用过的所有就诊卡 | |
| 63 | + * @param vcCardNo | |
| 64 | + * @return | |
| 65 | + */ | |
| 66 | + public List<String> getDzVcCardNos(String vcCardNo) | |
| 67 | + { | |
| 68 | + List<String> vcCardNos = new ArrayList<>(); | |
| 69 | + List<DzReplace> list = findAllVcCarddNo(vcCardNo); | |
| 70 | + | |
| 71 | + if (CollectionUtils.isNotEmpty(list)) | |
| 72 | + { | |
| 73 | + for (DzReplace zc : list) | |
| 74 | + { | |
| 75 | + if (zc != null && StringUtils.isNotEmpty(zc.getCardNo())) | |
| 76 | + { | |
| 77 | + vcCardNos.add(zc.getCardNo()); | |
| 78 | + } | |
| 79 | + } | |
| 80 | + } | |
| 81 | + else | |
| 82 | + { | |
| 83 | + vcCardNos.add(vcCardNo); | |
| 84 | + } | |
| 85 | + return vcCardNos; | |
| 17 | 86 | } |
| 18 | 87 | |
| 19 | 88 | } |