Commit e0fec1549e5b5feb47867555c974af2ef3dae5e8

Authored by jiangjiazhi
1 parent 9faf4d0eaf

增加配置

Showing 19 changed files with 761 additions and 61 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java View file @ e0fec15
... ... @@ -21,7 +21,7 @@
21 21 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
22 22 ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/spring/applicationContext_biz_patient1.xml");
23 23 PuerperaService basicConfigService = (PuerperaService) applicationContext.getBean(PuerperaService.class);
24   - PuerperaModel obj = new PuerperaModel();
  24 + /* PuerperaModel obj = new PuerperaModel();
25 25 obj.setAddress("成都市高新区天府2街");
26 26 obj.setAge(111);
27 27 obj.setDueDate(new Date());
... ... @@ -30,7 +30,7 @@
30 30 obj.setPhone("13996289315");
31 31 obj.setYn(1);
32 32 obj.setCardNo("50022319951267164465");
33   -// basicConfigService.addPuerpera(obj);
  33 + basicConfigService.addPuerpera(obj);
34 34  
35 35 PuerperaModel obj1 = new PuerperaModel();
36 36 obj1.setAddress("成都市高新区天府4街");
37 37  
... ... @@ -42,15 +42,16 @@
42 42 obj1.setYn(1);
43 43 obj1.setCommunityId("dqweqwdadadaddad");
44 44 obj1.setCardNo("50022319951267164466");
45   -// basicConfigService.addPuerpera(obj1);
  45 + basicConfigService.addPuerpera(obj1);*/
46 46  
47 47 PuerperaModelQuery puerperaQuery = new PuerperaModelQuery();
48 48  
49 49 ;
50   - puerperaQuery.setKeyword("小王");
51   - puerperaQuery.setDueDateStart(sdf.parse("2016-1-12"));
52   - puerperaQuery.setDueDateEnd(sdf.parse("2016-3-16"));
53   -// System.out.println(basicConfigService.queryPuerpera(puerperaQuery));
  50 +// puerperaQuery.setKeyword("小王");
  51 +// puerperaQuery.setDueDateStart(sdf.parse("2016-1-12"));
  52 +// puerperaQuery.setDueDateEnd(sdf.parse("2016-3-16"));
  53 + puerperaQuery.setId("5719caf624fd57791341b7cb");
  54 + System.out.println(basicConfigService.queryPuerpera(puerperaQuery));
54 55 /*
55 56 * for(int i = 6;i<7;i++){ BasicConfig obj = new BasicConfig(); obj.setCode("xc123456"+i); obj.setName("哮喘123456"+i); obj.setYn(1);
56 57 * obj.setParentId("56ea134c24fdaafbabbb0025"); basicConfigService.addBasicConfig(obj); }
... ... @@ -69,7 +70,8 @@
69 70 for (PuerperaModel users2 : users) {
70 71 System.out.println(users2.toString());
71 72 }*/
72   - addDataPermission(applicationContext);
  73 +// addDataPermission(applicationContext);
  74 + addVisit(applicationContext);
