Commit cc41506a4ab1d44736e731e6bd7bad2c1816018c
1 parent
28eba4bfc8
Exists in
master
and in
1 other branch
add import test
Showing 6 changed files with 231 additions and 0 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ArchiveDataDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/ArchiveDataDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/ArchiveDataServicer.java
- platform-dal/src/main/java/com/lyms/platform/pojo/ArchiveData.java
- platform-dal/src/main/java/com/lyms/platform/query/ArchiveDataQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ArchiveDataDao.java
View file @
cc41506
| 1 | +package com.lyms.platform.biz.dal; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 4 | +import com.lyms.platform.pojo.ArchiveData; | |
| 5 | + | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Created by riecard on 2016/10/19. | |
| 10 | + */ | |
| 11 | +public interface ArchiveDataDao { | |
| 12 | + List<ArchiveData> query(MongoQuery query); | |
| 13 | + | |
| 14 | + void saveArchiveData(ArchiveData data); | |
| 15 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/ArchiveDataDaoImpl.java
View file @
cc41506
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.ArchiveDataDao; | |
| 4 | +import com.lyms.platform.biz.dal.IAntExChuDao; | |
| 5 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 7 | +import com.lyms.platform.pojo.AntExChuModel; | |
| 8 | +import com.lyms.platform.pojo.ArchiveData; | |
| 9 | +import org.springframework.stereotype.Repository; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * Created by riecard on 2016/10/19. | |
| 15 | + */ | |
| 16 | +@Repository("archiveDataDao") | |
| 17 | +public class ArchiveDataDaoImpl extends BaseMongoDAOImpl<ArchiveData> implements ArchiveDataDao { | |
| 18 | + @Override | |
| 19 | + public List<ArchiveData> query(MongoQuery query) { | |
| 20 | + return find(query.convertToMongoQuery()); | |
| 21 | + } | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + public void saveArchiveData(ArchiveData data) { | |
| 25 | + save(data); | |
| 26 | + } | |
| 27 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/ArchiveDataServicer.java
View file @
cc41506
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.ArchiveDataDao; | |
| 4 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 5 | +import com.lyms.platform.pojo.ArchiveData; | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | + | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * Created by riecard on 2016/10/19. | |
| 13 | + */ | |
| 14 | +@Service | |
| 15 | +public class ArchiveDataServicer { | |
| 16 | + | |
| 17 | + @Autowired | |
| 18 | + private ArchiveDataDao archiveDataDao; | |
| 19 | + | |
| 20 | + public List<ArchiveData> query(MongoQuery query) { | |
| 21 | + return archiveDataDao.query(query); | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void saveArchiveData(ArchiveData data) { | |
| 25 | + archiveDataDao.saveArchiveData(data); | |
| 26 | + } | |
| 27 | + | |
| 28 | +} |
platform-dal/src/main/java/com/lyms/platform/pojo/ArchiveData.java
View file @
cc41506
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by riecard on 2016/10/19. | |
| 7 | + */ | |
| 8 | +@Document(collection = "lyms_archivedata") | |
| 9 | +public class ArchiveData implements java.io.Serializable { | |
| 10 | + | |
| 11 | + private String id; | |
| 12 | + private String name; | |
| 13 | + private String idCard; | |
| 14 | + private String hospitalId; | |
| 15 | + private String jsonData; | |
| 16 | + | |
| 17 | + public String getId() { | |
| 18 | + return id; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public void setId(String id) { | |
| 22 | + this.id = id; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public String getName() { | |
| 26 | + return name; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public void setName(String name) { | |
| 30 | + this.name = name; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public String getIdCard() { | |
| 34 | + return idCard; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setIdCard(String idCard) { | |
| 38 | + this.idCard = idCard; | |
| 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 getJsonData() { | |
| 50 | + return jsonData; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setJsonData(String jsonData) { | |
| 54 | + this.jsonData = jsonData; | |
| 55 | + } | |
| 56 | +} |
platform-dal/src/main/java/com/lyms/platform/query/ArchiveDataQuery.java
View file @
cc41506
| 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 | + | |
| 9 | +/** | |
| 10 | + * Created by riecard on 2016/10/19. | |
| 11 | + */ | |
| 12 | +public class ArchiveDataQuery extends BaseQuery implements IConvertToNativeQuery { | |
| 13 | + | |
| 14 | + private String id; | |
| 15 | + private String idCard; | |
| 16 | + private String hospitalId; | |
| 17 | + | |
| 18 | + public String getId() { | |
| 19 | + return id; | |
| 20 | + } | |
| 21 | + | |
| 22 | + public void setId(String id) { | |
| 23 | + this.id = id; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public String getIdCard() { | |
| 27 | + return idCard; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public void setIdCard(String idCard) { | |
| 31 | + this.idCard = idCard; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public String getHospitalId() { | |
| 35 | + return hospitalId; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public void setHospitalId(String hospitalId) { | |
| 39 | + this.hospitalId = hospitalId; | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + public MongoQuery convertToQuery() { | |
| 44 | + MongoCondition condition=MongoCondition.newInstance(); | |
| 45 | + if(null!=hospitalId){ | |
| 46 | + condition= condition.and("hospitalId",hospitalId, MongoOper.IS); | |
| 47 | + } | |
| 48 | + if(null!=idCard){ | |
| 49 | + condition= condition.and("idCard",idCard, MongoOper.IS); | |
| 50 | + } | |
| 51 | + if(null!=id){ | |
| 52 | + condition= condition.and("id",id, MongoOper.IS); | |
| 53 | + } | |
| 54 | + return condition.toMongoQuery(); | |
| 55 | + } | |
| 56 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RemoteController.java
View file @
cc41506
| 1 | +package com.lyms.platform.operate.web.controller; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.ArchiveDataServicer; | |
| 4 | +import com.lyms.platform.common.base.BaseController; | |
| 5 | +import com.lyms.platform.pojo.ArchiveData; | |
| 6 | +import com.lyms.platform.query.ArchiveDataQuery; | |
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 8 | +import org.springframework.stereotype.Controller; | |
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 11 | + | |
| 12 | +import javax.servlet.http.HttpServletResponse; | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * Created by riecard on 2016/10/18. | |
| 17 | + */ | |
| 18 | +@Controller | |
| 19 | +public class RemoteController extends BaseController { | |
| 20 | + | |
| 21 | + @Autowired | |
| 22 | + private ArchiveDataServicer archiveDataServicer; | |
| 23 | + | |
| 24 | + @RequestMapping(value = "/bookArchive",method = RequestMethod.GET) | |
| 25 | + public void queryBookArchive(HttpServletResponse response, String idCard, String hospitalId) { | |
| 26 | + ArchiveDataQuery query = new ArchiveDataQuery(); | |
| 27 | + query.setIdCard(idCard); | |
| 28 | +// query.setHospitalId(hospitalId); | |
| 29 | + List<ArchiveData> list = archiveDataServicer.query(query.convertToQuery()); | |
| 30 | + if (list!=null && list.size() > 0) { | |
| 31 | + writeJson(response, list.get(0).getJsonData()); | |
| 32 | + } else { | |
| 33 | + writeJson(response,"{\"errormsg\": \"没有查询到数据\",\"errorcode\": 4097}"); | |
| 34 | + } | |
| 35 | + } | |
| 36 | + | |
| 37 | + @RequestMapping(value = "/bookArchive",method = RequestMethod.POST) | |
| 38 | + public void addBookArchive(HttpServletResponse response, String idCard, String hospitalId, String jsonData, String name) { | |
| 39 | + ArchiveData data = new ArchiveData(); | |
| 40 | + data.setId(hospitalId+":"+idCard); | |
| 41 | + data.setHospitalId(hospitalId); | |
| 42 | + data.setIdCard(idCard); | |
| 43 | + data.setName(name); | |
| 44 | + data.setJsonData(jsonData); | |
| 45 | + archiveDataServicer.saveArchiveData(data); | |
| 46 | + writeString(response,"success"); | |
| 47 | + } | |
| 48 | + | |
| 49 | +} |