Commit 78072a1ab8d92c508161339dbac8fbed5fb00511

Authored by hujiaqi
Exists in master

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java

Showing 20 changed files

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java View file @ 78072a1
... ... @@ -12,6 +12,7 @@
12 12 import com.lyms.platform.common.dao.operator.MongoCondition;
13 13 import com.lyms.platform.common.dao.operator.MongoOper;
14 14 import com.lyms.platform.common.dao.operator.MongoQuery;
  15 +import com.lyms.platform.common.enums.GroupEnums;
15 16 import com.lyms.platform.common.enums.ServiceStatusEnums;
16 17 import com.lyms.platform.common.enums.ServiceTypeEnums;
17 18 import com.lyms.platform.common.enums.YnEnums;
... ... @@ -31,7 +32,6 @@
31 32 import org.springframework.context.support.ClassPathXmlApplicationContext;
32 33  
33 34 import org.springframework.data.mongodb.core.MongoTemplate;
34   -import org.springframework.data.mongodb.core.query.Criteria;
35 35 import org.springframework.data.mongodb.core.query.Query;
36 36 import org.springframework.data.mongodb.core.query.Update;
37 37  
38 38  
39 39  
... ... @@ -41,34 +41,46 @@
41 41 public static SimpleDateFormat h_m_s = new SimpleDateFormat("HH:mm:ss");
42 42  
43 43 public static void main(String[] args) throws Exception {
44   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
45 44 ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml");
46 45 // queryRisk(applicationContext);
47   - removeDoubleBaby(applicationContext);
  46 +// changeLong2Time(applicationContext);
  47 +
  48 + buildOrgGroup(applicationContext);
48 49 }
49 50  
50   - public static void removeDoubleBaby(ApplicationContext applicationContext) {
51   - MongoTemplate mongoTemplate
52   - =(MongoTemplate)applicationContext.getBean("mongoTemplate");
53   - mongoTemplate.getDb().slaveOk();
54   - mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray());
55   - List<BabyModel> list = mongoTemplate.find(new Query(new Criteria()), BabyModel.class);
56   - Map<String, BabyModel> localMap = new HashMap<>();
57   - Map<String, BabyModel> remoteMap = new HashMap<>();
58   - for (BabyModel model:list) {
59   - if (model.getId().length() == 24) {
60   - localMap.put(model.getMphone(),model);
61   - } else if (model.getId().length() == 32) {
62   - remoteMap.put(model.getMphone(),model);
63   - } else {
64   - System.out.println("other:"+JsonUtil.obj2JsonString(model));
65   - }
66   - }
67   - for (String phone:remoteMap.keySet()) {
68   - if (localMap.containsKey(phone)) {
69   - System.out.println("double:"+JsonUtil.obj2JsonString(remoteMap.get(phone)));
70   - }
71   - }
  51 +
  52 + public static void buildOrgGroup(ApplicationContext applicationContext){
  53 +
  54 + OrganizationGroupsService groupsService =applicationContext.getBean(OrganizationGroupsService.class);
  55 + OrganizationGroups groups=new OrganizationGroups();
  56 + groups.setbType(GroupEnums.BuildType.REGION.getbType());
  57 + groups.setGroupName("区域共享尼玛");
  58 + groups.setOwner(10002);
  59 + groups.setCreated(new Date());
  60 + groups.setModified(new Date());
  61 + groupsService.addOneEntity(groups);
  62 +
  63 +
  64 + OrganizationGroupsItemService groupsItemService= applicationContext.getBean(OrganizationGroupsItemService.class);
  65 + OrganizationGroupsItems groupsItems=new OrganizationGroupsItems();
  66 + groupsItems.setGroupId(groups.getId());
  67 + groupsItems.setCreated(new Date());
  68 + groupsItems.setModified(new Date());
  69 + groupsItems.setType(1);
  70 + List<Integer> list=new ArrayList<>();
  71 + list.add(193);
  72 + list.add(195);
  73 + list.add(197);
  74 + list.add(204);
  75 + list.add(248);
  76 + list.add(1000000000);
  77 + list.add(1000000001);
  78 + groupsItems.sethId(list);
  79 + groupsItems.setParentId("100002");
  80 + System.out.println(groupsItemService.addOneEntity(groupsItems));
  81 + OrganizationGroupsItemQuery groupsItemQuery=new OrganizationGroupsItemQuery();
  82 + List<OrganizationGroupsItems> list1= groupsItemService.queryList(groupsItemQuery);
  83 + System.out.println(list1.size());
72 84 }
73 85  
74 86 public static void changeLong2Time(ApplicationContext applicationContext) {
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IOrganizationGroupsDao.java View file @ 78072a1
  1 +package com.lyms.platform.biz.dal;
  2 +
  3 +import com.lyms.platform.common.dao.operator.MongoQuery;
  4 +import com.lyms.platform.pojo.OrganizationGroups;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + *
  10 + * 机构组操作
  11 + *
  12 + * Created by Administrator on 2016/12/21 0021.
  13 + */
  14 +public interface IOrganizationGroupsDao {
  15 +
  16 + /**
  17 + *
  18 + * 根据当前机构查询机构下的分组
  19 + *
  20 + * @return
  21 + */
  22 + List<OrganizationGroups> queryByOwner(MongoQuery mongoQuery);
  23 +
  24 +
  25 + /**
  26 + * 增加一个机构组
  27 + *
  28 + * @param organizationGroups
  29 + * @return
  30 + */
  31 + OrganizationGroups addOneEntity(OrganizationGroups organizationGroups);
  32 +
  33 + /**
  34 + * 查询符合条件的count
  35 + *
  36 + * @return 条数
  37 + */
  38 + int count(MongoQuery mongoQuery);
  39 +
  40 + /**
  41 + * 根据组id查询
  42 + *
  43 + * @param id
  44 + * @return
  45 + */
  46 + OrganizationGroups findById(String id);
  47 +
  48 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IOrganizationGroupsItemsDao.java View file @ 78072a1
  1 +package com.lyms.platform.biz.dal;
  2 +
  3 +import com.lyms.platform.common.dao.operator.MongoQuery;
  4 +import com.lyms.platform.pojo.OrganizationGroupsItems;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + *
  10 + * 机构组下的数据
  11 + *
  12 + * Created by Administrator on 2016/12/21 0021.
  13 + */
  14 +public interface IOrganizationGroupsItemsDao {
  15 +
  16 + /**
  17 + * 查询当前区域下选择的医院
  18 + *
  19 + * @param mogoQuery
  20 + * @return
  21 + */
  22 + List<OrganizationGroupsItems> queryList (MongoQuery mogoQuery);
  23 +
  24 +
  25 + /**
  26 + * 查询符合条件的条数
  27 + *
  28 + * @param mongoQuery
  29 + * @return
  30 + */
  31 + int count(MongoQuery mongoQuery);
  32 +
  33 + /**
  34 + * 增加一条数据
  35 + *
  36 + * @param groupsItems
  37 + * @return
  38 + */
  39 + OrganizationGroupsItems addOneEntity(OrganizationGroupsItems groupsItems);
  40 +
  41 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/OrganizationGroupsDaoImpl.java View file @ 78072a1
  1 +package com.lyms.platform.biz.dal.impl;
  2 +
  3 +import com.lyms.platform.biz.dal.IOrganizationGroupsDao;
  4 +import com.lyms.platform.common.dao.BaseMongoDAOImpl;
  5 +import com.lyms.platform.common.dao.operator.MongoQuery;
  6 +import com.lyms.platform.pojo.OrganizationGroups;
  7 +import org.springframework.stereotype.Repository;
  8 +
  9 +import java.util.List;
  10 +
  11 +/**
  12 + *
  13 + *机构组的dao
  14 + *
  15 + * Created by Administrator on 2016/12/21 0021.
  16 + */
  17 +@Repository("organizationGroupsDao")
  18 +public class OrganizationGroupsDaoImpl extends BaseMongoDAOImpl<OrganizationGroups> implements IOrganizationGroupsDao {
  19 +
  20 + @Override
  21 + public List<OrganizationGroups> queryByOwner(MongoQuery mongoQuery) {
  22 + return find(mongoQuery.convertToMongoQuery());
  23 + }
  24 +
  25 + @Override
  26 + public OrganizationGroups addOneEntity(OrganizationGroups organizationGroups) {
  27 + return save(organizationGroups);
  28 + }
  29 +
  30 + /**
  31 + * 根据组id查询
  32 + *
  33 + * @param id
  34 + * @return
  35 + */
  36 + public OrganizationGroups findById(String id){
  37 + return super.findById(id);
  38 + }
  39 +
  40 + /**
  41 + * 查询符合条件的count
  42 + *
  43 + * @return 条数
  44 + */
  45 + public int count(MongoQuery mongoQuery){
  46 + return (int)count(mongoQuery.convertToMongoQuery());
  47 + }
  48 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/OrganizationGroupsItemsDaoImpl.java View file @ 78072a1
  1 +package com.lyms.platform.biz.dal.impl;
  2 +
  3 +import com.lyms.platform.biz.dal.IOrganizationGroupsItemsDao;
  4 +import com.lyms.platform.common.dao.BaseMongoDAOImpl;
  5 +import com.lyms.platform.common.dao.operator.MongoQuery;
  6 +import com.lyms.platform.pojo.OrganizationGroupsItems;
  7 +import org.springframework.stereotype.Repository;
  8 +
  9 +import java.util.List;
  10 +
  11 +/**
  12 + *
  13 + * 机构组的成员
  14 + *
  15 + * Created by Administrator on 2016/12/21 0021.
  16 + */
  17 +@Repository("orgGroupsItemDao")
  18 +public class OrganizationGroupsItemsDaoImpl extends BaseMongoDAOImpl<OrganizationGroupsItems> implements IOrganizationGroupsItemsDao {
  19 + @Override
  20 + public List<OrganizationGroupsItems> queryList(MongoQuery mogoQuery) {
  21 + return find(mogoQuery.convertToMongoQuery());
  22 + }
  23 +
  24 + @Override
  25 + public int count(MongoQuery mongoQuery) {
  26 + return (int) count(mongoQuery.convertToMongoQuery());
  27 + }
  28 +
  29 +
  30 + public OrganizationGroupsItems addOneEntity(OrganizationGroupsItems groupsItems){
  31 + return save(groupsItems);
  32 + }
  33 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/OrganizationGroupsItemService.java View file @ 78072a1
  1 +package com.lyms.platform.biz.service;
  2 +
  3 +import com.lyms.platform.biz.dal.IOrganizationGroupsItemsDao;
  4 +import com.lyms.platform.common.dao.operator.MongoQuery;
  5 +import com.lyms.platform.pojo.OrganizationGroupsItems;
  6 +import com.lyms.platform.query.OrganizationGroupsItemQuery;
  7 +import org.apache.commons.lang.StringUtils;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.data.domain.Sort;
  10 +import org.springframework.stereotype.Service;
  11 +
  12 +import java.util.Date;
  13 +import java.util.List;
  14 +
  15 +/**
  16 + * 机构组的成员
  17 + * <p/>
  18 + * Created by Administrator on 2016/12/21 0021.
  19 + */
  20 +@Service
  21 +public class OrganizationGroupsItemService {
  22 + @Autowired
  23 + private IOrganizationGroupsItemsDao iOrganizationGroupsItemsDao;
  24 +
  25 +
  26 + /**
  27 + * 查询当前区域下选择的医院
  28 + *
  29 + * @param mogoQuery
  30 + * @return
  31 + */
  32 + public List<OrganizationGroupsItems> queryList(OrganizationGroupsItemQuery mogoQuery) {
  33 + MongoQuery mogo = mogoQuery.convertToQuery();
  34 + if (StringUtils.isNotEmpty(mogoQuery.getNeed())) {
  35 + mogoQuery.mysqlBuild(iOrganizationGroupsItemsDao.count(mogo));
  36 + mogo.start(mogoQuery.getOffset()).end(mogoQuery.getLimit());
  37 + }
  38 + return iOrganizationGroupsItemsDao.queryList(mogo.addOrder(Sort.Direction.DESC, "modified"));
  39 + }
  40 +
  41 + public int count(OrganizationGroupsItemQuery mogoQuery) {
  42 + MongoQuery mogo = mogoQuery.convertToQuery();
  43 + return iOrganizationGroupsItemsDao.count(mogo);
  44 + }
  45 +
  46 + /**
  47 + * 增加一条记录
  48 + *
  49 + * @param groupsItems
  50 + * @return
  51 + */
  52 + public OrganizationGroupsItems addOneEntity(OrganizationGroupsItems groupsItems) {
  53 + groupsItems.setCreated(new Date());
  54 + groupsItems.setModified(new Date());
  55 + return iOrganizationGroupsItemsDao.addOneEntity(groupsItems);
  56 + }
  57 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/OrganizationGroupsService.java View file @ 78072a1
  1 +package com.lyms.platform.biz.service;
  2 +
  3 +import com.lyms.platform.biz.dal.IOrganizationGroupsDao;
  4 +import com.lyms.platform.common.dao.operator.MongoQuery;
  5 +import com.lyms.platform.pojo.OrganizationGroups;
  6 +import com.lyms.platform.query.OrganizationGroupsQuery;
  7 +import org.apache.commons.lang.StringUtils;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.data.domain.Sort;
  10 +import org.springframework.stereotype.Service;
  11 +
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * 机构组的服务
  16 + * <p/>
  17 + * Created by Administrator on 2016/12/21 0021.
  18 + */
  19 +@Service
  20 +public class OrganizationGroupsService {
  21 +
  22 + @Autowired
  23 + private IOrganizationGroupsDao iOrganizationGroupsDao;
  24 +
  25 + /**
  26 + * 根据id查询
  27 + *
  28 + * @param id
  29 + * @return
  30 + */
  31 + public OrganizationGroups findById(String id) {
  32 + return iOrganizationGroupsDao.findById(id);
  33 + }
  34 +
  35 +
  36 + /**
  37 + * 根据当前机构查询机构下的分组
  38 + *
  39 + * @return
  40 + */
  41 + public List<OrganizationGroups> queryByOwner(OrganizationGroupsQuery mongoQuery) {
  42 + MongoQuery mogo = mongoQuery.convertToQuery();
  43 + if (StringUtils.isEmpty(mongoQuery.getNeed())) {
  44 + mongoQuery.mysqlBuild(iOrganizationGroupsDao.count(mogo));
  45 + mogo.start(mongoQuery.getOffset()).end(mongoQuery.getLimit());
  46 + }
  47 + return iOrganizationGroupsDao.queryByOwner(mogo.addOrder(Sort.Direction.DESC, "modified"));
  48 + }
  49 +
  50 +
  51 + /**
  52 + * 增加一个机构组
  53 + *
  54 + * @param organizationGroups
  55 + * @return
  56 + */
  57 + public OrganizationGroups addOneEntity(OrganizationGroups organizationGroups) {
  58 + return iOrganizationGroupsDao.addOneEntity(organizationGroups);
  59 + }
  60 +}
platform-biz-service/src/main/java/com/lyms/platform/permission/model/Users.java View file @ 78072a1
... ... @@ -25,6 +25,26 @@
25 25 private Integer zhiChenId;
26 26 private String zhiChen;
27 27 private String employeeId;
  28 + //当前医院所在是否是建档医院
  29 + private Integer bStatus;
  30 + //当前方式
  31 + private Integer bType;
  32 +
  33 + public Integer getbType() {
  34 + return bType;
  35 + }
  36 +
  37 + public void setbType(Integer bType) {
  38 + this.bType = bType;
  39 + }
  40 +
  41 + public Integer getbStatus() {
  42 + return bStatus;
  43 + }
  44 +
  45 + public void setbStatus(Integer bStatus) {
  46 + this.bStatus = bStatus;
  47 + }
28 48  
29 49 public String getEmployeeId() {
30 50 return employeeId;
platform-dal/src/main/java/com/lyms/platform/pojo/AntExRecordModel.java View file @ 78072a1
... ... @@ -26,6 +26,8 @@
26 26 private String parentId;
27 27  
28 28 private String hospitalId;
  29 + //手机号
  30 + private String phone;
29 31 //状态 1 已分娩 2未分娩
30 32 private int status;
31 33 //类型 1 初诊 2复诊
... ... @@ -55,6 +57,14 @@
55 57 private Date modified;
56 58  
57 59 private Date created;
  60 +
  61 + public String getPhone() {
  62 + return phone;
  63 + }
  64 +
  65 + public void setPhone(String phone) {
  66 + this.phone = phone;
  67 + }
58 68  
59 69 public String getfId() {
60 70 return fId;
platform-dal/src/main/java/com/lyms/platform/pojo/OrganizationGroups.java View file @ 78072a1
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.common.result.BaseModel;
  4 +import org.springframework.data.mongodb.core.mapping.Document;
  5 +
  6 +import java.util.Date;
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * 机构组
  11 + * <p/>
  12 + * Created by Administrator on 2016/12/21 0021.
  13 + */
  14 +@Document(collection = "lyms_groups")
  15 +public class OrganizationGroups extends BaseModel{
  16 +
  17 + private String id;
  18 + //机构id
  19 + private Integer owner;
  20 +
  21 +
  22 + //组名
  23 + private String groupName;
  24 +
  25 + /**
  26 + *
  27 + * 建档方式
  28 + *
  29 + * @link GroupEnums.BuildType
  30 + */
  31 + private Integer bType;
  32 +
  33 + private Date created;
  34 +
  35 + private Date modified;
  36 +
  37 + public Integer getOwner() {
  38 + return owner;
  39 + }
  40 +
  41 + public void setOwner(Integer owner) {
  42 + this.owner = owner;
  43 + }
  44 +
  45 + public String getId() {
  46 + return id;
  47 + }
  48 +
  49 + public void setId(String id) {
  50 + this.id = id;
  51 + }
  52 +
  53 + public String getGroupName() {
  54 + return groupName;
  55 + }
  56 +
  57 + public void setGroupName(String groupName) {
  58 + this.groupName = groupName;
  59 + }
  60 +
  61 + public Integer getbType() {
  62 + return bType;
  63 + }
  64 +
  65 + public void setbType(Integer bType) {
  66 + this.bType = bType;
  67 + }
  68 +
  69 + public Date getCreated() {
  70 + return created;
  71 + }
  72 +
  73 + public void setCreated(Date created) {
  74 + this.created = created;
  75 + }
  76 +
  77 + public Date getModified() {
  78 + return modified;
  79 + }
  80 +
  81 + public void setModified(Date modified) {
  82 + this.modified = modified;
  83 + }
  84 +}
platform-dal/src/main/java/com/lyms/platform/pojo/OrganizationGroupsItems.java View file @ 78072a1
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.common.result.BaseModel;
  4 +import org.springframework.data.mongodb.core.mapping.Document;
  5 +
  6 +import java.util.Date;
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * 机构组项目
  11 + *
  12 + *
  13 + * Created by Administrator on 2016/12/21 0021.
  14 + */
  15 +@Document(collection = "lyms_group_items")
  16 +public class OrganizationGroupsItems extends BaseModel {
  17 +
  18 +
  19 + private String id;
  20 + //省市区id
  21 + private String parentId;
  22 + //组id
  23 + private String groupId;
  24 +
  25 + //类型 -1 表示 是选择的区域 1 表示选择了具体的医院
  26 + private Integer type;
  27 + //选择的医院
  28 + private List<Integer> hId;
  29 +
  30 + private Date created;
  31 +
  32 + private Date modified;
  33 +
  34 + public String getGroupId() {
  35 + return groupId;
  36 + }
  37 +
  38 + public void setGroupId(String groupId) {
  39 + this.groupId = groupId;
  40 + }
  41 +
  42 + public String getId() {
  43 + return id;
  44 + }
  45 +
  46 + public void setId(String id) {
  47 + this.id = id;
  48 + }
  49 +
  50 + public String getParentId() {
  51 + return parentId;
  52 + }
  53 +
  54 + public void setParentId(String parentId) {
  55 + this.parentId = parentId;
  56 + }
  57 +
  58 + public Integer getType() {
  59 + return type;
  60 + }
  61 +
  62 + public void setType(Integer type) {
  63 + this.type = type;
  64 + }
  65 +
  66 + public List<Integer> gethId() {
  67 + return hId;
  68 + }
  69 +
  70 + public void sethId(List<Integer> hId) {
  71 + this.hId = hId;
  72 + }
  73 +
  74 + public Date getCreated() {
  75 + return created;
  76 + }
  77 +
  78 + public void setCreated(Date created) {
  79 + this.created = created;
  80 + }
  81 +
  82 + public Date getModified() {
  83 + return modified;
  84 + }
  85 +
  86 + public void setModified(Date modified) {
  87 + this.modified = modified;
  88 + }
  89 +}
platform-dal/src/main/java/com/lyms/platform/query/AntExRecordQuery.java View file @ 78072a1
... ... @@ -17,6 +17,33 @@
17 17 private String parentId;
18 18 private String id;
19 19 private String fId;
  20 + private String name;
  21 + private String cardNo;
  22 + private String phone;
  23 +
  24 + public String getName() {
  25 + return name;
  26 + }
  27 +
  28 + public void setName(String name) {
  29 + this.name = name;
  30 + }
  31 +
  32 + public String getCardNo() {
  33 + return cardNo;
  34 + }
  35 +
  36 + public void setCardNo(String cardNo) {
  37 + this.cardNo = cardNo;
  38 + }
  39 +
  40 + public String getPhone() {
  41 + return phone;
  42 + }
  43 +
  44 + public void setPhone(String phone) {
  45 + this.phone = phone;
  46 + }
20 47  
21 48 //创建时间
22 49 private String hospitalId;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/AntenatalExaminationController.java View file @ 78072a1
... ... @@ -10,6 +10,7 @@
10 10 import com.lyms.platform.common.result.BaseObjectResponse;
11 11 import com.lyms.platform.common.result.BaseResponse;
12 12 import com.lyms.platform.common.utils.PropertiesUtils;
  13 +import com.lyms.platform.operate.web.facade.AntExRecordFacade;
13 14 import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade;
14 15 import com.lyms.platform.operate.web.request.*;
15 16 import org.apache.commons.lang.StringUtils;
... ... @@ -41,6 +42,8 @@
41 42  
42 43 @Autowired
43 44 private QhdfyHisService qhdfyHisService;
  45 + @Autowired
  46 + private AntExRecordFacade antExRecordFacade;
44 47  
45 48 public static final String HIS_VERSION = PropertiesUtils.getPropertyValue("his_version");
46 49  
... ... @@ -165,7 +168,17 @@
165 168 @TokenRequired
166 169 public BaseResponse findAntExList(@Valid AntExListQueryRequest exListQueryRequest,HttpServletRequest request) {
167 170 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
168   - return antenatalExaminationFacade.findAntExListTwo(exListQueryRequest,loginState.getId());
  171 + return antenatalExaminationFacade.findAntExListTwo(exListQueryRequest, loginState.getId());
  172 + }
  173 +
  174 + /**
  175 + * 产检管理接口
  176 + *
  177 + * @return
  178 + */
  179 + public BaseResponse findAntEx(@Valid AntExManagerQueryRequest antExManagerQueryRequest){
  180 +
  181 + return null;
169 182 }
170 183 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java View file @ 78072a1
1 1 package com.lyms.platform.operate.web.controller;
2 2  
3 3  
  4 +import com.lyms.platform.biz.service.OrganizationGroupsService;
4 5 import com.lyms.platform.common.annotation.TokenRequired;
5 6 import com.lyms.platform.common.base.BaseController;
6 7 import com.lyms.platform.common.base.LoginContext;
7 8 import com.lyms.platform.common.base.PageInfo;
8 9 import com.lyms.platform.common.constants.ConstantInterface;
9 10 import com.lyms.platform.common.constants.ErrorCodeConstants;
10   -import com.lyms.platform.common.enums.HospitalStatusEnums;
11   -import com.lyms.platform.common.enums.UserTypeEnum;
12   -import com.lyms.platform.common.enums.YnEnums;
13   -import com.lyms.platform.common.enums.ZhiChenEnums;
  11 +import com.lyms.platform.common.enums.*;
14 12 import com.lyms.platform.common.utils.*;
15 13 import com.lyms.platform.operate.web.facade.AccessPermissionFacade;
16 14 import com.lyms.platform.operate.web.facade.AutoMatchFacade;
  15 +import com.lyms.platform.operate.web.facade.OrganizationGroupsFacade;
17 16 import com.lyms.platform.operate.web.result.FrontEndResult;
18 17 import com.lyms.platform.operate.web.session.SessionProvider;
19 18 import com.lyms.platform.operate.web.session.strategy.ISessionProvider;
20 19 import com.lyms.platform.permission.model.*;
21 20 import com.lyms.platform.permission.service.*;
22 21 import com.lyms.platform.pojo.DataPermissionsModel;
  22 +import com.lyms.platform.pojo.OrganizationGroups;
23 23 import org.apache.commons.collections.CollectionUtils;
24 24 import org.apache.commons.lang.StringUtils;
25 25 import org.apache.commons.lang.math.*;
... ... @@ -47,7 +47,7 @@
47 47 @Autowired
48 48 private UsersService usersService;
49 49 @Autowired
50   - private TokenService tokenService;
  50 + private OrganizationGroupsFacade groupsFacade;
51 51 @Autowired
52 52 private UserRoleMapsService userRoleMapsService;
53 53 @Autowired
... ... @@ -65,7 +65,7 @@
65 65 @Value("#{configProperties['defaultAdminOrgId']}")
66 66 private String defaultAdminOrgId;
67 67 @Autowired
68   - private RolePermissionMapsService rolePermissionMapsService;
  68 + private OrganizationGroupsService groupsService;
69 69 @Autowired
70 70 private Permissions2Service permissions2Service;
71 71 @Autowired
... ... @@ -481,6 +481,18 @@
481 481 Organization organization = organizationService.getOrganization(users.getOrgId());
482 482 organizations.add(organization);
483 483 users.setOrganization(organization);
  484 + //是否是建档医院
  485 + users.setbStatus(organization.getbStatus());
  486 + //设置建档方式
  487 + String groupId= groupsFacade.findByCurrentUserId(loginContext.getId()+"");
  488 + Integer bType= GroupEnums.BuildType.SINGLE.getbType();
  489 + if(StringUtils.isNotEmpty(groupId)){
  490 + OrganizationGroups groups= groupsService.findById(groupId);
  491 + if(null!=groups){
  492 + bType= groups.getbType();
  493 + }
  494 + }
  495 + users.setbType(bType);
484 496 List<Organization> list2 = accessPermissionFacade.getOrganization(permissionsModelList);
485 497 if (CollectionUtils.isNotEmpty(list2)) {
486 498 for (Organization o : list2) {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java View file @ 78072a1
... ... @@ -12,7 +12,9 @@
12 12 import com.lyms.platform.common.utils.ExceptionUtils;
13 13 import com.lyms.platform.common.utils.JsonUtil;
14 14 import com.lyms.platform.common.utils.StringUtils;
  15 +import com.lyms.platform.operate.web.request.AntExManagerQueryRequest;
15 16 import com.lyms.platform.operate.web.request.CjStatisticsQueryRequest;
  17 +import com.lyms.platform.operate.web.result.AntExManagerResult;
16 18 import com.lyms.platform.operate.web.result.CjStatisticsListResult;
17 19 import com.lyms.platform.operate.web.result.CjStatisticsResult;
18 20 import com.lyms.platform.operate.web.result.HighScoreResult;
... ... @@ -54,6 +56,34 @@
54 56 }
55 57  
56 58 /**
  59 + * 产检管理
  60 + *
  61 + * @return
  62 + */
  63 + public BaseResponse findList(AntExManagerQueryRequest antExManagerQueryRequest, Integer userId) {
  64 +
  65 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  66 + AntExRecordQuery antExRecordQuery = new AntExRecordQuery();
  67 + antExRecordQuery.setHospitalId(hospitalId);
  68 + antExRecordQuery.setNeed("1");
  69 + antExRecordQuery.setPage(antExManagerQueryRequest.getPage());
  70 + antExRecordQuery.setLimit(antExManagerQueryRequest.getLimit());
  71 + antExRecordQuery.setName(antExManagerQueryRequest.getName());
  72 + antExRecordQuery.setPhone(antExManagerQueryRequest.getPhone());
  73 +
  74 +
  75 + List<AntExManagerResult> data =new ArrayList<>();
  76 + List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery);
  77 + if (CollectionUtils.isNotEmpty(antExRecordModelList)) {
  78 + for (AntExRecordModel e : antExRecordModelList) {
  79 + AntExManagerResult antExManagerResult = new AntExManagerResult();
  80 + antExManagerResult.convertToResult(e);
  81 + }
  82 + }
  83 + return new BaseListResponse().setData(data).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  84 + }
  85 +
  86 + /**
57 87 * 产检统计
58 88 *
59 89 * @param userId
60 90  
... ... @@ -114,9 +144,9 @@
114 144 Patients patients = patientsService.findOnePatientById(record.getParentId());
115 145 String dueWeek = "";
116 146 if (null != patients) {
117   - if (patients.getDueStatus()!=null&&patients.getDueStatus() == 1&&patients.getType()==3) {
  147 + if (patients.getDueStatus() != null && patients.getDueStatus() == 1 && patients.getType() == 3) {
118 148 dueWeek = "终止妊娠";
119   - } else if (patients.getType()==3) {
  149 + } else if (patients.getType() == 3) {
120 150 dueWeek = "已分娩";
121 151 } else {
122 152 int days = DateUtil.daysBetween(patients.getLastMenses(), new Date());
... ... @@ -153,7 +183,7 @@
153 183 List level = new ArrayList();
154 184 try {
155 185 for (Object str : record.gethLevel()) {
156   - if(null!=str&&StringUtils.isNotEmpty(str.toString())){
  186 + if (null != str && StringUtils.isNotEmpty(str.toString())) {
157 187 BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(str.toString());
158 188 if (null != basicConfig) {
159 189 Map map = new HashMap();
160 190  
161 191  
162 192  
... ... @@ -180,20 +210,20 @@
180 210 List<HashMap> list = recordService.aggregateOne(antExRecordQuery);
181 211 for (HashMap map : list) {
182 212 CjStatisticsResult cjStatisticsResult = new CjStatisticsResult();
183   - String dId=null;
  213 + String dId = null;
184 214 Object id = map.get("_id");
185   - if(null!=id){
186   - dId =id.toString();
187   - }else {
  215 + if (null != id) {
  216 + dId = id.toString();
  217 + } else {
188 218 continue;
189 219 }
190 220  
191 221 cjStatisticsResult.setdId(dId);
192 222 cjStatisticsResult.setCount(map.get("count").toString());
193 223 try {
194   - if(null==dId){
  224 + if (null == dId) {
195 225 cjStatisticsResult.setdName("未知");
196   - }else{
  226 + } else {
197 227 Users users = usersService.getUsers(Integer.valueOf(dId));
198 228 if (null != users) {
199 229 cjStatisticsResult.setdName(users.getName());
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 78072a1
... ... @@ -62,6 +62,10 @@
62 62 private AntExRecordService recordService;
63 63 @Value(("#{configProperties['run.region']}"))
64 64 private String runType;
  65 +
  66 + @Autowired
  67 + private OrganizationGroupsFacade groupsFacade;
  68 +
65 69 /**
66 70 * 处理区域隐藏建档
67 71 *
... ... @@ -76,8 +80,9 @@
76 80 if (StringUtils.isNotEmpty(parentId)) {
77 81 return parentId;
78 82 }
79   -
80   - Patients patients = findOnePatient(null, null, null, hospitalId, 1, false, pid, true);
  83 + List li = new ArrayList();
  84 + li.add(hospitalId);
  85 + Patients patients = findOnePatient(null, null, null, li, 1, false, pid, true);
81 86 //表示本院已经有隐藏建档
82 87 if (null != patients) {
83 88 return patients.getId();
... ... @@ -99,6 +104,7 @@
99 104 }
100 105 return null;
101 106 }
  107 +
102 108 /**
103 109 * 修改最后一次产检时间
104 110 *
105 111  
106 112  
107 113  
108 114  
109 115  
... ... @@ -106,38 +112,39 @@
106 112 */
107 113 private void setLashCTimes(String id) {
108 114  
109   - AntExQuery antExQuery = new AntExQuery();
110   - antExQuery.setParentId(id);
111   - antExQuery.setYn(YnEnums.YES.getId());
112   - Date date=null;
113   - List<AntenatalExaminationModel> antEx = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "checkDate"));
114   - if (CollectionUtils.isNotEmpty(antEx)) {
115   - date= antEx.get(0).getCheckDate();
116   - } else {
117   - AntExChuQuery antExChuQuery = new AntExChuQuery();
118   - antExChuQuery.setParentId(id);
119   - antExChuQuery.setYn(YnEnums.YES.getId());
120   - List<AntExChuModel> antExChu = antenatalExaminationService.queryAntExChu(antExChuQuery);
121   - if (CollectionUtils.isNotEmpty(antExChu)) {
122   - date= antExChu.get(0).getCheckTime();
123   - }
  115 + AntExQuery antExQuery = new AntExQuery();
  116 + antExQuery.setParentId(id);
  117 + antExQuery.setYn(YnEnums.YES.getId());
  118 + Date date = null;
  119 + List<AntenatalExaminationModel> antEx = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "checkDate"));
  120 + if (CollectionUtils.isNotEmpty(antEx)) {
  121 + date = antEx.get(0).getCheckDate();
  122 + } else {
  123 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  124 + antExChuQuery.setParentId(id);
  125 + antExChuQuery.setYn(YnEnums.YES.getId());
  126 + List<AntExChuModel> antExChu = antenatalExaminationService.queryAntExChu(antExChuQuery);
  127 + if (CollectionUtils.isNotEmpty(antExChu)) {
  128 + date = antExChu.get(0).getCheckTime();
124 129 }
  130 + }
125 131  
126   - if (null!=date) {
  132 + if (null != date) {
127 133 Patients patients1 = new Patients();
128 134 patients1.setLastCTime(date);
129 135 patients1.setId(id);
130 136 patientsService.updatePatient(patients1);
131 137 }
132 138 }
  139 +
133 140 //当非建档医院修改初诊信息时,需要同步给建档医院
134   - private void syncMaster(String parentId){
  141 + private void syncMaster(String parentId) {
135 142  
136 143 //当前非建档医院最新的状态
137 144 Patients patients = patientsService.findOnePatientById(parentId);
138 145  
139   - if(StringUtils.isNotEmpty(patients.getSource())){
140   - Patients masterPatients =patientsService.findOnePatientById(patients.getSource());
  146 + if (StringUtils.isNotEmpty(patients.getSource())) {
  147 + Patients masterPatients = patientsService.findOnePatientById(patients.getSource());
141 148  
142 149 masterPatients.setoRiskFactor(patients.getoRiskFactor());
143 150 masterPatients.setLastCTime(patients.getLastCTime());
... ... @@ -225,7 +232,7 @@
225 232 //修改数据
226 233 syncMaster(antExAddRequest.getParentId());
227 234 //复诊,修改产检管理
228   - antenatalExaminationService.updateAntExRecord(model.getId(),2);
  235 + antenatalExaminationService.updateAntExRecord(model.getId(), 2);
229 236 if (null != patients.getBuildType() && patients.getBuildType() == 3) {
230 237 ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery();
231 238 referralApplyOrderQuery.setParentId(patients.getId());
... ... @@ -301,7 +308,7 @@
301 308 antExChuModel.setHospitalId(hospitalId);
302 309 antenatalExaminationService.updateAntExChu(antExChuModel, antExChuModel.getId());
303 310  
304   - antenatalExaminationService.updatePatientAbortion(antExChuModel.getId(),antExChuModel.getAbortionZR(), antExChuModel.getAbortionRG());
  311 + antenatalExaminationService.updatePatientAbortion(antExChuModel.getId(), antExChuModel.getAbortionZR(), antExChuModel.getAbortionRG());
305 312  
306 313 Patients patients = patientsService.findOnePatientById(excAddRequest.getParentId());
307 314 patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor());
... ... @@ -323,7 +330,7 @@
323 330  
324 331 //初诊,修改产检管理
325 332 // antenatalExaminationService.updateAntExRecord(antExChuModel.getId(), 1);
326   - if(StringUtils.isNotEmpty(antExChuModel.getPid())) {
  333 + if (StringUtils.isNotEmpty(antExChuModel.getPid())) {
327 334 recordService.handExRecord(antExChuModel.getPid());
328 335 }
329 336 } else {
... ... @@ -366,7 +373,7 @@
366 373 //修改本院最后一次定义高危
367 374 updateLastRhTime(patients.getId(), hospitalId);
368 375 setLashCTimes(antExChuModel.getParentId());
369   - if(StringUtils.isNotEmpty(antExChuModel.getPid())){
  376 + if (StringUtils.isNotEmpty(antExChuModel.getPid())) {
370 377 recordService.handExRecord(antExChuModel.getPid());
371 378 }
372 379 if (null != patients.getBuildType() && patients.getBuildType() == 3) {
373 380  
... ... @@ -832,9 +839,10 @@
832 839 List sortList = new ArrayList();
833 840 String hospital = autoMatchFacade.getHospitalId(userId);
834 841 List<SortIn> listDate = new ArrayList();
835   -
  842 + ;
836 843 if (CollectionUtils.isNotEmpty(list)) {
837   - Patients patients2 = findOnePatient(null, null, null, hospital, -1, true, exListQueryRequest.getPid(),false);
  844 +// Patients patients2 = findOnePatient(null, null, null, hospital, -1, true, exListQueryRequest.getPid(),false);
  845 + Patients patients2 = findOnePatient(null, null, null, groupsFacade.findGroupHospital(userId), -1, true, exListQueryRequest.getPid(), false);
838 846 antexListResult.convertToResult(null, patients2, null);
839 847  
840 848 HighScoreResult highScoreResult = findLastRisk(list.get(0).getPid(), false);
... ... @@ -1038,9 +1046,9 @@
1038 1046 AntExChuQuery antExChuQuery = new AntExChuQuery();
1039 1047 antExChuQuery.setYn(YnEnums.YES.getId());
1040 1048 antExChuQuery.setStart(patients.getBookbuildingDate());
1041   - if(null==patients.getFmDate()){
1042   - antExChuQuery.setEnd(new Date(DateUtil.addWeek(patients.getLastMenses(), 42).getTime()+ 86398000));
1043   - }else{
  1049 + if (null == patients.getFmDate()) {
  1050 + antExChuQuery.setEnd(new Date(DateUtil.addWeek(patients.getLastMenses(), 42).getTime() + 86398000));
  1051 + } else {
1044 1052 antExChuQuery.setEnd(new Date(patients.getFmDate().getTime() + 86398000));
1045 1053 }
1046 1054  
... ... @@ -1061,9 +1069,9 @@
1061 1069 antExQuery.setYn(YnEnums.YES.getId());
1062 1070 antExQuery.setPid(pid);
1063 1071 antExQuery.setStart(patients.getBookbuildingDate());
1064   - if(null==patients.getFmDate()){
1065   - antExQuery.setEnd(new Date(DateUtil.addWeek(patients.getLastMenses(), 42).getTime()+ 86398000));
1066   - }else{
  1072 + if (null == patients.getFmDate()) {
  1073 + antExQuery.setEnd(new Date(DateUtil.addWeek(patients.getLastMenses(), 42).getTime() + 86398000));
  1074 + } else {
1067 1075 antExQuery.setEnd(new Date(patients.getFmDate().getTime() + 86398000));
1068 1076 }
1069 1077  
1070 1078  
... ... @@ -1160,10 +1168,10 @@
1160 1168 return -1;
1161 1169 }
1162 1170 if (Integer.valueOf(o1.getType()) == Integer.valueOf(o2.getType())) {
1163   - if (o1.getCreated().getTime()<o2.getCreated().getTime()) {
  1171 + if (o1.getCreated().getTime() < o2.getCreated().getTime()) {
1164 1172 return -1;
1165 1173 }
1166   - if (o1.getCreated().getTime()>(o2.getCreated().getTime())) {
  1174 + if (o1.getCreated().getTime() > (o2.getCreated().getTime())) {
1167 1175 return 1;
1168 1176 }
1169 1177 }
... ... @@ -1227,7 +1235,7 @@
1227 1235 }
1228 1236 }
1229 1237  
1230   - List<AntenatalExaminationModel> list1 = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC,"checkDate"));
  1238 + List<AntenatalExaminationModel> list1 = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "checkDate"));
1231 1239 if (CollectionUtils.isNotEmpty(list1)) {
1232 1240 for (AntenatalExaminationModel an : list1) {
1233 1241 if (null != an.getHospitalId()) {
... ... @@ -1464,7 +1472,7 @@
1464 1472  
1465 1473 AntenatalExaminationModel localAntModel = antenatalExaminationService.findOneById(antExQueryRequest.getId());
1466 1474  
1467   - parentId =localAntModel.getParentId();
  1475 + parentId = localAntModel.getParentId();
1468 1476  
1469 1477 /*AntExQuery antExQuery = new AntExQuery();
1470 1478 antExQuery.setId(antExQueryRequest.getId());
... ... @@ -1493,7 +1501,7 @@
1493 1501 //修改最后一次检查时间
1494 1502 AntenatalExaminationModel antenatalExaminationModel = antenatalExaminationService.findOneById(antExQueryRequest.getId());
1495 1503  
1496   - setLashCTimes( antenatalExaminationModel.getParentId());
  1504 + setLashCTimes(antenatalExaminationModel.getParentId());
1497 1505  
1498 1506 updateLastRisk(antenatalExaminationModel.getParentId());
1499 1507 recordService.handExRecord(antenatalExaminationModel.getParentId());
1500 1508  
... ... @@ -1552,14 +1560,12 @@
1552 1560  
1553 1561  
1554 1562 //删除复诊或者出诊的时候更新patient表的下次预约时间为最近的一次预约
1555   - if (StringUtils.isNotEmpty(parentId))
1556   - {
  1563 + if (StringUtils.isNotEmpty(parentId)) {
1557 1564 PatientsQuery patientQuery = new PatientsQuery();
1558 1565 patientQuery.setYn(YnEnums.YES.getId());
1559 1566 patientQuery.setId(parentId);
1560 1567 List<Patients> patientses = patientsService.queryPatient(patientQuery);
1561   - if (CollectionUtils.isNotEmpty(patientses))
1562   - {
  1568 + if (CollectionUtils.isNotEmpty(patientses)) {
1563 1569 for (Patients pat : patientses) {
1564 1570 AntExChuQuery antExChuQuery = new AntExChuQuery();
1565 1571 antExChuQuery.setYn(YnEnums.YES.getId());
1566 1572  
... ... @@ -1568,21 +1574,18 @@
1568 1574 Date nextTime = null;
1569 1575 List<AntExChuModel> chus = antenatalExaminationService.queryAntExChu(antExChuQuery);
1570 1576 if (CollectionUtils.isNotEmpty(chus)) {
1571   - AntExChuModel chu = chus.get(0);
1572   - if (chu != null)
1573   - {
  1577 + AntExChuModel chu = chus.get(0);
  1578 + if (chu != null) {
1574 1579 nextTime = chu.getNextCheckTime();
1575 1580  
1576 1581 AntExQuery antExQuery = new AntExQuery();
1577 1582 antExQuery.setParentId(pat.getId());
1578 1583 antExQuery.setYn(YnEnums.YES.getId());
1579 1584 antExQuery.setHospitalId(pat.getHospitalId());
1580   - List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
1581   - if (CollectionUtils.isNotEmpty(list))
1582   - {
1583   - AntenatalExaminationModel ae = list.get(0);
1584   - if (ae != null)
1585   - {
  1585 + List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created"));
  1586 + if (CollectionUtils.isNotEmpty(list)) {
  1587 + AntenatalExaminationModel ae = list.get(0);
  1588 + if (ae != null) {
1586 1589 nextTime = ae.getNextCheckTime();
1587 1590 }
1588 1591 }
... ... @@ -1629,7 +1632,7 @@
1629 1632 * @param type 类型 1 孕妇 3 产妇 -1 不区分
1630 1633 * @param outHospital 是否需要查外院
1631 1634 */
1632   - public Patients findOnePatient(String cardNo, String vcCardNo, String id, String hospitalId, Integer type, boolean outHospital, String pid, boolean isEnable) {
  1635 + public Patients findOnePatient(String cardNo, String vcCardNo, String id, List<String> hospitalId, Integer type, boolean outHospital, String pid, boolean isEnable) {
1633 1636 PatientsQuery patientsQuery = new PatientsQuery();
1634 1637 if (StringUtils.isNotEmpty(cardNo)) {
1635 1638 patientsQuery.setCardNo(cardNo);
... ... @@ -1641,7 +1644,7 @@
1641 1644 patientsQuery.setPid(pid);
1642 1645 }
1643 1646 patientsQuery.setType(type);
1644   - patientsQuery.setHospitalId(hospitalId);
  1647 + patientsQuery.setHospitalList(hospitalId);
1645 1648 patientsQuery.setYn(YnEnums.YES.getId());
1646 1649 patientsQuery.setBuildType(1);
1647 1650 if (isEnable) {
... ... @@ -1699,6 +1702,7 @@
1699 1702 public BaseResponse queryAntenatalExamination(AntenatalExaminationQueryRequest queryRequest, Integer userId) {
1700 1703 String hospitalId = autoMatchFacade.getHospitalId(userId);
1701 1704 Patients patients = null;
  1705 + Organization og = organizationService.getOrganization(Integer.valueOf(hospitalId));
1702 1706 if (!StringUtils.isEmpty(queryRequest.getPatientId())) {
1703 1707 PatientsQuery patientsQuery = new PatientsQuery();
1704 1708 patientsQuery.setId(queryRequest.getPatientId());
1705 1709  
... ... @@ -1711,23 +1715,21 @@
1711 1715 } else {
1712 1716  
1713 1717 //区域模式
1714   - if (ErrorCodeConstants.RUN_MODE.equals(runType)) {
1715   - patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, hospitalId, 1, false, null, true);
1716   - } else {
1717   - //查询产妇数据
1718   - patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, hospitalId, 1, false, null, false);
1719   - }
  1718 +
  1719 + patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, groupsFacade.findGroupHospital(userId), 1, false, null, og.getbStatus() == 1);
  1720 + //查询产妇数据
  1721 +// patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, hospitalId, 1, false, null, false);
1720 1722 }
1721 1723  
1722 1724 if (null == patients) {
1723   - if (ErrorCodeConstants.RUN_MODE.equals(runType)) {
1724   - //查询是否还有其他记录
1725   - patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, hospitalId, 3, false, null, true);
1726   - } else {
1727   - //查询是否还有其他记录
1728   - patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, hospitalId, 3, false, null, false);
1729   - }
1730   -
  1725 +// if (ErrorCodeConstants.RUN_MODE.equals(runType)) {
  1726 +// //查询是否还有其他记录
  1727 +// patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, hospitalId, 3, false, null, true);
  1728 +// } else {
  1729 +// //查询是否还有其他记录
  1730 +// patients = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, hospitalId, 3, false, null, false);
  1731 +// }
  1732 + patients=findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, groupsFacade.findGroupHospital(userId), 3, false, null, og.getbStatus() == 1);
1731 1733  
1732 1734 //区域模式
1733 1735 if (ErrorCodeConstants.RUN_MODE.equals(runType)) {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java View file @ 78072a1
Diff suppressed. Click to show
... ... @@ -45,429 +45,384 @@
45 45 @Component
46 46 public class BookbuildingFacade {
47 47  
48   - private Logger logger = LoggerFactory.getLogger(BookbuildingFacade.class);
49   - public static final String HIS_VERSION = PropertiesUtils.getPropertyValue("his_version");
  48 + private Logger logger = LoggerFactory.getLogger(BookbuildingFacade.class);
  49 + public static final String HIS_VERSION = PropertiesUtils.getPropertyValue("his_version");
50 50  
51   - @Autowired
52   - private YunBookbuildingService yunBookbuildingService;
  51 + @Autowired
  52 + private YunBookbuildingService yunBookbuildingService;
53 53  
54   - @Autowired
55   - private BasicConfigFacade basicConfigFacade;
  54 + @Autowired
  55 + private BasicConfigFacade basicConfigFacade;
56 56  
57   - @Autowired
58   - private OrganizationService organizationService;
  57 + @Autowired
  58 + private OrganizationService organizationService;
59 59  
60 60  
61   - @Autowired
62   - private PersonService personService;
  61 + @Autowired
  62 + private PersonService personService;
63 63  
64   - @Autowired
65   - private SmsTemplateService smsTemplateService;
  64 + @Autowired
  65 + private SmsTemplateService smsTemplateService;
66 66  
67 67  
68   - @Autowired
69   - private AntenatalExaminationService antenatalExaminationService;
  68 + @Autowired
  69 + private AntenatalExaminationService antenatalExaminationService;
70 70  
71   - @Autowired
72   - private AutoMatchFacade autoMatchFacade;
  71 + @Autowired
  72 + private AutoMatchFacade autoMatchFacade;
73 73  
74   - @Autowired
75   - private UsersService usersService;
  74 + @Autowired
  75 + private UsersService usersService;
76 76  
77   - @Autowired
78   - private PatientsService patientsService;
  77 + @Autowired
  78 + private PatientsService patientsService;
79 79  
80   - @Autowired
81   - private BasicConfigService basicConfigService;
  80 + @Autowired
  81 + private BasicConfigService basicConfigService;
82 82  
83   - @Autowired
84   - private AntenatalExaminationFacade antenatalExaminationFacade;
  83 + @Autowired
  84 + private AntenatalExaminationFacade antenatalExaminationFacade;
85 85  
86   - @Autowired
87   - private SmsConfigFacade smsConfigFacade;
  86 + @Autowired
  87 + private SmsConfigFacade smsConfigFacade;
88 88  
89   - @Autowired
90   - private HisService hisServiceV2;
  89 + @Autowired
  90 + private HisService hisServiceV2;
91 91  
92   - @Autowired
93   - private QingLongXianHisService qingLongXianHisService;
  92 + @Autowired
  93 + private QingLongXianHisService qingLongXianHisService;
94 94  
95   - @Autowired
96   - private FnfyHisService fnfyHisService;
97   - @Autowired
98   - private QhdfyHisService qhdfyHisService;
  95 + @Autowired
  96 + private FnfyHisService fnfyHisService;
  97 + @Autowired
  98 + private QhdfyHisService qhdfyHisService;
99 99  
100 100  
101   - @Autowired
102   - private DeleteProcessHandler deleteProcessHandler;
  101 + @Autowired
  102 + private DeleteProcessHandler deleteProcessHandler;
103 103  
104   - @Autowired
105   - private SyncDataService syncDataService;
106   - @Autowired
107   - private SieveService sieveService;
108   - @Value(("#{configProperties['run.region']}"))
109   - private String runType;
  104 + @Autowired
  105 + private SyncDataService syncDataService;
  106 + @Autowired
  107 + private SieveService sieveService;
  108 + @Autowired
  109 + private OrganizationGroupsFacade groupsFacade;
110 110  
111   - /**
112   - * 添加孕妇建档
113   - * @param yunRequest
114   - * @return
115   - */
116   - public BaseObjectResponse addPregnantBookbuilding(
117   - YunBookbuildingAddRequest yunRequest,Integer userId) {
118 111  
119   - BaseObjectResponse br = new BaseObjectResponse();
120   - PatientsQuery patientsQuery = new PatientsQuery();
121   - patientsQuery.setYn(YnEnums.YES.getId());
122   - patientsQuery.setType(1);
123   - patientsQuery.setHospitalId(yunRequest.getHospitalId());
124   - patientsQuery.setBuildTypeEq(0);
125   - patientsQuery.setDueStatus(0);
  112 + /**
  113 + * 添加孕妇建档
  114 + *
  115 + * @param yunRequest
  116 + * @return
  117 + */
  118 + public BaseObjectResponse addPregnantBookbuilding(
  119 + YunBookbuildingAddRequest yunRequest, Integer userId) {
126 120  
127   - if (yunRequest.getPregnantCertificateNum() != null)
128   - {
129   - patientsQuery.setCardNo(yunRequest.getPregnantCertificateNum());
130   - //判断该身份证号码是否有孕妇建档 在该医院
131   - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
132   - if (CollectionUtils.isNotEmpty(patients))
133   - {
134   - br.setErrorcode(ErrorCodeConstants.DATA_EXIST);
135   - br.setErrormsg("该身份证在医院已经建档");
136   - return br;
137   - }
138   - }
139   - if (yunRequest.getPregnantPhone() != null)
140   - {
141   - patientsQuery.setCardNo(null);
142   - patientsQuery.setPhone(yunRequest.getPregnantPhone());
143   - //判断该手机号码在 孕期内有没有建档
144   - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
145   - if (CollectionUtils.isNotEmpty(patients))
146   - {
147   - br.setErrorcode(ErrorCodeConstants.DATA_EXIST);
148   - br.setErrormsg("该手机号码已经建档");
149   - return br;
150   - }
151   - }
  121 + BaseObjectResponse br = new BaseObjectResponse();
  122 + PatientsQuery patientsQuery = new PatientsQuery();
  123 + patientsQuery.setYn(YnEnums.YES.getId());
  124 + patientsQuery.setType(1);
  125 + patientsQuery.setHospitalId(yunRequest.getHospitalId());
  126 + patientsQuery.setBuildTypeEq(0);
  127 + patientsQuery.setDueStatus(0);
152 128  
153   - //就诊卡号判断
154   - if (StringUtils.isNotEmpty(yunRequest.getVcCardNo()))
155   - {
156   - patientsQuery.setCardNo(null);
157   - patientsQuery.setPhone(null);
158   - patientsQuery.setVcCardNo(yunRequest.getVcCardNo());
159   - patientsQuery.setHospitalId(yunRequest.getHospitalId());
160   - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
161   - if (CollectionUtils.isNotEmpty(patients))
162   - {
163   - br.setErrorcode(ErrorCodeConstants.DATA_EXIST);
164   - br.setErrormsg("该就诊卡号在该医院已经建档");
165   - return br;
166   - }
167   - }
  129 + if (yunRequest.getPregnantCertificateNum() != null) {
  130 + patientsQuery.setCardNo(yunRequest.getPregnantCertificateNum());
  131 + //判断该身份证号码是否有孕妇建档 在该医院
  132 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  133 + if (CollectionUtils.isNotEmpty(patients)) {
  134 + br.setErrorcode(ErrorCodeConstants.DATA_EXIST);
  135 + br.setErrormsg("该身份证在医院已经建档");
  136 + return br;
  137 + }
  138 + }
  139 + if (yunRequest.getPregnantPhone() != null) {
  140 + patientsQuery.setCardNo(null);
  141 + patientsQuery.setPhone(yunRequest.getPregnantPhone());
  142 + //判断该手机号码在 孕期内有没有建档
  143 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  144 + if (CollectionUtils.isNotEmpty(patients)) {
  145 + br.setErrorcode(ErrorCodeConstants.DATA_EXIST);
  146 + br.setErrormsg("该手机号码已经建档");
  147 + return br;
  148 + }
  149 + }
168 150  
169   - Integer type = 1; //1孕妇 2儿童 3产妇
170   - //建档类型 0 未分娩建档 1儿童建档时建档 2 自动分娩类型 3 转诊自动建档
171   - Integer buildType = 0;
172   - Date date = null;
173   - if (yunRequest.getLastMenstrualPeriod() != null)
174   - {
175   - date = DateUtil.addWeek(DateUtil.parseYMD(yunRequest.getLastMenstrualPeriod()),42);
176   - Date currentDate = DateUtil.formatDate(new Date());
177   - if (date.getTime() <= currentDate.getTime())
178   - {
179   - type = 3;
180   - buildType = 2;
181   - }
182   - }
  151 + //就诊卡号判断
  152 + if (StringUtils.isNotEmpty(yunRequest.getVcCardNo())) {
  153 + patientsQuery.setCardNo(null);
  154 + patientsQuery.setPhone(null);
  155 + patientsQuery.setVcCardNo(yunRequest.getVcCardNo());
  156 + patientsQuery.setHospitalId(yunRequest.getHospitalId());
  157 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  158 + if (CollectionUtils.isNotEmpty(patients)) {
  159 + br.setErrorcode(ErrorCodeConstants.DATA_EXIST);
  160 + br.setErrormsg("该就诊卡号在该医院已经建档");
  161 + return br;
  162 + }
  163 + }
183 164  
184   - PersonModel resperson = null;
185   - if (StringUtils.isNotEmpty(yunRequest.getPregnantCertificateNum()))
186   - {
  165 + Integer type = 1; //1孕妇 2儿童 3产妇
  166 + //建档类型 0 未分娩建档 1儿童建档时建档 2 自动分娩类型 3 转诊自动建档
  167 + Integer buildType = 0;
  168 + Date date = null;
  169 + if (yunRequest.getLastMenstrualPeriod() != null) {
  170 + date = DateUtil.addWeek(DateUtil.parseYMD(yunRequest.getLastMenstrualPeriod()), 42);
  171 + Date currentDate = DateUtil.formatDate(new Date());
  172 + if (date.getTime() <= currentDate.getTime()) {
  173 + type = 3;
  174 + buildType = 2;
  175 + }
  176 + }
187 177  
188   - PersonModelQuery personModelQuery = new PersonModelQuery();
189   - personModelQuery.setCardNo(yunRequest.getPregnantCertificateNum());
190   - personModelQuery.setYn(YnEnums.YES.getId());
191   - personModelQuery.setTypes(new Integer[]{1,3}); //孕妇或者产妇基本信息
192   - List<PersonModel> personModels = personService.queryPersons(personModelQuery);
  178 + PersonModel resperson = null;
  179 + if (StringUtils.isNotEmpty(yunRequest.getPregnantCertificateNum())) {
193 180  
194   - PersonModel pmodel = new PersonModel();
195   - pmodel.setName(yunRequest.getPregnantName());
196   - pmodel.setBirth(DateUtil.parseYMD(yunRequest.getBirthday()));
197   - pmodel.setPhone(yunRequest.getPregnantPhone());
198   - pmodel.setCardNo(yunRequest.getPregnantCertificateNum());
199   - pmodel.setType(type);
200   - pmodel.setModified(new Date());
201   - if (CollectionUtils.isNotEmpty(personModels) && personModels.get(0) != null)
202   - {
  181 + PersonModelQuery personModelQuery = new PersonModelQuery();
  182 + personModelQuery.setCardNo(yunRequest.getPregnantCertificateNum());
  183 + personModelQuery.setYn(YnEnums.YES.getId());
  184 + personModelQuery.setTypes(new Integer[]{1, 3}); //孕妇或者产妇基本信息
  185 + List<PersonModel> personModels = personService.queryPersons(personModelQuery);
203 186  
204   - resperson = personModels.get(0);
205   - personService.updatePerson(pmodel,personModels.get(0).getId());
206   - }
207   - else
208   - {
209   - pmodel.setYn(YnEnums.YES.getId());
210   - pmodel.setCreated(new Date());
211   - resperson = personService.addPerson(pmodel);
212   - }
213   - }
  187 + PersonModel pmodel = new PersonModel();
  188 + pmodel.setName(yunRequest.getPregnantName());
  189 + pmodel.setBirth(DateUtil.parseYMD(yunRequest.getBirthday()));
  190 + pmodel.setPhone(yunRequest.getPregnantPhone());
  191 + pmodel.setCardNo(yunRequest.getPregnantCertificateNum());
  192 + pmodel.setType(type);
  193 + pmodel.setModified(new Date());
  194 + if (CollectionUtils.isNotEmpty(personModels) && personModels.get(0) != null) {
214 195  
215   - Patients patient = getPatientsData(yunRequest);
216   - patient.setDueStatus(0);
217   - //1孕妇 3 产妇
218   - patient.setType(type);
219   - patient.setBuildType(buildType);
220   - if (type == ServiceObjEnums.CHANOBJ.getId() && date != null)
221   - {
222   - patient.setFmDate(date);
223   - }
224   - if (resperson != null)
225   - {
226   - patient.setPid(resperson.getId());
227   - HighScoreResult highScoreResult= antenatalExaminationFacade.findLastRisk(resperson.getId(), true);
228   - if(CollectionUtils.isNotEmpty(highScoreResult.getHighId())){
229   - patient.setRiskFactorId(highScoreResult.getHighId());
230   - }
231   - patient.setRiskScore(highScoreResult.getScore());
232   - if(CollectionUtils.isNotEmpty(highScoreResult.getLevelId())){
233   - patient.setRiskLevelId(JsonUtil.array2JsonString(highScoreResult.getLevelId()));
234   - }
235   - }
  196 + resperson = personModels.get(0);
  197 + personService.updatePerson(pmodel, personModels.get(0).getId());
  198 + } else {
  199 + pmodel.setYn(YnEnums.YES.getId());
  200 + pmodel.setCreated(new Date());
  201 + resperson = personService.addPerson(pmodel);
  202 + }
  203 + }
236 204  
237   - patient.setCreated(new Date());
238   - patient.setModified(new Date());
239   - patient.setOperator(userId);
240   - Patients p = yunBookbuildingService.addPregnantBookbuilding(patient);
  205 + Patients patient = getPatientsData(yunRequest);
  206 + patient.setDueStatus(0);
  207 + //1孕妇 3 产妇
  208 + patient.setType(type);
  209 + patient.setBuildType(buildType);
  210 + if (type == ServiceObjEnums.CHANOBJ.getId() && date != null) {
  211 + patient.setFmDate(date);
  212 + }
  213 + if (resperson != null) {
  214 + patient.setPid(resperson.getId());
  215 + HighScoreResult highScoreResult = antenatalExaminationFacade.findLastRisk(resperson.getId(), true);
  216 + if (CollectionUtils.isNotEmpty(highScoreResult.getHighId())) {
  217 + patient.setRiskFactorId(highScoreResult.getHighId());
  218 + }
  219 + patient.setRiskScore(highScoreResult.getScore());
  220 + if (CollectionUtils.isNotEmpty(highScoreResult.getLevelId())) {
  221 + patient.setRiskLevelId(JsonUtil.array2JsonString(highScoreResult.getLevelId()));
  222 + }
  223 + }
241 224  
242   - if (p == null || p.getId() == null)
243   - {
244   - br.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR);
245   - br.setErrormsg("建档失败,保存异常");
246   - return br;
  225 + patient.setCreated(new Date());
  226 + patient.setModified(new Date());
  227 + patient.setOperator(userId);
  228 + Patients p = yunBookbuildingService.addPregnantBookbuilding(patient);
247 229  
248   - }
  230 + if (p == null || p.getId() == null) {
  231 + br.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR);
  232 + br.setErrormsg("建档失败,保存异常");
  233 + return br;
249 234  
250   - //加入产筛
251   - patientsService.validata(p);
  235 + }
252 236  
253   - if (type == ServiceObjEnums.YUNOBJ.getId())
254   - {
255   - //生成建档短信
256   - createBuildSms(p);
257   - }
  237 + //加入产筛
  238 + patientsService.validata(p);
258 239  
259   - br.setErrorcode(ErrorCodeConstants.SUCCESS);
260   - br.setErrormsg("成功");
261   - br.setData(p.getId());
262   - return br;
  240 + if (type == ServiceObjEnums.YUNOBJ.getId()) {
  241 + //生成建档短信
  242 + createBuildSms(p);
  243 + }
263 244  
264   - }
  245 + br.setErrorcode(ErrorCodeConstants.SUCCESS);
  246 + br.setErrormsg("成功");
  247 + br.setData(p.getId());
  248 + return br;
265 249  
266   - /**
267   - * 创建孕妇建档短信
268   - */
269   - private void createBuildSms(Patients patient)
270   - {
  250 + }
271 251  
272   - //判断医院是否启动和对应的服务项是否启用
273   - SmsConfigModel configModel = new SmsConfigModel();
274   - BaseResponse response = smsConfigFacade.hospitalIsStart(patient.getHospitalId(),configModel,SmsServiceEnums.FWKT.getId());
275   - if (response != null)
276   - {
277   - return;
278   - }
  252 + /**
  253 + * 创建孕妇建档短信
  254 + */
  255 + private void createBuildSms(Patients patient) {
279 256  
280   - SmsTemplateQuery query = new SmsTemplateQuery();
281   - query.setYn(YnEnums.YES.getId());
282   - query.setStatus(1);
283   - query.setHospitalId(patient.getHospitalId());
284   - query.setServiceObj(ServiceObjEnums.YUNOBJ.getId());
285   - query.setSpecialDateType(SpecialDateEnums.JD.getId());
  257 + //判断医院是否启动和对应的服务项是否启用
  258 + SmsConfigModel configModel = new SmsConfigModel();
  259 + BaseResponse response = smsConfigFacade.hospitalIsStart(patient.getHospitalId(), configModel, SmsServiceEnums.FWKT.getId());
  260 + if (response != null) {
  261 + return;
  262 + }
286 263  
287   - Integer serviceType = patient.getServiceType();
288   - Integer serviceStatus = patient.getServiceStatus();
  264 + SmsTemplateQuery query = new SmsTemplateQuery();
  265 + query.setYn(YnEnums.YES.getId());
  266 + query.setStatus(1);
  267 + query.setHospitalId(patient.getHospitalId());
  268 + query.setServiceObj(ServiceObjEnums.YUNOBJ.getId());
  269 + query.setSpecialDateType(SpecialDateEnums.JD.getId());
289 270  
290   - List<SmsTemplateModel> sendList = new ArrayList<>();
  271 + Integer serviceType = patient.getServiceType();
  272 + Integer serviceStatus = patient.getServiceStatus();
291 273  
292   - List<SmsTemplateModel> temps = smsTemplateService.querySmsTemplates(query);
293   - if (CollectionUtils.isNotEmpty(temps))
294   - {
  274 + List<SmsTemplateModel> sendList = new ArrayList<>();
295 275  
296   - for (SmsTemplateModel temp : temps)
297   - {
298   - if (temp.getServiceType() == serviceType && temp.getServiceStatus() == serviceStatus)
299   - {
300   - sendList.add(temp);
301   - }
302   - else if (temp.getServiceType() == serviceType && temp.getServiceStatus() == serviceStatus)
303   - {
304   - sendList.add(temp);
305   - }
306   - else if (temp.getServiceStatus() == ServiceStatusEnums.ADD_ALL.getId())
307   - {
308   - if (serviceStatus == ServiceStatusEnums.ADD_OPEN.getId() || serviceStatus == ServiceStatusEnums.UNSUBSCRIBE.getId()
309   - || serviceStatus == ServiceStatusEnums.ADD_OVERDUE.getId()|| serviceStatus == ServiceStatusEnums.SUSPEND.getId())
310   - {
311   - sendList.add(temp);
312   - }
313   - }
314   - else if (temp.getServiceStatus() == ServiceStatusEnums.ALL_OPEN.getId())
315   - {
316   - if (serviceStatus == ServiceStatusEnums.STANDARD_OPEN.getId() || serviceStatus == ServiceStatusEnums.ADD_OPEN.getId() )
317   - {
318   - sendList.add(temp);
319   - }
320   - }
321   - else if (temp.getServiceStatus() == ServiceStatusEnums.ALL_OVERDUE.getId())
322   - {
323   - if (serviceStatus == ServiceStatusEnums.STANDARD_OVERDUE.getId() || serviceStatus == ServiceStatusEnums.ADD_OVERDUE.getId() )
324   - {
325   - sendList.add(temp);
326   - }
327   - }
328   - else if (temp.getServiceType() == ServiceTypeEnums.ALL_SERVICE.getId() && temp.getServiceStatus() == ServiceStatusEnums.ALL.getId())
329   - {
330   - sendList.add(temp);
331   - }
332   - }
  276 + List<SmsTemplateModel> temps = smsTemplateService.querySmsTemplates(query);
  277 + if (CollectionUtils.isNotEmpty(temps)) {
333 278  
334   - if (CollectionUtils.isNotEmpty(sendList))
335   - {
  279 + for (SmsTemplateModel temp : temps) {
  280 + if (temp.getServiceType() == serviceType && temp.getServiceStatus() == serviceStatus) {
  281 + sendList.add(temp);
  282 + } else if (temp.getServiceType() == serviceType && temp.getServiceStatus() == serviceStatus) {
  283 + sendList.add(temp);
  284 + } else if (temp.getServiceStatus() == ServiceStatusEnums.ADD_ALL.getId()) {
  285 + if (serviceStatus == ServiceStatusEnums.ADD_OPEN.getId() || serviceStatus == ServiceStatusEnums.UNSUBSCRIBE.getId()
  286 + || serviceStatus == ServiceStatusEnums.ADD_OVERDUE.getId() || serviceStatus == ServiceStatusEnums.SUSPEND.getId()) {
  287 + sendList.add(temp);
  288 + }
  289 + } else if (temp.getServiceStatus() == ServiceStatusEnums.ALL_OPEN.getId()) {
  290 + if (serviceStatus == ServiceStatusEnums.STANDARD_OPEN.getId() || serviceStatus == ServiceStatusEnums.ADD_OPEN.getId()) {
  291 + sendList.add(temp);
  292 + }
  293 + } else if (temp.getServiceStatus() == ServiceStatusEnums.ALL_OVERDUE.getId()) {
  294 + if (serviceStatus == ServiceStatusEnums.STANDARD_OVERDUE.getId() || serviceStatus == ServiceStatusEnums.ADD_OVERDUE.getId()) {
  295 + sendList.add(temp);
  296 + }
  297 + } else if (temp.getServiceType() == ServiceTypeEnums.ALL_SERVICE.getId() && temp.getServiceStatus() == ServiceStatusEnums.ALL.getId()) {
  298 + sendList.add(temp);
  299 + }
  300 + }
336 301  
337   - //短信前缀
338   - String messagePrefix = smsConfigFacade.getSmsPrefix(configModel, patient.getBookbuildingDoctor());
339   - for (SmsTemplateModel templateModel : sendList)
340   - {
341   - if (templateModel != null && templateModel.getStatus() == 1)
342   - {
343   - MessageListRequest smsList = new MessageListRequest();
344   - List<MessageRequest> messages = new ArrayList<>();
345   - MessageRequest mr = new MessageRequest();
346   - Date dueDate = DateUtil.addDay(patient.getLastMenses(), 7);
347   - dueDate = DateUtil.addMonth(dueDate, 9);
348   - String content = StringUtils.replaceEL(patient.getUsername(),dueDate,templateModel.getContent());
  302 + if (CollectionUtils.isNotEmpty(sendList)) {
349 303  
350   - mr.setContent("【"+messagePrefix+"】"+content);
351   - mr.setObjType(ServiceObjEnums.YUNOBJ.getId());
352   - mr.setPhone(patient.getPhone());
353   - mr.setTimeType(SmsTimeTypeEnums.ONTIME.getId());
354   - //短信商
355   - mr.setServiceType(SmsProviderEnums.YM.getId());
356   - mr.setTypeId(ProjectTypeEnums.YNXT.getId());
357   - mr.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date()));
358   - mr.setSubTypeId(SmsServiceEnums.FWKT.getId());
359   - mr.setStatus(SmsStatusEnums.WFS.getId());
360   - mr.setExt1(patient.getHospitalId());
361   - mr.setExt2(templateModel.getId());
362   - mr.setExt3(patient.getId());
363   - messages.add(mr);
  304 + //短信前缀
  305 + String messagePrefix = smsConfigFacade.getSmsPrefix(configModel, patient.getBookbuildingDoctor());
  306 + for (SmsTemplateModel templateModel : sendList) {
  307 + if (templateModel != null && templateModel.getStatus() == 1) {
  308 + MessageListRequest smsList = new MessageListRequest();
  309 + List<MessageRequest> messages = new ArrayList<>();
  310 + MessageRequest mr = new MessageRequest();
  311 + Date dueDate = DateUtil.addDay(patient.getLastMenses(), 7);
  312 + dueDate = DateUtil.addMonth(dueDate, 9);
  313 + String content = StringUtils.replaceEL(patient.getUsername(), dueDate, templateModel.getContent());
364 314  
365   - if (CollectionUtils.isNotEmpty(messages)) {
366   - smsList.setTypeId(ProjectTypeEnums.YNXT.getId());
367   - smsList.setMessages(messages);
368   - //调用发送接口
369   - if (!syncDataService.savePostMsg(JsonUtil.obj2JsonString(smsList), messages.get(0).getExt1())) {
370   - MessageCenterService.saveSmsCenter(smsList);
371   - }
372   - }
373   - }
374   - }
375   - }
376   - }
377   - }
  315 + mr.setContent("【" + messagePrefix + "】" + content);
  316 + mr.setObjType(ServiceObjEnums.YUNOBJ.getId());
  317 + mr.setPhone(patient.getPhone());
  318 + mr.setTimeType(SmsTimeTypeEnums.ONTIME.getId());
  319 + //短信商
  320 + mr.setServiceType(SmsProviderEnums.YM.getId());
  321 + mr.setTypeId(ProjectTypeEnums.YNXT.getId());
  322 + mr.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date()));
  323 + mr.setSubTypeId(SmsServiceEnums.FWKT.getId());
  324 + mr.setStatus(SmsStatusEnums.WFS.getId());
  325 + mr.setExt1(patient.getHospitalId());
  326 + mr.setExt2(templateModel.getId());
  327 + mr.setExt3(patient.getId());
  328 + messages.add(mr);
378 329  
  330 + if (CollectionUtils.isNotEmpty(messages)) {
  331 + smsList.setTypeId(ProjectTypeEnums.YNXT.getId());
  332 + smsList.setMessages(messages);
  333 + //调用发送接口
  334 + if (!syncDataService.savePostMsg(JsonUtil.obj2JsonString(smsList), messages.get(0).getExt1())) {
  335 + MessageCenterService.saveSmsCenter(smsList);
  336 + }
  337 + }
  338 + }
  339 + }
  340 + }
  341 + }
  342 + }
379 343  
380   - /**
381   - * 判断对应服务是否启动
382   - */
383   - private boolean isStartService(Integer smsType,String serviceStr)
384   - {
385   - if (StringUtils.isEmpty(serviceStr))
386   - {
387   - return false;
388   - }
389   - //消息服务启动
390   - List<Map> smsServices = JsonUtil.toList(serviceStr, Map.class);
391 344  
392   - if (CollectionUtils.isNotEmpty(smsServices))
393   - {
394   - for (Map map : smsServices)
395   - {
396   - String status = String.valueOf(map.get(String.valueOf(smsType)));
397   - if ("true".equals(status))
398   - {
399   - return true;
400   - }
401   - }
402   - }
403   - return false;
404   - }
  345 + /**
  346 + * 判断对应服务是否启动
  347 + */
  348 + private boolean isStartService(Integer smsType, String serviceStr) {
  349 + if (StringUtils.isEmpty(serviceStr)) {
  350 + return false;
  351 + }
  352 + //消息服务启动
  353 + List<Map> smsServices = JsonUtil.toList(serviceStr, Map.class);
405 354  
406   - /**
407   - * 更新孕妇信息
408   - * @param id
409   - * @param yunRequest
410   - */
411   - public BaseResponse updatePregnantById(String id, YunBookbuildingAddRequest yunRequest,Integer userId) {
  355 + if (CollectionUtils.isNotEmpty(smsServices)) {
  356 + for (Map map : smsServices) {
  357 + String status = String.valueOf(map.get(String.valueOf(smsType)));
  358 + if ("true".equals(status)) {
  359 + return true;
  360 + }
  361 + }
  362 + }
  363 + return false;
  364 + }
412 365  
  366 + /**
  367 + * 更新孕妇信息
  368 + *
  369 + * @param id
  370 + * @param yunRequest
  371 + */
  372 + public BaseResponse updatePregnantById(String id, YunBookbuildingAddRequest yunRequest, Integer userId) {
413 373  
414   - BaseResponse br = new BaseResponse();
415   - PatientsQuery patientsQuery = new PatientsQuery();
416   - patientsQuery.setYn(YnEnums.YES.getId());
417   - patientsQuery.setType(1);
418   - patientsQuery.setHospitalId(yunRequest.getHospitalId());
419   - patientsQuery.setBuildTypeEq(0);
420   - patientsQuery.setDueStatus(0);
421 374  
422   - if (yunRequest.getPregnantCertificateNum() != null)
423   - {
424   - patientsQuery.setCardNo(yunRequest.getPregnantCertificateNum());
425   - //判断该身份证号码是否有孕妇建档 在该医院
426   - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
427   - if (CollectionUtils.isNotEmpty(patients))
428   - {
429   - Patients pat = patients.get(0);
430   - if (pat != null && !pat.getPhone().equals(yunRequest.getPregnantPhone()))
431   - {
432   - if (StringUtils.isNotEmpty(yunRequest.getPregnantPhone())) {
433   - patientsQuery.setCardNo(null);
434   - patientsQuery.setPhone(yunRequest.getPregnantPhone());
435   - //判断该手机号码在 孕期内有没有建档
436   - patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
437   - if (CollectionUtils.isNotEmpty(patients)) {
438   - br.setErrorcode(ErrorCodeConstants.DATA_EXIST);
439   - br.setErrormsg("该手机号码已经建档");
440   - return br;
441   - }
442   - }
443   - }
  375 + BaseResponse br = new BaseResponse();
  376 + PatientsQuery patientsQuery = new PatientsQuery();
  377 + patientsQuery.setYn(YnEnums.YES.getId());
  378 + patientsQuery.setType(1);
  379 + patientsQuery.setHospitalId(yunRequest.getHospitalId());
  380 + patientsQuery.setBuildTypeEq(0);
  381 + patientsQuery.setDueStatus(0);
444 382  
445   - if (pat != null && StringUtils.isNotEmpty(pat.getVcCardNo()) && !pat.getVcCardNo().equals(yunRequest.getVcCardNo()))
446   - {
  383 + if (yunRequest.getPregnantCertificateNum() != null) {
  384 + patientsQuery.setCardNo(yunRequest.getPregnantCertificateNum());
  385 + //判断该身份证号码是否有孕妇建档 在该医院
  386 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  387 + if (CollectionUtils.isNotEmpty(patients)) {
  388 + Patients pat = patients.get(0);
  389 + if (pat != null && !pat.getPhone().equals(yunRequest.getPregnantPhone())) {
  390 + if (StringUtils.isNotEmpty(yunRequest.getPregnantPhone())) {
  391 + patientsQuery.setCardNo(null);
  392 + patientsQuery.setPhone(yunRequest.getPregnantPhone());
  393 + //判断该手机号码在 孕期内有没有建档
  394 + patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  395 + if (CollectionUtils.isNotEmpty(patients)) {
  396 + br.setErrorcode(ErrorCodeConstants.DATA_EXIST);
  397 + br.setErrormsg("该手机号码已经建档");
  398 + return br;
  399 + }
  400 + }
  401 + }
447 402  
448   - //就诊卡号判断
449   - if (StringUtils.isNotEmpty(yunRequest.getVcCardNo()))
450   - {
451   - patientsQuery.setCardNo(null);
452   - patientsQuery.setPhone(null);
453   - patientsQuery.setVcCardNo(yunRequest.getVcCardNo());
454   - patientsQuery.setHospitalId(yunRequest.getHospitalId());
455   - patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
456   - if (CollectionUtils.isNotEmpty(patients))
457   - {
458   - br.setErrorcode(ErrorCodeConstants.DATA_EXIST);
459   - br.setErrormsg("该就诊卡号在该医院已经建档");
460   - return br;
461   - }
462   - }
463   - }
464   - }
465   - }
  403 + if (pat != null && StringUtils.isNotEmpty(pat.getVcCardNo()) && !pat.getVcCardNo().equals(yunRequest.getVcCardNo())) {
466 404  
  405 + //就诊卡号判断
  406 + if (StringUtils.isNotEmpty(yunRequest.getVcCardNo())) {
  407 + patientsQuery.setCardNo(null);
  408 + patientsQuery.setPhone(null);
  409 + patientsQuery.setVcCardNo(yunRequest.getVcCardNo());
  410 + patientsQuery.setHospitalId(yunRequest.getHospitalId());
  411 + patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  412 + if (CollectionUtils.isNotEmpty(patients)) {
  413 + br.setErrorcode(ErrorCodeConstants.DATA_EXIST);
  414 + br.setErrormsg("该就诊卡号在该医院已经建档");
  415 + return br;
  416 + }
  417 + }
  418 + }
  419 + }
  420 + }
467 421  
468   - Patients patient = getPatientsData(yunRequest);
469   - patient.setModified(new Date());
470 422  
  423 + Patients patient = getPatientsData(yunRequest);
  424 + patient.setModified(new Date());
  425 +
471 426 // Integer type = ServiceObjEnums.YUNOBJ.getId();
472 427 // if (patient.getLastMenses() != null)
473 428 // {
474 429  
475 430  
476 431  
477 432  
478 433  
479 434  
480 435  
481 436  
482 437  
483 438  
484 439  
485 440  
486 441  
487 442  
488 443  
489 444  
490 445  
491 446  
492 447  
493 448  
494 449  
495 450  
496 451  
497 452  
498 453  
499 454  
500 455  
501 456  
502 457  
503 458  
504 459  
505 460  
506 461  
507 462  
508 463  
509 464  
510 465  
511 466  
512 467  
513 468  
514 469  
515 470  
516 471  
517 472  
518 473  
519 474  
520 475  
521 476  
522 477  
523 478  
524 479  
525 480  
526 481  
527 482  
528 483  
529 484  
530 485  
531 486  
532 487  
533 488  
534 489  
535 490  
536 491  
537 492  
538 493  
539 494  
540 495  
541 496  
542 497  
543 498  
544 499  
545 500  
546 501  
547 502  
548 503  
549 504  
550 505  
551 506  
552 507  
553 508  
554 509  
555 510  
556 511  
557 512  
558 513  
559 514  
560 515  
561 516  
562 517  
563 518  
564 519  
565 520  
566 521  
567 522  
568 523  
569 524  
570 525  
571 526  
572 527  
573 528  
574 529  
575 530  
576 531  
577 532  
578 533  
579 534  
580 535  
581 536  
582 537  
583 538  
584 539  
585 540  
586 541  
587 542  
588 543  
589 544  
590 545  
591 546  
592 547  
593 548  
594 549  
595 550  
596 551  
597 552  
598 553  
599 554  
600 555  
601 556  
602 557  
603 558  
604 559  
605 560  
606 561  
607 562  
... ... @@ -481,1044 +436,976 @@
481 436 // patient.setType(type);
482 437  
483 438  
484   - if (!StringUtils.isEmpty(yunRequest.getPid()))
485   - {
486   - PersonModel pmodel = new PersonModel();
487   - pmodel.setName(yunRequest.getPregnantName());
488   - pmodel.setBirth(DateUtil.parseYMD(yunRequest.getBirthday()));
489   - pmodel.setPhone(yunRequest.getPregnantPhone());
490   - pmodel.setCardNo(yunRequest.getPregnantCertificateNum());
491   - pmodel.setYn(YnEnums.YES.getId());
492   - pmodel.setModified(new Date());
493   - personService.updatePerson(pmodel, yunRequest.getPid());
494   - }
495   - patient.setId(id);
496   - //加入产筛
497   - patientsService.validata(patient);
498   - //如果当前是建档医院,那么需要修改其他非建档医院的数据
499   - if(autoMatchFacade.checkBStatus(userId)){
500   - patientsService.updateBaseData(patient);
501   - }
  439 + if (!StringUtils.isEmpty(yunRequest.getPid())) {
  440 + PersonModel pmodel = new PersonModel();
  441 + pmodel.setName(yunRequest.getPregnantName());
  442 + pmodel.setBirth(DateUtil.parseYMD(yunRequest.getBirthday()));
  443 + pmodel.setPhone(yunRequest.getPregnantPhone());
  444 + pmodel.setCardNo(yunRequest.getPregnantCertificateNum());
  445 + pmodel.setYn(YnEnums.YES.getId());
  446 + pmodel.setModified(new Date());
  447 + personService.updatePerson(pmodel, yunRequest.getPid());
  448 + }
  449 + patient.setId(id);
  450 + //加入产筛
  451 + patientsService.validata(patient);
  452 + //如果当前是建档医院,那么需要修改其他非建档医院的数据
  453 + if (autoMatchFacade.checkBStatus(userId)) {
  454 + patientsService.updateBaseData(patient);
  455 + }
502 456  
503 457  
504   - PatientsQuery pQuery = new PatientsQuery();
505   - pQuery.setYn(YnEnums.YES.getId());
506   - pQuery.setId(id);
507   - List<Patients> list = yunBookbuildingService.queryPregnantWithQuery(pQuery);
508   - if (CollectionUtils.isNotEmpty(list))
509   - {
510   - Patients pat = list.get(0);
511   - if (!(pat.getServiceStatus() == ServiceStatusEnums.STANDARD_OPEN.getId() || pat.getServiceStatus() == ServiceStatusEnums.ADD_OPEN.getId()))
512   - {
  458 + PatientsQuery pQuery = new PatientsQuery();
  459 + pQuery.setYn(YnEnums.YES.getId());
  460 + pQuery.setId(id);
  461 + List<Patients> list = yunBookbuildingService.queryPregnantWithQuery(pQuery);
  462 + if (CollectionUtils.isNotEmpty(list)) {
  463 + Patients pat = list.get(0);
  464 + if (!(pat.getServiceStatus() == ServiceStatusEnums.STANDARD_OPEN.getId() || pat.getServiceStatus() == ServiceStatusEnums.ADD_OPEN.getId())) {
513 465  
514   - if (pat.getServiceType() == ServiceTypeEnums.STANDARD_SERVICE.getId())
515   - {
516   - pat.setServiceStatus(ServiceStatusEnums.STANDARD_OPEN.getId());
517   - }
518   - else if (pat.getServiceType() == ServiceTypeEnums.ADD_SERVICE.getId())
519   - {
520   - pat.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId());
521   - }
  466 + if (pat.getServiceType() == ServiceTypeEnums.STANDARD_SERVICE.getId()) {
  467 + pat.setServiceStatus(ServiceStatusEnums.STANDARD_OPEN.getId());
  468 + } else if (pat.getServiceType() == ServiceTypeEnums.ADD_SERVICE.getId()) {
  469 + pat.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId());
  470 + }
522 471  
523   - createBuildSms(pat);
524   - }
525   - }
  472 + createBuildSms(pat);
  473 + }
  474 + }
526 475  
527   - patient.setOperator(userId);
528   - yunBookbuildingService.updatePregnant(patient, id);
  476 + patient.setOperator(userId);
  477 + yunBookbuildingService.updatePregnant(patient, id);
529 478  
530   - return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
531   - }
  479 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  480 + }
532 481  
533   - /**
534   - * 查询孕妇建档记录
535   - * @param bookbuildingQueryRequest
536   - * @return
537   - */
538   - public BaseListResponse queryPregnantBuildRecord(BookbuildingQueryRequest bookbuildingQueryRequest,Integer userId) {
539   - List<Patients> patients = new ArrayList<>();
540   - Map<String,List> typeMap = new HashMap<>();
541   - PatientsQuery patientsQuery = new PatientsQuery();
542   - patientsQuery.setYn(YnEnums.YES.getId());
543   - patientsQuery.setBuildType(1);
544   - //如果身份证号码不为空就以身份证号码查询
545   - if (!StringUtils.isEmpty(bookbuildingQueryRequest.getCardNo()))
546   - {
547   - patientsQuery.setCardNo(bookbuildingQueryRequest.getCardNo());
548   - patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery,"bookbuildingDate", Sort.Direction.DESC);
549   - }
550   - //否则用就诊卡号 查询到这个孕妇的身份证号码 再用身份证号码查询该孕妇的所有建档 包括产妇记录
551   - else if (!StringUtils.isEmpty(bookbuildingQueryRequest.getVcCardNo()))
552   - {
553   - String hospitalId = autoMatchFacade.getHospitalId(userId);
554   - patientsQuery.setVcCardNo(bookbuildingQueryRequest.getVcCardNo());
555   - //区域模式
556   - if (!ErrorCodeConstants.RUN_MODE.equals(runType)) {
557   - patientsQuery.setHospitalId(hospitalId);
558   - }
  482 + /**
  483 + * 查询孕妇建档记录
  484 + *
  485 + * @param bookbuildingQueryRequest
  486 + * @return
  487 + */
  488 + public BaseListResponse queryPregnantBuildRecord(BookbuildingQueryRequest bookbuildingQueryRequest, Integer userId) {
  489 + List<Patients> patients = new ArrayList<>();
  490 + Map<String, List> typeMap = new HashMap<>();
  491 + PatientsQuery patientsQuery = new PatientsQuery();
  492 + patientsQuery.setYn(YnEnums.YES.getId());
  493 + patientsQuery.setBuildType(1);
  494 + //如果身份证号码不为空就以身份证号码查询
  495 + if (!StringUtils.isEmpty(bookbuildingQueryRequest.getCardNo())) {
  496 + patientsQuery.setCardNo(bookbuildingQueryRequest.getCardNo());
  497 + patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery, "bookbuildingDate", Sort.Direction.DESC);
  498 + }
  499 + //否则用就诊卡号 查询到这个孕妇的身份证号码 再用身份证号码查询该孕妇的所有建档 包括产妇记录
  500 + else if (!StringUtils.isEmpty(bookbuildingQueryRequest.getVcCardNo())) {
559 501  
560   - List<Patients> patientsVc = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
561   - if (CollectionUtils.isNotEmpty(patientsVc))
562   - {
563   - if (patientsVc.get(0) == null || StringUtils.isEmpty(patientsVc.get(0).getCardNo()))
564   - {
565   - patients = patientsVc;
566   - }
567   - else
568   - {
569   - patientsQuery.setHospitalId(null);
570   - patientsQuery.setVcCardNo(null);
571   - patientsQuery.setCardNo(patientsVc.get(0).getCardNo());
572   - patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery,"bookbuildingDate", Sort.Direction.DESC);
573   - }
  502 + patientsQuery.setVcCardNo(bookbuildingQueryRequest.getVcCardNo());
574 503  
575   - }
576   - // 如果为空,初次建档,根据就诊卡号从HIS库取患者信息
577   - else {
578   - if ("2".equals(HIS_VERSION)) {
579   - typeMap.put("hisPatient", hisServiceV2.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo()));
580   - } else if ("3".equals(HIS_VERSION)) {
581   - typeMap.put("hisPatient", qingLongXianHisService.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo()));
582   - } else if ("5".equals(HIS_VERSION)) {
583   - typeMap.put("hisPatient", fnfyHisService.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo()));
584   - }else if ("4".equals(HIS_VERSION)) {
585   - typeMap.put("hisPatient", qhdfyHisService.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo()));
586   - }
587   - }
588   - }
  504 + //区域模式
  505 + patientsQuery.setHospitalList(groupsFacade.findGroupHospital(userId));
589 506  
590   - //历史建档记录
591   - List<Map> list = new ArrayList<>();
592   - List<BookbuildingRecordResult> results = new ArrayList<>();
593   - if (CollectionUtils.isNotEmpty(patients))
594   - {
595   - for(Patients pat : patients)
596   - {
597   - if (pat != null)
598   - {
599   - BookbuildingRecordResult result = new BookbuildingRecordResult();
600   - if (StringUtils.isNotEmpty(pat.getHospitalId()))
601   - {
602   - Organization org = organizationService.getOrganization(Integer.valueOf(pat.getHospitalId()));
603   - if (org != null)
604   - {
605   - result.setBookbuildHospital(org.getName());
606   - result.setHospitalId(String.valueOf(org.getId()));
607   - }
608   - }
609   - result.setBookbuildDate(DateUtil.getyyyy_MM_dd(pat.getBookbuildingDate()));
610   - result.setId(pat.getId());
611   - result.setType(pat.getType());
612   - result.setDueStatus(pat.getDueStatus());
613   - results.add(result);
614   - }
615   - }
616   - }
  507 + List<Patients> patientsVc = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  508 + if (CollectionUtils.isNotEmpty(patientsVc)) {
  509 + if (patientsVc.get(0) == null || StringUtils.isEmpty(patientsVc.get(0).getCardNo())) {
  510 + patients = patientsVc;
  511 + } else {
  512 + patientsQuery.setHospitalId(null);
  513 + patientsQuery.setVcCardNo(null);
  514 + patientsQuery.setCardNo(patientsVc.get(0).getCardNo());
  515 + patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery, "bookbuildingDate", Sort.Direction.DESC);
  516 + }
617 517  
  518 + }
  519 + // 如果为空,初次建档,根据就诊卡号从HIS库取患者信息
  520 + else {
  521 + if ("2".equals(HIS_VERSION)) {
  522 + typeMap.put("hisPatient", hisServiceV2.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo()));
  523 + } else if ("3".equals(HIS_VERSION)) {
  524 + typeMap.put("hisPatient", qingLongXianHisService.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo()));
  525 + } else if ("5".equals(HIS_VERSION)) {
  526 + typeMap.put("hisPatient", fnfyHisService.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo()));
  527 + } else if ("4".equals(HIS_VERSION)) {
  528 + typeMap.put("hisPatient", qhdfyHisService.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo()));
  529 + }
  530 + }
  531 + }