73 75 }
74 76  
75 77 public static void addDataPermission(ApplicationContext applicationContext){
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientDao.java View file @ e0fec15
  1 +package com.lyms.platform.biz.dal;
  2 +
  3 +import com.lyms.platform.common.dao.operator.MongoQuery;
  4 +import com.lyms.platform.common.dao.operator.Page;
  5 +import com.lyms.platform.pojo.Patients;
  6 +import com.lyms.platform.pojo.PuerperaModel;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * Created by Administrator on 2016/4/22 0022.
  12 + */
  13 +public interface IPatientDao {
  14 + public Patients addPatient(Patients obj);
  15 +
  16 + public void updatePatient(Patients obj, String id);
  17 +
  18 + public void deletePatient(String id);
  19 +
  20 + public Patients getPatient(String id);
  21 +
  22 + public int queryPatientCount(MongoQuery query);
  23 +
  24 + public List<Patients> queryPatient(MongoQuery query);
  25 +
  26 + public Page<Patients> findPage(MongoQuery query);
  27 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientDaoImpl.java View file @ e0fec15
  1 +package com.lyms.platform.biz.dal.impl;
  2 +
  3 +import com.lyms.platform.biz.dal.IPatientDao;
  4 +import com.lyms.platform.common.dao.operator.MongoCondition;
  5 +import com.lyms.platform.common.dao.operator.MongoOper;
  6 +import com.lyms.platform.common.dao.operator.MongoQuery;
  7 +import com.lyms.platform.common.dao.operator.Page;
  8 +import com.lyms.platform.pojo.Patients;
  9 +import com.lyms.platform.common.dao.BaseMongoDAOImpl;
  10 +import org.springframework.stereotype.Repository;
  11 +
  12 +import java.util.List;
  13 +
  14 +/**
  15 + *
  16 + * 患者模型
  17 + *
  18 + *
  19 + * Created by Administrator on 2016/4/22 0022.
  20 + */
  21 +@Repository("patientDaoImpl")
  22 +public class PatientDaoImpl extends BaseMongoDAOImpl<Patients> implements IPatientDao {
  23 + @Override
  24 + public Patients addPatient(Patients obj) {
  25 + return save(obj);
  26 + }
  27 +
  28 + @Override
  29 + public void updatePatient(Patients obj, String id) {
  30 + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj);
  31 + }
  32 +
  33 + @Override
  34 + public void deletePatient(String id) {
  35 + delete(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery());
  36 + }
  37 +
  38 + @Override
  39 + public Patients getPatient(String id) {
  40 + return findById(id);
  41 + }
  42 +
  43 + @Override
  44 + public int queryPatientCount(MongoQuery query) {
  45 + return (int) count(query.convertToMongoQuery());
  46 + }
  47 +
  48 + @Override
  49 + public List<Patients> queryPatient(MongoQuery query) {
  50 + return find(query.convertToMongoQuery());
  51 + }
  52 +
  53 + @Override
  54 + public Page<Patients> findPage(MongoQuery query) {
  55 + return findPage(query.convertToMongoQuery());
  56 + }
  57 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java View file @ e0fec15
  1 +package com.lyms.platform.biz.service;
  2 +
  3 +import com.lyms.platform.biz.dal.IPatientDao;
  4 +import com.lyms.platform.common.dao.operator.MongoCondition;
  5 +import com.lyms.platform.common.dao.operator.MongoOper;
  6 +import com.lyms.platform.common.dao.operator.MongoQuery;
  7 +import com.lyms.platform.common.dao.operator.Page;
  8 +import com.lyms.platform.pojo.Patients;
  9 +import com.lyms.platform.pojo.PuerperaModel;
  10 +import com.lyms.platform.query.PatientsQuery;
  11 +import com.lyms.platform.query.PuerperaModelQuery;
  12 +import org.apache.commons.collections.CollectionUtils;
  13 +import org.apache.commons.lang.StringUtils;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.data.domain.Sort;
  16 +import org.springframework.stereotype.Service;
  17 +
  18 +import java.util.List;
  19 +
  20 +/**
  21 + * Created by Administrator on 2016/4/22 0022.
  22 + */
  23 +@Service
  24 +public class PatientsService {
  25 +
  26 + @Autowired
  27 + private IPatientDao iPatientDao;
  28 +
  29 + public Patients addPatient(Patients obj) {
  30 + return iPatientDao.addPatient(obj);
  31 + }
  32 +
  33 + public void updatePatient(Patients obj) {
  34 + iPatientDao.updatePatient(obj, obj.getId());
  35 + }
  36 +
  37 + public List<Patients> queryPatient(PatientsQuery patientsQuery) {
  38 + MongoQuery query = patientsQuery.convertToQuery();
  39 + if (StringUtils.isNotEmpty(patientsQuery.getNeed())) {
  40 + patientsQuery.mysqlBuild(iPatientDao.queryPatientCount(patientsQuery.convertToQuery()));
  41 + query.start(patientsQuery.getOffset()).end(patientsQuery.getLimit());
  42 + }
  43 +
  44 + return iPatientDao.queryPatient(query.addOrder(Sort.Direction.ASC, "id"));
  45 + }
  46 +
  47 + /**
  48 + * 根据身份证号码查询某一个患者
  49 + *
  50 + * @return
  51 + */
  52 + public Patients findOnePatientByCardNo(PatientsQuery puerperaQuery) {
  53 + List<Patients> result = iPatientDao.queryPatient(puerperaQuery.convertToQuery());
  54 + if(CollectionUtils.isEmpty(result)){
  55 + return result.get(0);
  56 + }
  57 + return null;
  58 + }
  59 +
  60 + public Patients findOnePatientById(String id) {
  61 + return iPatientDao.getPatient(id);
  62 + }
  63 +}
platform-common/src/main/java/com/lyms/platform/common/core/resolve/MessageResolver.java View file @ e0fec15
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import java.util.Properties;
4 4  
  5 +import org.apache.commons.lang.StringUtils;
5 6 import org.springframework.beans.factory.InitializingBean;
6 7 import org.springframework.core.io.ClassPathResource;
7 8 import org.springframework.core.io.support.EncodedResource;
... ... @@ -34,6 +35,9 @@
34 35 }
35 36  
36 37 public String getErrorMessage(String key) {
  38 + if(StringUtils.isEmpty(messageMapHolder.getProperty(key))){
  39 + return key;
  40 + }
37 41 return messageMapHolder.getProperty(key);
38 42 }
39 43  
platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java View file @ e0fec15
... ... @@ -2,9 +2,45 @@
2 2  
3 3 import java.util.Date;
4 4  
  5 +import com.lyms.platform.common.result.BaseModel;
5 6 import com.lyms.platform.common.utils.DateUtil;
  7 +import org.springframework.data.mongodb.core.mapping.Document;
  8 +import org.springframework.data.mongodb.core.mapping.Field;
6 9  
7   -public class Patients {
  10 +
  11 +@Document(collection="lyms_patient")
  12 +public class Patients extends BaseModel {
  13 +
  14 +
  15 + /**
  16 + * 身份证号码
  17 + */
  18 + @Field("cardno")
  19 + private String cardNo;
  20 + /**
  21 + * 助产机构
  22 + */
  23 + @Field("deliverorg")
  24 + private String deliverOrg;
  25 + /**
  26 + * 分娩方式
  27 + */
  28 + @Field("duetype")
  29 + private String dueType;
  30 +
  31 + /**
  32 + * 地址
  33 + */
  34 + private String address;
  35 + /**
  36 + * 社区id
  37 + */
  38 + private String communityId;
  39 + /**
  40 + * 是否访视
  41 + */
  42 + private int isVisit;
  43 +
8 44 private String id;
9 45  
10 46 private String username;
... ... @@ -225,6 +261,54 @@
225 261  
226 262 public void setCreated(Date created) {
227 263 this.created = created;
  264 + }
  265 +
  266 + public String getAddress() {
  267 + return address;
  268 + }
  269 +
  270 + public void setAddress(String address) {
  271 + this.address = address;
  272 + }
  273 +
  274 + public String getCardNo() {
  275 + return cardNo;
  276 + }
  277 +
  278 + public void setCardNo(String cardNo) {
  279 + this.cardNo = cardNo;
  280 + }
  281 +
  282 + public String getCommunityId() {
  283 + return communityId;
  284 + }
  285 +
  286 + public void setCommunityId(String communityId) {
  287 + this.communityId = communityId;
  288 + }
  289 +
  290 + public String getDeliverOrg() {
  291 + return deliverOrg;
  292 + }
  293 +
  294 + public void setDeliverOrg(String deliverOrg) {
  295 + this.deliverOrg = deliverOrg;
  296 + }
  297 +
  298 + public String getDueType() {
  299 + return dueType;
  300 + }
  301 +
  302 + public void setDueType(String dueType) {
  303 + this.dueType = dueType;
  304 + }
  305 +
  306 + public int getIsVisit() {
  307 + return isVisit;
  308 + }
  309 +
  310 + public void setIsVisit(int isVisit) {
  311 + this.isVisit = isVisit;
228 312 }
229 313 }
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java View file @ e0fec15
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import java.util.Date;
4 4  
  5 +import org.bson.types.ObjectId;
5 6 import org.springframework.data.mongodb.core.query.Criteria;
6 7  
7 8 import com.lyms.platform.common.base.IConvertToNativeQuery;
... ... @@ -124,7 +125,7 @@
124 125 condition = condition.and("visitstatus", visitstatus, MongoOper.IS);
125 126 }
126 127 if (null != id) {
127   - condition = condition.and("id", id, MongoOper.IS);
  128 + condition = condition.and("id", new ObjectId(id), MongoOper.IS);
128 129 }
129 130 if(-1!=yn){
130 131 condition = condition.and("yn", yn, MongoOper.IS);
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java View file @ e0fec15
  1 +package com.lyms.platform.query;
  2 +
  3 +import com.lyms.platform.common.base.IConvertToNativeQuery;
  4 +import com.lyms.platform.common.dao.BaseQuery;
  5 +import com.lyms.platform.common.dao.operator.MongoCondition;
  6 +import com.lyms.platform.common.dao.operator.MongoOper;
  7 +import com.lyms.platform.common.dao.operator.MongoQuery;
  8 +import org.bson.types.ObjectId;
  9 +import org.springframework.data.mongodb.core.query.Criteria;
  10 +
  11 +import java.util.Date;
  12 +
  13 +/**
  14 + *
  15 + * 产妇模型定义
  16 + *
  17 + * @author Administrator
  18 + *
  19 + */
  20 +public class PatientsQuery extends BaseQuery implements IConvertToNativeQuery{
  21 +
  22 + private String id;
  23 +
  24 + /**
  25 + * 关键字
  26 + */
  27 + private String keyword;
  28 +
  29 + /**
  30 + * 产妇名称
  31 + */
  32 + private String name;
  33 + /**
  34 + * 产妇年龄
  35 + */
  36 + private int age;
  37 + /**
  38 + * 访视状态
  39 + */
  40 + private int visitstatus=-1;
  41 + /**
  42 + * 产妇手机号
  43 + */
  44 + private String phone;
  45 + /**
  46 + * 产妇分娩日期
  47 + */
  48 + private Date dueDateStart;
  49 +
  50 + private Date dueDateEnd;
  51 +
  52 + /**
  53 + * 地址
  54 + */
  55 + private String address;
  56 + /**
  57 + * 社区id
  58 + */
  59 + private String communityId;
  60 +
  61 + /**
  62 + * 身份证号码
  63 + */
  64 + private String cardNo;
  65 +
  66 +
  67 + /**
  68 + * 是否有效
  69 + */
  70 + private int yn;
  71 +
  72 +
  73 + public String getCardNo() {
  74 + return cardNo;
  75 + }
  76 + public void setCardNo(String cardNo) {
  77 + this.cardNo = cardNo;
  78 + }
  79 + public int getVisitstatus() {
  80 + return visitstatus;
  81 + }
  82 + public void setVisitstatus(int visitstatus) {
  83 + this.visitstatus = visitstatus;
  84 + }
  85 + public String getKeyword() {
  86 + return keyword;
  87 + }
  88 + public void setKeyword(String keyword) {
  89 + this.keyword = keyword;
  90 + }
  91 + public Date getDueDateStart() {
  92 + return dueDateStart;
  93 + }
  94 + public void setDueDateStart(Date dueDateStart) {
  95 + this.dueDateStart = dueDateStart;
  96 + }
  97 + public Date getDueDateEnd() {
  98 + return dueDateEnd;
  99 + }
  100 + public void setDueDateEnd(Date dueDateEnd) {
  101 + this.dueDateEnd = dueDateEnd;
  102 + }
  103 +
  104 +
  105 +
  106 + public int getYn() {
  107 + return yn;
  108 + }
  109 + public void setYn(int yn) {
  110 + this.yn = yn;
  111 + }
  112 + public String getName() {
  113 + return name;
  114 + }
  115 + public void setName(String name) {
  116 + this.name = name;
  117 + }
  118 + public int getAge() {
  119 + return age;
  120 + }
  121 + public void setAge(int age) {
  122 + this.age = age;
  123 + }
  124 + public String getPhone() {
  125 + return phone;
  126 + }
  127 + public void setPhone(String phone) {
  128 + this.phone = phone;
  129 + }
  130 +
  131 + public String getAddress() {
  132 + return address;
  133 + }
  134 + public void setAddress(String address) {
  135 + this.address = address;
  136 + }
  137 + public String getCommunityId() {
  138 + return communityId;
  139 + }
  140 + public void setCommunityId(String communityId) {
  141 + this.communityId = communityId;
  142 + }
  143 + public MongoQuery convertToQuery() {
  144 + MongoCondition condition = MongoCondition.newInstance();
  145 + if(null!=keyword){
  146 + MongoCondition con1= MongoCondition.newInstance("phone", keyword, MongoOper.LIKE);
  147 + MongoCondition con = MongoCondition.newInstance("username", keyword, MongoOper.LIKE);
  148 + condition = condition.orCondition(new MongoCondition[]{con1,con});
  149 + }
  150 + if(visitstatus!=-1){
  151 + condition= condition.and("visitstatus", visitstatus, MongoOper.IS);
  152 + }
  153 + if(null!=communityId){
  154 + condition= condition.and("communityId", communityId, MongoOper.IS);
  155 + }
  156 + if(null!=id){
  157 + condition= condition.and("id", new ObjectId(id), MongoOper.IS);
  158 + }
  159 + if(null!=cardNo){
  160 + condition=condition.and("cardno", cardNo, MongoOper.IS);
  161 + }
  162 + /*if(null!=dueDateStart){
  163 +// condition= condition.elemMatch("dueDate",MongoCondition.newInstance("$lte", dueDateStart, MongoOper.IS).and("$gte", dueDateEnd, MongoOper.IS));
  164 +// condition=condition.and("dueDate", dueDateStart, MongoOper.GTE).and("dueDate", dueDateEnd, MongoOper.LTE);
  165 + Criteria c = Criteria.where("dueDate").gte(dueDateStart).lte(dueDateEnd).andOperator(condition.getCriteria());
  166 + return new MongoCondition(c).toMongoQuery();
  167 + }*/
  168 + boolean isAddStart = Boolean.FALSE;
  169 + Criteria c = null;
  170 + if (null != dueDateStart) {
  171 + c = Criteria.where("dueDate").gte(dueDateStart);
  172 + isAddStart = Boolean.TRUE;
  173 + }
  174 +
  175 + if (null != dueDateEnd) {
  176 + if (isAddStart) {
  177 + c=c.lte(dueDateEnd);
  178 + } else {
  179 + c = Criteria.where("dueDate").lte(dueDateEnd);
  180 + }
  181 + isAddStart = Boolean.TRUE;
  182 + }
  183 + if (isAddStart) {
  184 + return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery();
  185 + }
  186 +
  187 + return condition.toMongoQuery();
  188 + }
  189 + public String getId() {
  190 + return id;
  191 + }
  192 + public void setId(String id) {
  193 + this.id = id;
  194 + }
  195 +
  196 +
  197 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PuerperaManageController.java View file @ e0fec15
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import javax.validation.Valid;
4 4  
  5 +import com.lyms.platform.operate.web.facade.PatientFacade;
5 6 import com.lyms.platform.operate.web.request.PuerperaMatcherCommunityRequest;
6 7 import org.springframework.beans.factory.annotation.Autowired;
7 8 import org.springframework.stereotype.Controller;
... ... @@ -26,6 +27,8 @@
26 27  
27 28 @Autowired
28 29 private PuerperaManagerFacade puerperaManagerFacade;
  30 + @Autowired
  31 + private PatientFacade patientFacade;
29 32  
30 33 /**
31 34 * 产妇管理查询接口
32 35  
... ... @@ -36,9 +39,9 @@
36 39 @RequestMapping(value = "/puerperamanage", method = RequestMethod.GET)
37 40 @ResponseBody
38 41 public BaseListResponse queryPuerperaList(@Valid PuerperaManagerQueryRequest managerRequest) {
39   - return puerperaManagerFacade.findPuerperaList(managerRequest);
  42 + return patientFacade.findPatientList(managerRequest);
40 43 }
41   -
  44 +
42 45 /**
43 46 *
44 47 * 产妇管理删除接口
... ... @@ -51,7 +54,7 @@
51 54 @ResponseBody
52 55 public BaseResponse deleteOnePuerperaById(@RequestParam("id") String id) {
53 56 //软删除数据
54   - return puerperaManagerFacade.deleteOnePuerperaById(id, Boolean.TRUE);
  57 + return patientFacade.deleteOnePuerperaById(id, Boolean.TRUE);
55 58 }
56 59  
57 60 /**
... ... @@ -65,7 +68,7 @@
65 68 @ResponseBody
66 69 @RequestMapping(value = "/matchpuerpera", method = RequestMethod.POST)
67 70 public BaseResponse matchCommunity(@Valid PuerperaMatcherCommunityRequest puerperaMatcherCommunityRequest){
68   - return puerperaManagerFacade.matchCommunity(puerperaMatcherCommunityRequest);
  71 + return patientFacade.matchCommunity(puerperaMatcherCommunityRequest);
69 72 }
70 73 /**
71 74 * 产妇管理修改
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/VisitController.java View file @ e0fec15
... ... @@ -4,11 +4,9 @@
4 4  
5 5 import org.apache.commons.lang.StringUtils;
6 6 import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.http.MediaType;
7 8 import org.springframework.stereotype.Controller;
8   -import org.springframework.web.bind.annotation.PathVariable;
9   -import org.springframework.web.bind.annotation.RequestMapping;
10   -import org.springframework.web.bind.annotation.RequestMethod;
11   -import org.springframework.web.bind.annotation.ResponseBody;
  9 +import org.springframework.web.bind.annotation.*;
12 10  
13 11 import com.lyms.platform.common.constants.ErrorCodeConstants;
14 12 import com.lyms.platform.common.result.BaseObjectResponse;
... ... @@ -58,8 +56,8 @@
58 56 * @return 返回结果
59 57 */
60 58 @ResponseBody
61   - @RequestMapping(value = "/visitpuerpera", method = RequestMethod.POST)
62   - public BaseResponse addOneVisit(@Valid
  59 + @RequestMapping(value = "/visitpuerpera", method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE,consumes =MediaType.APPLICATION_JSON_VALUE )
  60 + public BaseResponse addOneVisit(@Valid @RequestBody
63 61 VisitAddRequest visitAddRequest) {
64 62 return visitFacade.addOneVisit(visitAddRequest);
65 63 }
... ... @@ -72,7 +70,7 @@
72 70 * @return 返回结果
73 71 */
74 72 @ResponseBody
75   - @RequestMapping(value = "/visitbaby", method = RequestMethod.POST)
  73 + @RequestMapping(value = "/visitbaby", method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE,consumes =MediaType.APPLICATION_JSON_VALUE )
76 74 public BaseResponse addOneBabyVisit(@Valid
77 75 BabyVisitAddRequest babyVisitAddRequest) {
78 76 return visitFacade.addOrUpdateBabyAndVisit(babyVisitAddRequest);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java View file @ e0fec15
... ... @@ -4,6 +4,9 @@
4 4 import java.util.HashMap;
5 5 import java.util.List;
6 6  
  7 +import com.lyms.platform.biz.service.PatientsService;
  8 +import com.lyms.platform.pojo.Patients;
  9 +import com.lyms.platform.query.PatientsQuery;
7 10 import org.apache.commons.collections.CollectionUtils;
8 11 import org.apache.commons.lang.StringUtils;
9 12 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -28,6 +31,8 @@
28 31  
29 32 @Autowired
30 33 private PuerperaService puerperaService;
  34 + @Autowired
  35 + private PatientsService patientsService;
31 36  
32 37 @Autowired
33 38 private BabyService babyService;
34 39  
35 40  
... ... @@ -52,11 +57,13 @@
52 57 if (StringUtils.isNotEmpty(babyManagerRequest.getKeyword())) {
53 58 PuerperaModelQuery puerperaQuery = new PuerperaModelQuery();
54 59 puerperaQuery.setKeyword(babyManagerRequest.getKeyword());
  60 + PatientsQuery patientsQuery = new PatientsQuery();
  61 + patientsQuery.setKeyword(babyManagerRequest.getKeyword());
55 62 // 符合关键字的产妇列表
56   - List<PuerperaModel> puerList = puerperaService.queryPuerpera(puerperaQuery);
57   -
  63 +// List<PuerperaModel> puerList = puerperaService.queryPuerpera(puerperaQuery);
  64 + List<Patients> puerList = patientsService.queryPatient(patientsQuery);
58 65 if (CollectionUtils.isNotEmpty(puerList)) {
59   - for (PuerperaModel model : puerList) {
  66 + /* for (PuerperaModel model : puerList) {
60 67 babyQuery.setParentId(model.getId());
61 68 List<BabyModel> babies = babyService.queryBabyWithQuery(babyQuery);
62 69 if (CollectionUtils.isNotEmpty(babies)) {
... ... @@ -64,6 +71,16 @@
64 71 data.add(buildResult(baby, model));
65 72 }
66 73 }
  74 + }*/
  75 +
  76 + for(Patients model : puerList) {
  77 + babyQuery.setParentId(model.getId());
  78 + List<BabyModel> babies = babyService.queryBabyWithQuery(babyQuery);
  79 + if (CollectionUtils.isNotEmpty(babies)) {
  80 + for (BabyModel baby : babies) {
  81 + data.add(buildResult(baby, model));
  82 + }
  83 + }
67 84 }
68 85 }
69 86 } else {
... ... @@ -71,7 +88,7 @@
71 88 List<BabyModel> babies = babyService.queryBabyWithQuery(babyQuery);
72 89 if (CollectionUtils.isNotEmpty(babies)) {
73 90 for (BabyModel baby : babies) {
74   - data.add(buildResult(baby, puerperaService.findOnePuerperaById(baby.getParentId())));
  91 + data.add(buildResult(baby,/* puerperaService.findOnePuerperaById(baby.getParentId())*/patientsService.findOnePatientById(baby.getParentId())));
75 92 }
76 93 }
77 94 }
... ... @@ -111,6 +128,23 @@
111 128 // 填充小孩信息
112 129 babyResult.convertToResult(baby);
113 130 babyResult.setMotherName(puerModel.getName());
  131 + babyResult.setMotherPhone(puerModel.getPhone());
  132 + // HashMap map = (HashMap)JsonUtil.str2Obj(puerModel.getAddress(), HashMap.class);
  133 + // 需要将数据库中的json结构地址解析出来
  134 + HashMap<String, String> map = new HashMap<>();
  135 + map.put("address", "测试地址");
  136 + babyResult.setAddress(map.get("address").toString());
  137 + babyResult.setParentId(puerModel.getId());
  138 + // TODO 需要根据产妇模型上的社区id获取社区信息
  139 + babyResult.setCommunity(StringUtils.isEmpty(puerModel.getCommunityId()) ? "" : puerModel.getCommunityId());
  140 + return babyResult;
  141 + }
  142 + public BabyResult buildResult(BabyModel baby, Patients puerModel) {
  143 + BabyResult babyResult = new BabyResult();
  144 +
  145 + // 填充小孩信息
  146 + babyResult.convertToResult(baby);
  147 + babyResult.setMotherName(puerModel.getUsername());
114 148 babyResult.setMotherPhone(puerModel.getPhone());
115 149 // HashMap map = (HashMap)JsonUtil.str2Obj(puerModel.getAddress(), HashMap.class);
116 150 // 需要将数据库中的json结构地址解析出来
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java View file @ e0fec15
  1 +package com.lyms.platform.operate.web.facade;
  2 +
  3 +import com.lyms.platform.biz.service.PatientsService;
  4 +import com.lyms.platform.common.constants.ErrorCodeConstants;
  5 +import com.lyms.platform.common.enums.YnEnums;
  6 +import com.lyms.platform.common.result.BaseListResponse;
  7 +import com.lyms.platform.common.result.BaseResponse;
  8 +import com.lyms.platform.common.utils.Assert;
  9 +import com.lyms.platform.operate.web.request.PuerperaManagerQueryRequest;
  10 +import com.lyms.platform.operate.web.request.PuerperaManagerUpdateRequest;
  11 +import com.lyms.platform.operate.web.request.PuerperaMatcherCommunityRequest;
  12 +import com.lyms.platform.operate.web.result.PuerperaResult;
  13 +import com.lyms.platform.pojo.Patients;
  14 +import com.lyms.platform.pojo.PuerperaModel;
  15 +import com.lyms.platform.query.PatientsQuery;
  16 +import com.lyms.platform.query.PuerperaModelQuery;
  17 +import org.apache.commons.collections.CollectionUtils;
  18 +import org.springframework.beans.factory.annotation.Autowired;
  19 +import org.springframework.stereotype.Component;
  20 +
  21 +import java.util.ArrayList;
  22 +import java.util.List;
  23 +
  24 +/**
  25 + * Created by Administrator on 2016/4/22 0022.
  26 + */
  27 +@Component
  28 +public class PatientFacade {
  29 +
  30 + @Autowired
  31 + private PatientsService patientsService;
  32 +
  33 +
  34 + /**
  35 + * 修改产妇的社区
  36 + *
  37 + * @param puerperaMatcherCommunityRequest 修改产妇社区
  38 + *
  39 + * @return
  40 + */
  41 + public BaseResponse matchCommunity(PuerperaMatcherCommunityRequest puerperaMatcherCommunityRequest){
  42 + Patients puerperaModel = patientsService.findOnePatientById(puerperaMatcherCommunityRequest.getParentId());
  43 + Assert.notNull(puerperaModel, "产妇信息不存在");
  44 + puerperaModel.setCommunityId(puerperaMatcherCommunityRequest.getCommunityId());
  45 + patientsService.updatePatient(puerperaModel);
  46 + //TODO 产妇分配了社区,需要给对应的社区提示消息
  47 + return new BaseResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS);
  48 + }
  49 +
  50 + /**
  51 + * 修改产妇信息
  52 + *
  53 + * @param managerUpdateRequest
  54 + * 产妇信息修改请求
  55 + * @return
  56 + */
  57 + public BaseResponse updateOnePuerperaData(PuerperaManagerUpdateRequest managerUpdateRequest) {
  58 +
  59 + patientsService.updatePatient(managerUpdateRequest.convertToDataModel1());
  60 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  61 + }
  62 +
  63 + /**
  64 + * 获取符合条件的产妇数据
  65 + *
  66 + * @param managerRequest
  67 + * @return
  68 + */
  69 + public BaseListResponse findPatientList(PuerperaManagerQueryRequest managerRequest) {
  70 + PatientsQuery puerperaQuery = new PatientsQuery();
  71 + puerperaQuery.setLimit(managerRequest.getLimit());
  72 + puerperaQuery.setPage(managerRequest.getPage());
  73 + puerperaQuery.setDueDateEnd(managerRequest.getDueDateEnd());
  74 + puerperaQuery.setDueDateStart(managerRequest.getDueDateStart());
  75 + puerperaQuery.setKeyword(managerRequest.getKeyword());
  76 + puerperaQuery.setCommunityId(managerRequest.getCommunityId());
  77 + puerperaQuery.setVisitstatus(managerRequest.getVisitstatus());
  78 + puerperaQuery.setYn(YnEnums.YES.getId());
  79 + // 调用service查询
  80 +
  81 + List<Patients> puerperaList = patientsService.queryPatient(puerperaQuery);
  82 + List<PuerperaResult> data = new ArrayList<PuerperaResult>();
  83 + if (CollectionUtils.isNotEmpty(puerperaList)) {
  84 +
  85 + for (Patients model : puerperaList) {
  86 + PuerperaResult result = new PuerperaResult();
  87 + data.add(result.convertToResult(model));
  88 + }
  89 + }
  90 +
  91 + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(data);
  92 + }
  93 +
  94 + /**
  95 + * 删除一条产妇数据
  96 + *
  97 + * @param id
  98 + * 产妇id
  99 + * @param softDel
  100 + * 是否是软删除 <code>true/false</code>
  101 + * @return 处理结果
  102 + */
  103 + public BaseResponse deleteOnePuerperaById(String id, boolean softDel) {
  104 + if (softDel) {
  105 + Patients obj = new Patients();
  106 + obj.setId(id);
  107 + obj.setYn(YnEnums.NO.getId());
  108 + patientsService.updatePatient(obj);
  109 + }
  110 + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  111 + }
  112 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PuerperaManagerFacade.java View file @ e0fec15
1 1 package com.lyms.platform.operate.web.facade;
2 2  
  3 +import com.lyms.platform.biz.service.PatientsService;
3 4 import com.lyms.platform.biz.service.PuerperaService;
4 5 import com.lyms.platform.common.constants.ErrorCodeConstants;
5 6 import com.lyms.platform.common.enums.YnEnums;
... ... @@ -29,6 +30,7 @@
29 30  
30 31 @Autowired
31 32 private PuerperaService puerperaService;
  33 +
32 34  
33 35 /**
34 36 * 修改产妇的社区
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/VisitFacade.java View file @ e0fec15
... ... @@ -3,15 +3,14 @@
3 3 import java.util.ArrayList;
4 4 import java.util.List;
5 5  
  6 +import com.lyms.platform.biz.service.*;
  7 +import com.lyms.platform.pojo.*;
  8 +import com.lyms.platform.query.PatientsQuery;
6 9 import org.apache.commons.collections.CollectionUtils;
7 10 import org.apache.commons.lang.StringUtils;
8 11 import org.springframework.beans.factory.annotation.Autowired;
9 12 import org.springframework.stereotype.Component;
10 13  
11   -import com.lyms.platform.biz.service.BabyService;
12   -import com.lyms.platform.biz.service.BabyVisitService;
13   -import com.lyms.platform.biz.service.PuerperaService;
14   -import com.lyms.platform.biz.service.VisitService;
15 14 import com.lyms.platform.common.constants.ErrorCodeConstants;
16 15 import com.lyms.platform.common.enums.YnEnums;
17 16 import com.lyms.platform.common.result.BaseObjectResponse;
... ... @@ -23,10 +22,6 @@
23 22 import com.lyms.platform.operate.web.result.BabyVisitResult.BabyVisit;
24 23 import com.lyms.platform.operate.web.result.SimpleVisit;
25 24 import com.lyms.platform.operate.web.result.VisitResult;
26   -import com.lyms.platform.pojo.BabyModel;
27   -import com.lyms.platform.pojo.BabyVisitModel;
28   -import com.lyms.platform.pojo.PuerperaModel;
29   -import com.lyms.platform.pojo.VisitModel;
30 25 import com.lyms.platform.query.BabyModelQuery;
31 26 import com.lyms.platform.query.PuerperaModelQuery;
32 27 import com.lyms.platform.query.VisitQuery;
... ... @@ -50,6 +45,8 @@
50 45  
51 46 @Autowired
52 47 private BabyService babyService;
  48 + @Autowired
  49 + private PatientsService patientsService;
53 50  
54 51 /**
55 52 * 根据产妇id获取产妇的访视信息
... ... @@ -58,7 +55,7 @@
58 55 * @return
59 56 */
60 57 public BaseObjectResponse findOneById(String id) {
61   - return doBiz(puerperaService.findOnePuerperaById(id));
  58 + return doBiz(patientsService.findOnePatientById(id));
62 59 }
63 60  
64 61 /**
... ... @@ -69,7 +66,7 @@
69 66 * @return
70 67 */
71 68 public BaseObjectResponse findOneByCardNo(String cardNo) {
72   - PuerperaModel puerperaModel= findOnePuerperaByCardNo(cardNo);
  69 + Patients puerperaModel= findOnePuerperaByCardNo(cardNo);
73 70 if (null == puerperaModel) {
74 71 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.DEPT_NOT_EXISTS).setErrormsg("产妇信息不存在");
75 72 }
76 73  
... ... @@ -82,10 +79,10 @@
82 79 * @param puerperaModel
83 80 * @return
84 81 */
85   - private BaseObjectResponse doBiz(PuerperaModel puerperaModel) {
  82 + private BaseObjectResponse doBiz(Patients puerperaModel) {
86 83 VisitResult data = new VisitResult();
87 84 if (null != puerperaModel) {
88   - data.convertToResult(puerperaModel);
  85 + data.convertToResult1(puerperaModel);
89 86 VisitQuery visitQuery = new VisitQuery();
90 87 visitQuery.setParentId(puerperaModel.getId());
91 88 List<VisitModel> visits = visitService.queryVisit(visitQuery);
92 89  
... ... @@ -109,12 +106,12 @@
109 106 * 身份证号码
110 107 * @return 产妇信息
111 108 */
112   - private PuerperaModel findOnePuerperaByCardNo(String cardNo) {
113   - PuerperaModelQuery query = new PuerperaModelQuery();
  109 + private Patients findOnePuerperaByCardNo(String cardNo) {
  110 + PatientsQuery query = new PatientsQuery();
114 111 query.setCardNo(cardNo);
115 112 query.setYn(YnEnums.YES.getId());
116 113 // 根据身份证号找到产妇信息
117   - return puerperaService.findOnePuerperaByCardNo(query);
  114 + return patientsService.findOnePatientByCardNo(query);
118 115 }
119 116  
120 117 /**
121 118  
122 119  
123 120  
124 121  
... ... @@ -128,25 +125,30 @@
128 125 // 获取患者id
129 126 String parentId = visitRequest.getParentId();
130 127 if (StringUtils.isNotEmpty(parentId)) {
131   - PuerperaModelQuery puerperaQuery = new PuerperaModelQuery();
  128 + /* PuerperaModelQuery puerperaQuery = new PuerperaModelQuery();
132 129 puerperaQuery.setId(parentId);
133   - PuerperaModel model;
134   - List<PuerperaModel> puerList = puerperaService.queryPuerpera(puerperaQuery);
  130 + PuerperaModel model;*/
  131 + Patients model;
  132 + PatientsQuery patientsQuery = new PatientsQuery();
  133 + patientsQuery.setId(parentId);
  134 + List<Patients> puerList = patientsService.queryPatient(patientsQuery);
135 135 if (CollectionUtils.isNotEmpty(puerList)) {
136 136 model = puerList.get(0);
137 137 SimpleVisitPuerpera destModel = visitRequest.getPuerpera();
138 138 SimpleVisitPuerpera srcModel = visitRequest.new SimpleVisitPuerpera(model);
139 139 // 和数据库里面的对象比较如果不等就表示有修改需存入到数据库中
140 140 if (!destModel.equals(srcModel)) {
141   - puerperaService.updatePuerpera(visitRequest.getPuerpera().build());
  141 + patientsService.updatePatient(visitRequest.getPatients()/*.build()*/);
142 142 }
143 143 } else {
144 144 return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("产妇信息不存在");
145 145 }
146 146 } else {
147 147 // 表示是新的产妇直接新增
148   - parentId = puerperaService.addPuerpera(visitRequest.getPuerpera().build()).getId();
  148 +// parentId = puerperaService.addPuerpera(visitRequest.getPuerpera().build()).getId();
  149 + parentId =patientsService.addPatient(visitRequest.getPatients()).getId();
149 150 }
  151 +
150 152 // 如果为空表示新增
151 153 if (StringUtils.isEmpty(visitRequest.getRequestVisit().getId())) {
152 154 if (StringUtils.isNotEmpty(parentId)) {
153 155  
... ... @@ -191,14 +193,14 @@
191 193 */
192 194 public BaseObjectResponse findBabyVisitByMotherCardNo(String cardNo) {
193 195 // 根据身份证号获取到产妇信息
194   - PuerperaModel puerperaModel = findOnePuerperaByCardNo(cardNo);
  196 + Patients puerperaModel = findOnePuerperaByCardNo(cardNo);
195 197 if (null == puerperaModel) {
196 198 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.DEPT_NOT_EXISTS).setErrormsg("产妇信息不存在");
197 199 }
198 200 return findBabyVisit(puerperaModel);
199 201 }
200 202  
201   - private BaseObjectResponse findBabyVisit(PuerperaModel puerperaModel) {
  203 + private BaseObjectResponse findBabyVisit(Patients puerperaModel) {
202 204 BabyModelQuery babyQuery = new BabyModelQuery();
203 205 babyQuery.setParentId(puerperaModel.getId());
204 206 babyQuery.setYn(YnEnums.YES.getId());
... ... @@ -220,7 +222,7 @@
220 222  
221 223 // TODO 需要转换成具体的result对象
222 224 // 设置产妇的信息
223   - babyVisitResult.convertToResult(puerperaModel);
  225 + babyVisitResult.convertToResult1(puerperaModel);
224 226 babyVisitResult.setData(data);
225 227 return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(babyVisitResult);
226 228 }
... ... @@ -236,7 +238,7 @@
236 238 if (null == babyModel) {
237 239 return new BaseObjectResponse().setErrormsg("找不到相关的新生儿数据");
238 240 }
239   - PuerperaModel model = puerperaService.findOnePuerperaById(babyModel.getParentId());
  241 + Patients model = patientsService.findOnePatientById(babyModel.getParentId());
240 242 return findBabyVisit(model);
241 243 }
242 244 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/PuerperaManagerUpdateRequest.java View file @ e0fec15
... ... @@ -6,6 +6,7 @@
6 6 import com.lyms.platform.common.core.annotation.form.FormParam;
7 7 import com.lyms.platform.common.utils.DateUtil;
8 8 import com.lyms.platform.common.utils.JsonUtil;
  9 +import com.lyms.platform.pojo.Patients;
9 10 import com.lyms.platform.pojo.PuerperaModel;
10 11 import com.lyms.platform.pojo.VisitModel;
11 12  
... ... @@ -368,6 +369,18 @@
368 369 model.setDeliverOrg(deliverOrg);
369 370 model.setDueType(dueType);
370 371 model.setName(name);
  372 + model.setDueDate(DateUtil.parseYMD(dueDate));
  373 + model.setAddress(JsonUtil.obj2JsonString(address));
  374 + return model;
  375 + }
  376 +
  377 + public Patients convertToDataModel1() {
  378 + Patients model = new Patients();
  379 + model.setAge(age);
  380 + model.setCardNo(cardNo);
  381 + model.setDeliverOrg(deliverOrg);
  382 + model.setDueType(dueType);
  383 + model.setUsername(name);
371 384 model.setDueDate(DateUtil.parseYMD(dueDate));
372 385 model.setAddress(JsonUtil.obj2JsonString(address));
373 386 return model;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/VisitAddRequest.java View file @ e0fec15
1 1 package com.lyms.platform.operate.web.request;
2 2  
3 3 import java.util.Date;
  4 +import java.util.Map;
4 5  
5 6 import javax.validation.constraints.Max;
6 7 import javax.validation.constraints.Min;
7 8 import javax.validation.constraints.NotNull;
8 9  
  10 +import com.lyms.platform.pojo.Patients;
9 11 import org.hibernate.validator.constraints.NotEmpty;
10 12  
11 13 import com.lyms.platform.common.core.annotation.form.Form;
12 14  
... ... @@ -20,13 +22,14 @@
20 22 *
21 23 * @author Administrator
22 24 */
23   -@Form
  25 +//@Form
24 26 public class VisitAddRequest {
25 27  
26 28 // 产妇基本信息 start
27 29 /**
28 30 * 产妇id
29 31 */
  32 + @NotEmpty(message = "产妇id不能为空")
30 33 private String parentId;
31 34  
32 35 /**
33 36  
... ... @@ -38,16 +41,16 @@
38 41 /**
39 42 * 产妇年龄
40 43 */
41   - @NotNull(message = "page.limit.must.not.null")
42   - @Min(value = 1, message = "page.min")
43   - @Max(value = 40, message = "page.max")
  44 + @NotNull(message = "年龄不能为空")
  45 + @Min(value = 1, message = "年龄不能小于1")
  46 + @Max(value = 50, message = "年龄不能大于50")
44 47 private int age;
45 48  
46 49 /**
47 50 * 产妇身份证号码
48 51 */
49 52 @FormParam("cardno")
50   - @NotEmpty(message = "产妇名称不能为空")
  53 + @NotEmpty(message = "产妇身份证不能为空")
51 54 private String cardNo;
52 55  
53 56 /**
... ... @@ -71,7 +74,7 @@
71 74 /**
72 75 * 地址
73 76 */
74   - private String address;
  77 + private Map address;
75 78  
76 79 // 产妇基本信息 end
77 80 /**
78 81  
79 82  
... ... @@ -149,19 +152,19 @@
149 152 /**
150 153 * 指导
151 154 */
152   - private String guide;
  155 + private Map guide;
153 156  
154 157 /**
155 158 * 血压
156 159 */
157 160 // private Bp bp;
158   - private String bp;
  161 + private Map bp;
159 162  
160 163 /**
161 164 * 转诊
162 165 */
163 166 // private Referral referral;
164   - private String referral;
  167 + private Map referral;
165 168  
166 169 /**
167 170 * 类型
168 171  
169 172  
... ... @@ -221,14 +224,22 @@
221 224 this.deliverOrg = deliverOrg;
222 225 }
223 226  
224   - public String getAddress() {
  227 +/* public String getAddress() {
225 228 return address;
226 229 }
227 230  
228 231 public void setAddress(String address) {
229 232 this.address = address;
  233 + }*/
  234 +
  235 + public Map getAddress() {
  236 + return address;
230 237 }
231 238  
  239 + public void setAddress(Map address) {
  240 + this.address = address;
  241 + }
  242 +
232 243 public String getNumOfLive() {
233 244 return numOfLive;
234 245 }
235 246  
... ... @@ -349,10 +360,34 @@
349 360 this.other = other;
350 361 }
351 362  
352   - public String getGuide() {
  363 + public Map getBp() {
  364 + return bp;
  365 + }
  366 +
  367 + public void setBp(Map bp) {
  368 + this.bp = bp;
  369 + }
  370 +
  371 + public Map getGuide() {
353 372 return guide;
354 373 }
355 374  
  375 + public void setGuide(Map guide) {
  376 + this.guide = guide;
  377 + }
  378 +
  379 + public Map getReferral() {
  380 + return referral;
  381 + }
  382 +
  383 + public void setReferral(Map referral) {
  384 + this.referral = referral;
  385 + }
  386 +
  387 + /* public String getGuide() {
  388 + return guide;
  389 + }
  390 +
356 391 public void setGuide(String guide) {
357 392 this.guide = guide;
358 393 }
359 394  
... ... @@ -369,9 +404,10 @@
369 404 return referral;
370 405 }
371 406  
  407 +
372 408 public void setReferral(String referral) {
373 409 this.referral = referral;
374   - }
  410 + }*/
375 411  
376 412 public String getType() {
377 413 return type;
... ... @@ -402,6 +438,18 @@
402 438 puerperaModel.setAddress(JsonUtil.obj2JsonString(address));
403 439 return puerperaModel;
404 440 }
  441 + public Patients getPatients(){
  442 + Patients patients = new Patients();
  443 + patients.setId(parentId);
  444 + patients.setUsername(name);
  445 + patients.setAge(age);
  446 + patients.setCardNo(cardNo);
  447 + patients.setDueDate(new Date());
  448 + patients.setDeliverOrg(deliverOrg);
  449 + patients.setDueType(dueType);
  450 + patients.setAddress(JsonUtil.obj2JsonString(address));
  451 + return patients;
  452 + }
405 453  
406 454 public VisitModel getRequestVisit() {
407 455 VisitModel visit = new VisitModel();
... ... @@ -475,6 +523,16 @@
475 523 dueType = model.getDueType();
476 524 address = model.getAddress();
477 525 }
  526 + public SimpleVisitPuerpera(Patients model) {
  527 + id = model.getId();
  528 + name = model.getUsername();
  529 + age = model.getAge();
  530 + cardno = model.getCardNo();
  531 + dueDate = DateUtil.getyyyy_MM_dd(model.getDueDate());
  532 + deliverOrg = model.getDeliverOrg();
  533 + dueType = model.getDueType();
  534 + address = model.getAddress();
  535 + }
478 536  
479 537 public String getId() {
480 538 return id;
... ... @@ -621,6 +679,14 @@
621 679 model.setId("11");
622 680 model.setName("查房1");
623 681 System.out.println(puerpera.equals(new VisitAddRequest().new SimpleVisitPuerpera(model)));
  682 +
  683 + VisitAddRequest visitAddRequest = new VisitAddRequest();
  684 +// visitAddRequest.setAddress("测试");
  685 + visitAddRequest.setAge(1);
  686 +// visitAddRequest.setBp("{}");
  687 + visitAddRequest.setCardNo("454646465456465456");
  688 + visitAddRequest.setBreast("fafffaffaffa");
  689 + System.out.print(JsonUtil.obj2JsonString(visitAddRequest));
624 690 }
625 691 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyVisitResult.java View file @ e0fec15
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import java.util.List;
4 4  
  5 +import com.lyms.platform.pojo.Patients;
5 6 import org.springframework.data.annotation.Id;
6 7  
7 8 import com.lyms.platform.common.base.IBasicResultConvert;
... ... @@ -760,6 +761,13 @@
760 761 setmCardNo(destModel.getCardNo());
761 762 setmName(destModel.getName());
762 763  
  764 + return this;
  765 + }
  766 + public BabyVisitResult convertToResult1(Patients destModel) {
  767 + setAge(destModel.getAge());
  768 + setmCardNo(destModel.getCardNo());
  769 + setmName(destModel.getUsername());
  770 +
763 771 return this;
764 772 }
765 773 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PuerperaResult.java View file @ e0fec15
1 1 package com.lyms.platform.operate.web.result;
2 2  
  3 +import com.lyms.platform.pojo.Patients;
3 4 import org.apache.commons.lang.StringUtils;
4 5  
5 6 import com.lyms.platform.common.utils.DateUtil;
... ... @@ -110,6 +111,19 @@
110 111 setPhone(model.getPhone());
111 112 setAge(model.getAge());
112 113 setName(model.getName());
  114 + setVisitStatus(model.getIsVisit());
  115 + return this;
  116 + }
  117 +
  118 + public PuerperaResult convertToResult(Patients model) {
  119 + setAddress(model.getAddress());
  120 + setId(model.getId());
  121 + setDueDate(DateUtil.getyyyy_MM_dd(model.getDueDate()));
  122 + setVisit(model.getIsVisit() == 0 ? "未访视" : "已访视");
  123 + setCommunity(StringUtils.isEmpty(model.getCommunityId()) ? "未分配" : model.getCommunityId());
  124 + setPhone(model.getPhone());
  125 + setAge(model.getAge());
  126 + setName(model.getUsername());
113 127 setVisitStatus(model.getIsVisit());
114 128 return this;
115 129 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/VisitResult.java View file @ e0fec15
... ... @@ -5,6 +5,7 @@
5 5  
6 6 import com.lyms.platform.common.utils.DateUtil;
7 7 import com.lyms.platform.common.utils.JsonUtil;
  8 +import com.lyms.platform.pojo.Patients;
8 9 import com.lyms.platform.pojo.PuerperaModel;
9 10  
10 11 @SuppressWarnings("rawtypes")
... ... @@ -100,6 +101,18 @@
100 101 setDueDate(DateUtil.getyyyy_MM_dd(model.getDueDate()));
101 102 setDueType(model.getDueType());
102 103 setName(model.getName());
  104 + }
  105 + public void convertToResult1(Patients model) {
  106 + try {
  107 + setAddress(JsonUtil.str2Obj(model.getAddress(), Map.class));
  108 + } catch (Exception e) {
  109 + }
  110 + setAge(model.getAge());
  111 + setCardNo(model.getCardNo());
  112 + setDeliverOrg(model.getDeliverOrg());
  113 + setDueDate(DateUtil.getyyyy_MM_dd(model.getDueDate()));
  114 + setDueType(model.getDueType());
  115 + setName(model.getUsername());
103 116 }
104 117 }