Commit a3b2fff11c843d919954dd2a972c72ab8c0d864a
1 parent
e837a85a6f
Exists in
master
and in
6 other branches
增加体温接口
Showing 6 changed files with 464 additions and 0 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ITempDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/TempDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/TempService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/TempModel.java
- platform-dal/src/main/java/com/lyms/platform/query/TempQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TempController.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ITempDao.java
View file @
a3b2fff
| 1 | +package com.lyms.platform.biz.dal; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 4 | +import com.lyms.platform.pojo.TempModel; | |
| 5 | + | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 体温类相关dal实现 | |
| 10 | + * <p/> | |
| 11 | + * 详细描述 | |
| 12 | + * <p/> | |
| 13 | + * 示例代码 | |
| 14 | + * <pre> | |
| 15 | + * </pre/> | |
| 16 | + * | |
| 17 | + * @author JIAZHI.JIANG | |
| 18 | + * @version BME V100R001 2017-11-28 15:41 | |
| 19 | + * @since BME V100R001C40B104 | |
| 20 | + */ | |
| 21 | +public interface ITempDao { | |
| 22 | + | |
| 23 | + TempModel addOneTemp(TempModel target); | |
| 24 | + | |
| 25 | + List<TempModel> findByCondion(MongoQuery mongoQuery); | |
| 26 | + | |
| 27 | + void updateFirst(TempModel temp, String id); | |
| 28 | + | |
| 29 | + int queryTempModelCount(MongoQuery query); | |
| 30 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/TempDaoImpl.java
View file @
a3b2fff
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.ITempDao; | |
| 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.common.pojo.SyncDataModel; | |
| 9 | +import com.lyms.platform.pojo.TempModel; | |
| 10 | +import org.slf4j.Logger; | |
| 11 | +import org.slf4j.LoggerFactory; | |
| 12 | +import org.springframework.stereotype.Repository; | |
| 13 | + | |
| 14 | +import java.util.List; | |
| 15 | + | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * 体温操作类 | |
| 19 | + * <p/> | |
| 20 | + * 详细描述 | |
| 21 | + * <p/> | |
| 22 | + * 示例代码 | |
| 23 | + * <pre> | |
| 24 | + * </pre/> | |
| 25 | + * | |
| 26 | + * @author JIAZHI.JIANG | |
| 27 | + * @version BME V100R001 2017-11-28 16:19 | |
| 28 | + * @since BME V100R001C40B104 | |
| 29 | + */ | |
| 30 | +@Repository("tempDao") | |
| 31 | +public class TempDaoImpl extends BaseMongoDAOImpl<TempModel> implements ITempDao { | |
| 32 | + | |
| 33 | + //日志调测器 | |
| 34 | + private static final Logger logger = LoggerFactory.getLogger(TempDaoImpl.class); | |
| 35 | + | |
| 36 | + @Override | |
| 37 | + public TempModel addOneTemp(TempModel target) { | |
| 38 | + return save(target); | |
| 39 | + } | |
| 40 | + | |
| 41 | + @Override | |
| 42 | + public List<TempModel> findByCondion(MongoQuery mongoQuery) { | |
| 43 | + return find(mongoQuery.convertToMongoQuery()); | |
| 44 | + } | |
| 45 | + | |
| 46 | + @Override | |
| 47 | + public void updateFirst(TempModel temp, String id) { | |
| 48 | + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), temp); | |
| 49 | + } | |
| 50 | + | |
| 51 | + @Override | |
| 52 | + public int queryTempModelCount(MongoQuery query) { | |
| 53 | + return (int) count(query.convertToMongoQuery()); | |
| 54 | + } | |
| 55 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/TempService.java
View file @
a3b2fff
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.ITempDao; | |
| 4 | +import com.lyms.platform.biz.dal.impl.TempDaoImpl; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 6 | +import com.lyms.platform.pojo.Patients; | |
| 7 | +import com.lyms.platform.pojo.TempModel; | |
| 8 | +import com.lyms.platform.query.PatientsQuery; | |
| 9 | +import com.lyms.platform.query.TempQuery; | |
| 10 | +import org.apache.commons.lang.StringUtils; | |
| 11 | +import org.slf4j.Logger; | |
| 12 | +import org.slf4j.LoggerFactory; | |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | +import org.springframework.stereotype.Service; | |
| 15 | + | |
| 16 | +import java.util.Date; | |
| 17 | +import java.util.List; | |
| 18 | + | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * 体温服务类 | |
| 22 | + * <p/> | |
| 23 | + * 详细描述 | |
| 24 | + * <p/> | |
| 25 | + * 示例代码 | |
| 26 | + * <pre> | |
| 27 | + * </pre/> | |
| 28 | + * | |
| 29 | + * @author JIAZHI.JIANG | |
| 30 | + * @version BME V100R001 2017-11-28 16:42 | |
| 31 | + * @since BME V100R001C40B104 | |
| 32 | + */ | |
| 33 | +@Service | |
| 34 | +public class TempService { | |
| 35 | + | |
| 36 | + //日志调测器 | |
| 37 | + private static final Logger logger = LoggerFactory.getLogger(TempService.class); | |
| 38 | + | |
| 39 | + @Autowired | |
| 40 | + private ITempDao tempDao; | |
| 41 | + | |
| 42 | + public TempModel addOneTemp(TempModel target) { | |
| 43 | + target.setCreated(new Date()); | |
| 44 | + target.setModified(new Date()); | |
| 45 | + return tempDao.addOneTemp(target); | |
| 46 | + } | |
| 47 | + | |
| 48 | + public List<TempModel> queryTemp(TempQuery tempQuery) { | |
| 49 | + MongoQuery mongoQuery = tempQuery.convertToQuery(); | |
| 50 | + if (StringUtils.isNotEmpty(tempQuery.getNeed())) { | |
| 51 | + tempQuery.mysqlBuild(tempDao.queryTempModelCount(mongoQuery)); | |
| 52 | + mongoQuery.start(tempQuery.getOffset()).end(tempQuery.getLimit()); | |
| 53 | + } | |
| 54 | + return tempDao.findByCondion(mongoQuery); | |
| 55 | + } | |
| 56 | + | |
| 57 | + public void update(TempModel temp,String id){ | |
| 58 | + temp.setModified(new Date()); | |
| 59 | + tempDao.updateFirst(temp,id); | |
| 60 | + } | |
| 61 | +} |
platform-dal/src/main/java/com/lyms/platform/pojo/TempModel.java
View file @
a3b2fff
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.result.BaseModel; | |
| 4 | +import org.slf4j.Logger; | |
| 5 | +import org.slf4j.LoggerFactory; | |
| 6 | +import org.springframework.data.mongodb.core.index.Indexed; | |
| 7 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 8 | + | |
| 9 | +import java.util.Date; | |
| 10 | +import java.util.LinkedHashMap; | |
| 11 | +import java.util.List; | |
| 12 | +import java.util.Map; | |
| 13 | + | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * 体温model | |
| 17 | + * <p/> | |
| 18 | + * 详细描述 | |
| 19 | + * <p/> | |
| 20 | + * 示例代码 | |
| 21 | + * <pre> | |
| 22 | + * </pre/> | |
| 23 | + * | |
| 24 | + * @author JIAZHI.JIANG | |
| 25 | + * @version BME V100R001 2017-11-28 15:42 | |
| 26 | + * @since BME V100R001C40B104 | |
| 27 | + */ | |
| 28 | +@Document(collection="lyms_temp") | |
| 29 | +public class TempModel extends BaseModel { | |
| 30 | + | |
| 31 | + private String id; | |
| 32 | + | |
| 33 | + private String hId; | |
| 34 | + @Indexed | |
| 35 | + private String parentId; | |
| 36 | + @Indexed | |
| 37 | + private String pid; | |
| 38 | + | |
| 39 | + //操作人 | |
| 40 | + private String operator; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 是否有效 | |
| 44 | + */ | |
| 45 | + private Integer yn; | |
| 46 | + | |
| 47 | + //创建时间 | |
| 48 | + private Date created; | |
| 49 | + //修改时间 | |
| 50 | + private Date modified; | |
| 51 | + //体温值 | |
| 52 | + private LinkedHashMap<String,Double> tempList; | |
| 53 | + | |
| 54 | + @Indexed | |
| 55 | + private String createdTime; | |
| 56 | + | |
| 57 | + public String getId() { | |
| 58 | + return id; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setId(String id) { | |
| 62 | + this.id = id; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public String gethId() { | |
| 66 | + return hId; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void sethId(String hId) { | |
| 70 | + this.hId = hId; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public String getParentId() { | |
| 74 | + return parentId; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void setParentId(String parentId) { | |
| 78 | + this.parentId = parentId; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public String getPid() { | |
| 82 | + return pid; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public void setPid(String pid) { | |
| 86 | + this.pid = pid; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public String getOperator() { | |
| 90 | + return operator; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public void setOperator(String operator) { | |
| 94 | + this.operator = operator; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public Integer getYn() { | |
| 98 | + return yn; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public void setYn(Integer yn) { | |
| 102 | + this.yn = yn; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public Date getCreated() { | |
| 106 | + return created; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public void setCreated(Date created) { | |
| 110 | + this.created = created; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public Date getModified() { | |
| 114 | + return modified; | |
| 115 | + } | |
| 116 | + | |
| 117 | + public void setModified(Date modified) { | |
| 118 | + this.modified = modified; | |
| 119 | + } | |
| 120 | + | |
| 121 | + public LinkedHashMap<String, Double> getTempList() { | |
| 122 | + return tempList; | |
| 123 | + } | |
| 124 | + | |
| 125 | + public void setTempList(LinkedHashMap<String, Double> tempList) { | |
| 126 | + this.tempList = tempList; | |
| 127 | + } | |
| 128 | + | |
| 129 | + public String getCreatedTime() { | |
| 130 | + return createdTime; | |
| 131 | + } | |
| 132 | + | |
| 133 | + public void setCreatedTime(String createdTime) { | |
| 134 | + this.createdTime = createdTime; | |
| 135 | + } | |
| 136 | +} |
platform-dal/src/main/java/com/lyms/platform/query/TempQuery.java
View file @
a3b2fff
| 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.apache.commons.collections.CollectionUtils; | |
| 9 | +import org.slf4j.Logger; | |
| 10 | +import org.slf4j.LoggerFactory; | |
| 11 | + | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * 体温查询类 | |
| 17 | + * <p/> | |
| 18 | + * 详细描述 | |
| 19 | + * <p/> | |
| 20 | + * 示例代码 | |
| 21 | + * <pre> | |
| 22 | + * </pre/> | |
| 23 | + * | |
| 24 | + * @author JIAZHI.JIANG | |
| 25 | + * @version BME V100R001 2017-11-28 16:10 | |
| 26 | + * @since BME V100R001C40B104 | |
| 27 | + */ | |
| 28 | +public class TempQuery extends BaseQuery implements IConvertToNativeQuery { | |
| 29 | + | |
| 30 | + private String created; | |
| 31 | + private String parentId; | |
| 32 | + | |
| 33 | + //医院id | |
| 34 | + private List<String> hospitalList; | |
| 35 | + | |
| 36 | + private List<String> pIds; | |
| 37 | + | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 是否有效 | |
| 41 | + */ | |
| 42 | + private Integer yn = -1; | |
| 43 | + | |
| 44 | + public Integer getYn() { | |
| 45 | + return yn; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setYn(Integer yn) { | |
| 49 | + this.yn = yn; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public String getCreated() { | |
| 53 | + return created; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setCreated(String created) { | |
| 57 | + this.created = created; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public String getParentId() { | |
| 61 | + return parentId; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public void setParentId(String parentId) { | |
| 65 | + this.parentId = parentId; | |
| 66 | + } | |
| 67 | + | |
| 68 | + @Override | |
| 69 | + public MongoQuery convertToQuery() { | |
| 70 | + MongoCondition condition = MongoCondition.newInstance(); | |
| 71 | + | |
| 72 | + if (null != created) { | |
| 73 | + condition = condition.and("createdTime", created, MongoOper.IS); | |
| 74 | + } | |
| 75 | + if (-1 != yn) { | |
| 76 | + condition = condition.and("yn", yn, MongoOper.IS); | |
| 77 | + } | |
| 78 | + if(null!=parentId){ | |
| 79 | + condition= condition.and("parentId",parentId, MongoOper.IS); | |
| 80 | + } | |
| 81 | + if(CollectionUtils.isNotEmpty(hospitalList)){ | |
| 82 | + condition = condition.and("hId", hospitalList, MongoOper.IN); | |
| 83 | + } | |
| 84 | + if (null != pIds) { | |
| 85 | + condition = condition.and("pid", pIds, MongoOper.IN); | |
| 86 | + } | |
| 87 | + return condition.toMongoQuery(); | |
| 88 | + } | |
| 89 | + | |
| 90 | + public List<String> getHospitalList() { | |
| 91 | + return hospitalList; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public void setHospitalList(List<String> hospitalList) { | |
| 95 | + this.hospitalList = hospitalList; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public List<String> getpIds() { | |
| 99 | + return pIds; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public void setpIds(List<String> pIds) { | |
| 103 | + this.pIds = pIds; | |
| 104 | + } | |
| 105 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TempController.java
View file @
a3b2fff
| 1 | +package com.lyms.platform.operate.web.controller; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.PatientsService; | |
| 4 | +import com.lyms.platform.common.annotation.TokenRequired; | |
| 5 | +import com.lyms.platform.common.base.BaseController; | |
| 6 | +import com.lyms.platform.common.base.LoginContext; | |
| 7 | +import com.lyms.platform.common.result.BaseResponse; | |
| 8 | +import com.lyms.platform.operate.web.facade.TempFacade; | |
| 9 | +import com.lyms.platform.operate.web.request.TempAddRequest; | |
| 10 | +import com.lyms.platform.operate.web.request.TempQueryRequest; | |
| 11 | +import org.apache.commons.lang.StringUtils; | |
| 12 | +import org.hibernate.validator.constraints.NotEmpty; | |
| 13 | +import org.slf4j.Logger; | |
| 14 | +import org.slf4j.LoggerFactory; | |
| 15 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 16 | +import org.springframework.stereotype.Controller; | |
| 17 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 18 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 19 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 20 | +import org.springframework.web.bind.annotation.ResponseBody; | |
| 21 | + | |
| 22 | +import javax.servlet.http.HttpServletRequest; | |
| 23 | +import javax.validation.Valid; | |
| 24 | + | |
| 25 | + | |
| 26 | +/** | |
| 27 | + * 体温相关的接口 | |
| 28 | + * <p/> | |
| 29 | + * 详细描述 | |
| 30 | + * <p/> | |
| 31 | + * 示例代码 | |
| 32 | + * <pre> | |
| 33 | + * </pre/> | |
| 34 | + * | |
| 35 | + * @author JIAZHI.JIANG | |
| 36 | + * @version BME V100R001 2017-11-28 15:04 | |
| 37 | + * @since BME V100R001C40B104 | |
| 38 | + */ | |
| 39 | +@Controller | |
| 40 | +@RequestMapping("/temp") | |
| 41 | +public class TempController extends BaseController { | |
| 42 | + | |
| 43 | + //日志调测器 | |
| 44 | + private static final Logger logger = LoggerFactory.getLogger(TempController.class); | |
| 45 | + | |
| 46 | + | |
| 47 | + @Autowired | |
| 48 | + private TempFacade tempFacade; | |
| 49 | + | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 增加一条体温记录 | |
| 53 | + * | |
| 54 | + * @return | |
| 55 | + */ | |
| 56 | + @TokenRequired | |
| 57 | + @RequestMapping(value = "/add",method = RequestMethod.POST) | |
| 58 | + @ResponseBody | |
| 59 | + public BaseResponse addOnceTemp(@Valid TempAddRequest tempRequest,HttpServletRequest request) { | |
| 60 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 61 | + return tempFacade.addOrUpdateOneTemp(tempRequest,loginState.getId()); | |
| 62 | + } | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 体温管理列表 | |
| 66 | + * | |
| 67 | + * @param queryRequest | |
| 68 | + * @return | |
| 69 | + */ | |
| 70 | + @TokenRequired | |
| 71 | + @RequestMapping(value = "/list",method = RequestMethod.GET) | |
| 72 | + @ResponseBody | |
| 73 | + public BaseResponse findTempDataList(@Valid TempQueryRequest queryRequest,HttpServletRequest request){ | |
| 74 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 75 | + return tempFacade.findTempDataList(queryRequest,loginState.getId()); | |
| 76 | + } | |
| 77 | +} |