618 532  
  533 + //历史建档记录
  534 + List<Map> list = new ArrayList<>();
  535 + List<BookbuildingRecordResult> results = new ArrayList<>();
  536 + if (CollectionUtils.isNotEmpty(patients)) {
  537 + for (Patients pat : patients) {
  538 + if (pat != null) {
  539 + BookbuildingRecordResult result = new BookbuildingRecordResult();
  540 + if (StringUtils.isNotEmpty(pat.getHospitalId())) {
  541 + Organization org = organizationService.getOrganization(Integer.valueOf(pat.getHospitalId()));
  542 + if (org != null) {
  543 + result.setBookbuildHospital(org.getName());
  544 + result.setHospitalId(String.valueOf(org.getId()));
  545 + }
  546 + }
  547 + result.setBookbuildDate(DateUtil.getyyyy_MM_dd(pat.getBookbuildingDate()));
  548 + result.setId(pat.getId());
  549 + result.setType(pat.getType());
  550 + result.setDueStatus(pat.getDueStatus());
  551 + results.add(result);
  552 + }
  553 + }
  554 + }
619 555  
620   - //证件类型
621   - List<BasicConfigResult> pcerteTypeResult = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.CERTE_TYPE_ID);
622   - typeMap.put("certeType", pcerteTypeResult);
623 556  
624   - //国籍
625   - List<BasicConfigResult> countiryResults = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.COUNTRY_TYPE_ID);
626   - typeMap.put("country", countiryResults);
  557 + //证件类型
  558 + List<BasicConfigResult> pcerteTypeResult = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.CERTE_TYPE_ID);
  559 + typeMap.put("certeType", pcerteTypeResult);
