Explorar el Código

Merge branch 'dev' of chenweida/patient-co-management into dev

chenweida hace 8 años
padre
commit
4f5f28ef54

+ 0 - 20
patient-co-figure/src/main/java/com/yihu/figure/controller/DietController.java

@ -1,20 +0,0 @@
package com.yihu.figure.controller;
import com.yihu.figure.service.DietService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by chenweida on 2017/3/6.
 * 饮食
 */
@RestController
@RequestMapping(value = "/diet", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "饮食")
public class DietController {
    @Autowired
    private DietService dietService;
}

+ 46 - 1
patient-co-figure/src/main/java/com/yihu/figure/controller/DiseaseController.java

@ -2,9 +2,13 @@ package com.yihu.figure.controller;
import com.yihu.figure.service.DiseaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
@ -14,7 +18,48 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/disease", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "近期疾病")
public class DiseaseController {
public class DiseaseController extends BaseController{
    @Autowired
    private DiseaseService diseaseService;
    /**
     * 根据健康卡号抓取数据某个病人的全部就诊事件列表接口
     * /smjk/GetResidentEventListJson
     *
     * @param strSSID 健康卡号
     * @return
     */
    @ApiOperation(value = "根据健康卡号生成数据某个病人的全部就诊事件")
    @RequestMapping(value = "getResidentEventListJson", method = RequestMethod.GET)
    public String getResidentEventListJson(
            @ApiParam(name = "strSSID", value = "健康卡号", required = true) @RequestParam(value = "strSSID", required = true) String strSSID) {
        try {
             diseaseService.getResidentEventListJson(strSSID);
            return success("成功");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 根据健康卡号抓取数据某个病人的全部检查检验事件
     * /smjk/GetResidentEventListJson
     *
     * @param strSSID 健康卡号
     * @return
     */
    @ApiOperation(value = "根据健康卡号抓取数据某个病人的全部检查检验事件")
    @RequestMapping(value = "GetRecordListByCatalogcodesJson", method = RequestMethod.GET)
    public String GetRecordListByCatalogcodesJson(
            @ApiParam(name = "strSSID", value = "健康卡号", required = true) @RequestParam(value = "strSSID", required = true) String strSSID) {
        try {
            diseaseService.GetRecordListByCatalogcodesJson(strSSID); return success("成功");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
}

+ 0 - 20
patient-co-figure/src/main/java/com/yihu/figure/controller/MedicinalController.java

@ -1,20 +0,0 @@
package com.yihu.figure.controller;
import com.yihu.figure.service.MedicinalService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by chenweida on 2017/3/6.
 * 用药建议
 */
@RestController
@RequestMapping(value = "/medicinal", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "用药建议")
public class MedicinalController {
    @Autowired
    private MedicinalService medicinalService;
}

+ 0 - 20
patient-co-figure/src/main/java/com/yihu/figure/controller/SportsController.java

@ -1,20 +0,0 @@
package com.yihu.figure.controller;
import com.yihu.figure.service.SportsService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by chenweida on 2017/3/6.
 * 运动
 */
@RestController
@RequestMapping(value = "/sports", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "运动")
public class SportsController {
    @Autowired
    private SportsService sportsService;
}

+ 0 - 23
patient-co-figure/src/main/java/com/yihu/figure/dao/PatientDao.java

@ -1,23 +0,0 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.figure.dao;
import com.yihu.figure.model.Patient;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
    // 查询患者姓名
    @Query("select p.name from Patient p where p.code=?1 and p.status=1")
    String findNameByCode(String code);
}

+ 11 - 0
patient-co-figure/src/main/java/com/yihu/figure/dao/disease/InspectionDao.java

@ -0,0 +1,11 @@
package com.yihu.figure.dao.disease;
import com.yihu.figure.model.disease.Inspection;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/3/6.
 */
public interface InspectionDao extends PagingAndSortingRepository<Inspection, Long>, JpaSpecificationExecutor<Inspection> {
}

+ 11 - 0
patient-co-figure/src/main/java/com/yihu/figure/dao/disease/VisitDao.java

@ -0,0 +1,11 @@
package com.yihu.figure.dao.disease;
import com.yihu.figure.model.disease.Visit;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/3/6.
 */
public interface VisitDao extends PagingAndSortingRepository<Visit, Long>, JpaSpecificationExecutor<Visit> {
}

+ 0 - 343
patient-co-figure/src/main/java/com/yihu/figure/model/Patient.java

@ -1,343 +0,0 @@
package com.yihu.figure.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * 患者信息
 * @author George
 *
 */
@Entity
@Table(name = "wlyy_patient")
public class Patient extends IdEntity implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 8358924836164389434L;
	// 业务主键
	private String code;
	// 身份证号
	private String idcard;
	// 登录密码
	private String password;
	private String salt;
	// 姓名
	private String name;
	// 生日
	private Date birthday;
	// 性別,1男,2女
	private Integer sex;
	// 手機號
	private String mobile;
	// (基卫)手機號
	private String mobileRemarks;
	// 聯繫電話
	private String phone;
	// 社保卡號
	private String ssc;
	// 頭像HTTP地址
	private String photo;
	// 省代碼
	private String province;
	// 城市代碼
	private String city;
	// 區縣代碼
	private String town;
	// 街道代码
	private String street;
	// 省名
	private String provinceName;
	// 市名
	private String cityName;
	// 區縣名
	private String townName;
	// 街道名称
	private String streetName;
	// 地址
	private String address;
	// 疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病
	private Integer disease;
	// 病情:0绿标,1黄标,2红标
	private Integer diseaseCondition;
	// 病历记录总数
	private Integer recordAmount;
	// 總積分
	private Integer points;
	// 更新時間
	private Date czrq;
	// 微信编号
	private String openid;
	//微信时间
	private Date openidTime;
	// 用户状态:1正常,0禁用,-1恶意注册,2审核中
	private Integer status;
	public Patient() {
	}
	public Patient(Long id) {
		this.id = id;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getIdcard() {
		return idcard;
	}
	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getSalt() {
		return salt;
	}
	public void setSalt(String salt) {
		this.salt = salt;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public Integer getSex() {
		return sex;
	}
	public void setSex(Integer sex) {
		this.sex = sex;
	}
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getSsc() {
		return ssc;
	}
	public void setSsc(String ssc) {
		this.ssc = ssc;
	}
	@Column(name = "photo", insertable = false)
	public String getPhoto() {
		return photo;
	}
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getTown() {
		return town;
	}
	public void setTown(String town) {
		this.town = town;
	}
	public String getStreet() {
		return street;
	}
	public void setStreet(String street) {
		this.street = street;
	}
	@Column(name = "province_name")
	public String getProvinceName() {
		return provinceName;
	}
	public void setProvinceName(String provinceName) {
		this.provinceName = provinceName;
	}
	@Column(name = "city_name")
	public String getCityName() {
		return cityName;
	}
	public void setCityName(String cityName) {
		this.cityName = cityName;
	}
	@Column(name = "town_name")
	public String getTownName() {
		return townName;
	}
	public void setTownName(String townName) {
		this.townName = townName;
	}
	@Column(name = "street_name")
	public String getStreetName() {
		return streetName;
	}
	public void setStreetName(String streetName) {
		this.streetName = streetName;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public Integer getDisease() {
		return disease;
	}
	public void setDisease(Integer disease) {
		this.disease = disease;
	}
	@Column(name = "disease_condition")
	public Integer getDiseaseCondition() {
		return diseaseCondition;
	}
	public void setDiseaseCondition(Integer diseaseCondition) {
		this.diseaseCondition = diseaseCondition;
	}
	@Column(name = "record_amount")
	public Integer getRecordAmount() {
		return recordAmount;
	}
	public void setRecordAmount(Integer recordAmount) {
		this.recordAmount = recordAmount;
	}
	public Integer getPoints() {
		return points;
	}
	public void setPoints(Integer points) {
		this.points = points;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getCzrq() {
		return czrq;
	}
	public void setCzrq(Date czrq) {
		this.czrq = czrq;
	}
	public String getOpenid() {
		return openid;
	}
	public void setOpenid(String openid) {
		this.openid = openid;
	}
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public String getMobileRemarks() {
		return mobileRemarks;
	}
	public void setMobileRemarks(String mobileRemarks) {
		this.mobileRemarks = mobileRemarks;
	}
	public Date getOpenidTime() {
		return openidTime;
	}
	public void setOpenidTime(Date openidTime) {
		this.openidTime = openidTime;
	}
}

+ 124 - 0
patient-co-figure/src/main/java/com/yihu/figure/model/disease/Inspection.java

@ -0,0 +1,124 @@
package com.yihu.figure.model.disease;
import com.yihu.figure.model.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by chenweida on 2017/3/6.
 * 检查检验表
 */
@Entity
@Table(name = "figure_inspection")
public class Inspection extends IdEntity{
    private String serial;//'文档序号'
    private String item;//''检查项目名称''
    private Integer orgId;//'机构ID'
    private String catalogCode;//''档案类型''
    private Integer r;//''排序号''
    private Date endTime;//''事件时间''
    private String orgName;//''机构名称''
    private String unionssid;//'文档序号'
    private Date ehrCommitTime;//''提交时间''
    private String type;//''事件类型1门诊2住院3体检''
    private String event;//''事件号''
    private String xmanId;//
    public String getSerial() {
        return serial;
    }
    public void setSerial(String serial) {
        this.serial = serial;
    }
    public String getItem() {
        return item;
    }
    public void setItem(String item) {
        this.item = item;
    }
    public Integer getOrgId() {
        return orgId;
    }
    public void setOrgId(Integer orgId) {
        this.orgId = orgId;
    }
    public String getCatalogCode() {
        return catalogCode;
    }
    public void setCatalogCode(String catalogCode) {
        this.catalogCode = catalogCode;
    }
    public Integer getR() {
        return r;
    }
    public void setR(Integer r) {
        this.r = r;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public String getUnionssid() {
        return unionssid;
    }
    public void setUnionssid(String unionssid) {
        this.unionssid = unionssid;
    }
    public Date getEhrCommitTime() {
        return ehrCommitTime;
    }
    public void setEhrCommitTime(Date ehrCommitTime) {
        this.ehrCommitTime = ehrCommitTime;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getEvent() {
        return event;
    }
    public void setEvent(String event) {
        this.event = event;
    }
    public String getXmanId() {
        return xmanId;
    }
    public void setXmanId(String xmanId) {
        this.xmanId = xmanId;
    }
}

+ 88 - 0
patient-co-figure/src/main/java/com/yihu/figure/model/disease/Visit.java

@ -0,0 +1,88 @@
package com.yihu.figure.model.disease;
import com.yihu.figure.model.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by chenweida on 2017/3/6.
 * 就诊事件表
 */
@Entity
@Table(name = "figure_visit")
public class Visit extends IdEntity {
    private String diagnosis;//'主诊断名称'
    private Integer orgId;//'机构id'
    private String r;//''排序号''
    private Date endTime;//''事件时间''
    private String orgName;//'机构名称'
    private String type;//'事件类型1门诊2住院3体检',
    private String event;//''事件号''
    private String icdCode;// 主诊断编码
    public String getIcdCode() {
        return icdCode;
    }
    public void setIcdCode(String icdCode) {
        this.icdCode = icdCode;
    }
    public String getDiagnosis() {
        return diagnosis;
    }
    public void setDiagnosis(String diagnosis) {
        this.diagnosis = diagnosis;
    }
    public Integer getOrgId() {
        return orgId;
    }
    public void setOrgId(Integer orgId) {
        this.orgId = orgId;
    }
    public String getR() {
        return r;
    }
    public void setR(String r) {
        this.r = r;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getEvent() {
        return event;
    }
    public void setEvent(String event) {
        this.event = event;
    }
}

+ 0 - 10
patient-co-figure/src/main/java/com/yihu/figure/service/DietService.java

@ -1,10 +0,0 @@
package com.yihu.figure.service;
import org.springframework.stereotype.Service;
/**
 * Created by chenweida on 2017/3/6.
 */
@Service
public class DietService {
}

+ 101 - 0
patient-co-figure/src/main/java/com/yihu/figure/service/DiseaseService.java

@ -1,10 +1,111 @@
package com.yihu.figure.service;
import com.yihu.figure.dao.disease.InspectionDao;
import com.yihu.figure.dao.disease.VisitDao;
import com.yihu.figure.model.disease.Inspection;
import com.yihu.figure.model.disease.Visit;
import com.yihu.figure.util.DateUtil;
import com.yihu.figure.util.HttpClientUtil;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/3/6.
 */
@Service
public class DiseaseService {
    private String baseurl = "http://120.41.252.108:8181/figure/";
    @Autowired
    private VisitDao visitDao;
    @Autowired
    private InspectionDao inspectionDao;
    /**
     * 造就诊事件的数据
     *
     * @param strSSID
     */
    @Transactional
    public void getResidentEventListJson(String strSSID) {
        String url = baseurl + "data/getResidentEventListJson?strSSID=" + strSSID;
        String response = HttpClientUtil.get(url, "UTF-8");
        JSONObject obj = new JSONObject(response);
        if (obj.has("门诊")) {
            List<Visit> visits = new ArrayList<>();
            JSONArray ja = obj.getJSONArray("门诊");
            for (int i = 0; i < ja.length(); i++) {
                JSONObject jo = ja.getJSONObject(i);
                Visit visit = new Visit();
                visit.setDiagnosis(jo.getString("DIAGNOSIS"));
                visit.setEndTime(DateUtil.strToDate(jo.getString("END_TIME"),"yyyy-MM-dd HH:mm:ss"));
                visit.setEvent(jo.getString("EVENT"));
                visit.setOrgId(jo.getInt("ORG_ID"));
                visit.setOrgName(jo.getString("ORG_NAME"));
                visit.setR(jo.getInt("R")+"");
                visit.setType(jo.getInt("TYPE")+"");
                visit.setIcdCode(jo.getString("ICD_CODE"));
                visits.add(visit);
            }
            visitDao.save(visits);
        }
        if (obj.has("住院")) {
            List<Visit> visits = new ArrayList<>();
            JSONArray ja = obj.getJSONArray("住院");
            for (int i = 0; i < ja.length(); i++) {
                JSONObject jo = ja.getJSONObject(i);
                Visit visit = new Visit();
                visit.setDiagnosis(jo.getString("DIAGNOSIS"));
                visit.setEndTime(DateUtil.strToDate(jo.getString("END_TIME"),"yyyy-MM-dd HH:mm:ss"));
                visit.setEvent(jo.getString("EVENT"));
                visit.setOrgId(jo.getInt("ORG_ID"));
                visit.setOrgName(jo.getString("ORG_NAME"));
                visit.setR(jo.getInt("R")+"");
                visit.setType(jo.getInt("TYPE")+"");
                visit.setIcdCode(jo.getString("ICD_CODE"));
                visits.add(visit);
            }
            visitDao.save(visits);
        }
    }
    /**
     * 造检查检验的数据
     *
     * @param strSSID
     */
    @Transactional
    public void GetRecordListByCatalogcodesJson(String strSSID) {
        String url = baseurl + "data/GetRecordListByCatalogcodesJson?strSSID=" + strSSID;
        String response = HttpClientUtil.get(url, "UTF-8");
        JSONObject obj = new JSONObject(response);
        if (obj.has("检查")) {
            List<Inspection> inspections = new ArrayList<>();
            JSONArray ja = obj.getJSONArray("检查");
            for (int i = 0; i < ja.length(); i++) {
                JSONObject jo = ja.getJSONObject(i);
                Inspection inspection = new Inspection();
                inspection.setCatalogCode(jo.getString("CATALOG_CODE"));
                inspection.setEhrCommitTime(DateUtil.strToDate(jo.getString("EHR_COMMIT_TIME"),"yyyy-MM-dd HH:mm:ss"));
                inspection.setEndTime(DateUtil.strToDate(jo.getString("END_TIME"),"yyyy-MM-dd HH:mm:ss"));
                inspection.setEvent(jo.getString("EVENT"));
                inspection.setItem(jo.getString("ITEM"));
                inspection.setOrgId(jo.getInt("ORG_ID"));
                inspection.setOrgName(jo.getString("ORG_NAME"));
                inspection.setR(jo.getInt("R"));
                inspection.setSerial(jo.getString("SERIAL"));
                inspection.setType(jo.getString("TYPE"));
                inspection.setUnionssid(jo.getString("UNIONSSID"));
                inspection.setXmanId(jo.getString("XMAN_ID"));
                inspections.add(inspection);
            }
            inspectionDao.save(inspections);
        }
    }
}

+ 0 - 10
patient-co-figure/src/main/java/com/yihu/figure/service/MedicinalService.java

@ -1,10 +0,0 @@
package com.yihu.figure.service;
import org.springframework.stereotype.Service;
/**
 * Created by chenweida on 2017/3/6.
 */
@Service
public class MedicinalService {
}

+ 0 - 10
patient-co-figure/src/main/java/com/yihu/figure/service/SportsService.java

@ -1,10 +0,0 @@
package com.yihu.figure.service;
import org.springframework.stereotype.Service;
/**
 * Created by chenweida on 2017/3/6.
 */
@Service
public class SportsService {
}