Преглед изворни кода

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

zd_123 пре 7 година
родитељ
комит
ac9b35a620
16 измењених фајлова са 459 додато и 79 уклоњено
  1. 15 20
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientAimBloodSugger.java
  2. 6 3
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientAimSports.java
  3. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/TrackPatientDao.java
  4. 71 12
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java
  5. 132 24
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheme/DoctorSchemeService.java
  6. 3 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  7. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  8. 23 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/CommonUtil.java
  9. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java
  10. 3 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java
  11. 23 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/scheme/DoctroSchemeController.java
  12. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java
  13. 27 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/booking/PatientBookingController.java
  14. 34 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java
  15. 107 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/scheme/PatientSchemeController.java
  16. 8 0
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

+ 15 - 20
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientAimBloodSugger.java

@ -15,16 +15,16 @@ import java.util.Date;
@Entity
@Table(name = "wlyy_patient_aim_blood_sugger")
public class PatientAimBloodSugger extends IdEntity {
    private String code;
    private String patientcode;
    private String fbg;
    private String hpg;
    private String minimum;
    private String fbgMin;
    private String hpgMin;
    private String unit;
    private Date createTime;
    @Basic
    @Column(name = "code")
    public String getCode() {
        return code;
    }
@ -33,8 +33,6 @@ public class PatientAimBloodSugger extends IdEntity {
        this.code = code;
    }
    @Basic
    @Column(name = "patientcode")
    public String getPatientcode() {
        return patientcode;
    }
@ -43,8 +41,6 @@ public class PatientAimBloodSugger extends IdEntity {
        this.patientcode = patientcode;
    }
    @Basic
    @Column(name = "fbg")
    public String getFbg() {
        return fbg;
    }
@ -53,8 +49,6 @@ public class PatientAimBloodSugger extends IdEntity {
        this.fbg = fbg;
    }
    @Basic
    @Column(name = "hpg")
    public String getHpg() {
        return hpg;
    }
@ -63,18 +57,22 @@ public class PatientAimBloodSugger extends IdEntity {
        this.hpg = hpg;
    }
    @Basic
    @Column(name = "minimum")
    public String getMinimum() {
        return minimum;
    public String getHpgMin() {
        return hpgMin;
    }
    public void setHpgMin(String hpgMin) {
        this.hpgMin = hpgMin;
    }
    public void setMinimum(String minimum) {
        this.minimum = minimum;
    public String getFbgMin() {
        return fbgMin;
    }
    public void setFbgMin(String fbgMin) {
        this.fbgMin = fbgMin;
    }
    @Basic
    @Column(name = "unit")
    public String getUnit() {
        return unit;
    }
@ -83,8 +81,6 @@ public class PatientAimBloodSugger extends IdEntity {
        this.unit = unit;
    }
    @Basic
    @Column(name = "create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
@ -93,5 +89,4 @@ public class PatientAimBloodSugger extends IdEntity {
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 6 - 3
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientAimSports.java

@ -1,9 +1,11 @@
package com.yihu.wlyy.entity.patient;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;
/**
 * 患者监测目标-运动
@ -18,7 +20,7 @@ public class PatientAimSports extends IdEntity {
    private Integer dailyStepCount;     //运动步数
    private String bmiMax;              //bmi标准上限
    private String bmiMin;              //bmi标准下线
    private Timestamp createTime;       //创建时间
    private Date createTime;       //创建时间
    @Basic
@ -73,11 +75,12 @@ public class PatientAimSports extends IdEntity {
    @Basic
    @Column(name = "create_time")
    public Timestamp getCreateTime() {
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Timestamp createTime) {
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/TrackPatientDao.java

@ -13,5 +13,5 @@ public interface TrackPatientDao extends PagingAndSortingRepository<TrackPatient
    public TrackPatient findByDoctorCodeAndPatientCode(String doctorCode,String patientCode);
    public List<TrackPatient> findByDoctorCodeAndTeamCode(String doctorCode,Integer teamCode);
    public List<TrackPatient> findByDoctorCodeAndTeamCodeAndDel(String doctorCode,Integer teamCode,String del);
}

+ 71 - 12
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -8,6 +8,7 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.QrcodeUtil;
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -46,13 +47,17 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    
    @Autowired
    private com.yihu.wlyy.util.CommonUtil CommonUtil;
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    @Value("${neiwang.enable}")
    private Boolean isneiwang = false;  //如果不是内网项目要转到到内网wlyy在上传
    private static Object obj = new Object();
    private static Object obj2 = new Object();
    @Value("${fastDFS.fastdfs_file_url}")
    String fastdfs_file_url;
    //获取居民端取药码列表
    public  JSONArray findByStatusAndTime(Integer timeType, String patientCode, Integer status, Integer page, Integer pagesize,Integer type) {
        // 分页信息
@ -172,12 +177,39 @@ public class PrescriptionDispensaryCodeService extends BaseService {
            }
        }
        // 生成二维码
//        InputStream ipt = QrcodeUtil.createQrcode(Base64.encode(code.getBytes()),300,"png");
        InputStream ipt = QrcodeUtil.createQrcode(code,300,"png");
        ObjectNode imgNode = FastDFSUtil.upload(ipt,"png","QRCode_"+System.currentTimeMillis());
//        Prescription类  取药类型:1 自取 2快递配送 3健管师配送
        String fileUrl = fastdfs_file_url + imgNode.get("groupName").toString().replaceAll("\"","")
                + "/" + imgNode.get("remoteFileName").toString().replaceAll("\"","");
    
        String fileUrl = "";
    
        if (isneiwang) {
            // 圖片列表
            List<String> tempPaths = new ArrayList<String>();
            try {
                ObjectNode imgNode = FastDFSUtil.upload(ipt,"png","QRCode_"+System.currentTimeMillis());
                com.alibaba.fastjson.JSONObject json = com.alibaba.fastjson.JSONObject.parseObject(imgNode.toString());
                tempPaths.add(json.getString("fid"));
                String urls = "";
                for (String image : tempPaths) {
                    if (urls.length() == 0) {
                        urls = image;
                    } else {
                        urls += "," + image;
                    }
                }
                fileUrl = fastdfs_file_url + urls;
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            try {
                fileUrl = fastdfs_file_url + CommonUtil.PrescriptionQRCodetoNeiWang(ipt);
            }catch (Exception e){
                e.printStackTrace();
            }
            
        }
        //新增居民处方取码记录
        PrescriptionDispensaryCode prescriptionDispensaryCode = new PrescriptionDispensaryCode();
@ -205,12 +237,39 @@ public class PrescriptionDispensaryCodeService extends BaseService {
        //String jgsID= "";//配送员用户ID后4位
//        String jgsCode = code+"1234";//code+jgsID.substring(jgsID.length()-4);
        // 生成二维码
//        InputStream ipt = QrcodeUtil.createQrcode(Base64.encode(jgsCode.getBytes()),300,"png");
        InputStream ipt = QrcodeUtil.createQrcode(jgsCode,300,"png");
        ObjectNode imgNode = FastDFSUtil.upload(ipt,"png","QRCode_"+System.currentTimeMillis());
        InputStream ipt = QrcodeUtil.createQrcode(code,300,"png");
//        Prescription类  取药类型:1 自取 2快递配送 3健管师配送
        String fileUrl = fastdfs_file_url + imgNode.get("groupName").toString().replaceAll("\"","")
                + "/" + imgNode.get("remoteFileName").toString().replaceAll("\"","");
    
        String fileUrl = "";
    
        if (isneiwang) {
            // 圖片列表
            List<String> tempPaths = new ArrayList<String>();
            try {
                ObjectNode imgNode = FastDFSUtil.upload(ipt,"png","QRCode_"+System.currentTimeMillis());
                com.alibaba.fastjson.JSONObject json = com.alibaba.fastjson.JSONObject.parseObject(imgNode.toString());
                tempPaths.add(json.getString("fid"));
                String urls = "";
                for (String image : tempPaths) {
                    if (urls.length() == 0) {
                        urls = image;
                    } else {
                        urls += "," + image;
                    }
                }
                fileUrl = fastdfs_file_url + urls;
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            try {
                fileUrl = fastdfs_file_url + CommonUtil.PrescriptionQRCodetoNeiWang(ipt);
            }catch (Exception e){
                e.printStackTrace();
            }
        
        }
        //新增配送员处方取码记录
        PrescriptionDispensaryCode prescriptionDispensaryCode = new PrescriptionDispensaryCode();
        prescriptionDispensaryCode.setCode(jgsCode);

+ 132 - 24
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheme/DoctorSchemeService.java

@ -14,6 +14,7 @@ import com.yihu.wlyy.entity.patient.*;
import com.yihu.wlyy.entity.patient.vo.PatientVO;
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.doctor.*;
import com.yihu.wlyy.repository.patient.PatientAimSportsDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.TrackPatientDao;
import com.yihu.wlyy.repository.patient.scheme.PatientSchemeListDao;
@ -43,6 +44,7 @@ import java.util.*;
 * @date 2017/9/13 15:46
 */
@Service
@Transactional
public class DoctorSchemeService extends BaseService{
    private static Logger logger = LoggerFactory.getLogger(DoctorSchemeService.class);
@ -79,6 +81,9 @@ public class DoctorSchemeService extends BaseService{
    @Autowired
    private TrackPatientDao trackPatientDao;
    @Autowired
    private PatientAimSportsDao patientAimSportsDao;
    @Value("${im.data_base_name}")
    private String im_dataBase_name;
@ -99,7 +104,7 @@ public class DoctorSchemeService extends BaseService{
        //1.4.2加入跟踪居民过滤
        if(StringUtils.isNotBlank(trackFlag)&&"1".equals(trackFlag)){
            sql = sql + " JOIN wlyy_track_patient tp ON tp.patientCode = p.code ";
            sql = sql + " JOIN wlyy_track_patient tp ON tp.patient_code = p.code ";
        }
        if(-1 != deviceType){
@ -136,7 +141,7 @@ public class DoctorSchemeService extends BaseService{
        //1.4.2加入跟踪居民过滤
        if(StringUtils.isNotBlank(trackFlag)&&"1".equals(trackFlag)){
            sql = sql + "pt.del='1' AND pt.doctor_code = '"+doctorcode+"' AND pt.teamCode = "+teamCode;
            sql = sql + " AND tp.del='1' AND tp.doctor_code = '"+doctorcode+"' AND tp.team_code = "+teamCode;
        }
@ -564,7 +569,7 @@ public class DoctorSchemeService extends BaseService{
        }
        //1.4.2 重点关注居民
        List<TrackPatient> list = trackPatientDao.findByDoctorCodeAndTeamCode(doctorcode,Integer.parseInt(teamCode));
        List<TrackPatient> list = trackPatientDao.findByDoctorCodeAndTeamCodeAndDel(doctorcode,Integer.parseInt(teamCode),"1");
        if(list!=null&&list.size()>0){
            result.put("trackPatientCount",list.size());
        }else{
@ -737,13 +742,13 @@ public class DoctorSchemeService extends BaseService{
                rs.put("highCount",h.get("highCount"));
            }
            //2.正常
            List<Map<String,Object>> std = jdbcTemplate.queryForList(pStdSql);
            List<Map<String,Object>> std = jdbcTemplate.queryForList(stdSql);
            if(std!=null&&std.size()>0){
                Map<String,Object> st = std.get(0);
                rs.put("stdCount",st.get("stdCount"));
            }
            //3.偏低
            List<Map<String,Object>> low = jdbcTemplate.queryForList(pLowSql);
            List<Map<String,Object>> low = jdbcTemplate.queryForList(lowSql);
            if(low!=null&&low.size()>0){
                Map<String,Object> lw = low.get(0);
                rs.put("lowCount",lw.get("lowCount"));
@ -757,13 +762,13 @@ public class DoctorSchemeService extends BaseService{
                rs.put("highCount",h.get("highCount"));
            }
            //2.正常
            List<Map<String,Object>> std = jdbcTemplate.queryForList(stdSql);
            List<Map<String,Object>> std = jdbcTemplate.queryForList(pStdSql);
            if(std!=null&&std.size()>0){
                Map<String,Object> st = std.get(0);
                rs.put("stdCount",st.get("stdCount"));
            }
            //3.偏低
            List<Map<String,Object>> low = jdbcTemplate.queryForList(lowSql);
            List<Map<String,Object>> low = jdbcTemplate.queryForList(pLowSql);
            if(low!=null&&low.size()>0){
                Map<String,Object> lw = low.get(0);
                rs.put("lowCount",lw.get("lowCount"));
@ -918,13 +923,13 @@ public class DoctorSchemeService extends BaseService{
                rs.put("highCount",h.get("highCount"));
            }
            //2.正常
            List<Map<String,Object>> std = jdbcTemplate.queryForList(pStdSql);
            List<Map<String,Object>> std = jdbcTemplate.queryForList(stdSql);
            if(std!=null&&std.size()>0){
                Map<String,Object> st = std.get(0);
                rs.put("stdCount",st.get("stdCount"));
            }
            //3.偏低
            List<Map<String,Object>> low = jdbcTemplate.queryForList(pLowSql);
            List<Map<String,Object>> low = jdbcTemplate.queryForList(lowSql);
            if(low!=null&&low.size()>0){
                Map<String,Object> lw = low.get(0);
                rs.put("lowCount",lw.get("lowCount"));
@ -938,13 +943,13 @@ public class DoctorSchemeService extends BaseService{
                rs.put("highCount",h.get("highCount"));
            }
            //2.正常
            List<Map<String,Object>> std = jdbcTemplate.queryForList(stdSql);
            List<Map<String,Object>> std = jdbcTemplate.queryForList(pStdSql);
            if(std!=null&&std.size()>0){
                Map<String,Object> st = std.get(0);
                rs.put("stdCount",st.get("stdCount"));
            }
            //3.偏低
            List<Map<String,Object>> low = jdbcTemplate.queryForList(lowSql);
            List<Map<String,Object>> low = jdbcTemplate.queryForList(pLowSql);
            if(low!=null&&low.size()>0){
                Map<String,Object> lw = low.get(0);
                rs.put("lowCount",lw.get("lowCount"));
@ -972,16 +977,18 @@ public class DoctorSchemeService extends BaseService{
                " ORDER BY " +
                " i.record_date DESC LIMIT 1,1";
        String xtSchSql="SELECT " +
                " l.id " +
                " l.*," +
                " s.name " +
                " FROM " +
                " wlyy_patient_scheme_list l " +
                " wlyy_patient_scheme_list l JOIN wlyy_doctor_scheme_blood_sugger s ON s.code = l.schemecode  " +
                " WHERE " +
                " l.type = 1 " +
                " AND l.patientcode = '"+patient+"'";
        String xySchSql="SELECT " +
                " l.id " +
                " l.*," +
                " s.name " +
                " FROM " +
                " wlyy_patient_scheme_list l " +
                " wlyy_patient_scheme_list l JOIN wlyy_doctor_scheme_blood_pressure s ON s.code = l.schemecode" +
                " WHERE " +
                " l.type = 2 " +
                " AND l.patientcode = '"+patient+"'";
@ -996,16 +1003,16 @@ public class DoctorSchemeService extends BaseService{
        List<Map<String,Object>> xtList = jdbcTemplate.queryForList(xtSchSql);
        if(xtList!=null&&xtList.size()>0){
            rs.put("sugger","1");
            rs.put("sugger",xtList.get(0));
        }else{
            rs.put("sugger","0");
            rs.put("sugger",null);
        }
        List<Map<String,Object>> xyList = jdbcTemplate.queryForList(xySchSql);
        if(xyList!=null&&xyList.size()>0){
            rs.put("pressure","1");
            rs.put("pressure",xyList.get(0));
        }else{
            rs.put("pressure","0");
            rs.put("pressure",null);
        }
        return  rs;
@ -1017,8 +1024,10 @@ public class DoctorSchemeService extends BaseService{
        Map<String,Object> rs = new HashedMap();
        PatientAimBloodSugger patientAimBloodSugger =  patientAimBloodSuggerDao.findByPatientcode(patient);
        PatientAimBloodPressure patientAimBloodPressure = patientAimBloodPressureDao.findByPatientcode(patient);
        PatientAimSports patientAimSports = patientAimSportsDao.getPatientAimSportsByPatientCode(patient);
        rs.put("patientAimBloodSugger",patientAimBloodSugger);
        rs.put("patientAimBloodPressure",patientAimBloodPressure);
        rs.put("patientAimSports",patientAimSports);
        return rs;
    }
@ -1066,7 +1075,7 @@ public class DoctorSchemeService extends BaseService{
    }
    public Map<String,Object> getTrackPatientCountTitle(Integer teamCode,String doctor,String startDate,String endDate){
        List<TrackPatient> trackPatients = trackPatientDao.findByDoctorCodeAndTeamCode(doctor,teamCode);
        List<TrackPatient> trackPatients = trackPatientDao.findByDoctorCodeAndTeamCodeAndDel(doctor,teamCode,"1");
        Map<String,Object> rs = new HashedMap();
        rs.put("trackPatientCount",trackPatients.size());
        String sql = "SELECT " +
@ -1076,7 +1085,7 @@ public class DoctorSchemeService extends BaseService{
                " WHERE " +
                " t.del='1' " +
                " AND t.doctor_code = '"+doctor+"' " +
                " AND t.team_code = '"+teamCode+"' " +
                " AND t.team_code = "+teamCode +
                " AND t.create_time >= '"+startDate+"' " +
                " AND t.create_time <= '"+endDate+"'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
@ -1090,7 +1099,7 @@ public class DoctorSchemeService extends BaseService{
    }
    public  Map<String,Object> getTrackPatientServerCount(Long teamCode,String patient,String doctor,String startDate,String endDate){
    public  Map<String,Object> getTrackPatientServerCount(Long teamCode,String doctor,String startDate,String endDate){
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
@ -1146,7 +1155,7 @@ public class DoctorSchemeService extends BaseService{
                " )c ON c.id = m.doctor_code " +
                " WHERE " +
                " m.team_id = "  + id+
                " m.doctor_code ='"+doctor+"'" ;
                " AND m.doctor_code ='"+doctor+"'" ;
        //获取咨詢數
        Map<String, Object> consultCout = jdbcTemplate.queryForMap(consult_sql);
        if (consultCout.get("consultCount") == null) {
@ -1403,23 +1412,122 @@ public class DoctorSchemeService extends BaseService{
        return rs;
    }
    public String setPatientAim(String patients ,String suggerJson,String presJson){
    public String setSinglePatientAim(String patient ,String suggerJson,String presJson,String sportJson ){
        PatientAimBloodSugger sugger = patientAimBloodSuggerDao.findByPatientcode(patient);
        if(sugger!=null){
            patientAimBloodSuggerDao.delete(sugger);
        }
        PatientAimBloodPressure pres = patientAimBloodPressureDao.findByPatientcode(patient);
        if(pres!=null){
            patientAimBloodPressureDao.delete(pres);
        }
        PatientAimSports sport = patientAimSportsDao.getPatientAimSportsByPatientCode(patient);
        if(sport!=null){
            patientAimSportsDao.delete(sport);
        }
        net.sf.json.JSONObject sj  = net.sf.json.JSONObject.fromObject(suggerJson);
        net.sf.json.JSONObject pj  = net.sf.json.JSONObject.fromObject(presJson);
        net.sf.json.JSONObject spj  = net.sf.json.JSONObject.fromObject(sportJson);
        PatientAimBloodSugger patientAimBloodSugger = (PatientAimBloodSugger)net.sf.json.JSONObject.toBean(sj,PatientAimBloodSugger.class);
        PatientAimBloodPressure patientAimBloodPressure = (PatientAimBloodPressure)net.sf.json.JSONObject.toBean(pj,PatientAimBloodPressure.class);
        PatientAimSports patientAimSports = (PatientAimSports)net.sf.json.JSONObject.toBean(spj,PatientAimSports.class);
        patientAimBloodSugger.setPatientcode(patient);
        patientAimBloodSugger.setCode(getCode());
        patientAimBloodSugger.setCreateTime(new Date());
        patientAimBloodSuggerDao.save(patientAimBloodSugger);
        patientAimBloodPressure.setPatientcode(patient);
        patientAimBloodPressure.setCode(getCode());
        patientAimBloodPressure.setCreateTime(new Date());
        patientAimBloodPressureDao.save(patientAimBloodPressure);
        patientAimSports.setPatientcode(patient);
        patientAimSports.setCode(getCode());
        patientAimSports.setCreateTime(new Date());
        patientAimSportsDao.save(patientAimSports);
        return "1";
    }
    public String setPatientAim(String patients ,String suggerJson,String presJson,String sportJson){
        if(StringUtils.isNotBlank(patients)){
            String[] patient = patients.split(",");
            for(String p : patient){
                PatientAimBloodSugger sugger = patientAimBloodSuggerDao.findByPatientcode(p);
                if(sugger!=null){
                    patientAimBloodSuggerDao.delete(sugger);
                }
                PatientAimBloodPressure pres = patientAimBloodPressureDao.findByPatientcode(p);
                if(pres!=null){
                    patientAimBloodPressureDao.delete(pres);
                }
                PatientAimSports sport = patientAimSportsDao.getPatientAimSportsByPatientCode(p);
                if(sport!=null){
                    patientAimSportsDao.delete(sport);
                }
                net.sf.json.JSONObject sj  = net.sf.json.JSONObject.fromObject(suggerJson);
                net.sf.json.JSONObject pj  = net.sf.json.JSONObject.fromObject(presJson);
                net.sf.json.JSONObject spj  = net.sf.json.JSONObject.fromObject(sportJson);
                PatientAimBloodSugger patientAimBloodSugger = (PatientAimBloodSugger)net.sf.json.JSONObject.toBean(sj,PatientAimBloodSugger.class);
                PatientAimBloodPressure patientAimBloodPressure = (PatientAimBloodPressure)net.sf.json.JSONObject.toBean(pj,PatientAimBloodPressure.class);
                PatientAimSports patientAimSports = (PatientAimSports)net.sf.json.JSONObject.toBean(spj,PatientAimSports.class);
                patientAimBloodSugger.setPatientcode(p);
                patientAimBloodSugger.setCode(getCode());
                patientAimBloodSugger.setCreateTime(new Date());
                patientAimBloodSuggerDao.save(patientAimBloodSugger);
                patientAimBloodPressure.setPatientcode(p);
                patientAimBloodPressure.setCode(getCode());
                patientAimBloodPressure.setCreateTime(new Date());
                patientAimBloodPressureDao.save(patientAimBloodPressure);
                patientAimSports.setPatientcode(p);
                patientAimSports.setCode(getCode());
                patientAimSports.setCreateTime(new Date());
                patientAimSportsDao.save(patientAimSports);
            }
        }
        return "0";
    }
    public List<Map<String,Object>> getPatientScheme(String patient,String type){
        String sql =null;
        if("1".equals(type)){
            sql =  "SELECT " +
                    " s.* " +
                    " FROM " +
                    " wlyy_patient_scheme_list l " +
                    " JOIN wlyy_doctor_scheme_blood_sugger s ON s. CODE = l.schemecode " +
                    " WHERE " +
                    " l.type = 1  " +
                    " AND l.patientcode='"+patient+"'" +
                    " ORDER BY s.dayofweek ASC";
        }else{
            sql =  "SELECT " +
                    " s.* " +
                    " FROM " +
                    " wlyy_patient_scheme_list l " +
                    " JOIN wlyy_doctor_scheme_blood_pressure s ON s. CODE = l.schemecode " +
                    " WHERE " +
                    " l.type = 2 " +
                    " AND l.patientcode='"+patient+"'" +
                    " ORDER BY s.dayofweek ASC";
        }
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
}

+ 3 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -862,6 +862,7 @@ public class SignWebService extends BaseService {
        Long adminTeamId = null;
        String doctorHealth = null;
        String doctor = null;
        JSONObject resultObject = new JSONObject();
        //先查找续签表有没有记录
        List<SignFamilyRenew> renews = signFamilyRenewDao.findByTeamCodeIsValid(teamCode, code);
@ -888,6 +889,7 @@ public class SignWebService extends BaseService {
            adminTeamId = signFamily.getAdminTeamId();
            doctorHealth = signFamily.getDoctorHealth();
            doctor = signFamily.getDoctor();
            resultObject.put("expensesStatus", signFamily.getExpensesStatus());
        } else {
            SignFamilyRenew renew = renews.get(0);
@ -895,12 +897,9 @@ public class SignWebService extends BaseService {
            adminTeamId = renew.getAdminTeamId();
            doctorHealth = renew.getDoctorHealth();
            doctor = renew.getDoctor();
            resultObject.put("expensesStatus",renew.getExpensesStatus() );
        }
//        Patient p = patientService.findByCode(patientCode);
        JSONObject resultObject = new JSONObject();
        AdminTeam adminTeam = adminTeamService.getTeam(adminTeamId);
        //查找到团队领导
        Doctor leader = doctorService.findDoctorByCode(adminTeam.getLeaderCode());

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -1229,9 +1229,9 @@ public class JMJkEduArticleService extends BaseService {
            heapm.setLevel2Type(article.getString("secondLevelCategoryId"));
            heapm.setLevel(article.getString("articlelevel"));
//            heapm.setAllCount(heapm.getAllCount() + one.getPatients().size());
            heapm.setBrowseNumbere(Integer.valueOf(article.getString("browseNumber")));//文章浏览数
            heapm.setCommentNumber(Integer.valueOf(article.getString("commentNumber")));//文章评论数
            heapm.setPointNumber(Integer.valueOf(article.getString("pointNumber")));//文章点赞数
            heapm.setBrowseNumbere(Integer.valueOf(article.containsKey("browseNumber")?article.getString("browseNumber"):"0"));//文章浏览数
            heapm.setCommentNumber(Integer.valueOf(article.containsKey("commentNumber")?article.getString("commentNumber"):"0"));//文章评论数
            heapm.setPointNumber(Integer.valueOf(article.containsKey("pointNumber")?article.getString("pointNumber"):"0"));//文章点赞数
            heapm.setArticleCover(article.getString("articleCover"));//封面
            heapm.setComputeTime(computeTime(article.getString("insertTime")));
            heapm.setOperatorName(article.getString("operatorName"));

+ 23 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/CommonUtil.java

@ -590,4 +590,27 @@ public class CommonUtil {
        System.out.println("aaa,aaa,".substring(0,"aaa,aaa,".length()-2));
    }
    
    
    /**
     * 长处方生成取药码,生成取药二维码
     * 如果是外网那是发送到内网的服务器
     * @param ipt
     * @return
     */
    public String PrescriptionQRCodetoNeiWang(InputStream ipt) throws FileNotFoundException {
        String filename = "QRCode_"+System.currentTimeMillis();
        String fileUrls = "";
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        String returnStr = request(request, ipt,filename );
        logger.info("returnStr :" + returnStr);
        logger.info("fileName :" + filename);
        logger.info("result :" + returnStr.toString());
        if (returnStr != null) {
            //1.3.7去掉前缀
            fileUrls += returnStr+",";
        }
        
        return fileUrls.substring(0,fileUrls.length()-1);
    }
}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java

@ -577,8 +577,8 @@ public class FileUploadController extends BaseController {
                return error(-1, "上传失败");
            }
        } else {
            String result  = CommonUtil.toNeiWang(request, response);
            logger.info("fastDFSImag reslt :" + result);
//            String result  = CommonUtil.toNeiWang(request, response);
//            logger.info("fastDFSImag reslt :" + result);
            return CommonUtil.toNeiWang(request, response);
        }
    }

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -151,6 +151,7 @@ public class SignPatientLabelInfoController extends BaseController {
    @RequestMapping(value = "/setTrackPatient", method = RequestMethod.POST)
    @ApiOperation("设置居民重点关注")
    @ObserverRequired
    public String setTrackPatient(@ApiParam(name="patient",value="患者Code")@RequestParam(required = true)String patient,
                                  @ApiParam(name="state",value="1开启,0删除")@RequestParam(required = true)String state){
@ -161,6 +162,7 @@ public class SignPatientLabelInfoController extends BaseController {
            }
            return write(200, "查询成功", "data", rs);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -877,7 +879,7 @@ public class SignPatientLabelInfoController extends BaseController {
            @ApiParam(name="startdate", value="体征数据开始时间yyyy-mm-dd hh:mm:ss") @RequestParam(value = "startdate",required = false,defaultValue = "2017-9-10 00:00:00")  String startdate,
            @ApiParam(name="enddate", value="体征数据结束时间yyyy-mm-dd hh:mm:ss") @RequestParam(value = "enddate",required = false,defaultValue = "2017-9-16 23:59:59")  String enddate){
        try {
            com.alibaba.fastjson.JSONObject result = doctorSchemeService.getSlowDiseaseTeaminfos(teamCode,getcolor,getstands,gethealthindex,startdate,enddate,getUID());
            com.alibaba.fastjson.JSONObject result = doctorSchemeService.getSlowDiseaseTeaminfos(teamCode,getcolor,getstands,gethealthindex,startdate,enddate,"xh1D2017031503333");
            return write(200, "查询成功", "data", result);
        }catch (Exception e){
            //日志文件中记录异常信息

+ 23 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/scheme/DoctroSchemeController.java

@ -209,7 +209,7 @@ public class DoctroSchemeController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value="setDoctorSwitchTrackPatient",method = RequestMethod.GET)
    @RequestMapping(value="setDoctorSwitchTrackPatient",method = RequestMethod.POST)
    @ApiOperation("医生跟踪预警居民开关接口")
    @ObserverRequired
    public String setDoctorSwitchTrackPatient(@ApiParam(name="state", value="0不自动跟踪居民,1自动跟踪预警居民") @RequestParam(value = "state",required = true)String state){
@ -252,11 +252,10 @@ public class DoctroSchemeController extends BaseController {
    @RequestMapping(value="getTrackPatientServerCount",method = RequestMethod.GET)
    @ApiOperation("团队医生下,居民近一周服务情况接口")
    public String getTrackPatientServerCount(@ApiParam(name="teamCode", value="团队ID") @RequestParam(value = "teamCode",required = true)Long teamCode,
                                             @ApiParam(name="patient", value="居民Code") @RequestParam(value = "patient",required = true)String patient,
                                             @ApiParam(name="startDate", value="开始时间") @RequestParam(value = "startDate",required = true)String startDate,
                                             @ApiParam(name="endDate", value="结束时间") @RequestParam(value = "endDate",required = true)String endDate){
        try {
            return write(200, "查询成功", "data",doctorSchemeService.getTrackPatientServerCount(teamCode,patient,getUID(),startDate,endDate));
            return write(200, "查询成功", "data",doctorSchemeService.getTrackPatientServerCount(teamCode,getUID(),startDate,endDate));
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果
@ -266,8 +265,7 @@ public class DoctroSchemeController extends BaseController {
    @RequestMapping(value="getPatientHealthIndexByTeam",method = RequestMethod.GET)
    @ApiOperation("获取医生团队最近一周血糖情况/血压情况")
    public String getPatientHealthIndexByTeam(@ApiParam(name="patient", value="居民code") @RequestParam(value = "patient",required = true) String patient,
                                        @ApiParam(name="startDate", value="开始时间,YYYY-MM-dd") @RequestParam(value = "startDate",required = true)String startDate,
    public String getPatientHealthIndexByTeam(@ApiParam(name="startDate", value="开始时间,YYYY-MM-dd") @RequestParam(value = "startDate",required = true)String startDate,
                                        @ApiParam(name="endDate", value="结束时间,YYYY-MM-dd") @RequestParam(value = "endDate",required = true)String endDate,
                                        @ApiParam(name="type", value="0血糖,1.血压") @RequestParam(value = "type",required = true)String type,
                                        @ApiParam(name="teamCode", value="团队code") @RequestParam(value = "teamCode",required = true)Long teamCode){
@ -305,13 +303,15 @@ public class DoctroSchemeController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value="setPatientAim",method = RequestMethod.GET)
    @RequestMapping(value="setPatientAim",method = RequestMethod.POST)
    @ApiOperation("批量控制目标设置")
    @ObserverRequired
    public String setPatientAim(@ApiParam(name="patient", value="患者code,用“,”分割") @RequestParam(value = "patient",required = true)String patient,
                                @ApiParam(name="suggerJson", value="血糖目标实体") @RequestParam(value = "suggerJson",required = true)String suggerJson,
                                @ApiParam(name="pressureJson", value="血压目标实体") @RequestParam(value = "pressureJson",required = true)String pressureJson){
                                @ApiParam(name="pressureJson", value="血压目标实体") @RequestParam(value = "pressureJson",required = true)String pressureJson,
                                @ApiParam(name="sportJson", value="运动目标实体") @RequestParam(value = "sportJson",required = true)String sportJson){
        try {
            return write(200, "操作成功", "data",doctorSchemeService.setPatientAim(patient,suggerJson,pressureJson));
            return write(200, "操作成功", "data",doctorSchemeService.setPatientAim(patient,suggerJson,pressureJson,sportJson));
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果
@ -319,5 +319,20 @@ public class DoctroSchemeController extends BaseController {
        }
    }
    @RequestMapping(value="setSinglePatientAim",method = RequestMethod.POST)
    @ApiOperation("批量控制目标设置")
    @ObserverRequired
    public String setSinglePatientAim(@ApiParam(name="patient", value="患者code") @RequestParam(value = "patient",required = true)String patient,
                                      @ApiParam(name="suggerJson", value="血糖目标实体") @RequestParam(value = "suggerJson",required = true)String suggerJson,
                                      @ApiParam(name="pressureJson", value="血压目标实体") @RequestParam(value = "pressureJson",required = true)String pressureJson,
                                      @ApiParam(name="sportJson", value="运动目标实体") @RequestParam(value = "sportJson",required = true)String sportJson){
        try {
            return write(200, "操作成功", "data",doctorSchemeService.setSinglePatientAim(patient,suggerJson,pressureJson,sportJson));
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "操作失败");
        }
    }
}

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

@ -779,6 +779,7 @@ public class PatientController extends WeixinBaseController {
                json.put("street", temp.getStreet());        // 设置街道
                json.put("streetName", temp.getStreetName());// 设置街道名称
                json.put("address", temp.getAddress());// 设置地址
                json.put("medicareNumber",temp.getMedicareNumber());
                return write(200, "患者信息查询成功!", "data", json);
            } else {
                return error(-1, "患者信息查询失败!");

+ 27 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/booking/PatientBookingController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.patient.booking;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientReservation;
import com.yihu.wlyy.service.app.reservation.PatientReservationService;
@ -129,4 +130,30 @@ public class PatientBookingController extends WeixinBaseController{
            return error(-1, e.getMessage());
        }
    }
    
    //-----------------计划免疫预约相关接口--------------START
    
    @RequestMapping(value = "getChildrenInfo", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("根据条形编码获取儿童信息")
    public String getChildrenInfo (@ApiParam(name = "barCode", value = "条形编码", defaultValue = "")
                                   @RequestParam(value = "barCode", required = true) String barCode){
    
        try{
            return "";
//            String
////            PatientReservation obj = patientReservationService.findById(orderId);
//            if(obj != null){
//
//            }else{
//                return error(-1, "该条码对应的儿童信息不存在");
//            }
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    
    //-----------------计划免疫预约相关接口--------------END
}

+ 34 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java

@ -204,7 +204,12 @@ public class FamilyMemberController extends WeixinBaseController {
            } else  {
                result = familyMemberService.getPatientFamilyMembers(getUID(), "",null);
            }
            return write(200, "查询成功", "data", result);
            
            JSONObject data = new JSONObject();
            data.put("normalmembers",result);//家人关系
            data.put("immunemembers","");//免疫关系
            
            return write(200, "查询成功", "data", data);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
@ -456,4 +461,32 @@ public class FamilyMemberController extends WeixinBaseController {
        String loginPassword = MD5.GetMD5Code(pw + "1");
        return write(200,loginPassword);
    }
    
    @RequestMapping(value = "/addImmuneMenberByBarCode", method = RequestMethod.POST)
    @ApiOperation(value = "根据儿童编码绑定家人免疫关系")
    public String addImmuneMenberByBarCode(@ApiParam(name = "barCode", value = "条形编码", defaultValue = "")
                                        @RequestParam(value = "barCode", required = true) String barCode){
        try {
            
            int result = 0;
            
            if(result==0){
                return error(-1, "不能添加自己");
            }else if(result==-1){
                return error(-1, "居民信息查询失败");
            }else if(result==-2){
                return error(-1, "该成员未注册");
            }else if (result == -4) {
                return error(-1, "该家庭成员已存在");
            }else if(result==-5){
                return error(-1, "该家庭关系已存在成员");
            }else if(result ==2) {
                return write(200, "拒绝成功");
            }else{
                return write(200, "添加成功");
            }
        } catch (Exception e) {
            return error(-1, "绑定失败");
        }
    }
}

+ 107 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/scheme/PatientSchemeController.java

@ -0,0 +1,107 @@
package com.yihu.wlyy.web.patient.scheme;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.app.scheme.DoctorSchemeService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
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;
/**
 * Created by Trick on 2018/1/9.
 */
@RestController
@RequestMapping(value = "/patient/scheme")
@Api(description = "患者端-监测方案相关接口")
public class PatientSchemeController extends BaseController {
    @Autowired
    private SignPatientLabelInfoService labelInfoService;
    @Autowired
    private DoctorSchemeService doctorSchemeService;
    @RequestMapping(value = "/patient",method = RequestMethod.GET)
    @ApiOperation("查询居民信息")
    public String getPatient(String patient) {
        try {
            if (StringUtils.isEmpty(patient)) {
                return error(-1, "居民不能为空");
            }
            JSONObject p = labelInfoService.getPatient(getUID(),null);
            return write(200, "查询成功", "data", p);
        } catch (Exception e) {
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value="getPatientHealthIndex",method = RequestMethod.GET)
    @ApiOperation("获取最近一周血糖情况/血压情况")
    public String getPatientHealthIndex(@ApiParam(name="startDate", value="开始时间,YYYY-MM-dd") @RequestParam(value = "startDate",required = true)String startDate,
                                        @ApiParam(name="endDate", value="结束时间,YYYY-MM-dd") @RequestParam(value = "endDate",required = true)String endDate,
                                        @ApiParam(name="type", value="0血糖,1.血压") @RequestParam(value = "type",required = true)String type){
        try {
            return write(200, "查询成功", "data",doctorSchemeService.getPatientHealthIndex(getUID(),startDate, endDate, type));
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value="getTrackPatientInfo",method = RequestMethod.GET)
    @ApiOperation("获取:微信运动,身高体重,血糖监测方案,血压监测方案")
    public String getTrackPatientInfo(){
        try {
            return write(200, "查询成功", "data",doctorSchemeService.getTrackPatientInfo(getUID()));
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value="getControlObjectives",method = RequestMethod.GET)
    @ApiOperation("获取控制目标,血压,血糖")
    public String getControlObjectives(){
        try {
            return write(200, "查询成功", "data",doctorSchemeService.getControlObjectives(getUID()));
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value="getBodyInfo",method = RequestMethod.GET)
    @ApiOperation("获取身高体重详情列表")
    public String getBodyInfo(@ApiParam(name="startDate", value="开始时间,YYYY-MM-dd") @RequestParam(value = "startDate",required = true)String startDate,
                              @ApiParam(name="endDate", value="结束时间,YYYY—MM-dd") @RequestParam(value = "endDate",required = true)String endDate,
                              @ApiParam(name="page", value="起始页") @RequestParam(value = "page",required = true)Integer page,
                              @ApiParam(name="size", value="每页大小") @RequestParam(value = "size",required = true)Integer size){
        try {
            return write(200, "查询成功", "data",doctorSchemeService.getBodyInfo(getUID(),startDate,endDate,page,size));
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value="getPatientScheme",method = RequestMethod.GET)
    @ApiOperation("获取患者监控计划")
    public String getPatientScheme(@ApiParam(name="type", value="1血糖,2血压") @RequestParam(value = "type",required = true)String type){
        try {
            return write(200, "查询成功", "data",doctorSchemeService.getPatientScheme(getUID(),type));
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败");
        }
    }
}

+ 8 - 0
patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

@ -133,3 +133,11 @@ activemq:
neiwang:
  enable: false
  wlyy: http://59.61.92.90:8072/
#解决swagger 通过nginx代理之后curl显示localhost的问题
springfox:
  documentation:
    swagger:
      v2:
        host: 27.155.100.191
        path: /swagger/api-docs