627 560  
628   - // 民族
629   - List<BasicConfigResult> nationResults = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.NATION_TYPE_ID);
630   - typeMap.put("nation", nationResults);
  561 + //国籍
  562 + List<BasicConfigResult> countiryResults = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.COUNTRY_TYPE_ID);
  563 + typeMap.put("country", countiryResults);
631 564  
632   - // 职业类别
633   - List<BasicConfigResult> professionTypeResults = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.PROFESSION_TYPE_ID);
634   - typeMap.put("professionType", professionTypeResults);
  565 + // 民族
  566 + List<BasicConfigResult> nationResults = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.NATION_TYPE_ID);
  567 + typeMap.put("nation", nationResults);
635 568  
636   - // 户籍类别
637   - List<BasicConfigResult> censusType = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.CENSUS_TYPE_ID);
638   - typeMap.put("censusType", censusType);
  569 + // 职业类别
  570 + List<BasicConfigResult> professionTypeResults = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.PROFESSION_TYPE_ID);
  571 + typeMap.put("professionType", professionTypeResults);
639 572  
640   - // 户籍类别
641   - List<BasicConfigResult> liveType = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.LIVE_TYPE_ID);
642   - typeMap.put("liveType", liveType);
  573 + // 户籍类别
  574 + List<BasicConfigResult> censusType = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.CENSUS_TYPE_ID);
  575 + typeMap.put("censusType", censusType);
