diff --git a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBoneDao.java b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBoneDao.java new file mode 100644 index 0000000..a429093 --- /dev/null +++ b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBoneDao.java @@ -0,0 +1,20 @@ +package com.lyms.platform.biz.dal; + +import com.lyms.platform.common.dao.operator.MongoQuery; +import com.lyms.platform.pojo.BoneModel; + +import java.util.List; + +/** + * Created by Administrator on 2020/2/22. + */ +public interface IBoneDao { + + List queryBoneList(MongoQuery query); + + int queryBoneListCount(MongoQuery mongoQuery); + + void addBone(BoneModel model); + + void updateBone(MongoQuery mongoQuery, BoneModel model); +} diff --git a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BoneDao.java b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BoneDao.java new file mode 100644 index 0000000..22253e7 --- /dev/null +++ b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BoneDao.java @@ -0,0 +1,35 @@ +package com.lyms.platform.biz.dal.impl; + +import com.lyms.platform.biz.dal.IBoneDao; +import com.lyms.platform.common.dao.BaseMongoDAOImpl; +import com.lyms.platform.common.dao.operator.MongoQuery; +import com.lyms.platform.pojo.BoneModel; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * Created by Administrator on 2018-01-10. + */ +@Repository("boneDao") +public class BoneDao extends BaseMongoDAOImpl implements IBoneDao { + @Override + public List queryBoneList(MongoQuery query) { + return find(query.convertToMongoQuery()); + } + + @Override + public int queryBoneListCount(MongoQuery mongoQuery) { + return (int)count(mongoQuery.convertToMongoQuery()); + } + + @Override + public void addBone(BoneModel model) { + save(model); + } + + @Override + public void updateBone(MongoQuery mongoQuery,BoneModel model) { + update(mongoQuery.convertToMongoQuery(),model); + } +} diff --git a/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BoneService.java b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BoneService.java new file mode 100644 index 0000000..219865e --- /dev/null +++ b/platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BoneService.java @@ -0,0 +1,55 @@ +package com.lyms.platform.biz.service; + +import com.lyms.platform.biz.dal.IBoneDao; +import com.lyms.platform.common.dao.operator.MongoCondition; +import com.lyms.platform.common.dao.operator.MongoOper; +import com.lyms.platform.common.dao.operator.MongoQuery; +import com.lyms.platform.pojo.BoneModel; +import com.lyms.platform.query.BoneQuery; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * Created by Administrator on 2019-10-14. + */ +@Service +public class BoneService { + @Autowired + private IBoneDao BoneDao; + + public List queryBoneList(BoneQuery BoneQuery) { + + MongoQuery query = BoneQuery.convertToQuery(); + if (StringUtils.isNotEmpty(BoneQuery.getNeed())) { + BoneQuery.mysqlBuild(BoneDao.queryBoneListCount(query)); + query.start(BoneQuery.getOffset()).end(BoneQuery.getLimit()); + } + query.addOrder(Sort.Direction.DESC, StringUtils.isNotEmpty(BoneQuery.getSort()) ? BoneQuery.getSort() : "created"); + + + return BoneDao.queryBoneList(query); + } + + + public BoneModel queryOneBone(BoneQuery BoneQuery) { + List list = queryBoneList(BoneQuery); + if (CollectionUtils.isNotEmpty(list)) + { + return list.get(0); + } + return null; + } + + public void update(BoneModel model) { + BoneDao.updateBone(new MongoQuery(new MongoCondition("id", model.getId(), MongoOper.IS)), model); + } + + public void add(BoneModel model) { + BoneDao.addBone(model); + } +} diff --git a/platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java b/platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java index 15137c4..c47f680 100644 --- a/platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java +++ b/platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java @@ -91,6 +91,7 @@ public enum SerialIdEnum { ModularFunctionConfigModel("ModularFunctionConfigModel", 97531039991L), BabySieveModel("BabySieveModel", 97531049991L), MicroelementModel("MicroelementModel", 97321049991L), + BoneModel("BoneModel", 97321032991L), PostpartumRecords("PostpartumRecords", 97521049991L), QuestionModel("QuestionModel", 97521049991L), HealthChargeModel("HealthChargeModel", 97221049991L), diff --git a/platform-dal/src/main/java/com/lyms/platform/pojo/BoneModel.java b/platform-dal/src/main/java/com/lyms/platform/pojo/BoneModel.java new file mode 100644 index 0000000..a9f9c52 --- /dev/null +++ b/platform-dal/src/main/java/com/lyms/platform/pojo/BoneModel.java @@ -0,0 +1,227 @@ +package com.lyms.platform.pojo; + +import com.lyms.platform.beans.SerialIdEnum; +import com.lyms.platform.common.result.BaseModel; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.util.Date; + +/** + * 骨密度 + * + */ +@Document(collection = "lyms_bone") +public class BoneModel extends BaseModel { + + private static final long serialVersionUID = SerialIdEnum.BoneModel.getCid(); + + private String id; + + private String patientId; + + private String pid; + + //机构id + private String hospitalId; + + //末次月经 + private Date lastMenses; + + private Date birthday; + + private Date created; + + private Date modified; + + //测试位置 + private String position; + //平均值计算的便准差 + private Double sos; + private Double tvalue; + private Double zvalue; + + //骨质量指数 + private Double bqi; + + //骨折风险系数 + private Double rrf; + + //预发骨质疏松的年龄 + private Double eoa; + + //测量结果占峰值人群平均值百分比(声速值百分比) + private Double adultPercent; + + //测量结果占同性别同年龄人群平均值百分比(声速值百分比) + private Double agePercent; + + //骨生理年龄 + private Double age; + + + //0 孕前 1 儿童 + private Integer type; + + + private String cardNo; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getPatientId() { + return patientId; + } + + public void setPatientId(String patientId) { + this.patientId = patientId; + } + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getHospitalId() { + return hospitalId; + } + + public void setHospitalId(String hospitalId) { + this.hospitalId = hospitalId; + } + + public Date getLastMenses() { + return lastMenses; + } + + public void setLastMenses(Date lastMenses) { + this.lastMenses = lastMenses; + } + + public Date getBirthday() { + return birthday; + } + + public void setBirthday(Date birthday) { + this.birthday = birthday; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public Date getModified() { + return modified; + } + + public void setModified(Date modified) { + this.modified = modified; + } + + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + public Double getSos() { + return sos; + } + + public void setSos(Double sos) { + this.sos = sos; + } + + public Double getTvalue() { + return tvalue; + } + + public void setTvalue(Double tvalue) { + this.tvalue = tvalue; + } + + public Double getZvalue() { + return zvalue; + } + + public void setZvalue(Double zvalue) { + this.zvalue = zvalue; + } + + public Double getBqi() { + return bqi; + } + + public void setBqi(Double bqi) { + this.bqi = bqi; + } + + public Double getRrf() { + return rrf; + } + + public void setRrf(Double rrf) { + this.rrf = rrf; + } + + public Double getEoa() { + return eoa; + } + + public void setEoa(Double eoa) { + this.eoa = eoa; + } + + public Double getAdultPercent() { + return adultPercent; + } + + public void setAdultPercent(Double adultPercent) { + this.adultPercent = adultPercent; + } + + public Double getAgePercent() { + return agePercent; + } + + public void setAgePercent(Double agePercent) { + this.agePercent = agePercent; + } + + public Double getAge() { + return age; + } + + public void setAge(Double age) { + this.age = age; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getCardNo() { + return cardNo; + } + + public void setCardNo(String cardNo) { + this.cardNo = cardNo; + } +} diff --git a/platform-dal/src/main/java/com/lyms/platform/query/BoneQuery.java b/platform-dal/src/main/java/com/lyms/platform/query/BoneQuery.java new file mode 100644 index 0000000..d0682bb --- /dev/null +++ b/platform-dal/src/main/java/com/lyms/platform/query/BoneQuery.java @@ -0,0 +1,216 @@ +package com.lyms.platform.query; + +import com.lyms.platform.common.base.IConvertToNativeQuery; +import com.lyms.platform.common.dao.BaseQuery; +import com.lyms.platform.common.dao.operator.MongoCondition; +import com.lyms.platform.common.dao.operator.MongoOper; +import com.lyms.platform.common.dao.operator.MongoQuery; +import org.apache.commons.collections.CollectionUtils; +import org.springframework.data.mongodb.core.query.Criteria; + +import java.util.Date; +import java.util.List; + +/** + * Created by Administrator on 2016/6/21 0021. + */ +public class BoneQuery extends BaseQuery implements IConvertToNativeQuery { + + + private String id; + //创建时间 + private String hospitalId; + + private String patientId; + private List patientIds; + + private Integer type; + + private Date createdTimeStart; + + private Date createdTimeEnd; + + private Date modifiedStart; + + private Date modifiedEnd; + /** + * 生日 + */ + private Date birthStart; + /** + * 生日 + */ + private Date birthEnd; + + private String pid; + + private Date lastMensesStart; + private Date lastMensesEnd; + + + @Override + public MongoQuery convertToQuery() { + MongoCondition condition = MongoCondition.newInstance(); + + if (null != id) { + condition = condition.and("id", id, MongoOper.IS); + } + + + if (null != hospitalId) { + condition = condition.and("hospitalId", hospitalId, MongoOper.IS); + } + if (null != type) { + condition = condition.and("type", type, MongoOper.IS); + } + + if (null != pid) { + condition = condition.and("pid", pid, MongoOper.IS); + } + + if (CollectionUtils.isNotEmpty(patientIds)) { + condition = condition.and("patientId", patientIds, MongoOper.IN); + } + + Criteria c = null; + + + if (null != lastMensesStart && lastMensesEnd != null) { + if (null != c) { + c = c.where("lastMenses").gte(lastMensesStart).lte(lastMensesEnd); + } else { + c = Criteria.where("lastMenses").gte(lastMensesStart).lte(lastMensesEnd); + } + } + if (null != createdTimeStart && createdTimeEnd != null) { + if (null != c) { + c = c.where("created").gte(createdTimeStart).lte(createdTimeEnd); + } else { + c = Criteria.where("created").gte(createdTimeStart).lte(createdTimeEnd); + } + } + if (null != modifiedStart && modifiedEnd != null) { + if (null != c) { + c = c.where("modified").gte(modifiedStart).lte(modifiedEnd); + } else { + c = Criteria.where("modified").gte(modifiedStart).lte(modifiedEnd); + } + } + if (null != c) { + condition = condition.andCondition(new MongoCondition(c)); + } + return condition.toMongoQuery(); + } + + public Date getLastMensesEnd() { + return lastMensesEnd; + } + + public void setLastMensesEnd(Date lastMensesEnd) { + this.lastMensesEnd = lastMensesEnd; + } + + public Date getLastMensesStart() { + return lastMensesStart; + } + + public void setLastMensesStart(Date lastMensesStart) { + this.lastMensesStart = lastMensesStart; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public List getPatientIds() { + return patientIds; + } + + public void setPatientIds(List patientIds) { + this.patientIds = patientIds; + } + + public String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getHospitalId() { + return hospitalId; + } + + public void setHospitalId(String hospitalId) { + this.hospitalId = hospitalId; + } + + public String getPatientId() { + return patientId; + } + + public void setPatientId(String patientId) { + this.patientId = patientId; + } + + public Date getCreatedTimeStart() { + return createdTimeStart; + } + + public void setCreatedTimeStart(Date createdTimeStart) { + this.createdTimeStart = createdTimeStart; + } + + public Date getCreatedTimeEnd() { + return createdTimeEnd; + } + + public void setCreatedTimeEnd(Date createdTimeEnd) { + this.createdTimeEnd = createdTimeEnd; + } + + public Date getModifiedStart() { + return modifiedStart; + } + + public void setModifiedStart(Date modifiedStart) { + this.modifiedStart = modifiedStart; + } + + public Date getModifiedEnd() { + return modifiedEnd; + } + + public void setModifiedEnd(Date modifiedEnd) { + this.modifiedEnd = modifiedEnd; + } + + public Date getBirthStart() { + return birthStart; + } + + public void setBirthStart(Date birthStart) { + this.birthStart = birthStart; + } + + public Date getBirthEnd() { + return birthEnd; + } + + public void setBirthEnd(Date birthEnd) { + this.birthEnd = birthEnd; + } +} diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BoneController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BoneController.java new file mode 100644 index 0000000..3459f79 --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BoneController.java @@ -0,0 +1,83 @@ +package com.lyms.platform.operate.web.controller; + +import com.lyms.platform.common.annotation.TokenRequired; +import com.lyms.platform.common.base.BaseController; +import com.lyms.platform.common.result.BaseResponse; +import com.lyms.platform.operate.web.facade.BoneFacade; +import com.lyms.platform.pojo.BoneModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + + +/** + * 骨密度 + *

+ *

+ * Created by Administrator on 2016/6/15 0015. + */ +@Controller +public class BoneController extends BaseController { + + @Autowired + private BoneFacade BoneFacade; + + /** + * 添加骨密度 + * @param request + * @param BoneModel + * @return + */ + @ResponseBody + @RequestMapping(value = "/saveBone", method = RequestMethod.POST) + public BaseResponse saveBone(HttpServletRequest request, + @RequestBody BoneModel BoneModel) { + return BoneFacade.saveBone(BoneModel); + } + + + /** + * 骨密度报告 + * @param request + * @param httpServletResponse + * @param type + * @param id + * @return + */ + @ResponseBody + @RequestMapping(method = RequestMethod.GET, value = "/queryBoneReport/{type}/{doctorId}/{id}") + @TokenRequired + public BaseResponse queryBoneReport(HttpServletRequest request, HttpServletResponse httpServletResponse, + @PathVariable Integer type, + @PathVariable String doctorId, + @PathVariable String id) + { + return BoneFacade.queryBoneReport(type, doctorId, id, getUserId(request)); + } + + + /** + * 骨密度测量列表 + * @param request + * @return + */ + @TokenRequired + @ResponseBody + @RequestMapping(value = "/queryBoneList", method = RequestMethod.GET) + public BaseResponse queryAmniocentesisList(HttpServletRequest request, + @RequestParam(required = false) String queryNo, + @RequestParam(required = false) Integer weekStart, + @RequestParam(required = false) Integer weekEnd, + @RequestParam(required = false) Integer age, + @RequestParam(required = false) Integer type, + @RequestParam(required = true) Integer page, + @RequestParam(required = true) Integer limit, + @RequestParam(required = false) String vcCardNo) { + + return BoneFacade.queryBoneList(queryNo, weekStart, weekEnd, age, vcCardNo, type, page, limit, getUserId(request)); + + } +} \ No newline at end of file diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BoneFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BoneFacade.java new file mode 100644 index 0000000..018bce7 --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BoneFacade.java @@ -0,0 +1,178 @@ +package com.lyms.platform.operate.web.facade; + + +import com.lyms.platform.biz.service.BasicConfigService; +import com.lyms.platform.biz.service.BoneService; +import com.lyms.platform.biz.service.PatientsService; +import com.lyms.platform.common.constants.ErrorCodeConstants; +import com.lyms.platform.common.dao.BaseQuery; +import com.lyms.platform.common.enums.YnEnums; +import com.lyms.platform.common.result.BaseListResponse; +import com.lyms.platform.common.result.BaseObjectResponse; +import com.lyms.platform.common.result.BaseResponse; +import com.lyms.platform.common.utils.DateUtil; +import com.lyms.platform.operate.web.utils.FunvCommonUtil; +import com.lyms.platform.pojo.BoneModel; +import com.lyms.platform.pojo.Patients; +import com.lyms.platform.query.BoneQuery; +import com.lyms.platform.query.PatientsQuery; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.stereotype.Component; + +import java.util.*; + + +/** + * Created by Administrator on 2019-10-14. + */ +@Component +public class BoneFacade { + + @Autowired + private AutoMatchFacade autoMatchFacade; + + @Autowired + private BoneService BoneService; + + @Autowired + private BasicConfigService basicConfigService; + + @Autowired + private HealthChargeFacade healthChargeFacade; + + @Autowired + private PatientsService patientsService; + + @Autowired + private MongoTemplate mongoTemplate; + + public BaseResponse queryBoneList(String queryNo, Integer weekStart, Integer weekEnd, Integer age, String vcCardNo,Integer type ,Integer page, Integer limit, Integer userId) { + + + List dataList = new ArrayList(); + String hospitalId = autoMatchFacade.getHospitalId(userId); + PatientsQuery patientsQuery = new PatientsQuery(); + List patientses = null; + List patientIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(queryNo) ||StringUtils.isNotEmpty(vcCardNo) ) { + patientsQuery.setQueryNo(queryNo); + patientsQuery.setHospitalId(hospitalId); + patientsQuery.setVcCardNo(vcCardNo); + patientses = patientsService.queryPatient1(patientsQuery, "created"); + if (CollectionUtils.isEmpty(patientses)) + { + return new BaseListResponse().setData(dataList). + setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(new BaseQuery().getPageInfo()); + } + else + { + for (Patients pat : patientses) + { + patientIds.add(pat.getId()); + } + } + } + BoneQuery query = new BoneQuery(); + query.setLimit(limit); + query.setPage(page); + query.setHospitalId(hospitalId); + query.setPatientIds(patientIds); + query.setType(0); + query.setSort(" created "); + + if (age != null) + { + Date start = DateUtil.getBeforeAge(age); + Date end = DateUtil.getBeforeAge(age + 1); + query.setBirthStart(start); + query.setBirthEnd(end); + } + + if (weekStart != null && weekEnd != null) { + Date start = DateUtil.getWeekStart(weekStart); + Date end = DateUtil.getWeekEnd(weekEnd); + query.setLastMensesStart(start); + query.setLastMensesEnd(end); + } + + + List models = BoneService.queryBoneList(query); + if (CollectionUtils.isNotEmpty(models)) + { + for (BoneModel model : models) + { + Map data = new HashMap(); + Patients patients = patientsService.findOnePatientById(model.getPatientId()); + data.put("id",model.getId()); + data.put("userName",patients.getUsername()); + data.put("phone",patients.getPhone()); + data.put("vcCardNo",patients.getVcCardNo()); + data.put("cardNo",patients.getCardNo()); + data.put("age", DateUtil.getAge(patients.getBirth(), model.getCreated())); + data.put("week", DateUtil.getWeekDesc(patients.getLastMenses(), model.getCreated())); + data.put("created", DateUtil.getyyyy_MM_dd(model.getCreated())); + dataList.add(data); + + } + } + return new BaseListResponse().setData(dataList). + setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setPageInfo(query.getPageInfo()); + } + + public BaseResponse queryBoneReport(Integer type,String doctorId, String id, Integer userId) { + Map data = new HashMap(); + String hospitalId = autoMatchFacade.getHospitalId(userId); + + BoneQuery query = new BoneQuery(); + query.setType(type); + query.setId(id); + BoneModel model = BoneService.queryOneBone(query); + if (model != null) + { + Patients pat = patientsService.findOnePatientById(model.getPatientId()); + data.put("city", FunvCommonUtil.getBaseicConfigByid(pat.getCityRegisterId(), basicConfigService)); + data.put("area", FunvCommonUtil.getBaseicConfigByid(pat.getAreaRegisterId(), basicConfigService)); + data.put("userName",pat.getUsername()); + data.put("age", DateUtil.getAge(pat.getBirth(), model.getCreated())); + data.put("week", DateUtil.getWeekDesc(pat.getLastMenses(), model.getCreated())); + data.put("zvalue", model.getZvalue()); + data.put("tvalue", model.getTvalue()); + data.put("created", DateUtil.getyyyy_MM_dd(model.getCreated())); + Date lastMenses = DateUtil.addDay(pat.getLastMenses(),1); + int week = DateUtil.getWeek(lastMenses,model.getCreated()); + + } + + healthChargeFacade.addHealthCharge(hospitalId,8, model.getPatientId(), 1, 1, userId, doctorId, false); + return new BaseObjectResponse().setData(data). + setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); + } + + + public BaseResponse saveBone(BoneModel boneModel) { + PatientsQuery patientsQuery = new PatientsQuery(); + patientsQuery.setYn(YnEnums.YES.getId()); + patientsQuery.setType(1); + patientsQuery.setCardNo(boneModel.getCardNo()); + List patients = patientsService.queryPatient(patientsQuery); + if (CollectionUtils.isNotEmpty(patients)) + { + Patients pat = patients.get(0); + boneModel.setHospitalId(pat.getHospitalId()); + boneModel.setPatientId(pat.getId()); + boneModel.setPid(pat.getPid()); + boneModel.setBirthday(pat.getBirth()); + boneModel.setLastMenses(pat.getLastMenses()); + boneModel.setType(0); + boneModel.setCreated(new Date()); + boneModel.setModified(new Date()); + BoneService.add(boneModel); + } + + return new BaseResponse(). + setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); + } +} diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/HealthChargeFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/HealthChargeFacade.java index ed0e969..0eb95e7 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/HealthChargeFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/HealthChargeFacade.java @@ -57,7 +57,7 @@ public class HealthChargeFacade { * 新增字段:报表解读人 孕妇/儿童 * * @param hospitalId 医院id - * @param healthType 打印类型 1体重 2 血糖 3 血压 4妊高症 4-儿童膳食 6体成分分析 7 孕期微量元素 + * @param healthType 打印类型 1体重 2 血糖 3 血压 4妊高症 4-儿童膳食 6体成分分析 7 孕期微量元素 8孕期骨密度 * @param foreignId 档案id (院内建档或者临时档案id)孕妇/儿童 * @param type 打印报告类别 1普通报告 2高危报告(暂时不用) * @param source 档案来源类型 1院内建档 2零时建档 (暂时不用) diff --git a/platform-transfer/src/main/java/com/lyms/platform/conn/BaseConnection.java b/platform-transfer/src/main/java/com/lyms/platform/conn/BaseConnection.java new file mode 100644 index 0000000..33c3f7f --- /dev/null +++ b/platform-transfer/src/main/java/com/lyms/platform/conn/BaseConnection.java @@ -0,0 +1,46 @@ +package com.lyms.platform.conn; + +import java.sql.*; + +/** + * Created by Administrator on 2020-03-06. + */ +public class BaseConnection { + + + public static Connection getConnection(String path) + { + Connection conn = null; + try { + Class.forName("com.hxtt.sql.access.AccessDriver"); + String url = "jdbc:Access:///"+path; + conn = DriverManager.getConnection(url, "", ""); + } catch (Exception e) { + e.printStackTrace(); + } + return conn; + } + + public static void close(Connection conn, Statement sta, ResultSet rst) + { + try { + if (rst != null) + { + rst.close(); + } + if (sta != null) + { + sta.close(); + } + if (conn != null) + { + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + + + +} diff --git a/platform-transfer/src/main/java/com/lyms/platform/conn/BoneConnection.java b/platform-transfer/src/main/java/com/lyms/platform/conn/BoneConnection.java new file mode 100644 index 0000000..39ca48a --- /dev/null +++ b/platform-transfer/src/main/java/com/lyms/platform/conn/BoneConnection.java @@ -0,0 +1,21 @@ +package com.lyms.platform.conn; + +import com.lyms.platform.common.utils.PropertiesUtils; + +import java.sql.*; + +/** + * 骨密度连接 + */ +public class BoneConnection extends BaseConnection{ + + public static final String bone_path = PropertiesUtils.getPropertyValue("bone_path"); + + public static Connection getConnection() + { + Connection conn = getConnection(bone_path); + return conn; + } + + +} diff --git a/platform-transfer/src/main/java/com/lyms/platform/conn/MicroelementConnection.java b/platform-transfer/src/main/java/com/lyms/platform/conn/MicroelementConnection.java index b7aa851..93d4dbd 100644 --- a/platform-transfer/src/main/java/com/lyms/platform/conn/MicroelementConnection.java +++ b/platform-transfer/src/main/java/com/lyms/platform/conn/MicroelementConnection.java @@ -4,39 +4,16 @@ import com.lyms.platform.common.utils.PropertiesUtils; import java.sql.*; -public class MicroelementConnection { - public static final String mdb_path = PropertiesUtils.getPropertyValue("mdb_path"); +/** + * 微量元素连接 + */ +public class MicroelementConnection extends BaseConnection{ + + public static final String microelement_path = PropertiesUtils.getPropertyValue("microelement_path"); + public static Connection getConnection() { - Connection conn = null; - try { - Class.forName("com.hxtt.sql.access.AccessDriver"); - String url = "jdbc:Access:///"+mdb_path; - conn = DriverManager.getConnection(url, "", ""); - } catch (Exception e) { - e.printStackTrace(); - } + Connection conn = getConnection(microelement_path); return conn; } - - public static void close(Connection conn, Statement sta, ResultSet rst) - { - try { - if (rst != null) - { - rst.close(); - } - if (sta != null) - { - sta.close(); - } - if (conn != null) - { - conn.close(); - } - } catch (SQLException e) { - e.printStackTrace(); - } - } - } diff --git a/platform-transfer/src/main/java/com/lyms/platform/microelement/MicroelementWorker.java b/platform-transfer/src/main/java/com/lyms/platform/microelement/MicroelementWorker.java index bc4d97a..a393cbb 100644 --- a/platform-transfer/src/main/java/com/lyms/platform/microelement/MicroelementWorker.java +++ b/platform-transfer/src/main/java/com/lyms/platform/microelement/MicroelementWorker.java @@ -94,20 +94,17 @@ public class MicroelementWorker { } } - public static String autoTransfer( Map data) + public static String autoTransfer(Map data) { if (data != null && data.size() > 0) { String json = JsonUtil.obj2Str(data); System.out.println(json); - String result = HttpClientUtil.doPostSSL(url,json); + String result = HttpClientUtil.doPostSSL(url+"/saveMicroelement",json); System.out.println("http result= "+result); return result; } return ""; } -// public static void main(String[] args) { -// getMicroelementRecords(); -// } } diff --git a/platform-transfer/src/main/resources/config.properties b/platform-transfer/src/main/resources/config.properties index ed2a3c7..e86e3cf 100644 --- a/platform-transfer/src/main/resources/config.properties +++ b/platform-transfer/src/main/resources/config.properties @@ -1,2 +1,6 @@ -mdb_path=D://tc.mdb -url=https://dev-rp-api.healthbaby.com.cn/saveMicroelement \ No newline at end of file +#΢Ԫaccess· +microelement_path=D://tc.mdb +#ܶaccessݿ· +bone_path=D://tc.mdb +#ַ +url=https://dev-rp-api.healthbaby.com.cn \ No newline at end of file diff --git a/platform-transfer/src/main/resources/spring/applicationContext-quartz.xml b/platform-transfer/src/main/resources/spring/applicationContext-quartz.xml index ee58344..7c98cb4 100644 --- a/platform-transfer/src/main/resources/spring/applicationContext-quartz.xml +++ b/platform-transfer/src/main/resources/spring/applicationContext-quartz.xml @@ -10,8 +10,9 @@ http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"> - - + + + @@ -21,15 +22,34 @@ - + + + + + + + + + + + + + + + + + + + +