Commit 9eb5fb808300f55ea7b88157abbb93feb99e32d8
Exists in
master
and in
7 other branches
Merge remote-tracking branch 'origin/master'
Showing 18 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/PatientCheckTicketDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/PatientTicketIdDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientCheckTicketDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientTicketIdDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AutoIncermentService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientCheckTicketService.java
- platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java
- platform-dal/src/main/java/com/lyms/platform/pojo/PatientCheckTicket.java
- platform-dal/src/main/java/com/lyms/platform/pojo/PatientTicketId.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientCheckTicketQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PregnantBuildController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/FolicAcidFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PremaritalCheckupFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/GrowthCountTask.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
View file @
9eb5fb8
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | import java.util.*; |
| 7 | 7 | import java.util.Date; |
| 8 | 8 | |
| 9 | +import com.lyms.platform.biz.dal.PatientTicketIdDao; | |
| 9 | 10 | import com.lyms.platform.biz.dal.impl.YunBookbuildingDaoImpl; |
| 10 | 11 | import com.lyms.platform.biz.param.AssayConfigQuery; |
| 11 | 12 | import com.lyms.platform.biz.service.*; |
| ... | ... | @@ -45,7 +46,19 @@ |
| 45 | 46 | // queryRisk(applicationContext); |
| 46 | 47 | // changeLong2Time(applicationContext); |
| 47 | 48 | |
| 48 | - buildOrgGroup(applicationContext); | |
| 49 | + findandmodify(applicationContext); | |
| 50 | + } | |
| 51 | + | |
| 52 | + public static void findandmodify(ApplicationContext applicationContext) { | |
| 53 | + MongoTemplate mongoTemplate | |
| 54 | + =(MongoTemplate)applicationContext.getBean("mongoTemplate"); | |
| 55 | + mongoTemplate.getDb().slaveOk(); | |
| 56 | + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray()); | |
| 57 | + PatientTicketIdDao patientTicketIdDao = (PatientTicketIdDao)applicationContext.getBean("patientTicketIdDao"); | |
| 58 | + System.out.println(patientTicketIdDao.nextId(BasicConfigServiceTest.class.getSimpleName())); | |
| 59 | + System.out.println(patientTicketIdDao.nextId(BasicConfigServiceTest.class.getSimpleName())); | |
| 60 | + System.out.println(patientTicketIdDao.nextId(BasicConfigServiceTest.class.getSimpleName())); | |
| 61 | + System.out.println(patientTicketIdDao.nextId(BasicConfigServiceTest.class.getSimpleName())); | |
| 49 | 62 | } |
| 50 | 63 | |
| 51 | 64 |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/PatientCheckTicketDao.java
View file @
9eb5fb8
| 1 | +package com.lyms.platform.biz.dal; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 4 | +import com.lyms.platform.pojo.PatientCheckTicket; | |
| 5 | + | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Created by riecard on 2016/12/28. | |
| 10 | + */ | |
| 11 | +public interface PatientCheckTicketDao { | |
| 12 | + | |
| 13 | + public PatientCheckTicket addTicket(PatientCheckTicket obj); | |
| 14 | + | |
| 15 | + public void updateTicket(PatientCheckTicket obj); | |
| 16 | + | |
| 17 | + public PatientCheckTicket getTicket(String id); | |
| 18 | + | |
| 19 | + public int queryTicketCount(MongoQuery query); | |
| 20 | + | |
| 21 | + public List<PatientCheckTicket> queryTicket(MongoQuery query); | |
| 22 | + | |
| 23 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/PatientTicketIdDao.java
View file @
9eb5fb8
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientCheckTicketDaoImpl.java
View file @
9eb5fb8
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.PatientCheckTicketDao; | |
| 4 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
| 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 com.lyms.platform.pojo.PatientCheckTicket; | |
| 9 | +import org.springframework.stereotype.Repository; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * Created by riecard on 2016/12/28. | |
| 15 | + */ | |
| 16 | +@Repository("patientCheckTicketDao") | |
| 17 | +public class PatientCheckTicketDaoImpl extends BaseMongoDAOImpl<PatientCheckTicket> implements PatientCheckTicketDao { | |
| 18 | + @Override | |
| 19 | + public PatientCheckTicket addTicket(PatientCheckTicket obj) { | |
| 20 | + return save(obj); | |
| 21 | + } | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + public void updateTicket(PatientCheckTicket obj) { | |
| 25 | + update(new MongoQuery(new MongoCondition("id", obj.getId(), MongoOper.IS)).convertToMongoQuery(), obj);; | |
| 26 | + } | |
| 27 | + | |
| 28 | + @Override | |
| 29 | + public PatientCheckTicket getTicket(String id) { | |
| 30 | + return findById(id); | |
| 31 | + } | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public int queryTicketCount(MongoQuery query) { | |
| 35 | + return (int)count(query.convertToMongoQuery()); | |
| 36 | + } | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public List<PatientCheckTicket> queryTicket(MongoQuery query) { | |
| 40 | + return find(query.convertToMongoQuery()); | |
| 41 | + } | |
| 42 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientTicketIdDaoImpl.java
View file @
9eb5fb8
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.PatientTicketIdDao; | |
| 4 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
| 5 | +import com.lyms.platform.pojo.PatientTicketId; | |
| 6 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 7 | +import org.springframework.data.mongodb.core.query.Query; | |
| 8 | +import org.springframework.stereotype.Repository; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * Created by riecard on 2016/12/28. | |
| 12 | + */ | |
| 13 | +@Repository("patientTicketIdDao") | |
| 14 | +public class PatientTicketIdDaoImpl extends BaseMongoDAOImpl<PatientTicketId> implements PatientTicketIdDao { | |
| 15 | + | |
| 16 | + @Override | |
| 17 | + public Integer nextId(String tableName) { | |
| 18 | + Integer id = 0; | |
| 19 | + PatientTicketId ticketId = findById(tableName); | |
| 20 | + if (ticketId == null) { | |
| 21 | + ticketId = new PatientTicketId(); | |
| 22 | + ticketId.setId(tableName); | |
| 23 | + ticketId.setTicketId(1); | |
| 24 | + save(ticketId); | |
| 25 | + id = 1; | |
| 26 | + } else { | |
| 27 | + id = ticketId.getTicketId() + 1; | |
| 28 | + ticketId.setTicketId(id); | |
| 29 | + update(new Query(Criteria.where("id").is(tableName)),ticketId); | |
| 30 | + } | |
| 31 | + return id; | |
| 32 | + } | |
| 33 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AutoIncermentService.java
View file @
9eb5fb8
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.PatientTicketIdDao; | |
| 4 | +import com.lyms.platform.common.result.BaseModel; | |
| 5 | +import com.lyms.platform.pojo.Patients; | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Created by riecard on 2016/12/28. | |
| 11 | + */ | |
| 12 | +@Service("autoIncermentService") | |
| 13 | +public class AutoIncermentService { | |
| 14 | + | |
| 15 | + @Autowired | |
| 16 | + private PatientTicketIdDao patientTicketIdDao; | |
| 17 | + | |
| 18 | + public Integer nextId(Class cls) { | |
| 19 | + return patientTicketIdDao.nextId(cls.getSimpleName()); | |
| 20 | + } | |
| 21 | + | |
| 22 | + public String nextPatientTicketId() { | |
| 23 | + Integer id = patientTicketIdDao.nextId(Patients.class.getSimpleName()); | |
| 24 | + return String.format("%08d", id); | |
| 25 | + } | |
| 26 | + | |
| 27 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientCheckTicketService.java
View file @
9eb5fb8
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.PatientCheckTicketDao; | |
| 4 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 5 | +import com.lyms.platform.pojo.PatientCheckTicket; | |
| 6 | +import com.lyms.platform.query.PatientCheckTicketQuery; | |
| 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 | + * Created by riecard on 2016/12/28. | |
| 17 | + */ | |
| 18 | +@Service | |
| 19 | +public class PatientCheckTicketService { | |
| 20 | + | |
| 21 | + @Autowired | |
| 22 | + private PatientCheckTicketDao patientCheckTicketDao; | |
| 23 | + | |
| 24 | + public PatientCheckTicket addTicket(PatientCheckTicket obj) { | |
| 25 | + return patientCheckTicketDao.addTicket(obj); | |
| 26 | + } | |
| 27 | + | |
| 28 | + public void updateTicket(PatientCheckTicket obj) { | |
| 29 | + patientCheckTicketDao.updateTicket(obj);; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public String updateTicket(String id, Integer status, String cousumeHospitalId) { | |
| 33 | + PatientCheckTicket ticket = getTicket(id); | |
| 34 | + if (ticket == null) { | |
| 35 | + return "免费产检券不存在"; | |
| 36 | + } else if (ticket.getStatus() != 1) { | |
| 37 | + return "免费产检券已被使用了"; | |
| 38 | + } | |
| 39 | + ticket.setStatus(status); | |
| 40 | + ticket.setConsumeHospitalId(cousumeHospitalId); | |
| 41 | + ticket.setConsumeDate(new Date()); | |
| 42 | + updateTicket(ticket); | |
| 43 | + return null; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public PatientCheckTicket getTicket(String id) { | |
| 47 | + return patientCheckTicketDao.getTicket(id); | |
| 48 | + } | |
| 49 | + | |
| 50 | + public int queryTicketCount(PatientCheckTicketQuery query) { | |
| 51 | + return patientCheckTicketDao.queryTicketCount(query.convertToQuery()); | |
| 52 | + } | |
| 53 | + | |
| 54 | + public List<PatientCheckTicket> queryTicket(PatientCheckTicketQuery ticketQuery) { | |
| 55 | + MongoQuery query = ticketQuery.convertToQuery(); | |
| 56 | + if (StringUtils.isNotEmpty(ticketQuery.getNeed())) { | |
| 57 | + ticketQuery.mysqlBuild(patientCheckTicketDao.queryTicketCount(query)); | |
| 58 | + query.start(ticketQuery.getOffset()).end(ticketQuery.getLimit()); | |
| 59 | + } | |
| 60 | + if(!StringUtils.isEmpty(ticketQuery.getSort())){ | |
| 61 | + return patientCheckTicketDao.queryTicket(query.addOrder(Sort.Direction.ASC, ticketQuery.getSort())); | |
| 62 | + } | |
| 63 | + return patientCheckTicketDao.queryTicket(query.addOrder(Sort.Direction.DESC, "id")); | |
| 64 | + } | |
| 65 | + | |
| 66 | + public List<PatientCheckTicket> queryTicket(String patientId, String hospitalId,String consumeHospitalId,Integer status) { | |
| 67 | + PatientCheckTicketQuery query = new PatientCheckTicketQuery(); | |
| 68 | + query.setNeed(null); | |
| 69 | + query.setPatientId(patientId); | |
| 70 | + query.setHospitalId(hospitalId); | |
| 71 | + query.setConsumeHospitalId(consumeHospitalId); | |
| 72 | + query.setStatus(status); | |
| 73 | + return patientCheckTicketDao.queryTicket(query.convertToQuery().addOrder(Sort.Direction.DESC, "id")); | |
| 74 | + } | |
| 75 | + | |
| 76 | +} |
platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java
View file @
9eb5fb8
| ... | ... | @@ -46,6 +46,8 @@ |
| 46 | 46 | SmsTemplateModel("SmsTemplateModel", 97531000410L), |
| 47 | 47 | StopPregModel("StopPregModel", 97531000420L), |
| 48 | 48 | VisitModel("VisitModel", 97531000430L), |
| 49 | + PatientTicketId("PatientTicketId", 97531000440L), | |
| 50 | + PatientCheckTicket("PatientCheckTicket", 97531000450L), | |
| 49 | 51 | last("last", 97531009990L); |
| 50 | 52 | private String cname; |
| 51 | 53 | private Long cid; |
platform-dal/src/main/java/com/lyms/platform/pojo/PatientCheckTicket.java
View file @
9eb5fb8
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import com.lyms.platform.beans.SerialIdEnum; | |
| 4 | +import com.lyms.platform.common.result.BaseModel; | |
| 5 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 6 | + | |
| 7 | +import java.util.Date; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Created by riecard on 2016/12/28. | |
| 11 | + */ | |
| 12 | +@Document(collection="lyms_patient_check_ticket") | |
| 13 | +public class PatientCheckTicket extends BaseModel { | |
| 14 | + | |
| 15 | + private static final long serialVersionUID = SerialIdEnum.PatientCheckTicket.getCid(); | |
| 16 | + | |
| 17 | + private String id; | |
| 18 | + private String patientId; | |
| 19 | + private String hospitalId; | |
| 20 | + private String consumeHospitalId; | |
| 21 | + private Integer status; // 1:创建未使用, 2:产检使用,3:分娩销毁 | |
| 22 | + private Date created; | |
| 23 | + private Date consumeDate; | |
| 24 | + | |
| 25 | + public String getId() { | |
| 26 | + return id; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public void setId(String id) { | |
| 30 | + this.id = id; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public String getPatientId() { | |
| 34 | + return patientId; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setPatientId(String patientId) { | |
| 38 | + this.patientId = patientId; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public String getHospitalId() { | |
| 42 | + return hospitalId; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setHospitalId(String hospitalId) { | |
| 46 | + this.hospitalId = hospitalId; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public String getConsumeHospitalId() { | |
| 50 | + return consumeHospitalId; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setConsumeHospitalId(String consumeHospitalId) { | |
| 54 | + this.consumeHospitalId = consumeHospitalId; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public Integer getStatus() { | |
| 58 | + return status; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setStatus(Integer status) { | |
| 62 | + this.status = status; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public Date getCreated() { | |
| 66 | + return created; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setCreated(Date created) { | |
| 70 | + this.created = created; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public Date getConsumeDate() { | |
| 74 | + return consumeDate; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void setConsumeDate(Date consumeDate) { | |
| 78 | + this.consumeDate = consumeDate; | |
| 79 | + } | |
| 80 | +} |
platform-dal/src/main/java/com/lyms/platform/pojo/PatientTicketId.java
View file @
9eb5fb8
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import com.lyms.platform.beans.SerialIdEnum; | |
| 4 | +import com.lyms.platform.common.result.BaseModel; | |
| 5 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Created by riecard on 2016/12/28. | |
| 9 | + */ | |
| 10 | +@Document(collection="lyms_patient_ticket_id") | |
| 11 | +public class PatientTicketId extends BaseModel { | |
| 12 | + | |
| 13 | + private static final long serialVersionUID = SerialIdEnum.PatientTicketId.getCid(); | |
| 14 | + | |
| 15 | + private String id; | |
| 16 | + private Integer ticketId; | |
| 17 | + | |
| 18 | + public String getId() { | |
| 19 | + return id; | |
| 20 | + } | |
| 21 | + | |
| 22 | + public void setId(String id) { | |
| 23 | + this.id = id; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public Integer getTicketId() { | |
| 27 | + return ticketId; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public void setTicketId(Integer ticketId) { | |
| 31 | + this.ticketId = ticketId; | |
| 32 | + } | |
| 33 | +} |
platform-dal/src/main/java/com/lyms/platform/query/PatientCheckTicketQuery.java
View file @
9eb5fb8
| 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 com.lyms.platform.common.utils.StringUtils; | |
| 9 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * Created by riecard on 2016/12/28. | |
| 13 | + */ | |
| 14 | +public class PatientCheckTicketQuery extends BaseQuery implements IConvertToNativeQuery { | |
| 15 | + | |
| 16 | + private String id; | |
| 17 | + private String patientId; | |
| 18 | + private String hospitalId; | |
| 19 | + private String consumeHospitalId; | |
| 20 | + private Integer status; // 1:创建未使用, 2:产检使用,3:分娩销毁 | |
| 21 | + | |
| 22 | + @Override | |
| 23 | + public MongoQuery convertToQuery() { | |
| 24 | + MongoCondition condition = MongoCondition.newInstance(); | |
| 25 | + if (status != null) { | |
| 26 | + condition = condition.and("status", status, MongoOper.IS); | |
| 27 | + } | |
| 28 | + if (!StringUtils.isEmpty(id)) { | |
| 29 | + condition = condition.and("id", id, MongoOper.IS); | |
| 30 | + } | |
| 31 | + if (!StringUtils.isEmpty(patientId)) { | |
| 32 | + condition = condition.and("patientId", patientId, MongoOper.IS); | |
| 33 | + } | |
| 34 | + if (!StringUtils.isEmpty(hospitalId)) { | |
| 35 | + condition = condition.and("hospitalId", hospitalId, MongoOper.IS); | |
| 36 | + } | |
| 37 | + if (!StringUtils.isEmpty(consumeHospitalId)) { | |
| 38 | + condition = condition.and("consumeHospitalId", consumeHospitalId, MongoOper.IS); | |
| 39 | + } | |
| 40 | + return condition.toMongoQuery(); | |
| 41 | + } | |
| 42 | + | |
| 43 | + public String getId() { | |
| 44 | + return id; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public void setId(String id) { | |
| 48 | + this.id = id; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public String getPatientId() { | |
| 52 | + return patientId; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public void setPatientId(String patientId) { | |
| 56 | + this.patientId = patientId; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public String getHospitalId() { | |
| 60 | + return hospitalId; | |
| 61 | + } | |
| 62 | + | |
| 63 | + public void setHospitalId(String hospitalId) { | |
| 64 | + this.hospitalId = hospitalId; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public String getConsumeHospitalId() { | |
| 68 | + return consumeHospitalId; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public void setConsumeHospitalId(String consumeHospitalId) { | |
| 72 | + this.consumeHospitalId = consumeHospitalId; | |
| 73 | + } | |
| 74 | + | |
| 75 | + public Integer getStatus() { | |
| 76 | + return status; | |
| 77 | + } | |
| 78 | + | |
| 79 | + public void setStatus(Integer status) { | |
| 80 | + this.status = status; | |
| 81 | + } | |
| 82 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PregnantBuildController.java
View file @
9eb5fb8
| ... | ... | @@ -47,6 +47,17 @@ |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | + * 查询孕妇建档记录 | |
| 51 | + * @return | |
| 52 | + */ | |
| 53 | + @RequestMapping(value = "/getCheckTicketList", method = RequestMethod.GET) | |
| 54 | + @ResponseBody | |
| 55 | + @TokenRequired | |
| 56 | + public BaseListResponse getCheckTicketList(@RequestParam(required = true) String patientId) { | |
| 57 | + return bookbuildingFacade.getTicketList(patientId); | |
| 58 | + } | |
| 59 | + | |
| 60 | + /** | |
| 50 | 61 | * 添加孕妇建档或者更新孕妇建档 |
| 51 | 62 | * @param yunBookbuildingAddRequest |
| 52 | 63 | * @return |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
View file @
9eb5fb8
| ... | ... | @@ -64,6 +64,9 @@ |
| 64 | 64 | @Autowired |
| 65 | 65 | private OrganizationGroupsFacade groupsFacade; |
| 66 | 66 | |
| 67 | + @Autowired | |
| 68 | + private PatientCheckTicketService patientCheckTicketService; | |
| 69 | + | |
| 67 | 70 | /** |
| 68 | 71 | * 处理区域隐藏建档 |
| 69 | 72 | * |
| ... | ... | @@ -234,6 +237,13 @@ |
| 234 | 237 | patientsService.updatePatient(patients); |
| 235 | 238 | patientsService.updatePatientOneCol(patients.getId(), com.lyms.platform.common.utils.StringUtils.isEmpty(antExAddRequest.getNextCheckTime()) == true ? null : DateUtil.parseYMD(antExAddRequest.getNextCheckTime())); |
| 236 | 239 | antenatalExaminationService.addOneBabyAnt(model); |
| 240 | + // 修改关联券的使用状态,如果已使用,则返回错误码 | |
| 241 | + if (StringUtils.isNotBlank(model.getBarCode())) { | |
| 242 | + String code = patientCheckTicketService.updateTicket(model.getBarCode(), 2, model.getHospitalId()); | |
| 243 | + if (code != null) { | |
| 244 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg(code); | |
| 245 | + } | |
| 246 | + } | |
| 237 | 247 | |
| 238 | 248 | //修改最后一次检查时间 |
| 239 | 249 | setLashCTimes(antExAddRequest.getParentId()); |
| ... | ... | @@ -382,6 +392,13 @@ |
| 382 | 392 | antExChuModel.setYn(YnEnums.YES.getId()); |
| 383 | 393 | antExChuModel.setHospitalId(autoMatchFacade.getHospitalId(userId)); |
| 384 | 394 | antenatalExaminationService.addOneAntEx(antExChuModel); |
| 395 | + // 修改关联券的使用状态,如果已使用,则返回错误码 | |
| 396 | + if (StringUtils.isNotBlank(antExChuModel.getBarCode())) { | |
| 397 | + String code = patientCheckTicketService.updateTicket(antExChuModel.getBarCode(), 2, antExChuModel.getHospitalId()); | |
| 398 | + if (code != null) { | |
| 399 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg(code); | |
| 400 | + } | |
| 401 | + } | |
| 385 | 402 | //修改患者风险等级 |
| 386 | 403 | |
| 387 | 404 | patients.setLastCheckEmployeeId(excAddRequest.getProdDoctor()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
9eb5fb8
| ... | ... | @@ -297,233 +297,238 @@ |
| 297 | 297 | * @return |
| 298 | 298 | */ |
| 299 | 299 | public BaseObjectResponse addBabyBookbuilding(BabyBookbuildingAddRequest request,Integer userId) { |
| 300 | + | |
| 300 | 301 | BaseObjectResponse br = new BaseObjectResponse(); |
| 302 | + try { | |
| 303 | + //判断儿童是否建档在该医院 | |
| 304 | + if (StringUtils.isNotEmpty(request.getMommyPhone()) || StringUtils.isNotEmpty(request.getMommyCertificateNum())) { | |
| 305 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
| 306 | + babyQuery.setYn(YnEnums.YES.getId()); | |
| 307 | + String phoneId = request.getMommyPhone() + | |
| 308 | + DateUtil.getYmd(DateUtil.parseYMD(request.getBabyBirthday())) + request.getBabyName(); | |
| 301 | 309 | |
| 302 | - //判断儿童是否建档在该医院 | |
| 303 | - if (StringUtils.isNotEmpty(request.getMommyPhone()) || StringUtils.isNotEmpty(request.getMommyCertificateNum())) { | |
| 304 | - BabyModelQuery babyQuery = new BabyModelQuery(); | |
| 305 | - babyQuery.setYn(YnEnums.YES.getId()); | |
| 306 | - String phoneId = request.getMommyPhone() + | |
| 307 | - DateUtil.getYmd(DateUtil.parseYMD(request.getBabyBirthday())) + request.getBabyName(); | |
| 308 | - | |
| 309 | - String cardId = request.getMommyCertificateNum() + | |
| 310 | - DateUtil.getYmd(DateUtil.parseYMD(request.getBabyBirthday())) + request.getBabyName(); | |
| 311 | - babyQuery.setPhoneId(phoneId); | |
| 312 | - babyQuery.setCardId(cardId); | |
| 313 | - babyQuery.setHospitalId(request.getHospitalId()); | |
| 314 | - List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
| 315 | - if (CollectionUtils.isNotEmpty(models)) { | |
| 316 | - br.setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
| 317 | - br.setErrormsg("儿童在医院已经建档"); | |
| 318 | - return br; | |
| 310 | + String cardId = request.getMommyCertificateNum() + | |
| 311 | + DateUtil.getYmd(DateUtil.parseYMD(request.getBabyBirthday())) + request.getBabyName(); | |
| 312 | + babyQuery.setPhoneId(phoneId); | |
| 313 | + babyQuery.setCardId(cardId); | |
| 314 | + babyQuery.setHospitalId(request.getHospitalId()); | |
| 315 | + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
| 316 | + if (CollectionUtils.isNotEmpty(models)) { | |
| 317 | + br.setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
| 318 | + br.setErrormsg("儿童在医院已经建档"); | |
| 319 | + return br; | |
| 320 | + } | |
| 319 | 321 | } |
| 320 | - } | |
| 321 | 322 | |
| 322 | - //判断就诊卡号是否已经建档 | |
| 323 | - if (StringUtils.isNotEmpty(request.getVcCardNo())) { | |
| 324 | - BabyModelQuery babyQuery = new BabyModelQuery(); | |
| 325 | - babyQuery.setYn(YnEnums.YES.getId()); | |
| 326 | - babyQuery.setVcCardNo(request.getVcCardNo()); | |
| 327 | - babyQuery.setHospitalId(request.getHospitalId()); | |
| 328 | - List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
| 329 | - if (CollectionUtils.isNotEmpty(models)) { | |
| 330 | - br.setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
| 331 | - br.setErrormsg("儿童就诊卡号在该医院已经建档"); | |
| 332 | - return br; | |
| 333 | - } | |
| 323 | + //判断就诊卡号是否已经建档 | |
| 324 | + if (StringUtils.isNotEmpty(request.getVcCardNo())) { | |
| 325 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
| 326 | + babyQuery.setYn(YnEnums.YES.getId()); | |
| 327 | + babyQuery.setVcCardNo(request.getVcCardNo()); | |
| 328 | + babyQuery.setHospitalId(request.getHospitalId()); | |
| 329 | + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
| 330 | + if (CollectionUtils.isNotEmpty(models)) { | |
| 331 | + br.setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
| 332 | + br.setErrormsg("儿童就诊卡号在该医院已经建档"); | |
| 333 | + return br; | |
| 334 | + } | |
| 334 | 335 | |
| 335 | - PatientsQuery patientsQuery = new PatientsQuery(); | |
| 336 | - patientsQuery.setVcCardNo(request.getVcCardNo()); | |
| 337 | - patientsQuery.setHospitalId(request.getHospitalId()); | |
| 338 | - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 339 | - if (CollectionUtils.isNotEmpty(patients)) { | |
| 340 | - br.setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
| 341 | - br.setErrormsg("该就诊卡号在该医院已经建档"); | |
| 342 | - return br; | |
| 336 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 337 | + patientsQuery.setVcCardNo(request.getVcCardNo()); | |
| 338 | + patientsQuery.setHospitalId(request.getHospitalId()); | |
| 339 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 340 | + if (CollectionUtils.isNotEmpty(patients)) { | |
| 341 | + br.setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
| 342 | + br.setErrormsg("该就诊卡号在该医院已经建档"); | |
| 343 | + return br; | |
| 344 | + } | |
| 343 | 345 | } |
| 344 | - } | |
| 345 | 346 | |
| 346 | - Patients patients = null; | |
| 347 | - PersonModel resperson = null; | |
| 348 | - String babyPersonId = ""; | |
| 349 | - //更新儿童基本信息的内容 | |
| 350 | - PersonModel babyPerson = new PersonModel(); | |
| 351 | - babyPerson.setName(request.getBabyName()); | |
| 352 | - babyPerson.setBirth(DateUtil.parseYMD(request.getBabyBirthday())); | |
| 353 | - babyPerson.setPhone(request.getMommyPhone()); | |
| 354 | - babyPerson.setCardNo(request.getMommyCertificateNum()); | |
| 355 | - babyPerson.setType(2); | |
| 356 | - babyPerson.setYn(YnEnums.YES.getId()); | |
| 357 | - babyPerson.setModified(new Date()); | |
| 358 | - if (StringUtils.isNotEmpty(request.getPid())) { | |
| 359 | - babyPersonId = request.getPid(); | |
| 360 | - personService.updatePerson(babyPerson, request.getPid()); | |
| 361 | - } else { | |
| 347 | + Patients patients = null; | |
| 348 | + PersonModel resperson = null; | |
| 349 | + String babyPersonId = ""; | |
| 350 | + //更新儿童基本信息的内容 | |
| 351 | + PersonModel babyPerson = new PersonModel(); | |
| 352 | + babyPerson.setName(request.getBabyName()); | |
| 353 | + babyPerson.setBirth(DateUtil.parseYMD(request.getBabyBirthday())); | |
| 354 | + babyPerson.setPhone(request.getMommyPhone()); | |
| 355 | + babyPerson.setCardNo(request.getMommyCertificateNum()); | |
| 356 | + babyPerson.setType(2); | |
| 362 | 357 | babyPerson.setYn(YnEnums.YES.getId()); |
| 363 | - babyPerson.setCreated(new Date()); | |
| 364 | - resperson = personService.addPerson(babyPerson); | |
| 365 | - babyPersonId = resperson.getId(); | |
| 366 | - } | |
| 358 | + babyPerson.setModified(new Date()); | |
| 359 | + if (StringUtils.isNotEmpty(request.getPid())) { | |
| 360 | + babyPersonId = request.getPid(); | |
| 361 | + personService.updatePerson(babyPerson, request.getPid()); | |
| 362 | + } else { | |
| 363 | + babyPerson.setYn(YnEnums.YES.getId()); | |
| 364 | + babyPerson.setCreated(new Date()); | |
| 365 | + resperson = personService.addPerson(babyPerson); | |
| 366 | + babyPersonId = resperson.getId(); | |
| 367 | + } | |
| 367 | 368 | |
| 368 | 369 | |
| 369 | - //查询孕妇或者产妇建档的基本信息 | |
| 370 | - PersonModelQuery personYunModelQuery = new PersonModelQuery(); | |
| 371 | -// personYunModelQuery.setPhone(request.getMommyPhone()); | |
| 372 | - personYunModelQuery.setYn(YnEnums.YES.getId()); | |
| 373 | - personYunModelQuery.setTypes(new Integer[]{1, 3}); | |
| 374 | - personYunModelQuery.setCardNo(request.getMommyCertificateNum()); | |
| 375 | - List<PersonModel> personYunModels = personService.queryPersons(personYunModelQuery); | |
| 376 | - if (CollectionUtils.isNotEmpty(personYunModels)) { | |
| 377 | - PersonModel pm = personYunModels.get(0); | |
| 378 | - if (pm != null) { | |
| 379 | - //查询最后一次建档记录 | |
| 380 | - PatientsQuery patientsQuery = new PatientsQuery(); | |
| 381 | - patientsQuery.setYn(YnEnums.YES.getId()); | |
| 382 | - patientsQuery.setPid(pm.getId()); | |
| 383 | - List<Patients> pats = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 384 | - if (CollectionUtils.isNotEmpty(pats)) { | |
| 370 | + //查询孕妇或者产妇建档的基本信息 | |
| 371 | + PersonModelQuery personYunModelQuery = new PersonModelQuery(); | |
| 372 | + // personYunModelQuery.setPhone(request.getMommyPhone()); | |
| 373 | + personYunModelQuery.setYn(YnEnums.YES.getId()); | |
| 374 | + personYunModelQuery.setTypes(new Integer[]{1, 3}); | |
| 375 | + personYunModelQuery.setCardNo(request.getMommyCertificateNum()); | |
| 376 | + List<PersonModel> personYunModels = personService.queryPersons(personYunModelQuery); | |
| 377 | + if (CollectionUtils.isNotEmpty(personYunModels)) { | |
| 378 | + PersonModel pm = personYunModels.get(0); | |
| 379 | + if (pm != null) { | |
| 380 | + //查询最后一次建档记录 | |
| 381 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 382 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 383 | + patientsQuery.setPid(pm.getId()); | |
| 384 | + List<Patients> pats = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 385 | + if (CollectionUtils.isNotEmpty(pats)) { | |
| 385 | 386 | |
| 386 | - //当前状态为 孕妇状态 | |
| 387 | - if (pm.getType() != null && pm.getType() == 1) { | |
| 388 | - boolean isUpdatePatStatus = false; | |
| 389 | - for (Patients pat : pats) { | |
| 390 | - if (pat == null) { | |
| 391 | - continue; | |
| 392 | - } | |
| 387 | + //当前状态为 孕妇状态 | |
| 388 | + if (pm.getType() != null && pm.getType() == 1) { | |
| 389 | + boolean isUpdatePatStatus = false; | |
| 390 | + for (Patients pat : pats) { | |
| 391 | + if (pat == null) { | |
| 392 | + continue; | |
| 393 | + } | |
| 393 | 394 | |
| 394 | - //找到当前医院的孕妇建档 | |
| 395 | - if (pat.getHospitalId() != null && pat.getHospitalId().equals(request.getHospitalId())) { | |
| 396 | - patients = pat; | |
| 397 | - } | |
| 395 | + //找到当前医院的孕妇建档 | |
| 396 | + if (pat.getHospitalId() != null && pat.getHospitalId().equals(request.getHospitalId())) { | |
| 397 | + patients = pat; | |
| 398 | + } | |
| 398 | 399 | |
| 399 | - if (pat.getType() != null && pat.getType() == 1) { | |
| 400 | + if (pat.getType() != null && pat.getType() == 1) { | |
| 400 | 401 | |
| 401 | - //判断在儿童建档的时候,是否设置到这个儿童对应的孕妇 设置成产妇 | |
| 402 | - //计算规则 儿童生日 >= 孕妇末次月经 + 24周 设置成分娩 (高帆 2016-08-09 16:47定 ) | |
| 403 | - Date lastMenses = pat.getLastMenses(); | |
| 404 | - if (lastMenses != null && request.getBabyBirthday() != null) { | |
| 405 | - Date brith = DateUtil.parseYMD(request.getBabyBirthday()); | |
| 406 | - Date tempDate = DateUtil.addWeek(lastMenses, 24); | |
| 407 | - if (brith.getTime() >= tempDate.getTime()) { | |
| 408 | - //设置孕妇已分娩 | |
| 409 | - Patients patientUpdate = new Patients(); | |
| 410 | - patientUpdate.setYn(YnEnums.YES.getId()); | |
| 411 | - patientUpdate.setType(3); | |
| 412 | - patientUpdate.setFmDate(StringUtils.isEmpty(request.getDueDate()) ? DateUtil.parseYMD(request.getBabyBirthday()) : DateUtil.parseYMD(request.getDueDate())); | |
| 413 | - patientsService.updatePatientByPid(patientUpdate, pm.getId()); | |
| 414 | - if (!isUpdatePatStatus) { | |
| 415 | - isUpdatePatStatus = true; | |
| 416 | - } | |
| 402 | + //判断在儿童建档的时候,是否设置到这个儿童对应的孕妇 设置成产妇 | |
| 403 | + //计算规则 儿童生日 >= 孕妇末次月经 + 24周 设置成分娩 (高帆 2016-08-09 16:47定 ) | |
| 404 | + Date lastMenses = pat.getLastMenses(); | |
| 405 | + if (lastMenses != null && request.getBabyBirthday() != null) { | |
| 406 | + Date brith = DateUtil.parseYMD(request.getBabyBirthday()); | |
| 407 | + Date tempDate = DateUtil.addWeek(lastMenses, 24); | |
| 408 | + if (brith.getTime() >= tempDate.getTime()) { | |
| 409 | + //设置孕妇已分娩 | |
| 410 | + Patients patientUpdate = new Patients(); | |
| 411 | + patientUpdate.setYn(YnEnums.YES.getId()); | |
| 412 | + patientUpdate.setType(3); | |
| 413 | + patientUpdate.setFmDate(StringUtils.isEmpty(request.getDueDate()) ? DateUtil.parseYMD(request.getBabyBirthday()) : DateUtil.parseYMD(request.getDueDate())); | |
| 414 | + patientsService.updatePatientByPid(patientUpdate, pm.getId()); | |
| 415 | + if (!isUpdatePatStatus) { | |
| 416 | + isUpdatePatStatus = true; | |
| 417 | + } | |
| 417 | 418 | |
| 419 | + } | |
| 418 | 420 | } |
| 419 | 421 | } |
| 420 | 422 | } |
| 421 | - } | |
| 422 | 423 | |
| 423 | - if (isUpdatePatStatus) { | |
| 424 | - pm.setType(3);//基本信息更新成产妇 | |
| 425 | - personService.updatePerson(pm, pm.getId()); | |
| 426 | - } | |
| 427 | - } else if (pm.getType() != null && pm.getType() == 3) { | |
| 428 | - //儿童建档时 需要修改自动分娩的产妇 | |
| 429 | - for (Patients patients1 : pats) { | |
| 430 | - //自动分娩类型 | |
| 431 | - if (null != patients1.getBuildType() && 2 == patients1.getBuildType()) { | |
| 432 | - Date lastMenses = patients1.getLastMenses(); | |
| 433 | - if (lastMenses != null && request.getBabyBirthday() != null) { | |
| 434 | - Date brith = DateUtil.parseYMD(request.getBabyBirthday()); | |
| 435 | - Date tempDate = DateUtil.addWeek(lastMenses, 24); | |
| 436 | - if (brith.getTime() >= tempDate.getTime()) { | |
| 437 | - Patients patients2 = new Patients(); | |
| 438 | - patients2.setId(patients1.getId()); | |
| 439 | - patients2.setFmDate(StringUtils.isEmpty(request.getDueDate()) ? DateUtil.parseYMD(request.getBabyBirthday()) : DateUtil.parseYMD(request.getDueDate())); | |
| 440 | - patients2.setBuildType(0); | |
| 441 | - patientsService.updatePatient(patients2); | |
| 424 | + if (isUpdatePatStatus) { | |
| 425 | + pm.setType(3);//基本信息更新成产妇 | |
| 426 | + personService.updatePerson(pm, pm.getId()); | |
| 427 | + } | |
| 428 | + } else if (pm.getType() != null && pm.getType() == 3) { | |
| 429 | + //儿童建档时 需要修改自动分娩的产妇 | |
| 430 | + for (Patients patients1 : pats) { | |
| 431 | + //自动分娩类型 | |
| 432 | + if (null != patients1.getBuildType() && 2 == patients1.getBuildType()) { | |
| 433 | + Date lastMenses = patients1.getLastMenses(); | |
| 434 | + if (lastMenses != null && request.getBabyBirthday() != null) { | |
| 435 | + Date brith = DateUtil.parseYMD(request.getBabyBirthday()); | |
| 436 | + Date tempDate = DateUtil.addWeek(lastMenses, 24); | |
| 437 | + if (brith.getTime() >= tempDate.getTime()) { | |
| 438 | + Patients patients2 = new Patients(); | |
| 439 | + patients2.setId(patients1.getId()); | |
| 440 | + patients2.setFmDate(StringUtils.isEmpty(request.getDueDate()) ? DateUtil.parseYMD(request.getBabyBirthday()) : DateUtil.parseYMD(request.getDueDate())); | |
| 441 | + patients2.setBuildType(0); | |
| 442 | + patientsService.updatePatient(patients2); | |
| 443 | + } | |
| 442 | 444 | } |
| 443 | 445 | } |
| 444 | 446 | } |
| 445 | 447 | } |
| 446 | - } | |
| 447 | 448 | |
| 448 | - if (patients == null) { | |
| 449 | - //添加产妇建档 | |
| 450 | - Patients patient = getPatientsData(request); | |
| 451 | - patient.setPid(pm.getId()); | |
| 452 | - patient.setCreated(new Date()); | |
| 453 | - patients = yunBookbuildingService.addPregnantBookbuilding(patient); | |
| 449 | + if (patients == null) { | |
| 450 | + //添加产妇建档 | |
| 451 | + Patients patient = getPatientsData(request); | |
| 452 | + patient.setPid(pm.getId()); | |
| 453 | + patient.setCreated(new Date()); | |
| 454 | + patients = yunBookbuildingService.addPregnantBookbuilding(patient); | |
| 455 | + } | |
| 454 | 456 | } |
| 457 | + | |
| 455 | 458 | } |
| 459 | + } | |
| 460 | + //没有孕妇基本信息就新建产妇建档 和基本信息 | |
| 461 | + else { | |
| 462 | + //添加产妇基本信息 | |
| 463 | + PersonModel pmodel = new PersonModel(); | |
| 464 | + pmodel.setName(request.getMommyName()); | |
| 465 | + pmodel.setBirth(DateUtil.parseYMD(request.getMommyBirthday())); | |
| 466 | + pmodel.setPhone(request.getMommyPhone()); | |
| 467 | + pmodel.setCardNo(request.getMommyCertificateNum()); | |
| 468 | + pmodel.setType(3); | |
| 469 | + pmodel.setYn(YnEnums.YES.getId()); | |
| 470 | + pmodel.setModified(new Date()); | |
| 471 | + pmodel.setCreated(new Date()); | |
| 456 | 472 | |
| 473 | + PersonModel yunModel = personService.addPerson(pmodel); | |
| 474 | + | |
| 475 | + //添加产妇建档 | |
| 476 | + Patients patient = getPatientsData(request); | |
| 477 | + patient.setPid(yunModel.getId()); | |
| 478 | + patient.setCreated(new Date()); | |
| 479 | + patients = yunBookbuildingService.addPregnantBookbuilding(patient); | |
| 457 | 480 | } |
| 458 | - } | |
| 459 | - //没有孕妇基本信息就新建产妇建档 和基本信息 | |
| 460 | - else { | |
| 461 | - //添加产妇基本信息 | |
| 462 | - PersonModel pmodel = new PersonModel(); | |
| 463 | - pmodel.setName(request.getMommyName()); | |
| 464 | - pmodel.setBirth(DateUtil.parseYMD(request.getMommyBirthday())); | |
| 465 | - pmodel.setPhone(request.getMommyPhone()); | |
| 466 | - pmodel.setCardNo(request.getMommyCertificateNum()); | |
| 467 | - pmodel.setType(3); | |
| 468 | - pmodel.setYn(YnEnums.YES.getId()); | |
| 469 | - pmodel.setModified(new Date()); | |
| 470 | - pmodel.setCreated(new Date()); | |
| 471 | 481 | |
| 472 | - PersonModel yunModel = personService.addPerson(pmodel); | |
| 473 | 482 | |
| 474 | - //添加产妇建档 | |
| 475 | - Patients patient = getPatientsData(request); | |
| 476 | - patient.setPid(yunModel.getId()); | |
| 477 | - patient.setCreated(new Date()); | |
| 478 | - patients = yunBookbuildingService.addPregnantBookbuilding(patient); | |
| 479 | - } | |
| 483 | + if (patients == null) { | |
| 484 | + br.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); | |
| 485 | + br.setErrormsg("失败"); | |
| 486 | + return br; | |
| 487 | + } | |
| 480 | 488 | |
| 489 | + BabyModel model = getBabyModel(request); | |
| 490 | + model.setPid(babyPersonId); | |
| 491 | + model.setOperator(userId); | |
| 492 | + if (StringUtils.isNotEmpty(request.getMommyCertificateNum())) { | |
| 481 | 493 | |
| 482 | - if (patients == null) { | |
| 483 | - br.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); | |
| 484 | - br.setErrormsg("失败"); | |
| 485 | - return br; | |
| 486 | - } | |
| 494 | + String cardId = request.getMommyCertificateNum() + | |
| 495 | + DateUtil.getYmd(DateUtil.parseYMD(request.getBabyBirthday())); | |
| 496 | + model.setCardId(cardId + request.getBabyName()); | |
| 497 | + } | |
| 498 | + if (StringUtils.isNotEmpty(request.getMommyPhone())) { | |
| 499 | + String phoneId = request.getMommyPhone() + | |
| 500 | + DateUtil.getYmd(DateUtil.parseYMD(request.getBabyBirthday())); | |
| 501 | + model.setPhoneId(phoneId + request.getBabyName()); | |
| 502 | + } | |
| 487 | 503 | |
| 488 | - BabyModel model = getBabyModel(request); | |
| 489 | - model.setPid(babyPersonId); | |
| 490 | - model.setOperator(userId); | |
| 491 | - if (StringUtils.isNotEmpty(request.getMommyCertificateNum())) { | |
| 504 | + if (patients.getId() != null) { | |
| 505 | + model.setParentId(patients.getId()); | |
| 506 | + } | |
| 507 | + model.setCreated(new Date()); | |
| 508 | + model.setModified(new Date()); | |
| 509 | + model.setBuildType(1); | |
| 510 | + model.setHospitalId(request.getHospitalId()); | |
| 511 | + // String hospitalName = organizationService.getOrganization(Integer.valueOf(request.getHospitalId())).getName(); | |
| 512 | + model = babyBookbuildingService.addBabyBookbuilding(model); | |
| 492 | 513 | |
| 493 | - String cardId = request.getMommyCertificateNum() + | |
| 494 | - DateUtil.getYmd(DateUtil.parseYMD(request.getBabyBirthday())); | |
| 495 | - model.setCardId(cardId + request.getBabyName()); | |
| 496 | - } | |
| 497 | - if (StringUtils.isNotEmpty(request.getMommyPhone())) { | |
| 498 | - String phoneId = request.getMommyPhone() + | |
| 499 | - DateUtil.getYmd(DateUtil.parseYMD(request.getBabyBirthday())); | |
| 500 | - model.setPhoneId(phoneId + request.getBabyName()); | |
| 501 | - } | |
| 514 | + if (model == null || model.getId() == null) { | |
| 515 | + br.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); | |
| 516 | + br.setErrormsg("保存失败"); | |
| 517 | + return br; | |
| 518 | + } | |
| 519 | + //创建建档短信 | |
| 520 | + createBuildSms(model); | |
| 502 | 521 | |
| 503 | - if (patients.getId() != null) { | |
| 504 | - model.setParentId(patients.getId()); | |
| 522 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 523 | + br.setErrormsg("成功"); | |
| 524 | + br.setData(model.getId()); | |
| 505 | 525 | } |
| 506 | - model.setCreated(new Date()); | |
| 507 | - model.setModified(new Date()); | |
| 508 | - model.setBuildType(1); | |
| 509 | - model.setHospitalId(request.getHospitalId()); | |
| 510 | - String hospitalName = organizationService.getOrganization(Integer.valueOf(request.getHospitalId())).getName(); | |
| 511 | - model = babyBookbuildingService.addBabyBookbuilding(model); | |
| 512 | - | |
| 513 | - if (model == null || model.getId() == null) { | |
| 514 | - br.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); | |
| 515 | - br.setErrormsg("保存失败"); | |
| 516 | - return br; | |
| 526 | + catch (Exception e) | |
| 527 | + { | |
| 528 | + br = new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION); | |
| 529 | + ExceptionUtils.catchException(e, "add baby building 异常"); | |
| 517 | 530 | } |
| 518 | - //创建建档短信 | |
| 519 | - createBuildSms(model); | |
| 520 | - | |
| 521 | - br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 522 | - br.setErrormsg("成功"); | |
| 523 | - br.setData(model.getId()); | |
| 524 | - | |
| 525 | 531 | return br; |
| 526 | - | |
| 527 | 532 | } |
| 528 | 533 | |
| 529 | 534 | |
| ... | ... | @@ -2156,7 +2161,6 @@ |
| 2156 | 2161 | babyQuery.setHospitalId(hospitalId); |
| 2157 | 2162 | |
| 2158 | 2163 | babyQuery.setYn(YnEnums.YES.getId()); |
| 2159 | - Date currentDate = DateUtil.formatDate(new Date()); | |
| 2160 | 2164 | |
| 2161 | 2165 | if (StringUtils.isNotEmpty(request.getBirth())) |
| 2162 | 2166 | { |
| 2163 | 2167 | |
| 2164 | 2168 | |
| ... | ... | @@ -2167,14 +2171,13 @@ |
| 2167 | 2171 | } |
| 2168 | 2172 | if (request.getMonthAgeStart() != null) |
| 2169 | 2173 | { |
| 2170 | - Date start = DateUtil.addMonth(currentDate, -request.getMonthAgeStart()); | |
| 2171 | - babyQuery.setCheckDateEnd(start); | |
| 2174 | + babyQuery.setCheckMonthStart(request.getMonthAgeStart()); | |
| 2172 | 2175 | } |
| 2173 | 2176 | if (request.getMonthAgeEnd() != null) |
| 2174 | 2177 | { |
| 2175 | - Date end = DateUtil.addDay(DateUtil.addMonth(currentDate, -request.getMonthAgeEnd() - 1), 1); | |
| 2176 | - babyQuery.setCheckDateStart(end); | |
| 2178 | + babyQuery.setCheckMonthEnd(request.getMonthAgeEnd()); | |
| 2177 | 2179 | } |
| 2180 | + | |
| 2178 | 2181 | List<BabyGrowthCountResult> result = new ArrayList<>(); |
| 2179 | 2182 | |
| 2180 | 2183 | Map<String,List<BabyGrowthCountResult>> mapItems = getCountGroupItemMaps(); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
9eb5fb8
| ... | ... | @@ -103,8 +103,23 @@ |
| 103 | 103 | @Autowired |
| 104 | 104 | private OrganizationGroupsFacade groupsFacade; |
| 105 | 105 | |
| 106 | + @Autowired | |
| 107 | + private AutoIncermentService autoIncermentService; | |
| 106 | 108 | |
| 109 | + @Autowired | |
| 110 | + private PatientCheckTicketService patientCheckTicketService; | |
| 111 | + | |
| 107 | 112 | /** |
| 113 | + * 根据患者的建档ID,查询还未使用的免费产检查券 | |
| 114 | + * @param patientId | |
| 115 | + * @return | |
| 116 | + */ | |
| 117 | + public BaseListResponse getTicketList(String patientId) { | |
| 118 | + List<PatientCheckTicket> list = patientCheckTicketService.queryTicket(patientId,null,null,1); | |
| 119 | + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(list).setPageInfo(new PageInfo()); | |
| 120 | + } | |
| 121 | + | |
| 122 | + /** | |
| 108 | 123 | * 添加孕妇建档 |
| 109 | 124 | * |
| 110 | 125 | * @param yunRequest |
| ... | ... | @@ -235,6 +250,18 @@ |
| 235 | 250 | if (type == ServiceObjEnums.YUNOBJ.getId()) { |
| 236 | 251 | //生成建档短信 |
| 237 | 252 | createBuildSms(p); |
| 253 | + } | |
| 254 | + | |
| 255 | + // 建档成功后,给孕妇造五个条形码 | |
| 256 | + String ticketPid = autoIncermentService.nextPatientTicketId(); | |
| 257 | + for (Integer i=1;i<=5;i++) { | |
| 258 | + PatientCheckTicket ticket = new PatientCheckTicket(); | |
| 259 | + ticket.setStatus(1); | |
| 260 | + ticket.setHospitalId(p.getHospitalId()); | |
| 261 | + ticket.setPatientId(p.getId()); | |
| 262 | + ticket.setCreated(new Date()); | |
| 263 | + ticket.setId("0335" + ticketPid + String.format("%02d", i)); | |
| 264 | + patientCheckTicketService.addTicket(ticket); | |
| 238 | 265 | } |
| 239 | 266 | |
| 240 | 267 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/FolicAcidFacade.java
View file @
9eb5fb8
| ... | ... | @@ -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.DateUtil; |
| 13 | +import com.lyms.platform.common.utils.DefenceUtils; | |
| 13 | 14 | import com.lyms.platform.common.utils.ExcelUtil; |
| 14 | 15 | import com.lyms.platform.common.utils.SystemConfig; |
| 15 | 16 | import com.lyms.platform.operate.web.request.FolicAcidAddRequest; |
| ... | ... | @@ -332,7 +333,7 @@ |
| 332 | 333 | map.put("id",data.getId()); |
| 333 | 334 | ResidentsArchiveModel model = residentsArchiveService.getResident(data.getParentId()); |
| 334 | 335 | map.put("username",model.getUsername()); |
| 335 | - map.put("certificateNum",model.getCertificateNum()); | |
| 336 | + map.put("certificateNum", DefenceUtils.getId(model.getCertificateNum())); | |
| 336 | 337 | map.put("phone", FunvCommonUtil.getXingPhone(model.getPhone())); |
| 337 | 338 | map.put("drawTime", DateUtil.getyyyy_MM_dd(data.getDrawTime())); |
| 338 | 339 | map.put("drawCount", data.getDrawCount()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PremaritalCheckupFacade.java
View file @
9eb5fb8
| ... | ... | @@ -481,12 +481,21 @@ |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | /* 配偶信息 */ |
| 484 | - if (addRequest.getDeliverStatus()!=null && addRequest.getDeliverStatus()==1){ | |
| 485 | - checkup.setSpouseName(addRequest.getSpouseName()); | |
| 486 | - checkup.setSpouseCertificateTypeId(addRequest.getSpouseCertificateTypeId()); | |
| 487 | - checkup.setSpouseCertificateNum(addRequest.getSpouseCertificateNum()); | |
| 488 | - checkup.setIsBloodshed(addRequest.getIsBloodshed()); | |
| 489 | - checkup.setBloodshed(addRequest.getBloodshed()); | |
| 484 | + if (addRequest.getDeliverStatus()!=null){ | |
| 485 | + if (addRequest.getDeliverStatus()==1){ | |
| 486 | + checkup.setSpouseName(addRequest.getSpouseName()); | |
| 487 | + checkup.setSpouseCertificateTypeId(addRequest.getSpouseCertificateTypeId()); | |
| 488 | + checkup.setSpouseCertificateNum(addRequest.getSpouseCertificateNum()); | |
| 489 | + checkup.setIsBloodshed(addRequest.getIsBloodshed()); | |
| 490 | + checkup.setBloodshed(addRequest.getBloodshed()); | |
| 491 | + }else if (addRequest.getDeliverStatus()==2){ | |
| 492 | + checkup.setSpouseName(""); | |
| 493 | + checkup.setSpouseCertificateTypeId(""); | |
| 494 | + checkup.setSpouseCertificateNum(""); | |
| 495 | + checkup.setIsBloodshed(0); | |
| 496 | + checkup.setBloodshed(""); | |
| 497 | + } | |
| 498 | + checkup.setDeliverStatus(addRequest.getDeliverStatus()); | |
| 490 | 499 | } |
| 491 | 500 | |
| 492 | 501 | /* 婚育史 */ |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/GrowthCountTask.java
View file @
9eb5fb8
| 1 | 1 | package com.lyms.platform.operate.web.utils; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.biz.service.BabyCheckService; |
| 4 | +import com.lyms.platform.common.enums.YnEnums; | |
| 5 | +import com.lyms.platform.common.utils.DateUtil; | |
| 4 | 6 | import com.lyms.platform.common.utils.ExceptionUtils; |
| 7 | +import com.lyms.platform.common.utils.StringUtils; | |
| 5 | 8 | import com.lyms.platform.operate.web.result.BabyGrowthCountResult; |
| 6 | 9 | import com.lyms.platform.query.BabyCheckModelQuery; |
| 7 | 10 | import org.apache.commons.collections.CollectionUtils; |
| 8 | 11 | |
| 9 | 12 | |
| 10 | 13 | |
| ... | ... | @@ -47,20 +50,28 @@ |
| 47 | 50 | @Override |
| 48 | 51 | public List<BabyGrowthCountResult> call() throws Exception { |
| 49 | 52 | |
| 53 | + BabyCheckModelQuery babyCheckModelQuery = new BabyCheckModelQuery(); | |
| 54 | + babyCheckModelQuery.setYn(YnEnums.YES.getId()); | |
| 55 | + babyCheckModelQuery.setHospitalId(babyQuery.getHospitalId()); | |
| 56 | + babyCheckModelQuery.setBirthStart(babyQuery.getBirthStart()); | |
| 57 | + babyCheckModelQuery.setBirthEnd(babyQuery.getBirthEnd()); | |
| 58 | + babyCheckModelQuery.setCheckMonthStart(babyQuery.getCheckMonthStart()); | |
| 59 | + babyCheckModelQuery.setCheckMonthEnd(babyQuery.getCheckMonthEnd()); | |
| 60 | + | |
| 50 | 61 | if (CollectionUtils.isNotEmpty(growths)) |
| 51 | 62 | { |
| 52 | 63 | for(BabyGrowthCountResult grouwth : growths) |
| 53 | 64 | { |
| 54 | 65 | if ("身长".equals(type)) |
| 55 | 66 | { |
| 56 | - babyQuery.setHeightEvaluate(grouwth.getEvaluate()); | |
| 67 | + babyCheckModelQuery.setHeightEvaluate(grouwth.getEvaluate()); | |
| 57 | 68 | } |
| 58 | 69 | else if ("体重".equals(type)) |
| 59 | 70 | { |
| 60 | - babyQuery.setWeightEvaluate(grouwth.getEvaluate()); | |
| 71 | + babyCheckModelQuery.setWeightEvaluate(grouwth.getEvaluate()); | |
| 61 | 72 | } |
| 62 | 73 | grouwth.setTypeName(type); |
| 63 | - int count = babyCheckService.queryBabyCheckCount(babyQuery); | |
| 74 | + int count = babyCheckService.queryBabyCheckCount(babyCheckModelQuery); | |
| 64 | 75 | grouwth.setCount(String.valueOf(count)); |
| 65 | 76 | } |
| 66 | 77 | } |