643 576  
644   - //服务类型
645   - List serviceType = ServiceTypeEnums.getServiceTypeList();
646   - typeMap.put("serviceType", serviceType);
  577 + // 户籍类别
  578 + List<BasicConfigResult> liveType = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.LIVE_TYPE_ID);
  579 + typeMap.put("liveType", liveType);
647 580  
648   - //服务状态
649   - List serviceStatus = ServiceStatusEnums.getServiceStatusList();
650   - typeMap.put("serviceStatus", serviceStatus);
  581 + //服务类型
  582 + List serviceType = ServiceTypeEnums.getServiceTypeList();
  583 + typeMap.put("serviceType", serviceType);
651 584  
652   - //孕妇体验类型
653   - List expYunEnums = ExpYunEnums.getExpYunEnums();
654   - typeMap.put("expYunEnums", expYunEnums);
  585 + //服务状态
  586 + List serviceStatus = ServiceStatusEnums.getServiceStatusList();
  587 + typeMap.put("serviceStatus", serviceStatus);
655 588  
656   - list.add(typeMap);
  589 + //孕妇体验类型
  590 + List expYunEnums = ExpYunEnums.getExpYunEnums();
  591 + typeMap.put("expYunEnums", expYunEnums);
657 592  
  593 + list.add(typeMap);
658 594  
659   - Map<String,Object> mapData = new HashMap<>();
660   - mapData.put("data",results);
661   - mapData.put("initBuildDate", DateUtil.getyyyy_MM_dd(new Date()));
662   - list.add(mapData);
663 595  
664   - BaseListResponse listResponse = new BaseListResponse();
665   - listResponse.setData(list);
666   - listResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
667   - listResponse.setErrormsg("成功");
668   - return listResponse;
669   - }
  596 + Map<String, Object> mapData = new HashMap<>();
  597 + mapData.put("data", results);
  598 + mapData.put("initBuildDate", DateUtil.getyyyy_MM_dd(new Date()));
  599 + list.add(mapData);
670 600  
  601 + BaseListResponse listResponse = new BaseListResponse();
  602 + listResponse.setData(list);
  603 + listResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  604 + listResponse.setErrormsg("成功");
  605 + return listResponse;
  606 + }
671 607  
672 608  
  609 + /**
  610 + * 准备修改和添加的孕妇建档数据
  611 + *
  612 + * @param yunRequest
  613 + * @return
  614 + */
  615 + private Patients getPatientsData(YunBookbuildingAddRequest yunRequest) {
  616 + Patients patient = new Patients();
  617 + patient.setUsername(yunRequest.getPregnantName());
673 618  
674   - /**
675   - * 准备修改和添加的孕妇建档数据
676   - * @param yunRequest
677   - * @return
678   - */
679   - private Patients getPatientsData(YunBookbuildingAddRequest yunRequest)
680   - {
681   - Patients patient = new Patients();
682   - patient.setUsername(yunRequest.getPregnantName());
  619 + patient.setPcerteTypeId(yunRequest.getPregnantCertificateTypeId());
683 620  
684   - patient.setPcerteTypeId(yunRequest.getPregnantCertificateTypeId());
  621 + patient.setCardNo(yunRequest.getPregnantCertificateNum());
685 622  
686   - patient.setCardNo(yunRequest.getPregnantCertificateNum());
  623 + patient.setPcountryId(yunRequest.getPregnantCountryId());
  624 + patient.setPnationId(yunRequest.getPregnantNationId());
  625 + patient.setBirth(DateUtil.parseYMD(yunRequest.getBirthday()));
687 626  
688   - patient.setPcountryId(yunRequest.getPregnantCountryId());
689   - patient.setPnationId(yunRequest.getPregnantNationId());
690   - patient.setBirth(DateUtil.parseYMD(yunRequest.getBirthday()));
  627 + patient.setPcensusTypeId(yunRequest.getPregnantCensusTypeId());
691 628  
692   - patient.setPcensusTypeId(yunRequest.getPregnantCensusTypeId());
  629 + patient.setPliveTypeId(yunRequest.getPregnantLiveTypeId());
693 630  
694   - patient.setPliveTypeId(yunRequest.getPregnantLiveTypeId());
  631 + patient.setPprofessionTypeId(yunRequest.getPregnantProfessionTypeId());
695 632  
696   - patient.setPprofessionTypeId(yunRequest.getPregnantProfessionTypeId());
  633 + patient.setPhone(yunRequest.getPregnantPhone());
697 634  
698   - patient.setPhone(yunRequest.getPregnantPhone());
  635 + patient.setPworkUnit(yunRequest.getPregnantWorkUnit());
  636 + patient.setPlevelTypeId(yunRequest.getPregnantLevelTypeId());
699 637  
700   - patient.setPworkUnit(yunRequest.getPregnantWorkUnit());
701   - patient.setPlevelTypeId(yunRequest.getPregnantLevelTypeId());
  638 + //孕妇居住地
  639 + patient.setAddressRegister(yunRequest.getPregnantCensusAddr());
  640 + patient.setProvinceRegisterId(yunRequest.getPregnantCensusProvinceId());
  641 + patient.setCityRegisterId(yunRequest.getPregnantCensusCityId());
  642 + patient.setAreaRegisterId(yunRequest.getPregnantCensusAreaId());
  643 + patient.setStreetRegisterId(yunRequest.getPregnantCensusStreetId());
702 644  
703   - //孕妇居住地
704   - patient.setAddressRegister(yunRequest.getPregnantCensusAddr());
705   - patient.setProvinceRegisterId(yunRequest.getPregnantCensusProvinceId());
706   - patient.setCityRegisterId(yunRequest.getPregnantCensusCityId());
707   - patient.setAreaRegisterId(yunRequest.getPregnantCensusAreaId());
708   - patient.setStreetRegisterId(yunRequest.getPregnantCensusStreetId());
  645 + //孕妇户籍地址
  646 + patient.setAddress(yunRequest.getPregnantLiveAddr());
  647 + patient.setProvinceId(yunRequest.getPregnantLiveProvinceId());
  648 + patient.setCityId(yunRequest.getPregnantLiveCityId());
  649 + patient.setAreaId(yunRequest.getPregnantLiveAreaId());
  650 + patient.setStreetId(yunRequest.getPregnantLiveStreetId());
709 651  
710   - //孕妇户籍地址
711   - patient.setAddress(yunRequest.getPregnantLiveAddr());
712   - patient.setProvinceId(yunRequest.getPregnantLiveProvinceId());
713   - patient.setCityId(yunRequest.getPregnantLiveCityId());
714   - patient.setAreaId(yunRequest.getPregnantLiveAreaId());
715   - patient.setStreetId(yunRequest.getPregnantLiveStreetId());
  652 + //孕妇产后修养地
  653 + patient.setAddressPostRest(yunRequest.getChildbirthAddr());
  654 + patient.setProvincePostRestId(yunRequest.getChildbirthProvinceId());
  655 + patient.setCityPostRestId(yunRequest.getChildbirthCityId());
  656 + patient.setAreaPostRestId(yunRequest.getChildbirthAreaId());
  657 + patient.setStreetPostRestId(yunRequest.getChildbirthStreetId());
716 658  
717   - //孕妇产后修养地
718   - patient.setAddressPostRest(yunRequest.getChildbirthAddr());
719   - patient.setProvincePostRestId(yunRequest.getChildbirthProvinceId());
720   - patient.setCityPostRestId(yunRequest.getChildbirthCityId());
721   - patient.setAreaPostRestId(yunRequest.getChildbirthAreaId());
722   - patient.setStreetPostRestId(yunRequest.getChildbirthStreetId());
  659 + //丈夫信息
  660 + patient.setHusbandName(yunRequest.getHusbandName());
  661 + patient.setHcertificateTypeId(yunRequest.getHusbandCertificateTypeId());
723 662  
724   - //丈夫信息
725   - patient.setHusbandName(yunRequest.getHusbandName());
726   - patient.setHcertificateTypeId(yunRequest.getHusbandCertificateTypeId());
  663 + if (StringUtils.isNotEmpty(yunRequest.getHusbandCertificateTypeId()) && StringUtils.isNotEmpty(yunRequest.getHusbandCertificateNum())) {
  664 + BasicConfigQuery basicConfigQuery = new BasicConfigQuery();
  665 + basicConfigQuery.setId(yunRequest.getHusbandCertificateTypeId());
  666 + basicConfigQuery.setYn(YnEnums.YES.getId());
  667 + List<BasicConfig> data = basicConfigService.queryBasicConfig(basicConfigQuery);
  668 + if (CollectionUtils.isNotEmpty(data)) {
  669 + //身份证类型得到丈夫的生日 必须为身份证类型
  670 + if ("SFZ".endsWith(data.get(0).getCode())) {
  671 + String cardNo = yunRequest.getHusbandCertificateNum();
  672 + Date birth = StringUtils.getBirthDay(cardNo);
  673 + patient.setHusbandBirth(birth);
  674 + }
  675 + }
  676 + }
727 677  
728   - if (StringUtils.isNotEmpty(yunRequest.getHusbandCertificateTypeId()) && StringUtils.isNotEmpty(yunRequest.getHusbandCertificateNum()))
729   - {
730   - BasicConfigQuery basicConfigQuery = new BasicConfigQuery();
731   - basicConfigQuery.setId(yunRequest.getHusbandCertificateTypeId());
732   - basicConfigQuery.setYn(YnEnums.YES.getId());
733   - List<BasicConfig> data = basicConfigService.queryBasicConfig(basicConfigQuery);
734   - if (CollectionUtils.isNotEmpty(data)) {
735   - //身份证类型得到丈夫的生日 必须为身份证类型
736   - if ("SFZ".endsWith(data.get(0).getCode()))
737   - {
738   - String cardNo = yunRequest.getHusbandCertificateNum();
739   - Date birth = StringUtils.getBirthDay(cardNo);
740   - patient.setHusbandBirth(birth);
741   - }
742   - }
743   - }
  678 + patient.setHcertificateNum(yunRequest.getHusbandCertificateNum());
  679 + patient.setHusbandPhone(yunRequest.getHusbandPhone());
  680 + patient.setHcountryId(yunRequest.getHusbandCountryId());
  681 + patient.setHnationId(yunRequest.getHusbandNationId());
  682 + patient.setHprofessionTypeId(yunRequest.getHusbandProfessionTypeId());
  683 + patient.setHworkUnit(yunRequest.getHusbandWorkUnit());
  684 + patient.setHaddressRegister(yunRequest.getHusbandAddressRegister());
  685 + patient.setHprovinceRegisterId(yunRequest.getHusbandProvinceRegisterId());
  686 + patient.setHcityRegisterId(yunRequest.getHusbandCityRegisterId());
  687 + patient.setHareaRegisterId(yunRequest.getHusbandAreaRegisterId());
  688 + patient.setHstreetRegisterId(yunRequest.getHusbandStreetRegisterId());
  689 + patient.setHlevelTypeId(yunRequest.getHusbandLevelTypeId());
744 690  
745   - patient.setHcertificateNum(yunRequest.getHusbandCertificateNum());
746   - patient.setHusbandPhone(yunRequest.getHusbandPhone());
747   - patient.setHcountryId(yunRequest.getHusbandCountryId());
748   - patient.setHnationId(yunRequest.getHusbandNationId());
749   - patient.setHprofessionTypeId(yunRequest.getHusbandProfessionTypeId());
750   - patient.setHworkUnit(yunRequest.getHusbandWorkUnit());
751   - patient.setHaddressRegister(yunRequest.getHusbandAddressRegister());
752   - patient.setHprovinceRegisterId(yunRequest.getHusbandProvinceRegisterId());
753   - patient.setHcityRegisterId(yunRequest.getHusbandCityRegisterId());
754   - patient.setHareaRegisterId(yunRequest.getHusbandAreaRegisterId());
755   - patient.setHstreetRegisterId(yunRequest.getHusbandStreetRegisterId());
756   - patient.setHlevelTypeId(yunRequest.getHusbandLevelTypeId());
  691 + patient.setServiceStatus(yunRequest.getServiceStatus());
757 692  
758   - patient.setServiceStatus(yunRequest.getServiceStatus());
  693 + if (yunRequest.getExpType() != null) {
  694 + if (yunRequest.getExpType() == ExpYunEnums.SGY.getId()) {
  695 + Date vipEndTime = DateUtil.addMonth(DateUtil.parseYMD(yunRequest.getBookbuildingDate()), 3);
  696 + Date dueDate = DateUtil.parseYMD(yunRequest.getDueDate());
  697 + if (vipEndTime.getTime() > dueDate.getTime()) {
  698 + vipEndTime = dueDate;
  699 + }
  700 + patient.setVipEndTime(vipEndTime);
  701 + } else {
  702 + Date vipEndTime = DateUtil.parseYMD(yunRequest.getDueDate());
  703 + patient.setVipEndTime(vipEndTime);
  704 + }
  705 + patient.setExpType(yunRequest.getExpType());
  706 + }
759 707  
760   - if (yunRequest.getExpType() != null)
761   - {
762   - if (yunRequest.getExpType() == ExpYunEnums.SGY.getId())
763   - {
764   - Date vipEndTime = DateUtil.addMonth(DateUtil.parseYMD(yunRequest.getBookbuildingDate()),3);
765   - Date dueDate = DateUtil.parseYMD(yunRequest.getDueDate());
766   - if (vipEndTime.getTime() > dueDate.getTime())
767   - {
768   - vipEndTime = dueDate;
769   - }
770   - patient.setVipEndTime(vipEndTime);
771   - }
772   - else
773   - {
774   - Date vipEndTime = DateUtil.parseYMD(yunRequest.getDueDate());
775   - patient.setVipEndTime(vipEndTime);
776   - }
777   - patient.setExpType(yunRequest.getExpType());
778   - }
779 708  
  709 + //patient.setVipEndTime(DateUtil.parseYMD(yunRequest.getVipEndTime()));
  710 + patient.setExpVip(yunRequest.getExpVip());
  711 + patient.setMremark(yunRequest.getMremark());
780 712  
781   - //patient.setVipEndTime(DateUtil.parseYMD(yunRequest.getVipEndTime()));
782   - patient.setExpVip(yunRequest.getExpVip());
783   - patient.setMremark(yunRequest.getMremark());
  713 + patient.setLastMenses(DateUtil.parseYMD(yunRequest.getLastMenstrualPeriod()));
  714 + patient.setDueDate(DateUtil.parseYMD(yunRequest.getDueDate()));
  715 + patient.setFileCode(yunRequest.getFileCode());
  716 + patient.setBookbuildingDoctor(yunRequest.getBookbuildingDoctor());
  717 + patient.setBookbuildingDate(DateUtil.parseYMD(yunRequest.getBookbuildingDate()));
  718 + patient.setServiceType(yunRequest.getServiceType());
  719 + patient.setVcCardNo(yunRequest.getVcCardNo());
  720 + patient.setHospitalId(yunRequest.getHospitalId());
  721 + patient.setYn(YnEnums.YES.getId());
784 722  
785   - patient.setLastMenses(DateUtil.parseYMD(yunRequest.getLastMenstrualPeriod()));
786   - patient.setDueDate(DateUtil.parseYMD(yunRequest.getDueDate()));
787   - patient.setFileCode(yunRequest.getFileCode());
788   - patient.setBookbuildingDoctor(yunRequest.getBookbuildingDoctor());
789   - patient.setBookbuildingDate(DateUtil.parseYMD(yunRequest.getBookbuildingDate()));
790   - patient.setServiceType(yunRequest.getServiceType());
791   - patient.setVcCardNo(yunRequest.getVcCardNo());
792   - patient.setHospitalId(yunRequest.getHospitalId());
793   - patient.setYn(YnEnums.YES.getId());
  723 + return patient;
  724 + }
794 725  
795   - return patient;
796   - }
  726 + /**
  727 + * 查询孕妇建档详细
  728 + *
  729 + * @param id
  730 + * @return
  731 + */
  732 + public BaseObjectResponse queryPregnantBuildById(String id) {
797 733  
798   - /**
799   - * 查询孕妇建档详细
800   - * @param id
801   - * @return
802   - */
803   - public BaseObjectResponse queryPregnantBuildById(String id) {
  734 + PatientsQuery patientsQuery = new PatientsQuery();
  735 + patientsQuery.setId(id);
  736 + patientsQuery.setYn(YnEnums.YES.getId());
  737 + PregnantInfoResult result = new PregnantInfoResult();
  738 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  739 + if (patients != null && patients.size() > 0) {
  740 + Patients p = patients.get(0);
  741 + result = getResult(p);
  742 + }
804 743  
805   - PatientsQuery patientsQuery = new PatientsQuery();
806   - patientsQuery.setId(id);
807   - patientsQuery.setYn(YnEnums.YES.getId());
808   - PregnantInfoResult result = new PregnantInfoResult();
809   - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
810   - if (patients != null && patients.size() > 0)
811   - {
812   - Patients p = patients.get(0);
813   - result = getResult(p);
814   - }
  744 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  745 + objectResponse.setData(result);
  746 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  747 + objectResponse.setErrormsg("成功");
  748 + return objectResponse;
  749 + }
815 750  
816   - BaseObjectResponse objectResponse = new BaseObjectResponse();
817   - objectResponse.setData(result);
818   - objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
819   - objectResponse.setErrormsg("成功");
820   - return objectResponse;
821   - }
822 751  
  752 + private PregnantInfoResult getResult(Patients p) {
  753 + PregnantInfoResult result = new PregnantInfoResult();
  754 + result.setId(p.getId());
  755 + /**********孕妇基本信息***************/
  756 + result.setPregnantName(p.getUsername());
  757 + result.setPregnantCertificateTypeId(p.getPcerteTypeId());
  758 + result.setPregnantCertificateNum(p.getCardNo());
  759 + result.setPregnantCountryId(p.getPcountryId());
  760 + result.setPregnantNationId(p.getPnationId());
  761 + result.setBirthday(DateUtil.getyyyy_MM_dd(p.getBirth()));
  762 + result.setPregnantCensusTypeId(p.getPcensusTypeId());
  763 + result.setPregnantLiveTypeId(p.getPliveTypeId());
  764 + result.setPregnantProfessionTypeId(p.getPprofessionTypeId());
  765 + result.setPregnantLevelTypeId(p.getPlevelTypeId());
823 766  
824   - private PregnantInfoResult getResult(Patients p)
825   - {
826   - PregnantInfoResult result = new PregnantInfoResult();
827   - result.setId(p.getId());
828   - /**********孕妇基本信息***************/
829   - result.setPregnantName(p.getUsername());
830   - result.setPregnantCertificateTypeId(p.getPcerteTypeId());
831   - result.setPregnantCertificateNum(p.getCardNo());
832   - result.setPregnantCountryId(p.getPcountryId());
833   - result.setPregnantNationId(p.getPnationId());
834   - result.setBirthday(DateUtil.getyyyy_MM_dd(p.getBirth()));
835   - result.setPregnantCensusTypeId(p.getPcensusTypeId());
836   - result.setPregnantLiveTypeId(p.getPliveTypeId());
837   - result.setPregnantProfessionTypeId(p.getPprofessionTypeId());
838   - result.setPregnantLevelTypeId(p.getPlevelTypeId());
  767 + /**********孕妇联系方式***************/
  768 + result.setPregnantPhone(p.getPhone());
  769 + result.setPregnantWorkUnit(p.getPworkUnit());
839 770  
840   - /**********孕妇联系方式***************/
841   - result.setPregnantPhone(p.getPhone());
842   - result.setPregnantWorkUnit(p.getPworkUnit());
  771 + result.setPregnantCensusProvinceId(p.getProvinceRegisterId());
  772 + result.setPregnantCensusCityId(p.getCityRegisterId());
  773 + result.setPregnantCensusAreaId(p.getAreaRegisterId());
  774 + result.setPregnantCensusStreetId(p.getStreetRegisterId());
  775 + result.setPregnantCensusAddr(p.getAddressRegister());
843 776  
844   - result.setPregnantCensusProvinceId(p.getProvinceRegisterId());
845   - result.setPregnantCensusCityId(p.getCityRegisterId());
846   - result.setPregnantCensusAreaId(p.getAreaRegisterId());
847   - result.setPregnantCensusStreetId(p.getStreetRegisterId());
848   - result.setPregnantCensusAddr(p.getAddressRegister());
  777 + result.setPregnantLiveProvinceId(p.getProvinceId());
  778 + result.setPregnantLiveCityId(p.getCityId());
  779 + result.setPregnantLiveAreaId(p.getAreaId());
  780 + result.setPregnantLiveStreetId(p.getStreetId());
  781 + result.setPregnantLiveAddr(p.getAddress());
849 782  
850   - result.setPregnantLiveProvinceId(p.getProvinceId());
851   - result.setPregnantLiveCityId(p.getCityId());
852   - result.setPregnantLiveAreaId(p.getAreaId());
853   - result.setPregnantLiveStreetId(p.getStreetId());
854   - result.setPregnantLiveAddr(p.getAddress());
855 783  
  784 + result.setChildbirthAddr(p.getAddressPostRest());
  785 + result.setChildbirthProvinceId(p.getProvincePostRestId());
  786 + result.setChildbirthCityId(p.getCityPostRestId());
  787 + result.setChildbirthAreaId(p.getAreaPostRestId());
  788 + result.setChildbirthStreetId(p.getStreetPostRestId());
856 789  
857   - result.setChildbirthAddr(p.getAddressPostRest());
858   - result.setChildbirthProvinceId(p.getProvincePostRestId());
859   - result.setChildbirthCityId(p.getCityPostRestId());
860   - result.setChildbirthAreaId(p.getAreaPostRestId());
861   - result.setChildbirthStreetId(p.getStreetPostRestId());
  790 + /****************丈夫信息**************/
  791 + result.setHusbandName(p.getHusbandName());
  792 + result.setHusbandPhone(p.getHusbandPhone());
862 793  
863   - /****************丈夫信息**************/
864   - result.setHusbandName(p.getHusbandName());
865   - result.setHusbandPhone(p.getHusbandPhone());
  794 + result.setHusbandCertificateTypeId(p.getHcertificateTypeId());
  795 + result.setHusbandCertificateNum(p.getHcertificateNum());
  796 + result.setHusbandCountryId(p.getHcountryId());
  797 + result.setHusbandNationId(p.getHnationId());
  798 + result.setHusbandProfessionTypeId(p.getHprofessionTypeId());
  799 + result.setHusbandWorkUnit(p.getHworkUnit());
  800 + result.setHusbandLevelTypeId(p.getHlevelTypeId());
866 801  
867   - result.setHusbandCertificateTypeId(p.getHcertificateTypeId());
868   - result.setHusbandCertificateNum(p.getHcertificateNum());
869   - result.setHusbandCountryId(p.getHcountryId());
870   - result.setHusbandNationId(p.getHnationId());
871   - result.setHusbandProfessionTypeId(p.getHprofessionTypeId());
872   - result.setHusbandWorkUnit(p.getHworkUnit());
873   - result.setHusbandLevelTypeId(p.getHlevelTypeId());
  802 + result.setHusbandAddressRegister(p.getHaddressRegister());
  803 + result.setHusbandProvinceRegisterId(p.getHprovinceRegisterId());
  804 + result.setHusbandCityRegisterId(p.getHcityRegisterId());
  805 + result.setHusbandAreaRegisterId(p.getHareaRegisterId());
  806 + result.setHusbandStreetRegisterId(p.getHstreetRegisterId());
874 807  
875   - result.setHusbandAddressRegister(p.getHaddressRegister());
876   - result.setHusbandProvinceRegisterId(p.getHprovinceRegisterId());
877   - result.setHusbandCityRegisterId(p.getHcityRegisterId());
878   - result.setHusbandAreaRegisterId(p.getHareaRegisterId());
879   - result.setHusbandStreetRegisterId(p.getHstreetRegisterId());
  808 + result.setServiceStatus(p.getServiceStatus() == null ? "" : String.valueOf(p.getServiceStatus()));
  809 + result.setVipEndTime(DateUtil.getyyyy_MM_dd(p.getVipEndTime()));
  810 + result.setExpVip(p.getExpVip());
  811 + result.setMremark(p.getMremark());
880 812  
881   - result.setServiceStatus(p.getServiceStatus() == null ? "" : String.valueOf(p.getServiceStatus()));
882   - result.setVipEndTime(DateUtil.getyyyy_MM_dd(p.getVipEndTime()));
883   - result.setExpVip(p.getExpVip());
884   - result.setMremark(p.getMremark());
885 813  
  814 + //院内信息
  815 + result.setLastMenstrualPeriod(DateUtil.getyyyy_MM_dd(p.getLastMenses()));
  816 + result.setDueDate(DateUtil.getyyyy_MM_dd(p.getDueDate()));
  817 + result.setFileCode(p.getFileCode());
  818 + result.setVcCardNo(p.getVcCardNo());
886 819  
887   - //院内信息
888   - result.setLastMenstrualPeriod(DateUtil.getyyyy_MM_dd(p.getLastMenses()));
889   - result.setDueDate(DateUtil.getyyyy_MM_dd(p.getDueDate()));
890   - result.setFileCode(p.getFileCode());
891   - result.setVcCardNo(p.getVcCardNo());
  820 + if (StringUtils.isNotEmpty(p.getBookbuildingDoctor())) {
  821 + Users users = usersService.getUsers(Integer.parseInt(p.getBookbuildingDoctor()));
  822 + if (users != null) {
  823 + Map<String, String> doctorObj = new HashMap<>();
  824 + doctorObj.put("id", p.getBookbuildingDoctor());
  825 + doctorObj.put("name", users.getName());
  826 + result.setBookbuildingDoctor(doctorObj);
  827 + }
  828 + }
892 829  
893   - if (StringUtils.isNotEmpty(p.getBookbuildingDoctor()))
894   - {
895   - Users users = usersService.getUsers(Integer.parseInt(p.getBookbuildingDoctor()));
896   - if (users != null)
897   - {
898   - Map<String,String> doctorObj = new HashMap<>();
899   - doctorObj.put("id",p.getBookbuildingDoctor());
900   - doctorObj.put("name",users.getName());
901   - result.setBookbuildingDoctor(doctorObj);
902   - }
903   - }
  830 + result.setBookbuildingDate(DateUtil.getyyyy_MM_dd(p.getBookbuildingDate()));
  831 + result.setServiceType(p.getServiceType() == null ? "" : String.valueOf(p.getServiceType()));
904 832  
905   - result.setBookbuildingDate(DateUtil.getyyyy_MM_dd(p.getBookbuildingDate()));
906   - result.setServiceType(p.getServiceType() == null ? "" : String.valueOf(p.getServiceType()));
  833 + result.setExpType(p.getExpType());
907 834  
908   - result.setExpType(p.getExpType());
  835 + result.setPid(p.getPid());
  836 + result.setDueStatus(p.getDueStatus());
  837 + return result;
  838 + }
909 839  
910   - result.setPid(p.getPid());
911   - result.setDueStatus(p.getDueStatus());
912   - return result;
913   - }
  840 + /**
  841 + * 孕妇建档页面基础数据
  842 + *
  843 + * @return
  844 + */
  845 + public BaseObjectResponse getYunBuildBaseConfig() {
  846 + Map<String, List> typeMap = new HashMap<>();
914 847  
915   - /**
916   - * 孕妇建档页面基础数据
917   - * @return
918   - */
919   - public BaseObjectResponse getYunBuildBaseConfig() {
920   - Map<String,List> typeMap = new HashMap<>();
  848 + //证件类型
  849 + List<BasicConfigResult> pcerteTypeResult = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.CERTE_TYPE_ID);
  850 + typeMap.put("certeType", pcerteTypeResult);
921 851  
922   - //证件类型
923   - List<BasicConfigResult> pcerteTypeResult = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.CERTE_TYPE_ID);
924   - typeMap.put("certeType", pcerteTypeResult);
  852 + //国籍
  853 + List<BasicConfigResult> countiryResults = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.COUNTRY_TYPE_ID);
  854 + typeMap.put("country", countiryResults);
925 855  
926   - //国籍
927   - List<BasicConfigResult> countiryResults = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.COUNTRY_TYPE_ID);
928   - typeMap.put("country", countiryResults);
  856 + // 民族
  857 + List<BasicConfigResult> nationResults = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.NATION_TYPE_ID);
  858 + typeMap.put("nation", nationResults);
929 859  
930   - // 民族
931   - List<BasicConfigResult> nationResults = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.NATION_TYPE_ID);
932   - typeMap.put("nation", nationResults);
  860 + // 职业类别
  861 + List<BasicConfigResult> professionTypeResults = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.PROFESSION_TYPE_ID);
  862 + typeMap.put("professionType", professionTypeResults);
933 863  
934   - // 职业类别
935   - List<BasicConfigResult> professionTypeResults = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.PROFESSION_TYPE_ID);
936   - typeMap.put("professionType", professionTypeResults);
  864 + // 户籍类别
  865 + List<BasicConfigResult> censusType = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.CENSUS_TYPE_ID);
  866 + typeMap.put("censusType", censusType);
937 867  
938   - // 户籍类别
939   - List<BasicConfigResult> censusType = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.CENSUS_TYPE_ID);
940   - typeMap.put("censusType", censusType);
  868 + // 户籍类别
  869 + List<BasicConfigResult> liveType = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.LIVE_TYPE_ID);
  870 + typeMap.put("liveType", liveType);
941 871  
942   - // 户籍类别
943   - List<BasicConfigResult> liveType = basicConfigFacade.getBaseicConfigByParentId(SystemConfig.LIVE_TYPE_ID);
944   - typeMap.put("liveType", liveType);
  872 + //服务类型
  873 + List serviceType = ServiceTypeEnums.getServiceTypeList();
  874 + typeMap.put("serviceType", serviceType);
945 875  
946   - //服务类型
947   - List serviceType = ServiceTypeEnums.getServiceTypeList();
948   - typeMap.put("serviceType", serviceType);
  876 + //服务状态
  877 + List serviceStatus = ServiceStatusEnums.getServiceStatusList();
  878 + typeMap.put("serviceStatus", serviceStatus);
949 879  
950   - //服务状态
951   - List serviceStatus = ServiceStatusEnums.getServiceStatusList();
952   - typeMap.put("serviceStatus", serviceStatus);
  880 + //孕妇体验类型
  881 + List expYunEnums = ExpYunEnums.getExpYunEnums();
  882 + typeMap.put("expYunEnums", expYunEnums);
953 883  
954   - //孕妇体验类型
955   - List expYunEnums = ExpYunEnums.getExpYunEnums();
956   - typeMap.put("expYunEnums", expYunEnums);
957 884  
  885 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  886 + objectResponse.setData(typeMap);
  887 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  888 + objectResponse.setErrormsg("成功");
  889 + return objectResponse;
  890 + }
958 891  
959   - BaseObjectResponse objectResponse = new BaseObjectResponse();
960   - objectResponse.setData(typeMap);
961   - objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
962   - objectResponse.setErrormsg("成功");
963   - return objectResponse;
964   - }
  892 + /**
  893 + * 删除孕妇建档
  894 + *
  895 + * @param id
  896 + * @return
  897 + */
  898 + public BaseResponse deletePregnantById(String id, Integer userId) {
  899 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  900 + antExChuQuery.setParentId(id);
  901 + antExChuQuery.setYn(YnEnums.YES.getId());
  902 + //获取初诊记录
  903 + List<AntExChuModel> antExChulist = antenatalExaminationService.queryAntExChu(antExChuQuery);
  904 + String hospital = autoMatchFacade.getHospitalId(userId);
  905 + Patients patients = yunBookbuildingService.findOneById(id);
965 906  
966   - /**
967   - * 删除孕妇建档
968   - * @param id
969   - * @return
970   - */
971   - public BaseResponse deletePregnantById(String id,Integer userId) {
972   - AntExChuQuery antExChuQuery = new AntExChuQuery();
973   - antExChuQuery.setParentId(id);
974   - antExChuQuery.setYn(YnEnums.YES.getId());
975   - //获取初诊记录
976   - List<AntExChuModel> antExChulist = antenatalExaminationService.queryAntExChu(antExChuQuery);
977   - String hospital = autoMatchFacade.getHospitalId(userId);
978   - Patients patients = yunBookbuildingService.findOneById(id);
979   -
980 907 // if (CollectionUtils.isNotEmpty(antExChulist))
981   - if(!deleteProcessHandler.deleteBookBuild(patients.getPid(),patients.getBookbuildingDate(),hospital))
982   - {
983   - return new BaseResponse().setErrorcode(ErrorCodeConstants.DONT_DELETE).setErrormsg("孕妇存在检查记录,不能删除建档");
984   - }
985   - yunBookbuildingService.deletePregnantById(id);
986   - //删除建档需要删除产筛数据
987   - SieveQuery sieveQuery=new SieveQuery();
988   - sieveQuery.setYn(YnEnums.YES.getId());
989   - sieveQuery.setParentId(id);
990   - sieveService.deleteById(sieveQuery);
991   - return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
992   - }
  908 + if (!deleteProcessHandler.deleteBookBuild(patients.getPid(), patients.getBookbuildingDate(), hospital)) {
  909 + return new BaseResponse().setErrorcode(ErrorCodeConstants.DONT_DELETE).setErrormsg("孕妇存在检查记录,不能删除建档");
  910 + }
  911 + yunBookbuildingService.deletePregnantById(id);
  912 + //删除建档需要删除产筛数据
  913 + SieveQuery sieveQuery = new SieveQuery();
  914 + sieveQuery.setYn(YnEnums.YES.getId());
  915 + sieveQuery.setParentId(id);
  916 + sieveService.deleteById(sieveQuery);
  917 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  918 + }
993 919  
994   - /**
995   - * 查询孕妇基本信息 通过就诊卡号或者身份证
996   - * @param cardNo
997   - * @param vcCardNo
998   - * @return
999   - */
1000   - public BaseObjectResponse queryYunBuildInfo(String cardNo, String vcCardNo,Integer userId) {
1001   - Patients pat = null;
1002   - PatientsQuery patientsQuery = new PatientsQuery();
1003   - patientsQuery.setYn(YnEnums.YES.getId());
1004   - if (StringUtils.isNotEmpty(cardNo))
1005   - {
1006   - patientsQuery.setCardNo(cardNo);
1007   - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
1008   - if (CollectionUtils.isNotEmpty(patients))
1009   - {
1010   - pat = patients.get(0);
1011   - }
1012   - }
  920 + /**
  921 + * 查询孕妇基本信息 通过就诊卡号或者身份证
  922 + *
  923 + * @param cardNo
  924 + * @param vcCardNo
  925 + * @return
  926 + */
  927 + public BaseObjectResponse queryYunBuildInfo(String cardNo, String vcCardNo, Integer userId) {
  928 + Patients pat = null;
  929 + PatientsQuery patientsQuery = new PatientsQuery();
  930 + patientsQuery.setYn(YnEnums.YES.getId());
  931 + if (StringUtils.isNotEmpty(cardNo)) {
  932 + patientsQuery.setCardNo(cardNo);
  933 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  934 + if (CollectionUtils.isNotEmpty(patients)) {
  935 + pat = patients.get(0);
  936 + }
  937 + }
1013 938  
1014   - String hospitalId = "";
1015   - //得到当前登录的医院id
1016   - if (userId != null)
1017   - {
1018   - Users dbuser = usersService.getUsers(userId);
1019   - if (dbuser != null) {
1020   - hospitalId = String.valueOf(dbuser.getOrgId());
1021   - }
1022   - }
  939 + String hospitalId = "";
  940 + //得到当前登录的医院id
  941 + if (userId != null) {
  942 + Users dbuser = usersService.getUsers(userId);
  943 + if (dbuser != null) {
  944 + hospitalId = String.valueOf(dbuser.getOrgId());
  945 + }
  946 + }
1023 947  
1024   - if (StringUtils.isNotEmpty(vcCardNo) && StringUtils.isNotEmpty(hospitalId))
1025   - {
1026   - patientsQuery.setVcCardNo(vcCardNo);
1027   - patientsQuery.setHospitalId(hospitalId);
1028   - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
1029   - if (CollectionUtils.isNotEmpty(patients))
1030   - {
1031   - Patients vcCardNoPat = patients.get(0);
1032   - patientsQuery.setHospitalId(null);
1033   - patientsQuery.setVcCardNo(null);
1034   - patientsQuery.setCardNo(vcCardNoPat.getCardNo());
1035   - List<Patients> cardNoPat = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
1036   - if (CollectionUtils.isNotEmpty(cardNoPat))
1037   - {
1038   - pat = cardNoPat.get(0);
1039   - }
1040   - }
1041   - }
1042   - BaseObjectResponse objectResponse = new BaseObjectResponse();
1043   - if (pat == null)
1044   - {
1045   - objectResponse.setData("");
1046   - }
1047   - else
1048   - {
1049   - objectResponse.setData(getResult(pat));
1050   - }
  948 + if (StringUtils.isNotEmpty(vcCardNo) && StringUtils.isNotEmpty(hospitalId)) {
  949 + patientsQuery.setVcCardNo(vcCardNo);
  950 + patientsQuery.setHospitalId(hospitalId);
  951 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  952 + if (CollectionUtils.isNotEmpty(patients)) {
  953 + Patients vcCardNoPat = patients.get(0);
  954 + patientsQuery.setHospitalId(null);
  955 + patientsQuery.setVcCardNo(null);
  956 + patientsQuery.setCardNo(vcCardNoPat.getCardNo());
  957 + List<Patients> cardNoPat = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  958 + if (CollectionUtils.isNotEmpty(cardNoPat)) {
  959 + pat = cardNoPat.get(0);
  960 + }
  961 + }
  962 + }
  963 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  964 + if (pat == null) {
  965 + objectResponse.setData("");
  966 + } else {
  967 + objectResponse.setData(getResult(pat));
  968 + }
1051 969  
1052   - objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
1053   - objectResponse.setErrormsg("成功");
1054   - return objectResponse;
1055   - }
  970 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  971 + objectResponse.setErrormsg("成功");
  972 + return objectResponse;
  973 + }
1056 974  
1057   - public BaseObjectResponse queryHospitals(String keyWord, Integer page, Integer limit) {
1058   - OrganizationQuery organizationQuery = new OrganizationQuery();
1059   - if(null != page && limit != page) {
1060   - organizationQuery.setNeed("true");
1061   - organizationQuery.setPage(page);
1062   - organizationQuery.setLimit(limit);
1063   - organizationQuery.setSort("modified desc");
1064   - }
  975 + public BaseObjectResponse queryHospitals(String keyWord, Integer page, Integer limit) {
  976 + OrganizationQuery organizationQuery = new OrganizationQuery();
  977 + if (null != page && limit != page) {
  978 + organizationQuery.setNeed("true");
  979 + organizationQuery.setPage(page);
  980 + organizationQuery.setLimit(limit);
  981 + organizationQuery.setSort("modified desc");
  982 + }
1065 983  
1066   - organizationQuery.setYn(YnEnums.YES.getId());
1067   - organizationQuery.setKeyword(keyWord);
  984 + organizationQuery.setYn(YnEnums.YES.getId());
  985 + organizationQuery.setKeyword(keyWord);
1068 986  
1069 987  
1070   - List<Map<String,String>> mapList = new ArrayList<>();
1071   - List<Organization> orgs = organizationService.queryHospitals(organizationQuery);
1072   - if (CollectionUtils.isNotEmpty(orgs))
1073   - {
1074   - for(Organization org : orgs)
1075   - {
1076   - Map<String,String> map = new HashMap<>();
1077   - map.put("id",org.getId()+"");
1078   - map.put("name", org.getName());
1079   - mapList.add(map);
1080   - }
1081   - }
  988 + List<Map<String, String>> mapList = new ArrayList<>();
  989 + List<Organization> orgs = organizationService.queryHospitals(organizationQuery);
  990 + if (CollectionUtils.isNotEmpty(orgs)) {
  991 + for (Organization org : orgs) {
  992 + Map<String, String> map = new HashMap<>();
  993 + map.put("id", org.getId() + "");
  994 + map.put("name", org.getName());
  995 + mapList.add(map);
  996 + }
  997 + }
1082 998  
1083   - BaseObjectResponse objectResponse = new BaseObjectResponse();
1084   - objectResponse.setData(mapList);
  999 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  1000 + objectResponse.setData(mapList);
1085 1001  
1086   - objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
1087   - objectResponse.setErrormsg("成功");
1088   - return objectResponse;
1089   - }
  1002 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  1003 + objectResponse.setErrormsg("成功");
  1004 + return objectResponse;
  1005 + }
1090 1006  
1091   - public BaseListResponse queryChanJianReport(Integer userId, String exDateStart,
1092   - String exDateEnd,
1093   - String name,
1094   - Integer weekStarts,
1095   - Integer weekEnds,
1096   - String hbsag,
1097   - String hbeag,
1098   - String hbeab,
1099   - String hbcab,
1100   - String syphilis,
1101   - String hiv,
1102   - String hcv,
1103   - String doctorNo,
1104   - Integer page,
1105   - Integer limit) {
  1007 + public BaseListResponse queryChanJianReport(Integer userId, String exDateStart,
  1008 + String exDateEnd,
  1009 + String name,
  1010 + Integer weekStarts,
  1011 + Integer weekEnds,
  1012 + String hbsag,
  1013 + String hbeag,
  1014 + String hbeab,
  1015 + String hbcab,
  1016 + String syphilis,
  1017 + String hiv,
  1018 + String hcv,
  1019 + String doctorNo,
  1020 + Integer page,
  1021 + Integer limit) {
1106 1022  
1107   - String hospitalId = autoMatchFacade.getHospitalId(userId);
  1023 + String hospitalId = autoMatchFacade.getHospitalId(userId);
1108 1024  
1109   - int start = 0;
1110   - int end = 1000;
1111   - if (page != null && limit != null)
1112   - {
1113   - start = (page -1) * limit+1;
1114   - end = page*limit;
1115   - }
1116   - String countSql =" SELECT count(*) as allCount "+
1117   - "FROM ODS_F_AUXILIARY_EXAMI A\n" +
1118   - "INNER JOIN ODS_F_GRAVIDA_RECORD B ON A.RECORD_ID=B.RECORD_ID\n" +
1119   - "INNER JOIN ODS_D_HOSPITAL C ON A.HOSPITAL_NO=C.HOSPITAL_NO AND C.VER_NO=2\n" +
1120   - "WHERE C.YCY_STSTEM_ID= '"+hospitalId +"'";
  1025 + int start = 0;
  1026 + int end = 1000;
  1027 + if (page != null && limit != null) {
  1028 + start = (page - 1) * limit + 1;
  1029 + end = page * limit;
  1030 + }
  1031 + String countSql = " SELECT count(*) as allCount " +
  1032 + "FROM ODS_F_AUXILIARY_EXAMI A\n" +
  1033 + "INNER JOIN ODS_F_GRAVIDA_RECORD B ON A.RECORD_ID=B.RECORD_ID\n" +
  1034 + "INNER JOIN ODS_D_HOSPITAL C ON A.HOSPITAL_NO=C.HOSPITAL_NO AND C.VER_NO=2\n" +
  1035 + "WHERE C.YCY_STSTEM_ID= '" + hospitalId + "'";
1121 1036  
1122 1037  
1123   - String sql = "SELECT * FROM ( SELECT A.*, ROWNUM RN FROM ( SELECT A.EXAMINE_DATE,\n" +
1124   - " A.NAME,\n" +
1125   - " A.AGE,\n" +
1126   - " A.NOW_WEEKS,\n" +
1127   - " A.NOW_WEEKS_DAY, \n" +
1128   - " B.EDD_DATE,\n" +
1129   - " A.HBSAG,\n" +
1130   - " A.HBSAB,\n" +
1131   - " A.HBEAG,\n" +
1132   - " A.HBEAB,\n" +
1133   - " A.HBCAB,\n" +
1134   - " A.SYPHILIS,\n" +
1135   - " A.HIV,\n" +
1136   - " A.HCV,\n" +
1137   - " (CASE WHEN A.HIGH_RISK_GRADE IS NULL THEN '绿色预警' ELSE A.HIGH_RISK_GRADE END) AS HIGH_RISK_GRADE,\n" +
1138   - " (CASE WHEN A.HIGH_RISK_FACTOR IS NULL THEN '健康' ELSE A.HIGH_RISK_FACTOR END) AS HIGH_RISK_FACTOR,\n" +
1139   - " A.NEXT_EXAMINE_DATE,\n" +
1140   - " A.EXAMINE_HISTORY_NUM,\n" +
1141   - " A.DOCTOR_NAME,\n" +
1142   - " A.DOCTOR_NAME AS BOOKER,\n" +
1143   - " DECODE(B.IS_VIP_ID,1,'增值服务','标准服务') AS SERVICE_STATUS,\n" +
1144   - " A.SUGGESTION,\n" +
1145   - " B.TEL_NO,\n" +
1146   - " B.HOME_ADDR,\n" +
1147   - " B.STREET_VALLAGE_ID,\n" +
1148   - " B.STREET_VALLAGE,\n" +
1149   - " B.AREA_COUNTY_ID,\n" +
1150   - " B.AREA_COUNTY,\n" +
1151   - " B.CITY_ID,\n" +
1152   - " B.CITY,\n" +
1153   - " B.PROVINCE_ID,\n" +
1154   - " B.PROVINCE\n" +
1155   - " FROM ODS_F_AUXILIARY_EXAMI A " +
1156   - " INNER JOIN ODS_F_GRAVIDA_RECORD B ON A.RECORD_ID=B.RECORD_ID \n" +
1157   - " INNER JOIN ODS_D_HOSPITAL C ON A.HOSPITAL_NO=C.HOSPITAL_NO AND C.VER_NO=2 \n" +
1158   - " WHERE C.YCY_STSTEM_ID= '"+hospitalId +"'";
1159   - if (StringUtils.isNotEmpty(exDateStart))
1160   - {
1161   - sql += " AND A.EXAMINE_DATE>= to_date('"+exDateStart+"','yyyy-MM-dd')";
1162   - countSql += " AND A.EXAMINE_DATE>= to_date('"+exDateStart+"','yyyy-MM-dd')";
1163   - }
1164   - if (StringUtils.isNotEmpty(exDateEnd))
1165   - {
1166   - sql += " AND A.EXAMINE_DATE <= to_date('"+exDateEnd+"','yyyy-MM-dd')";
1167   - countSql += " AND A.EXAMINE_DATE <= to_date('"+exDateEnd+"','yyyy-MM-dd')";
1168   - }
  1038 + String sql = "SELECT * FROM ( SELECT A.*, ROWNUM RN FROM ( SELECT A.EXAMINE_DATE,\n" +
  1039 + " A.NAME,\n" +
  1040 + " A.AGE,\n" +
  1041 + " A.NOW_WEEKS,\n" +
  1042 + " A.NOW_WEEKS_DAY, \n" +
  1043 + " B.EDD_DATE,\n" +
  1044 + " A.HBSAG,\n" +
  1045 + " A.HBSAB,\n" +
  1046 + " A.HBEAG,\n" +
  1047 + " A.HBEAB,\n" +
  1048 + " A.HBCAB,\n" +
  1049 + " A.SYPHILIS,\n" +
  1050 + " A.HIV,\n" +
  1051 + " A.HCV,\n" +
  1052 + " (CASE WHEN A.HIGH_RISK_GRADE IS NULL THEN '绿色预警' ELSE A.HIGH_RISK_GRADE END) AS HIGH_RISK_GRADE,\n" +
  1053 + " (CASE WHEN A.HIGH_RISK_FACTOR IS NULL THEN '健康' ELSE A.HIGH_RISK_FACTOR END) AS HIGH_RISK_FACTOR,\n" +
  1054 + " A.NEXT_EXAMINE_DATE,\n" +
  1055 + " A.EXAMINE_HISTORY_NUM,\n" +
  1056 + " A.DOCTOR_NAME,\n" +
  1057 + " A.DOCTOR_NAME AS BOOKER,\n" +
  1058 + " DECODE(B.IS_VIP_ID,1,'增值服务','标准服务') AS SERVICE_STATUS,\n" +
  1059 + " A.SUGGESTION,\n" +
  1060 + " B.TEL_NO,\n" +
  1061 + " B.HOME_ADDR,\n" +
  1062 + " B.STREET_VALLAGE_ID,\n" +
  1063 + " B.STREET_VALLAGE,\n" +
  1064 + " B.AREA_COUNTY_ID,\n" +
  1065 + " B.AREA_COUNTY,\n" +
  1066 + " B.CITY_ID,\n" +
  1067 + " B.CITY,\n" +
  1068 + " B.PROVINCE_ID,\n" +
  1069 + " B.PROVINCE\n" +
  1070 + " FROM ODS_F_AUXILIARY_EXAMI A " +
  1071 + " INNER JOIN ODS_F_GRAVIDA_RECORD B ON A.RECORD_ID=B.RECORD_ID \n" +
  1072 + " INNER JOIN ODS_D_HOSPITAL C ON A.HOSPITAL_NO=C.HOSPITAL_NO AND C.VER_NO=2 \n" +
  1073 + " WHERE C.YCY_STSTEM_ID= '" + hospitalId + "'";
  1074 + if (StringUtils.isNotEmpty(exDateStart)) {
  1075 + sql += " AND A.EXAMINE_DATE>= to_date('" + exDateStart + "','yyyy-MM-dd')";
  1076 + countSql += " AND A.EXAMINE_DATE>= to_date('" + exDateStart + "','yyyy-MM-dd')";
  1077 + }
  1078 + if (StringUtils.isNotEmpty(exDateEnd)) {
  1079 + sql += " AND A.EXAMINE_DATE <= to_date('" + exDateEnd + "','yyyy-MM-dd')";
  1080 + countSql += " AND A.EXAMINE_DATE <= to_date('" + exDateEnd + "','yyyy-MM-dd')";
  1081 + }
1169 1082  
1170   - if (StringUtils.isNotEmpty(name))
1171   - {
1172   - sql += " AND A.NAME LIKE '%"+name+"%'";
1173   - countSql += " AND A.NAME LIKE '%"+name+"%'";
1174   - }
  1083 + if (StringUtils.isNotEmpty(name)) {
  1084 + sql += " AND A.NAME LIKE '%" + name + "%'";
  1085 + countSql += " AND A.NAME LIKE '%" + name + "%'";
  1086 + }
1175 1087  
1176   - if (weekStarts != null)
1177   - {
1178   - sql += " AND A.NOW_WEEKS>= "+weekStarts;
1179   - countSql += " AND A.NOW_WEEKS>= "+weekStarts;
1180   - }
  1088 + if (weekStarts != null) {
  1089 + sql += " AND A.NOW_WEEKS>= " + weekStarts;
  1090 + countSql += " AND A.NOW_WEEKS>= " + weekStarts;
  1091 + }
1181 1092  
1182   - if (weekEnds != null)
1183   - {
1184   - sql += " AND A.NOW_WEEKS <= "+weekEnds;
1185   - countSql += " AND A.NOW_WEEKS <= "+weekEnds;
1186   - }
  1093 + if (weekEnds != null) {
  1094 + sql += " AND A.NOW_WEEKS <= " + weekEnds;
  1095 + countSql += " AND A.NOW_WEEKS <= " + weekEnds;
  1096 + }
1187 1097  
1188   - if (StringUtils.isNotEmpty(hbsag))
1189   - {
1190   - sql += " AND A.HBSAG = "+hbsag;
1191   - countSql += " AND A.HBSAG = "+hbsag;
1192   - }
  1098 + if (StringUtils.isNotEmpty(hbsag)) {
  1099 + sql += " AND A.HBSAG = " + hbsag;
  1100 + countSql += " AND A.HBSAG = " + hbsag;
  1101 + }
1193 1102  
1194   - if (StringUtils.isNotEmpty(hbeag))
1195   - {
1196   - sql += " AND A.HBEAG = "+hbeag;
1197   - countSql += " AND A.HBEAG = "+hbeag;
1198   - }
  1103 + if (StringUtils.isNotEmpty(hbeag)) {
  1104 + sql += " AND A.HBEAG = " + hbeag;
  1105 + countSql += " AND A.HBEAG = " + hbeag;
  1106 + }
1199 1107  
1200   - if (StringUtils.isNotEmpty(hbeab))
1201   - {
1202   - sql += " AND A.HBEAB = "+hbeab;
1203   - countSql += " AND A.HBEAB = "+hbeab;
1204   - }
  1108 + if (StringUtils.isNotEmpty(hbeab)) {
  1109 + sql += " AND A.HBEAB = " + hbeab;
  1110 + countSql += " AND A.HBEAB = " + hbeab;
  1111 + }
1205 1112  
1206   - if (StringUtils.isNotEmpty(hbcab))
1207   - {
1208   - sql += " AND A.HBCAB = "+hbcab;
1209   - countSql += " AND A.HBCAB = "+hbcab;
1210   - }
1211   - if (StringUtils.isNotEmpty(syphilis))
1212   - {
1213   - sql += " AND A.SYPHILIS = "+syphilis;
1214   - countSql += " AND A.SYPHILIS = "+syphilis;
1215   - }
  1113 + if (StringUtils.isNotEmpty(hbcab)) {
  1114 + sql += " AND A.HBCAB = " + hbcab;
  1115 + countSql += " AND A.HBCAB = " + hbcab;
  1116 + }
  1117 + if (StringUtils.isNotEmpty(syphilis)) {
  1118 + sql += " AND A.SYPHILIS = " + syphilis;
  1119 + countSql += " AND A.SYPHILIS = " + syphilis;
  1120 + }
1216 1121  
1217   - if (StringUtils.isNotEmpty(hiv))
1218   - {
1219   - sql += " AND A.HIV = "+hiv;
1220   - countSql += " AND A.HIV = "+hiv;
1221   - }
  1122 + if (StringUtils.isNotEmpty(hiv)) {
  1123 + sql += " AND A.HIV = " + hiv;
  1124 + countSql += " AND A.HIV = " + hiv;
  1125 + }
1222 1126  
1223   - if (StringUtils.isNotEmpty(hcv))
1224   - {
1225   - sql += " AND A.HCV = "+hcv;
1226   - countSql += " AND A.HCV = "+hcv;
1227   - }
1228   - if (StringUtils.isNotEmpty(doctorNo))
1229   - {
1230   - sql += " AND A.DOCTOR_NO = "+doctorNo;
1231   - countSql += " AND A.DOCTOR_NO = "+doctorNo;
1232   - }
  1127 + if (StringUtils.isNotEmpty(hcv)) {
  1128 + sql += " AND A.HCV = " + hcv;
  1129 + countSql += " AND A.HCV = " + hcv;
  1130 + }
  1131 + if (StringUtils.isNotEmpty(doctorNo)) {
  1132 + sql += " AND A.DOCTOR_NO = " + doctorNo;
  1133 + countSql += " AND A.DOCTOR_NO = " + doctorNo;
  1134 + }
1233 1135  
1234   - sql+=" order by A.EXAMINE_DATE DESC,A.Name ASC,A.EXAMINE_ID DESC ) A WHERE ROWNUM <= "+end+" ) WHERE RN >= "+start;
  1136 + sql += " order by A.EXAMINE_DATE DESC,A.Name ASC,A.EXAMINE_ID DESC ) A WHERE ROWNUM <= " + end + " ) WHERE RN >= " + start;
1235 1137  
1236   - logger.info(sql);
1237   - List<Map<String,Object>> list = JdbcUtil.getListDataBySql(sql);
  1138 + logger.info(sql);
  1139 + List<Map<String, Object>> list = JdbcUtil.getListDataBySql(sql);
1238 1140  
1239   - Integer count = Integer.parseInt(String.valueOf(JdbcUtil.getOralceSingleObjBySql(countSql)));
1240   - BaseListResponse listResponse= new BaseListResponse();
1241   - listResponse.setData(list);
  1141 + Integer count = Integer.parseInt(String.valueOf(JdbcUtil.getOralceSingleObjBySql(countSql)));
  1142 + BaseListResponse listResponse = new BaseListResponse();
  1143 + listResponse.setData(list);
1242 1144  
1243   - PageInfo pageInfo = new PageInfo(page, 0,count,limit);
  1145 + PageInfo pageInfo = new PageInfo(page, 0, count, limit);
1244 1146  
1245   - listResponse.setPageInfo(pageInfo);
  1147 + listResponse.setPageInfo(pageInfo);
1246 1148  
1247   - listResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
1248   - listResponse.setErrormsg("成功");
1249   - return listResponse;
1250   - }
  1149 + listResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  1150 + listResponse.setErrormsg("成功");
  1151 + return listResponse;
  1152 + }
1251 1153  
1252 1154  
1253   - public void exportChanReport(Integer userId, HttpServletResponse httpServletResponse,
1254   - String exDateStart,
1255   - String exDateEnd,
1256   - String name,
1257   - Integer weekStarts,
1258   - Integer weekEnds,
1259   - String hbsag,
1260   - String hbeag,
1261   - String hbeab,
1262   - String hbcab,
1263   - String syphilis,
1264   - String hiv,
1265   - String hcv,
1266   - String doctorNo) {
1267   - String hospitalId = autoMatchFacade.getHospitalId(userId);
1268   - String sql = "SELECT A.EXAMINE_DATE,\n" +
1269   - " A.NAME,\n" +
1270   - " A.AGE,\n" +
1271   - " (CASE WHEN A.NOW_WEEKS_DAY<>0 THEN '孕'||A.NOW_WEEKS|| '周+'||A.NOW_WEEKS_DAY||'天' ELSE '孕'||A.NOW_WEEKS|| '周' END) as NOW_WEEKS,\n" +
1272   - " A.NOW_WEEKS_DAY, \n" +
1273   - " B.EDD_DATE,\n" +
1274   - " A.HBSAG,\n" +
1275   - " A.HBSAB,\n" +
1276   - " A.HBEAG,\n" +
1277   - " A.HBEAB,\n" +
1278   - " A.HBCAB,\n" +
1279   - " A.SYPHILIS,\n" +
1280   - " A.HIV,\n" +
1281   - " A.HCV,\n" +
1282   - " (CASE WHEN A.HIGH_RISK_GRADE IS NULL THEN '绿色预警' ELSE A.HIGH_RISK_GRADE END) AS HIGH_RISK_GRADE,\n" +
1283   - " (CASE WHEN A.HIGH_RISK_FACTOR IS NULL THEN '健康' ELSE A.HIGH_RISK_FACTOR END) AS HIGH_RISK_FACTOR,\n" +
1284   - " A.NEXT_EXAMINE_DATE,\n" +
1285   - " A.EXAMINE_HISTORY_NUM,\n" +
1286   - " A.DOCTOR_NAME,\n" +
1287   - " A.DOCTOR_NAME AS BOOKER,\n" +
1288   - " DECODE(B.IS_VIP_ID,1,'增值服务','标准服务') AS SERVICE_STATUS,\n" +
1289   - " A.SUGGESTION,\n" +
1290   - " B.TEL_NO,\n" +
1291   - " B.HOME_ADDR,\n" +
1292   - " B.STREET_VALLAGE_ID,\n" +
1293   - " B.STREET_VALLAGE,\n" +
1294   - " B.AREA_COUNTY_ID,\n" +
1295   - " B.AREA_COUNTY,\n" +
1296   - " B.CITY_ID,\n" +
1297   - " B.CITY,\n" +
1298   - " B.PROVINCE_ID,\n" +
1299   - " B.PROVINCE\n" +
1300   - " FROM ODS_F_AUXILIARY_EXAMI A " +
1301   - " INNER JOIN ODS_F_GRAVIDA_RECORD B ON A.RECORD_ID=B.RECORD_ID \n" +
1302   - " INNER JOIN ODS_D_HOSPITAL C ON A.HOSPITAL_NO=C.HOSPITAL_NO AND C.VER_NO=2 \n" +
1303   - " WHERE C.YCY_STSTEM_ID= '"+hospitalId +"'";
1304   - if (StringUtils.isNotEmpty(exDateStart))
1305   - {
1306   - sql += " AND A.EXAMINE_DATE>= to_date('"+exDateStart+"','yyyy-MM-dd')";
1307   - }
1308   - if (StringUtils.isNotEmpty(exDateEnd))
1309   - {
1310   - sql += " AND A.EXAMINE_DATE <= to_date('"+exDateEnd+"','yyyy-MM-dd')";
1311   - }
  1155 + public void exportChanReport(Integer userId, HttpServletResponse httpServletResponse,
  1156 + String exDateStart,
  1157 + String exDateEnd,
  1158 + String name,
  1159 + Integer weekStarts,
  1160 + Integer weekEnds,
  1161 + String hbsag,
  1162 + String hbeag,
  1163 + String hbeab,
  1164 + String hbcab,
  1165 + String syphilis,
  1166 + String hiv,
  1167 + String hcv,
  1168 + String doctorNo) {
  1169 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  1170 + String sql = "SELECT A.EXAMINE_DATE,\n" +
  1171 + " A.NAME,\n" +
  1172 + " A.AGE,\n" +
  1173 + " (CASE WHEN A.NOW_WEEKS_DAY<>0 THEN '孕'||A.NOW_WEEKS|| '周+'||A.NOW_WEEKS_DAY||'天' ELSE '孕'||A.NOW_WEEKS|| '周' END) as NOW_WEEKS,\n" +
  1174 + " A.NOW_WEEKS_DAY, \n" +
  1175 + " B.EDD_DATE,\n" +
  1176 + " A.HBSAG,\n" +
  1177 + " A.HBSAB,\n" +
  1178 + " A.HBEAG,\n" +
  1179 + " A.HBEAB,\n" +
  1180 + " A.HBCAB,\n" +
  1181 + " A.SYPHILIS,\n" +
  1182 + " A.HIV,\n" +
  1183 + " A.HCV,\n" +
  1184 + " (CASE WHEN A.HIGH_RISK_GRADE IS NULL THEN '绿色预警' ELSE A.HIGH_RISK_GRADE END) AS HIGH_RISK_GRADE,\n" +
  1185 + " (CASE WHEN A.HIGH_RISK_FACTOR IS NULL THEN '健康' ELSE A.HIGH_RISK_FACTOR END) AS HIGH_RISK_FACTOR,\n" +
  1186 + " A.NEXT_EXAMINE_DATE,\n" +
  1187 + " A.EXAMINE_HISTORY_NUM,\n" +
  1188 + " A.DOCTOR_NAME,\n" +
  1189 + " A.DOCTOR_NAME AS BOOKER,\n" +
  1190 + " DECODE(B.IS_VIP_ID,1,'增值服务','标准服务') AS SERVICE_STATUS,\n" +
  1191 + " A.SUGGESTION,\n" +
  1192 + " B.TEL_NO,\n" +
  1193 + " B.HOME_ADDR,\n" +
  1194 + " B.STREET_VALLAGE_ID,\n" +
  1195 + " B.STREET_VALLAGE,\n" +
  1196 + " B.AREA_COUNTY_ID,\n" +
  1197 + " B.AREA_COUNTY,\n" +
  1198 + " B.CITY_ID,\n" +
  1199 + " B.CITY,\n" +
  1200 + " B.PROVINCE_ID,\n" +
  1201 + " B.PROVINCE\n" +
  1202 + " FROM ODS_F_AUXILIARY_EXAMI A " +
  1203 + " INNER JOIN ODS_F_GRAVIDA_RECORD B ON A.RECORD_ID=B.RECORD_ID \n" +
  1204 + " INNER JOIN ODS_D_HOSPITAL C ON A.HOSPITAL_NO=C.HOSPITAL_NO AND C.VER_NO=2 \n" +
  1205 + " WHERE C.YCY_STSTEM_ID= '" + hospitalId + "'";
  1206 + if (StringUtils.isNotEmpty(exDateStart)) {
  1207 + sql += " AND A.EXAMINE_DATE>= to_date('" + exDateStart + "','yyyy-MM-dd')";
  1208 + }
  1209 + if (StringUtils.isNotEmpty(exDateEnd)) {
  1210 + sql += " AND A.EXAMINE_DATE <= to_date('" + exDateEnd + "','yyyy-MM-dd')";
  1211 + }
1312 1212  
1313   - if (StringUtils.isNotEmpty(name))
1314   - {
1315   - sql += " AND A.NAME LIKE '%"+name+"%'";
1316   - }
  1213 + if (StringUtils.isNotEmpty(name)) {
  1214 + sql += " AND A.NAME LIKE '%" + name + "%'";
  1215 + }
1317 1216  
1318   - if (weekStarts != null)
1319   - {
1320   - sql += " AND A.NOW_WEEKS>= "+weekStarts;
1321   - }
  1217 + if (weekStarts != null) {
  1218 + sql += " AND A.NOW_WEEKS>= " + weekStarts;
  1219 + }
1322 1220  
1323   - if (weekEnds != null)
1324   - {
1325   - sql += " AND A.NOW_WEEKS <= "+weekEnds;
1326   - }
  1221 + if (weekEnds != null) {
  1222 + sql += " AND A.NOW_WEEKS <= " + weekEnds;
  1223 + }
1327 1224  
1328   - if (StringUtils.isNotEmpty(hbsag))
1329   - {
1330   - sql += " AND A.HBSAG = "+hbsag;
1331   - }
  1225 + if (StringUtils.isNotEmpty(hbsag)) {
  1226 + sql += " AND A.HBSAG = " + hbsag;
  1227 + }
1332 1228  
1333   - if (StringUtils.isNotEmpty(hbeag))
1334   - {
1335   - sql += " AND A.HBEAG = "+hbeag;
1336   - }
  1229 + if (StringUtils.isNotEmpty(hbeag)) {
  1230 + sql += " AND A.HBEAG = " + hbeag;
  1231 + }
1337 1232  
1338   - if (StringUtils.isNotEmpty(hbeab))
1339   - {
1340   - sql += " AND A.HBEAB = "+hbeab;
1341   - }
  1233 + if (StringUtils.isNotEmpty(hbeab)) {
  1234 + sql += " AND A.HBEAB = " + hbeab;
  1235 + }
1342 1236  
1343   - if (StringUtils.isNotEmpty(hbcab))
1344   - {
1345   - sql += " AND A.HBCAB = "+hbcab;
1346   - }
1347   - if (StringUtils.isNotEmpty(syphilis))
1348   - {
1349   - sql += " AND A.SYPHILIS = "+syphilis;
1350   - }
  1237 + if (StringUtils.isNotEmpty(hbcab)) {
  1238 + sql += " AND A.HBCAB = " + hbcab;
  1239 + }
  1240 + if (StringUtils.isNotEmpty(syphilis)) {
  1241 + sql += " AND A.SYPHILIS = " + syphilis;
  1242 + }
1351 1243  
1352   - if (StringUtils.isNotEmpty(hiv))
1353   - {
1354   - sql += " AND A.HIV = "+hiv;
1355   - }
  1244 + if (StringUtils.isNotEmpty(hiv)) {
  1245 + sql += " AND A.HIV = " + hiv;
  1246 + }
1356 1247  
1357   - if (StringUtils.isNotEmpty(hcv))
1358   - {
1359   - sql += " AND A.HCV = "+hcv;
1360   - }
1361   - if (StringUtils.isNotEmpty(doctorNo))
1362   - {
1363   - sql += " AND A.DOCTOR_NO = "+doctorNo;
1364   - }
  1248 + if (StringUtils.isNotEmpty(hcv)) {
  1249 + sql += " AND A.HCV = " + hcv;
  1250 + }
  1251 + if (StringUtils.isNotEmpty(doctorNo)) {
  1252 + sql += " AND A.DOCTOR_NO = " + doctorNo;
  1253 + }
1365 1254  
1366   - sql+=" order by A.EXAMINE_DATE DESC,A.Name ASC,A.EXAMINE_ID DESC ";
  1255 + sql += " order by A.EXAMINE_DATE DESC,A.Name ASC,A.EXAMINE_ID DESC ";
1367 1256  
1368   - try {
1369   - List<Map<String,Object>> datas = JdbcUtil.getListDataBySql(sql);
1370   - OutputStream out = httpServletResponse.getOutputStream();
1371   - Map<String,String> cnames = new LinkedHashMap<>();
  1257 + try {
  1258 + List<Map<String, Object>> datas = JdbcUtil.getListDataBySql(sql);
  1259 + OutputStream out = httpServletResponse.getOutputStream();
  1260 + Map<String, String> cnames = new LinkedHashMap<>();
1372 1261  
1373   - cnames.put("NAME", "姓名");
1374   - cnames.put("AGE", "年龄");
1375   - cnames.put("NOW_WEEKS", "孕周");
1376   - cnames.put("TEL_NO", "联系方式");
1377   - cnames.put("SUGGESTION", "处理意见");
1378   - cnames.put("HBSAG", "乙肝表面抗原");
1379   - cnames.put("HBSAB", "乙肝表面抗体");
1380   - cnames.put("HBEAG", "乙肝e抗原");
1381   - cnames.put("HBEAB", "乙肝e抗体");
1382   - cnames.put("HBCAB", "乙肝核心抗体");
1383   - cnames.put("SYPHILIS", "梅毒");
1384   - cnames.put("HIV", "HIV");
1385   - cnames.put("HCV", "丙肝");
1386   - cnames.put("NEXT_EXAMINE_DATE", "预约产检日期");
1387   - cnames.put("EXAMINE_HISTORY_NUM", "本院产检次数");
1388   - cnames.put("DOCTOR_NAME", "产检医生");
1389   - cnames.put("BOOKER", "登记人");
1390   - cnames.put("SERVICE_STATUS", "服务类型");
1391   - cnames.put("HIGH_RISK_FACTOR", "高危因素");
1392   - cnames.put("HIGH_RISK_GRADE", "高危等级");
1393   - cnames.put("EDD_DATE", "预产期");
1394   - cnames.put("EXAMINE_DATE", "产检日期");
1395   - cnames.put("HOME_ADDR", "居住地");
1396   - httpServletResponse.setContentType("application/octet-stream");
1397   - httpServletResponse.setCharacterEncoding("UTF-8");
1398   - httpServletResponse.setHeader("Content-Disposition", "attachment;fileName=datas.xls");
1399   - ExcelUtil.toChanExcel(out, datas, cnames);
1400   - }catch (Exception e)
1401   - {
1402   - logger.error(e +"",e);
1403   - }
1404   - }
  1262 + cnames.put("NAME", "姓名");
  1263 + cnames.put("AGE", "年龄");
  1264 + cnames.put("NOW_WEEKS", "孕周");
  1265 + cnames.put("TEL_NO", "联系方式");
  1266 + cnames.put("SUGGESTION", "处理意见");
  1267 + cnames.put("HBSAG", "乙肝表面抗原");
  1268 + cnames.put("HBSAB", "乙肝表面抗体");
  1269 + cnames.put("HBEAG", "乙肝e抗原");
  1270 + cnames.put("HBEAB", "乙肝e抗体");
  1271 + cnames.put("HBCAB", "乙肝核心抗体");
  1272 + cnames.put("SYPHILIS", "梅毒");
  1273 + cnames.put("HIV", "HIV");
  1274 + cnames.put("HCV", "丙肝");
  1275 + cnames.put("NEXT_EXAMINE_DATE", "预约产检日期");
  1276 + cnames.put("EXAMINE_HISTORY_NUM", "本院产检次数");
  1277 + cnames.put("DOCTOR_NAME", "产检医生");
  1278 + cnames.put("BOOKER", "登记人");
  1279 + cnames.put("SERVICE_STATUS", "服务类型");
  1280 + cnames.put("HIGH_RISK_FACTOR", "高危因素");
  1281 + cnames.put("HIGH_RISK_GRADE", "高危等级");
  1282 + cnames.put("EDD_DATE", "预产期");
  1283 + cnames.put("EXAMINE_DATE", "产检日期");
  1284 + cnames.put("HOME_ADDR", "居住地");
  1285 + httpServletResponse.setContentType("application/octet-stream");
  1286 + httpServletResponse.setCharacterEncoding("UTF-8");
  1287 + httpServletResponse.setHeader("Content-Disposition", "attachment;fileName=datas.xls");
  1288 + ExcelUtil.toChanExcel(out, datas, cnames);
  1289 + } catch (Exception e) {
  1290 + logger.error(e + "", e);
  1291 + }
  1292 + }
1405 1293  
1406   - /**
1407   - *
1408   - * 建档管理页面
1409   - *
1410   - * @param bookBuildManagerQueryRequest
1411   - * @return
1412   - */
1413   - public BaseListResponse queryBookBuild(BookBuildManagerQueryRequest bookBuildManagerQueryRequest,Integer userId){
1414   - PatientsQuery patientsQuery1=new PatientsQuery();
1415   - patientsQuery1.setYn(YnEnums.YES.getId());
1416   - List buildType = new ArrayList();
1417   - buildType.add(0);
1418   - buildType.add(2);
1419   - patientsQuery1.setBuildTypeList(buildType);
1420   - String hospitalId= autoMatchFacade.getHospitalId(userId);
1421   - patientsQuery1.setHospitalId(hospitalId);
1422   - patientsQuery1.setNeed("1");
1423   - patientsQuery1.setLimit(bookBuildManagerQueryRequest.getLimit());
1424   - patientsQuery1.setPage(bookBuildManagerQueryRequest.getPage());
1425   - patientsQuery1.setPhone(bookBuildManagerQueryRequest.getPhone());
1426   - patientsQuery1.setCardNo(bookBuildManagerQueryRequest.getCardNo());
1427   - patientsQuery1.setPhone(bookBuildManagerQueryRequest.getPhone());
  1294 + /**
  1295 + * 建档管理页面
  1296 + *
  1297 + * @param bookBuildManagerQueryRequest
  1298 + * @return
  1299 + */
  1300 + public BaseListResponse queryBookBuild(BookBuildManagerQueryRequest bookBuildManagerQueryRequest, Integer userId) {
  1301 + PatientsQuery patientsQuery1 = new PatientsQuery();
  1302 + patientsQuery1.setYn(YnEnums.YES.getId());
  1303 + List buildType = new ArrayList();
  1304 + buildType.add(0);
  1305 + buildType.add(2);
  1306 + patientsQuery1.setBuildTypeList(buildType);
  1307 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  1308 + patientsQuery1.setHospitalId(hospitalId);
  1309 + patientsQuery1.setNeed("1");
  1310 + patientsQuery1.setLimit(bookBuildManagerQueryRequest.getLimit());
  1311 + patientsQuery1.setPage(bookBuildManagerQueryRequest.getPage());
  1312 + patientsQuery1.setPhone(bookBuildManagerQueryRequest.getPhone());
  1313 + patientsQuery1.setCardNo(bookBuildManagerQueryRequest.getCardNo());
  1314 + patientsQuery1.setPhone(bookBuildManagerQueryRequest.getPhone());
1428 1315  
1429   - List<Patients> patientses= yunBookbuildingService.queryPregnantWithQuery(patientsQuery1);
  1316 + List<Patients> patientses = yunBookbuildingService.queryPregnantWithQuery(patientsQuery1);
1430 1317  
1431   - BookBuildManagerResult bookBuildManagerResult=new BookBuildManagerResult();
1432   - List<BookBuildManagerResult> data = new ArrayList<>();
1433   - for(Patients patients: patientses){
1434   - bookBuildManagerResult.convertToResult(patients);
  1318 + BookBuildManagerResult bookBuildManagerResult = new BookBuildManagerResult();
  1319 + List<BookBuildManagerResult> data = new ArrayList<>();
  1320 + for (Patients patients : patientses) {
  1321 + bookBuildManagerResult.convertToResult(patients);
1435 1322  
1436   - }
1437   - return new BaseListResponse().setData(data).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
1438   - }
  1323 + }
  1324 + return new BaseListResponse().setData(data).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  1325 + }
1439 1326  
1440   - public BaseResponse findPatientById(String parentId,Integer userId){
1441   - PatientsQuery patientsQuery = new PatientsQuery();
1442   - patientsQuery.setId(parentId);
1443   - patientsQuery.setYn(YnEnums.YES.getId());
1444   - patientsQuery.setHospitalId(autoMatchFacade.getHospitalId(userId));
1445   - PregnantInfoResult result = new PregnantInfoResult();
1446   - SimplePregnantResult patientResult =new SimplePregnantResult();
1447   - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
1448   - if (patients != null && patients.size() > 0)
1449   - {
1450   - Patients p = patients.get(0);
1451   - result = getResult(p);
  1327 + public BaseResponse findPatientById(String parentId, Integer userId) {
  1328 + PatientsQuery patientsQuery = new PatientsQuery();
  1329 + patientsQuery.setId(parentId);
  1330 + patientsQuery.setYn(YnEnums.YES.getId());
  1331 + patientsQuery.setHospitalId(autoMatchFacade.getHospitalId(userId));
  1332 + PregnantInfoResult result = new PregnantInfoResult();
  1333 + SimplePregnantResult patientResult = new SimplePregnantResult();
  1334 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  1335 + if (patients != null && patients.size() > 0) {
  1336 + Patients p = patients.get(0);
  1337 + result = getResult(p);
1452 1338  
1453   - patientResult.setId(result.getId());
1454   - patientResult.setPid(result.getPid());
  1339 + patientResult.setId(result.getId());
  1340 + patientResult.setPid(result.getPid());
1455 1341  
1456   - patientResult.setPregnantName(result.getPregnantName());
1457   - patientResult.setPregnantPhone(result.getPregnantPhone());
1458   - patientResult.setPregnantAge(DateUtil.getAge(p.getBirth()) + "");
  1342 + patientResult.setPregnantName(result.getPregnantName());
  1343 + patientResult.setPregnantPhone(result.getPregnantPhone());
  1344 + patientResult.setPregnantAge(DateUtil.getAge(p.getBirth()) + "");
1459 1345  
1460   - patientResult.setPregnantLiveAddr(p.getAddressRegister());
1461   - patientResult.setPregnantLiveProvinceId(p.getProvinceRegisterId());
1462   - patientResult.setPregnantLiveCityId(p.getCityRegisterId());
1463   - patientResult.setPregnantLiveAreaId(p.getAreaRegisterId());
1464   - patientResult.setPregnantLiveStreetId(p.getStreetRegisterId());
  1346 + patientResult.setPregnantLiveAddr(p.getAddressRegister());
  1347 + patientResult.setPregnantLiveProvinceId(p.getProvinceRegisterId());
  1348 + patientResult.setPregnantLiveCityId(p.getCityRegisterId());
  1349 + patientResult.setPregnantLiveAreaId(p.getAreaRegisterId());
  1350 + patientResult.setPregnantLiveStreetId(p.getStreetRegisterId());
1465 1351  
1466 1352  
1467   - patientResult.setPregnantLiveProvince(getBasicConfig(patientResult.getPregnantLiveProvinceId()));
1468   - patientResult.setPregnantLiveCity(getBasicConfig(patientResult.getPregnantLiveCityId()));
1469   - patientResult.setPregnantLiveArea(getBasicConfig(patientResult.getPregnantLiveAreaId()));
1470   - patientResult.setPregnantLiveStreet(getBasicConfig(patientResult.getPregnantLiveStreetId()));
1471   - patientResult.setHusbandName(result.getHusbandName());
1472   - //丈夫证件号
1473   - if(StringUtils.isNotEmpty(result.getHusbandCertificateNum()) &&result.getHusbandCertificateNum().length()==18){
  1353 + patientResult.setPregnantLiveProvince(getBasicConfig(patientResult.getPregnantLiveProvinceId()));
  1354 + patientResult.setPregnantLiveCity(getBasicConfig(patientResult.getPregnantLiveCityId()));
  1355 + patientResult.setPregnantLiveArea(getBasicConfig(patientResult.getPregnantLiveAreaId()));
  1356 + patientResult.setPregnantLiveStreet(getBasicConfig(patientResult.getPregnantLiveStreetId()));
  1357 + patientResult.setHusbandName(result.getHusbandName());
  1358 + //丈夫证件号
  1359 + if (StringUtils.isNotEmpty(result.getHusbandCertificateNum()) && result.getHusbandCertificateNum().length() == 18) {
1474 1360  
1475   - int years,months,days;
1476   - try{
1477   - String year = result.getHusbandCertificateNum().substring(6,10);
1478   - String month = result.getHusbandCertificateNum().substring(10, 12);
1479   - String day = result.getHusbandCertificateNum().substring(12,14);
1480   - years=Integer.valueOf(year);
1481   - months=Integer.valueOf(month);
1482   - days=Integer.valueOf(day);
1483   - Calendar calendar=Calendar.getInstance();
1484   - calendar.set(years,months-1,days);
1485   - patientResult.setHusbandAge(DateUtil.getAge(calendar.getTime())+"");
1486   - }catch (Exception e){
1487   - }
1488   - }
  1361 + int years, months, days;
  1362 + try {
  1363 + String year = result.getHusbandCertificateNum().substring(6, 10);
  1364 + String month = result.getHusbandCertificateNum().substring(10, 12);
  1365 + String day = result.getHusbandCertificateNum().substring(12, 14);
  1366 + years = Integer.valueOf(year);
  1367 + months = Integer.valueOf(month);
  1368 + days = Integer.valueOf(day);
  1369 + Calendar calendar = Calendar.getInstance();
  1370 + calendar.set(years, months - 1, days);
  1371 + patientResult.setHusbandAge(DateUtil.getAge(calendar.getTime()) + "");
  1372 + } catch (Exception e) {
  1373 + }
  1374 + }
1489 1375  
1490   - patientResult.setHusbandCertificateNum(result.getHusbandCertificateNum());
1491   - patientResult.setHusbandCertificateTypeId(result.getHusbandCertificateTypeId());
1492   - patientResult.setHusbandPhone(result.getHusbandPhone());
1493   - }
1494   - // 增加初诊信息,桓台医院打印使用
1495   - AntExChuQuery antExChuQuery = new AntExChuQuery();
1496   - antExChuQuery.setParentId(patientResult.getId());
1497   - antExChuQuery.setYn(YnEnums.YES.getId());
1498   - List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery);
1499   - if (CollectionUtils.isNotEmpty(antExChuModels)) {
1500   - AntExChuModel antExChuModel = antExChuModels.get(0);
1501   - patientResult.setPregnancyTimes(antExChuModel.getPregnancyTimes());
1502   - patientResult.setProdTime(antExChuModel.getProdTime());
1503   - patientResult.setDelivery(antExChuModel.getDelivery());
1504   - patientResult.setPlanedProd(antExChuModel.getPlanedProd());
1505   - }
  1376 + patientResult.setHusbandCertificateNum(result.getHusbandCertificateNum());
  1377 + patientResult.setHusbandCertificateTypeId(result.getHusbandCertificateTypeId());
  1378 + patientResult.setHusbandPhone(result.getHusbandPhone());
  1379 + }
  1380 + // 增加初诊信息,桓台医院打印使用
  1381 + AntExChuQuery antExChuQuery = new AntExChuQuery();
  1382 + antExChuQuery.setParentId(patientResult.getId());
  1383 + antExChuQuery.setYn(YnEnums.YES.getId());
  1384 + List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery);
  1385 + if (CollectionUtils.isNotEmpty(antExChuModels)) {
  1386 + AntExChuModel antExChuModel = antExChuModels.get(0);
  1387 + patientResult.setPregnancyTimes(antExChuModel.getPregnancyTimes());
  1388 + patientResult.setProdTime(antExChuModel.getProdTime());
  1389 + patientResult.setDelivery(antExChuModel.getDelivery());
  1390 + patientResult.setPlanedProd(antExChuModel.getPlanedProd());
  1391 + }
1506 1392  
1507   - BaseObjectResponse objectResponse = new BaseObjectResponse();
1508   - objectResponse.setData(patientResult);
1509   - objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
1510   - objectResponse.setErrormsg("成功");
1511   - return objectResponse;
1512   - }
1513   - private String getBasicConfig(String id){
1514   - if(StringUtils.isEmpty(id)){
1515   - return "";
1516   - }
1517   - BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(id);
1518   - if(null!=basicConfig){
1519   - return basicConfig.getName();
1520   - }
1521   - return "";
1522   - }
  1393 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  1394 + objectResponse.setData(patientResult);
  1395 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  1396 + objectResponse.setErrormsg("成功");
  1397 + return objectResponse;
  1398 + }
  1399 +
  1400 + private String getBasicConfig(String id) {
  1401 + if (StringUtils.isEmpty(id)) {
  1402 + return "";
  1403 + }
  1404 + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(id);
  1405 + if (null != basicConfig) {
  1406 + return basicConfig.getName();
  1407 + }
  1408 + return "";
  1409 + }
1523 1410 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java View file @ 78072a1
... ... @@ -14,9 +14,7 @@
14 14 import com.lyms.platform.operate.web.request.MatDeliverQueryRequest;
15 15 import com.lyms.platform.operate.web.request.NewBabyManagerRequest;
16 16 import com.lyms.platform.operate.web.result.*;
17   -import com.lyms.platform.operate.web.utils.CommonsHelper;
18 17 import com.lyms.platform.permission.model.Organization;
19   -import com.lyms.platform.permission.model.OrganizationQuery;
20 18 import com.lyms.platform.permission.model.Users;
21 19 import com.lyms.platform.permission.service.OrganizationService;
22 20 import com.lyms.platform.permission.service.UsersService;
23 21  
... ... @@ -74,14 +72,8 @@
74 72 private DeleteProcessHandler deleteProcessHandler;
75 73  
76 74 @Autowired
77   - private DataPermissionService dataPermissionService;
  75 + private OrganizationGroupsFacade organizationGroupsFacade;
78 76  
79   - @Autowired
80   - private BasicConfigService basicConfigService;
81   -
82   - @Value(("#{configProperties['run.region']}"))
83   - private String runType;
84   -
85 77 private static Map<Integer, String> ONE_ENUMS = new HashMap<>();
86 78  
87 79 private static Map<String, List> babyMap = new HashMap<>();
88 80  
... ... @@ -134,8 +126,10 @@
134 126 List<MaternalDeliverModel.Baby> babyList = new ArrayList<>();
135 127 String hospitalId = autoMatchFacade.getHospitalId(userId);
136 128 MaternalDeliverModel maternalDeliverModel = deliverAddRequest.convertToDataModel();
  129 +
  130 + Organization og = organizationService.getOrganization(Integer.valueOf(hospitalId));
137 131 //区域模式
138   - if (ErrorCodeConstants.RUN_MODE.equals(runType)) {
  132 + if (og.getbStatus()!=1) {
139 133 String parentId =antenatalExaminationFacade.handHideBuild(deliverAddRequest.getPid(), deliverAddRequest.getParentId(), userId);
140 134 if (StringUtils.isEmpty(parentId)) {
141 135 logger.warn("get handHideBuild parentId is null.");
... ... @@ -477,9 +471,6 @@
477 471 personModel.setName(babyModel.getName());
478 472 personModel.setCreated(new Date());
479 473 babyModel.setPid(personService.addPerson(personModel).getId());
480   -
481   -
482   -
483 474 }
484 475 babyIds.add(babyService.addOneBaby(babyModel).getId());
485 476 if ((RenShenJieJuEnums.O.getId() + "").equals(baby.getPregnancyOut())) {
... ... @@ -487,7 +478,6 @@
487 478 //儿童建档
488 479 babyBookbuildingFacade.createBuildSms(babyModel);
489 480 }
490   -
491 481 i++;
492 482 }
493 483 maternalDeliverModel.setBaby(babyList);
494 484  
495 485  
... ... @@ -501,21 +491,17 @@
501 491 * @return
502 492 */
503 493 public BaseResponse queryMatDeliver(MatDeliverQueryRequest deliverQueryRequest, Integer userId) {
504   - List<Integer> list1 = autoMatchFacade.matchOrgId(userId);
505   - String hospital = null;
506   - if (CollectionUtils.isNotEmpty(list1)) {
507   - hospital = list1.get(0) + "";
508   - }
  494 +
  495 + String hospital=autoMatchFacade.getHospitalId(userId);
509 496 //获取
510 497 /* Patients patients = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null, hospital, -1);
511 498 if (null == patients) {
512 499 return new BaseResponse().setErrormsg("没有相关的产妇记录").setErrorcode(ErrorCodeConstants.BUSINESS_ERROR);
513 500 }*/
  501 +
  502 + Organization og = organizationService.getOrganization(Integer.valueOf(hospital));
514 503 //区域模式
515   - boolean isEnable=false;
516   - if (ErrorCodeConstants.RUN_MODE.equals(runType)) {
517   - isEnable=true;
518   - }
  504 + boolean isEnable=og.getbStatus()==1;
519 505  
520 506 //外院的孕妇
521 507 Patients patients1 = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null, null, 1, false, null,true);
522 508  
... ... @@ -524,9 +510,9 @@
524 510  
525 511 //http://jira.healthbaby.com.cn/browse/WEB-204 修改bug
526 512 //本院的孕妇
527   - Patients patients = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null, hospital, 1, false, null,isEnable);
  513 + Patients patients = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null, organizationGroupsFacade.findGroupHospital(userId), 1, false, null,isEnable);
528 514 //本院产妇
529   - Patients patients3 = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null, hospital, 3, false, null,isEnable);
  515 + Patients patients3 = antenatalExaminationFacade.findOnePatient(deliverQueryRequest.getCardNo(), deliverQueryRequest.getVcCardNo(), null, organizationGroupsFacade.findGroupHospital(userId), 3, false, null,isEnable);
530 516 PersonModelQuery personModelQuery = new PersonModelQuery();
531 517 String pid = "";
532 518 if (null != patients1) {
... ... @@ -920,7 +906,7 @@
920 906 // 什么都不做,这里是数据传入错误了
921 907 }
922 908 }
923   - //
  909 +
924 910 patientsQuery.setYn(YnEnums.YES.getId());
925 911 patientsQuery.setType(3);
926 912 // 构造医院id集合
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ 78072a1
... ... @@ -73,6 +73,8 @@
73 73 private DataPermissionService dataPermissionService;
74 74 @Autowired
75 75 private OrganizationService organizationService;
  76 + @Autowired
  77 + private OrganizationGroupsFacade groupsFacade;
76 78  
77 79 private ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(15, 20, 1, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>(5000));
78 80  
... ... @@ -460,7 +462,7 @@
460 462 patientsQuery.setPhone(patientQueryRequest.getPhone());
461 463 patientsQuery.setCardNo(patientQueryRequest.getCardNo());
462 464 String hospital = autoMatchFacade.getHospitalId(userId);
463   - Patients patients = antenatalExaminationFacade.findOnePatient(patientQueryRequest.getCardNo(), null, patientQueryRequest.getId(), hospital, -1, false, patientQueryRequest.getPid(),false);
  465 + Patients patients = antenatalExaminationFacade.findOnePatient(patientQueryRequest.getCardNo(), null, patientQueryRequest.getId(), groupsFacade.findGroupHospital(userId), -1, false, patientQueryRequest.getPid(),false);
464 466 PatientBaseResult patientBaseResult = new PatientBaseResult();
465 467 if (null != patients) {
466 468 patientBaseResult.convert(patients);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PostReviewFacade.java View file @ 78072a1
1 1 package com.lyms.platform.operate.web.facade;
2 2  
3   -import com.lyms.platform.biz.service.ApplyOrderService;
4   -import com.lyms.platform.biz.service.MatDeliverService;
5   -import com.lyms.platform.biz.service.PatientsService;
6   -import com.lyms.platform.biz.service.PostReviewService;
  3 +import com.lyms.platform.biz.service.*;
7 4 import com.lyms.platform.common.constants.ErrorCodeConstants;
8 5 import com.lyms.platform.common.enums.ServiceStatusEnums;
9 6 import com.lyms.platform.common.enums.ServiceTypeEnums;
... ... @@ -24,7 +21,6 @@
24 21 import com.lyms.platform.permission.service.OrganizationService;
25 22 import com.lyms.platform.permission.service.UsersService;
26 23 import com.lyms.platform.pojo.*;
27   -import com.lyms.platform.query.AntExQuery;
28 24 import com.lyms.platform.query.MatDeliverQuery;
29 25 import com.lyms.platform.query.PostReviewQuery;
30 26 import com.lyms.platform.query.ReferralApplyOrderQuery;
... ... @@ -32,7 +28,6 @@
32 28 import org.apache.commons.lang.StringUtils;
33 29 import org.apache.commons.lang.math.NumberUtils;
34 30 import org.springframework.beans.factory.annotation.Autowired;
35   -import org.springframework.beans.factory.annotation.Value;
36 31 import org.springframework.data.domain.Sort;
37 32 import org.springframework.stereotype.Component;
38 33  
... ... @@ -40,7 +35,7 @@
40 35  
41 36 /**
42 37 * 产后复查门面
43   - * <p>
  38 + * <p/>
44 39 * Created by Administrator on 2016/6/28 0028.
45 40 */
46 41 @Component
47 42  
48 43  
49 44  
50 45  
51 46  
52 47  
53 48  
54 49  
55 50  
... ... @@ -62,40 +57,44 @@
62 57 private UsersService usersService;
63 58 @Autowired
64 59 private ApplyOrderService applyOrderService;
65   - @Value(("#{configProperties['run.region']}"))
66   - private String runType;
  60 + @Autowired
  61 + private OrganizationGroupsFacade groupsFacade;
  62 + @Autowired
  63 + private OrganizationGroupsService groupsService;
67 64  
68 65 /**
69   - *
70 66 * 增加产后复查记录
  67 + * <p/>
  68 + * 3、当前孕妇在系统中的本次妊娠期处于已分娩(孕周大于41+6孕周自动分娩、做了分娩记录、儿童建档对应的孕妇分娩),但该孕妇在本院未建档,点击查询进入新增复查界面;在保存产后复查时要自动给该产妇建档(建档的基本信息为该产妇在系统中最新的建档信息)
  69 + * <p/>
  70 + * 4、当通过产后复查给产妇建档时,如果查询到该产妇在本院有patient数据并且该patient的buildType=1,则要把该patient的buildType更新为0(防止儿童建档时产生了产妇建档数据,在添加产后复查时重复给该产妇建档)
71 71 *
72   - * 3、当前孕妇在系统中的本次妊娠期处于已分娩(孕周大于41+6孕周自动分娩、做了分娩记录、儿童建档对应的孕妇分娩),但该孕妇在本院未建档,点击查询进入新增复查界面;在保存产后复查时要自动给该产妇建档(建档的基本信息为该产妇在系统中最新的建档信息)
73   -
74   - 4、当通过产后复查给产妇建档时,如果查询到该产妇在本院有patient数据并且该patient的buildType=1,则要把该patient的buildType更新为0(防止儿童建档时产生了产妇建档数据,在添加产后复查时重复给该产妇建档)
75   -
76 72 * @param postReviewRequest
77 73 * @param userId
78 74 * @return
79 75 */
80   - public BaseResponse addPostReview(PostReviewRequest postReviewRequest,Integer userId) {
  76 + public BaseResponse addPostReview(PostReviewRequest postReviewRequest, Integer userId) {
81 77 PostReviewModel postReviewModel = postReviewRequest.convertToDataModel();
82   -
83 78 //表示区域的
84   - if (ErrorCodeConstants.RUN_MODE.equals(runType)) {
85   - String parentId = examinationFacade.handHideBuild(postReviewRequest.getPid(), postReviewRequest.getParentId(), userId);
86   - if (StringUtils.isEmpty(parentId)) {
87   - //打印日志
  79 + String hospital = autoMatchFacade.getHospitalId(userId);
  80 + String groupId=groupsFacade.findByCurrentUserId(hospital);
  81 + if(StringUtils.isNotEmpty(groupId)){
  82 + OrganizationGroups gorp= groupsService.findById(groupId);
  83 + if (gorp.getbType()!=1) {
  84 + String parentId = examinationFacade.handHideBuild(postReviewRequest.getPid(), postReviewRequest.getParentId(), userId);
  85 + if (StringUtils.isEmpty(parentId)) {
  86 + //打印日志
  87 + }
  88 + postReviewModel.setParentId(parentId);
88 89 }
89   - postReviewModel.setParentId(parentId);
90 90 }
91 91  
92 92 //获取数据
93 93 Patients patients1 = patientsService.findOnePatientById(postReviewRequest.getParentId());
94   - String hospital= autoMatchFacade.getHospitalId(userId);
95 94  
96 95 postReviewModel.setOperator(userId);
97 96 //判断是否是同一个医院
98   - if(!patients1.getHospitalId().equals(hospital)){
  97 + if (!patients1.getHospitalId().equals(hospital)) {
99 98 patients1.setId(null);
100 99 patients1.setHospitalId(hospital);
101 100 patients1.setBuildType(0);
... ... @@ -113,7 +112,7 @@
113 112 postReviewModel.setYn(YnEnums.YES.getId());
114 113 postReviewModel.setHospitalId(hospital);
115 114 Patients patients = patientsService.findOnePatientById(postReviewRequest.getParentId());
116   - if(StringUtils.isNotEmpty(postReviewRequest.getDueDate())){
  115 + if (StringUtils.isNotEmpty(postReviewRequest.getDueDate())) {
117 116 patients.setFmDate(DateUtil.parseYMD(postReviewRequest.getDueDate()));
118 117 patients.setType(3);
119 118 patients.setEnable("1");
120 119  
121 120  
... ... @@ -124,20 +123,19 @@
124 123  
125 124 postReviewService.addPostReview(postReviewModel);
126 125  
127   - if(null!=patients1.getPostViewTimes()){
128   - Patients patients2=new Patients();
129   - patients2.setPostViewTimes(patients1.getPostViewTimes()+1);
  126 + if (null != patients1.getPostViewTimes()) {
  127 + Patients patients2 = new Patients();
  128 + patients2.setPostViewTimes(patients1.getPostViewTimes() + 1);
130 129 patients2.setId(patients1.getId());
131 130 patientsService.updatePatient(patients2);
132   - }else{
133   - Patients patients2=new Patients();
  131 + } else {
  132 + Patients patients2 = new Patients();
134 133 patients2.setPostViewTimes(1);
135 134 patients2.setId(patients1.getId());
136 135 patientsService.updatePatient(patients2);
137 136 }
138 137  
139 138  
140   -
141 139 if (null != patients.getBuildType() && patients.getBuildType() == 3) {
142 140 ReferralApplyOrderQuery referralApplyOrderQuery = new ReferralApplyOrderQuery();
143 141 referralApplyOrderQuery.setParentId(patients.getId());
... ... @@ -169,7 +167,7 @@
169 167  
170 168 } else {
171 169 Patients patients = patientsService.findOnePatientById(postReviewRequest.getParentId());
172   - if(StringUtils.isNotEmpty(postReviewRequest.getDueDate())){
  170 + if (StringUtils.isNotEmpty(postReviewRequest.getDueDate())) {
173 171 patients.setFmDate(DateUtil.parseYMD(postReviewRequest.getDueDate()));
174 172 patients.setType(3);
175 173 patientsService.updatePatient(patients);
176 174  
177 175  
178 176  
179 177  
180 178  
181 179  
... ... @@ -180,41 +178,35 @@
180 178 }
181 179  
182 180 /**
183   - *
184 181 * 1、当前孕妇在系统中的本次妊娠期处于未分娩/已终止妊娠或在结束上次妊娠期后再次新增了建档,不管该孕妇在本院是否建档,点击查询时提示当前用户未分娩,不能进行复查
185   -
186   - 2、当前孕妇在系统中的本次妊娠期处于已分娩(孕周大于41+6孕周自动分娩、做了分娩记录、儿童建档对应的孕妇分娩),并且该孕妇在本院已建档,点击查询进入新增复查界面
187   -
188   - 3、当前孕妇在系统中的本次妊娠期处于已分娩(孕周大于41+6孕周自动分娩、做了分娩记录、儿童建档对应的孕妇分娩),但该孕妇在本院未建档,点击查询进入新增复查界面;在保存产后复查时要自动给该产妇建档(建档的基本信息为该产妇在系统中最新的建档信息)
189   -
190   - 4、当通过产后复查给产妇建档时,如果查询到该产妇在本院有patient数据并且该patient的buildType=1,则要把该patient的buildType更新为0(防止儿童建档时产生了产妇建档数据,在添加产后复查时重复给该产妇建档)
  182 + * <p/>
  183 + * 2、当前孕妇在系统中的本次妊娠期处于已分娩(孕周大于41+6孕周自动分娩、做了分娩记录、儿童建档对应的孕妇分娩),并且该孕妇在本院已建档,点击查询进入新增复查界面
  184 + * <p/>
  185 + * 3、当前孕妇在系统中的本次妊娠期处于已分娩(孕周大于41+6孕周自动分娩、做了分娩记录、儿童建档对应的孕妇分娩),但该孕妇在本院未建档,点击查询进入新增复查界面;在保存产后复查时要自动给该产妇建档(建档的基本信息为该产妇在系统中最新的建档信息)
  186 + * <p/>
  187 + * 4、当通过产后复查给产妇建档时,如果查询到该产妇在本院有patient数据并且该patient的buildType=1,则要把该patient的buildType更新为0(防止儿童建档时产生了产妇建档数据,在添加产后复查时重复给该产妇建档)
191 188 *
192 189 * @param postReviewQueryRequest
193 190 * @param userId
194 191 * @return
195 192 */
196   - public BaseResponse queryPostList(PostReviewQueryRequest postReviewQueryRequest,Integer userId) {
197   - Patients patients=null;
198   - if(ErrorCodeConstants.RUN_MODE.equals(runType)){
199   - patients = examinationFacade.findOnePatient(postReviewQueryRequest.getCardNo(), postReviewQueryRequest.getVcCardNo(), null, null, 1,false,null,true);
200   - }else {
201   - patients = examinationFacade.findOnePatient(postReviewQueryRequest.getCardNo(), postReviewQueryRequest.getVcCardNo(), null, null, 1,false,null,false);
202   - }
  193 + public BaseResponse queryPostList(PostReviewQueryRequest postReviewQueryRequest, Integer userId) {
  194 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  195 + Organization og = organizationService.getOrganization(Integer.valueOf(hospitalId));
  196 + Patients patients = examinationFacade.findOnePatient(postReviewQueryRequest.getCardNo(), postReviewQueryRequest.getVcCardNo(), null, null, 1, false, null, og.getbStatus() != 1);
203 197  
204 198 //未分娩建档
205 199  
206   - if(null!=patients){
  200 + if (null != patients) {
207 201 return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("该孕妇还未分娩,不能进行复查");
208 202 }
209 203  
210   -
211   -
212   - String hospitalId = autoMatchFacade.getHospitalId(userId);
213 204 //取所有医院的建档数据 优先取本院 ,然后取外院
214   - Patients patientsList = examinationFacade.findOnePatient(postReviewQueryRequest.getCardNo(), postReviewQueryRequest.getVcCardNo(), null, hospitalId, 3,true,null,true);
  205 +
  206 + Patients patientsList = examinationFacade.findOnePatient(postReviewQueryRequest.getCardNo(), postReviewQueryRequest.getVcCardNo(), null, groupsFacade.findGroupHospital(userId), 3, true, null, og.getbStatus() != 1);
215 207 PostReviewListResult postReviewListResult = new PostReviewListResult();
216 208 if (null != patientsList) {
217   - if(null!=patientsList.getDueStatus() && 1 == patientsList.getDueStatus()){
  209 + if (null != patientsList.getDueStatus() && 1 == patientsList.getDueStatus()) {
218 210 return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("该孕妇已终止妊娠,不能进行复查");
219 211 }
220 212  
221 213  
222 214  
223 215  
... ... @@ -229,22 +221,22 @@
229 221 postReviewQuery.setYn(YnEnums.YES.getId());
230 222 postReviewQuery.setStart(patientsList.getFmDate());
231 223 List<PostReviewModel> postReviewModels = postReviewService.findWithList(postReviewQuery);
232   - String dueDate="";
233   - if(CollectionUtils.isNotEmpty(list)){
234   - dueDate= list.get(0).getDueDate();
235   - }else if(patientsList.getType()==3){
236   - dueDate=DateUtil.getyyyy_MM_dd(patientsList.getFmDate());
  224 + String dueDate = "";
  225 + if (CollectionUtils.isNotEmpty(list)) {
  226 + dueDate = list.get(0).getDueDate();
  227 + } else if (patientsList.getType() == 3) {
  228 + dueDate = DateUtil.getyyyy_MM_dd(patientsList.getFmDate());
237 229 }
238   - HighScoreResult highScoreResult = examinationFacade.findLastRisk(patientsList.getPid(),false);
  230 + HighScoreResult highScoreResult = examinationFacade.findLastRisk(patientsList.getPid(), false);
239 231  
240 232 List<AntData> dataList = new ArrayList<>();
241 233 postReviewListResult.setLastBuildTime(DateUtil.getyyyy_MM_dd(patientsList.getFmDate()));
242   - if(CollectionUtils.isNotEmpty(postReviewModels)){
243   - String hospitalName="";
244   - for(PostReviewModel model:postReviewModels){
  234 + if (CollectionUtils.isNotEmpty(postReviewModels)) {
  235 + String hospitalName = "";
  236 + for (PostReviewModel model : postReviewModels) {
245 237 Organization organization = organizationService.getOrganization(NumberUtils.toInt(model.getHospitalId()));
246   - if(null!=organization){
247   - hospitalName=organization.getName();
  238 + if (null != organization) {
  239 + hospitalName = organization.getName();
248 240 }
249 241 dataList.add(new AntData(model, hospitalName, DateUtil.parseYMD(dueDate)));
250 242 }
... ... @@ -261,7 +253,6 @@
261 253 }
262 254  
263 255  
264   -
265 256 /**
266 257 * 根据id 获取产后记录
267 258 *
268 259  
... ... @@ -274,13 +265,13 @@
274 265 Assert.notNull(postReviewModel, "没有对应的数据.");
275 266 PostReviewResult postReviewResult = new PostReviewResult();
276 267 postReviewResult.convertToResult(postReviewModel);
277   - java.util.Map<String,String> map = new HashMap<>();
278   - if(NumberUtils.isNumber(postReviewModel.getProdDoctor())){
  268 + java.util.Map<String, String> map = new HashMap<>();
  269 + if (NumberUtils.isNumber(postReviewModel.getProdDoctor())) {
279 270  
280 271 Users users = usersService.getUsers(Integer.valueOf(postReviewModel.getProdDoctor()));
281   - if(null!=users){
282   - map.put("id",users.getId()+"");
283   - map.put("name",users.getName());
  272 + if (null != users) {
  273 + map.put("id", users.getId() + "");
  274 + map.put("name", users.getName());
284 275 }
285 276 }
286 277 postReviewResult.setProdDoctor(map);
287 278  
... ... @@ -289,9 +280,9 @@
289 280 postReviewResult.setHospitalName(organization.getName());
290 281 }*/
291 282 try {
292   - if(StringUtils.isNotEmpty(postReviewModel.getDiagnosis())){
  283 + if (StringUtils.isNotEmpty(postReviewModel.getDiagnosis())) {
293 284 List list = JsonUtil.toList(postReviewModel.getDiagnosis(), List.class);
294   - postReviewResult.setDiagnosis(examinationFacade.queryRisk(list,false).getHighRisk());
  285 + postReviewResult.setDiagnosis(examinationFacade.queryRisk(list, false).getHighRisk());
295 286 }
296 287 } catch (Exception e) {
297 288 }
298 289  
299 290  
... ... @@ -300,17 +291,18 @@
300 291  
301 292 /**
302 293 * 修改数据
  294 + *
303 295 * @param id
304 296 * @return
305 297 */
306   - public BaseResponse updateOnePost(String id,Integer userId){
  298 + public BaseResponse updateOnePost(String id, Integer userId) {
307 299 String hospital = autoMatchFacade.getHospitalId(userId);
308 300 PostReviewQuery antExQuery = new PostReviewQuery();
309 301 antExQuery.setId(id);
310 302 antExQuery.setYn(YnEnums.YES.getId());
311 303 antExQuery.setHospitalId(hospital);
312 304  
313   - List<PostReviewModel> list = postReviewService.findWithList(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC,"checkTime"));
  305 + List<PostReviewModel> list = postReviewService.findWithList(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "checkTime"));
314 306 //TODO 需要根据时间去查询是否是本院最后一条记录
315 307 if (CollectionUtils.isNotEmpty(list)) {
316 308 antExQuery.setStart(new Date(list.get(0).getCheckTime().getTime() + 40000));
317 309  
... ... @@ -318,17 +310,17 @@
318 310 }
319 311 antExQuery.setId(null);
320 312  
321   - list =postReviewService.findWithList(antExQuery.convertToQuery());
322   - if(CollectionUtils.isNotEmpty(list)){
323   - for(int i=0;i<list.size();i++){
324   - if(list.get(i).getId().equals(id)){
  313 + list = postReviewService.findWithList(antExQuery.convertToQuery());
  314 + if (CollectionUtils.isNotEmpty(list)) {
  315 + for (int i = 0; i < list.size(); i++) {
  316 + if (list.get(i).getId().equals(id)) {
325 317 list.remove(i);
326 318 }
327 319 }
328 320 }
329 321  
330   - if(CollectionUtils.isEmpty(list)){
331   - PostReviewModel postReviewModel=new PostReviewModel();
  322 + if (CollectionUtils.isEmpty(list)) {
  323 + PostReviewModel postReviewModel = new PostReviewModel();
332 324 postReviewModel.setYn(YnEnums.NO.getId());
333 325 postReviewModel.setId(id);
334 326 postReviewModel.setOperator(userId);
335 327  
... ... @@ -336,16 +328,16 @@
336 328  
337 329  
338 330 PostReviewModel postReviewModel1 = postReviewService.findOneById(id);
339   - if(null!=postReviewModel1){
340   - Patients patients=patientsService.findOnePatientById(postReviewModel1.getParentId());
341   - if(null!=patients){
342   - if(null!=patients.getPostViewTimes()){
343   - Patients patients2=new Patients();
344   - patients2.setPostViewTimes(patients.getPostViewTimes()+1);
  331 + if (null != postReviewModel1) {
  332 + Patients patients = patientsService.findOnePatientById(postReviewModel1.getParentId());
  333 + if (null != patients) {
  334 + if (null != patients.getPostViewTimes()) {
  335 + Patients patients2 = new Patients();
  336 + patients2.setPostViewTimes(patients.getPostViewTimes() + 1);
345 337 patients2.setId(patients.getId());
346 338 patientsService.updatePatient(patients2);
347   - }else{
348   - Patients patients2=new Patients();
  339 + } else {
  340 + Patients patients2 = new Patients();
349 341 patients2.setPostViewTimes(list.size());
350 342 patients2.setId(patients.getId());
351 343 patientsService.updatePatient(patients2);
... ... @@ -353,7 +345,7 @@
353 345 }
354 346 }
355 347 return new BaseResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS);
356   - }else{
  348 + } else {
357 349 return new BaseResponse().setErrorcode(ErrorCodeConstants.BUSINESS_ERROR).setErrormsg("当前复查记录不是本院最新的复查记录,不能删除");
358 350 }
359 351 }