Преглед на файлове

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

wujunjie преди 7 години
родител
ревизия
e573236ef6
променени са 36 файла, в които са добавени 1241 реда и са изтрити 328 реда
  1. 5 5
      common/common-entity/pom.xml
  2. 97 0
      common/common-entity/src/main/java/com/yihu/es/entity/MapDataDTO.java
  3. 170 144
      common/common-entity/src/main/java/com/yihu/wlyy/entity/device/PatientDevice.java
  4. 15 15
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/WlyyPatientDeviceController.java
  5. 10 6
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyPatientDeviceService.java
  6. 46 1
      patient-co-manage/wlyy-manage/src/main/resources/application.yml
  7. 0 1
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/patientDevice_list.jsp
  8. 0 1
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/patientDevice_list_js.jsp
  9. 3 3
      patient-co-service/wlyy_service/src/main/resources/application.yml
  10. 1 1
      patient-co/patient-co-wlyy-job/pom.xml
  11. 78 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/util/LatitudeUtils.java
  12. 32 0
      patient-co/patient-co-wlyy/doc/技术文档/es/体征地图新增索引
  13. 7 0
      patient-co/patient-co-wlyy/pom.xml
  14. 9 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/Application.java
  15. 6 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDeviceDao.java
  16. 6 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java
  17. 154 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheduling/DoctorWorkTimeService.java
  18. 74 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/team/AdminTeamService.java
  19. 3 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  20. 36 108
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/ImmuneService.java
  21. 187 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DesUtil.java
  22. 79 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/LatitudeUtils.java
  23. 62 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/PinYinUtil.java
  24. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java
  25. 97 25
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandingService.java
  26. 23 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java
  27. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  28. 4 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/team/AdminTeamController.java
  29. 19 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java
  30. 2 0
      patient-co/patient-co-wlyy/src/main/resources/application-dev.yml
  31. 3 1
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  32. 2 0
      patient-co/patient-co-wlyy/src/main/resources/application-local.yml
  33. 2 0
      patient-co/patient-co-wlyy/src/main/resources/application-localtest.yml
  34. 2 0
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml
  35. 2 0
      patient-co/patient-co-wlyy/src/main/resources/application-test.yml
  36. 1 1
      patient-co/patient-co-wlyy/src/main/resources/system.properties

+ 5 - 5
common/common-entity/pom.xml

@ -63,11 +63,11 @@
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.boot</groupId>-->
            <!--<artifactId>spring-boot-starter-data-elasticsearch</artifactId>-->
            <!--<version>1.3.5.RELEASE</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
            <version>1.3.5.RELEASE</version>
        </dependency>
    </dependencies>
</project>

+ 97 - 0
common/common-entity/src/main/java/com/yihu/es/entity/MapDataDTO.java

@ -0,0 +1,97 @@
package com.yihu.es.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.searchbox.annotations.JestId;
import org.springframework.data.elasticsearch.annotations.GeoPointField;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
import java.util.Date;
/**
 * Created by chenweida on 2018/2/12.
 */
public class MapDataDTO {
    @JestId
    private String id;
    private String idCard; //设备绑定身份证
    private String deviceSn;//设备SnID
    private Long deviceId;//设备ID 用于区分类型
    @GeoPointField
    private GeoPoint location;//经纬度
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ssXX")
    @JSONField(format = "yyyy-MM-dd'T'HH:mm:ssXX")
    private Date deviceTime;//设备版定数时间
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ssXX")
    @JSONField(format = "yyyy-MM-dd'T'HH:mm:ssXX")
    private Date createTime;  // 创建时间(ES:必填)
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getIdCard() {
        return idCard;
    }
    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    public Long getDeviceId() {
        return deviceId;
    }
    public void setDeviceId(Long deviceId) {
        this.deviceId = deviceId;
    }
    public GeoPoint getLocation() {
        return location;
    }
    public void setLocation(GeoPoint location) {
        this.location = location;
    }
    public Date getDeviceTime() {
        return deviceTime;
    }
    public void setDeviceTime(Date deviceTime) {
        this.deviceTime = deviceTime;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public void setLocation(Double lat, Double lng) {
        GeoPoint geoPoint = new GeoPoint(lat, lng);
        this.location = geoPoint;
    }
}

+ 170 - 144
common/common-entity/src/main/java/com/yihu/wlyy/entity/device/PatientDevice.java

@ -6,158 +6,184 @@ import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
@Entity
@Table(name = "wlyy_patient_device")
public class PatientDevice extends IdEntity {
	// 设备ID
	private Long deviceId;
	// 设备标识 1血糖仪,2.血压计
	private String deviceSn;
	//sim卡号
	private String sim;
	// 设备名称
	private String deviceName;
	// 用户code
	private String user;
	// 设备类型标识
	private String categoryCode;
	// 用户类型标准 -1代表单用户
	private String userType;
	// 用户身份证
	private String userIdcard;
	// 操作医生代码
	private String doctor;
	private String agent;//代绑人代码(家人)
	// 操作时间
	private Date czrq;
	///**
	// * 是否有效
	// * 1-已删除绑定
	// * 0-正常绑定
	// */
	//private int del;
	///**
	// * 删除人CODE
	// */
	//private String delUser;
    // 设备ID
    private Long deviceId;
    // 设备标识 1血糖仪,2.血压计
    private String deviceSn;
    //sim卡号
    private String sim;
    // 设备名称
    private String deviceName;
    // 用户code
    private String user;
    // 设备类型标识
    private String categoryCode;
    // 用户类型标准 -1代表单用户
    private String userType;
    // 用户身份证
    private String userIdcard;
    // 操作医生代码
    private String doctor;
    private String agent;//代绑人代码(家人)
    // 操作时间
    private Date czrq;
    //========================非表字段======================
    //患者居住地址
    private String address;
    ///**
    // * 是否有效
    // * 1-已删除绑定
    // * 0-正常绑定
    // */
    //private int del;
    ///**
    // * 删除人CODE
    // */
    //private String delUser;
    //
	//@Column(name="del_user")
	//public String getDelUser() {
	//	return delUser;
	//}
    //@Column(name="del_user")
    //public String getDelUser() {
    //	return delUser;
    //}
    //
	//public void setDelUser(String delUser) {
	//	this.delUser = delUser;
	//}
    //public void setDelUser(String delUser) {
    //	this.delUser = delUser;
    //}
    //
	//public int getDel() {
	//	return del;
	//}
    //public int getDel() {
    //	return del;
    //}
    //
	//public void setDel(int del) {
	//	this.del = del;
	//}
	@Column(name="device_id")
	public Long getDeviceId() {
		return deviceId;
	}
	public void setDeviceId(Long deviceId) {
		this.deviceId = deviceId;
	}
	@Column(name="device_sn")
	public String getDeviceSn() {
		return deviceSn;
	}
	public void setDeviceSn(String deviceSn) {
		this.deviceSn = deviceSn;
	}
	@Column(name="sim")
	public String getSim() {
		return sim;
	}
	public void setSim(String sim) {
		this.sim = sim;
	}
	@Column(name="device_name")
	public String getDeviceName() {
		return deviceName;
	}
	public void setDeviceName(String deviceName) {
		this.deviceName = deviceName;
	}
	@Column(name="user")
	public String getUser() {
		return user;
	}
	public void setUser(String user) {
		this.user = user;
	}
	@Column(name="category_code")
	public String getCategoryCode() {
		return categoryCode;
	}
	public void setCategoryCode(String categoryCode) {
		this.categoryCode = categoryCode;
	}
	@Column(name="user_type")
	public String getUserType() {
		return userType;
	}
	public void setUserType(String userType) {
		this.userType = userType;
	}
	@Column(name="user_idcard")
	public String getUserIdcard() {
		return userIdcard;
	}
	public void setUserIdcard(String userIdcard) {
		this.userIdcard = userIdcard;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	@Column(name="czrq")
	public Date getCzrq() {
		return czrq;
	}
	public void setCzrq(Date czrq) {
		this.czrq = czrq;
	}
	@Column(name="doctor")
	public String getDoctor() {
		return doctor;
	}
	public void setDoctor(String doctor) {
		this.doctor = doctor;
	}
	@Column(name="agent")
	public String getAgent() {
		return agent;
	}
	public void setAgent(String agent) {
		this.agent = agent;
	}
    //public void setDel(int del) {
    //	this.del = del;
    //}
    @Column(name = "device_id")
    public Long getDeviceId() {
        return deviceId;
    }
    public void setDeviceId(Long deviceId) {
        this.deviceId = deviceId;
    }
    @Column(name = "device_sn")
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    @Column(name = "sim")
    public String getSim() {
        return sim;
    }
    public void setSim(String sim) {
        this.sim = sim;
    }
    @Column(name = "device_name")
    public String getDeviceName() {
        return deviceName;
    }
    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }
    @Column(name = "user")
    public String getUser() {
        return user;
    }
    public void setUser(String user) {
        this.user = user;
    }
    @Column(name = "category_code")
    public String getCategoryCode() {
        return categoryCode;
    }
    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }
    @Column(name = "user_type")
    public String getUserType() {
        return userType;
    }
    public void setUserType(String userType) {
        this.userType = userType;
    }
    @Column(name = "user_idcard")
    public String getUserIdcard() {
        return userIdcard;
    }
    public void setUserIdcard(String userIdcard) {
        this.userIdcard = userIdcard;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "czrq")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "agent")
    public String getAgent() {
        return agent;
    }
    public void setAgent(String agent) {
        this.agent = agent;
    }
    @Transient
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public PatientDevice(String address, Date czrq, String userIdcard, String deviceSn, Long deviceId) {
        this.address = address;
        this.czrq = czrq;
        this.userIdcard = userIdcard;
        this.deviceSn = deviceSn;
        this.deviceId = deviceId;
    }
    public PatientDevice() {
    }
}

+ 15 - 15
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/WlyyPatientDeviceController.java

@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
@ -35,18 +36,6 @@ public class WlyyPatientDeviceController extends BaseController {
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String listPageInit(){
    
        String currentid = getUID();
    
        Doctor doctor = doctorService.findDoctorByCode(currentid);
    
        String hospitalCode = "";
        
        if(doctor != null){
            hospitalCode = doctor.getHospital();
        }
        
        request.setAttribute("hospitalCode",hospitalCode);
        
        return "device/patientDevice_list";
    }
@ -59,13 +48,24 @@ public class WlyyPatientDeviceController extends BaseController {
            @RequestParam(value = "deviceSn",required = false) String deviceSn,
            @RequestParam(value = "userName",required = false) String userName,
            @RequestParam(value = "doctorName",required = false) String doctorName,
            @RequestParam(value = "hospitalCode",required = false) String hospitalCode,
            @RequestParam(value = "hospitalName",required = false) String hospitalName,
            @RequestParam(value = "page") Integer page,
            @RequestParam(value = "rows") Integer pageSize){
            @RequestParam(value = "rows") Integer pageSize,
            HttpServletRequest req, HttpServletResponse resp){
        try {
    
            String currentid = req.getSession().getAttribute("code").toString();
    
            System.out.println("doctorid:"+currentid);
            
            
            Doctor doctor = doctorService.findDoctorByCode(currentid);
    
            String hospitalCode = "";
    
            if(doctor != null){
                System.out.println("doctor-hospitalCode:"+doctor.getHospital());
                hospitalCode = doctor.getHospital();
            }
            
            List<WlyyPatientDeviceVO> patientDevices = patientDeviceService.searchListNew(deviceName,categoryCode, deviceSn, userName, doctorName,hospitalName,hospitalCode,page, pageSize);
            Long totalcount = patientDeviceService.getCountSearchListNew(deviceName,categoryCode, deviceSn, userName, doctorName,hospitalName,hospitalCode);

+ 10 - 6
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyPatientDeviceService.java

@ -183,20 +183,22 @@ public class WlyyPatientDeviceService extends BaseJpaService<WlyyPatientDevice,W
                "ORDER BY czrq DESC ";
        
        sql = sql+" limit " + (page-1)*pageSize+", "+pageSize;
        System.out.println("list:"+sql);
        list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(WlyyPatientDeviceVO.class));
        return list ;
	}
    
    public Long getCountSearchListNew(String deviceName, String categoryCode, String deviceSn, String userName, String doctorName, String hospitalName,String hospitalCode) {
    
        String sql  = "SELECT count(d.id)" +
        String sql  = "SELECT count(d.id) " +
                "FROM " +
                "wlyy_sign_family s," +
                "wlyy_patient_device d," +
                "wlyy_patient p " +
                "WHERE s.patient=d.`user` ";
                " wlyy_sign_family s," +
                " wlyy_patient_device d," +
                " wlyy_patient p " +
                "WHERE " +
                " s.patient = d.`user` ";
        if(StringUtils.isNotBlank(hospitalName)){
            sql = sql + "AND s.hospital like '%"+hospitalName+"%' ";
            sql = sql + "AND s.hospital_name like '%"+hospitalName+"%' ";
        }
    
        if(StringUtils.isNotBlank(hospitalCode)){
@ -225,6 +227,8 @@ public class WlyyPatientDeviceService extends BaseJpaService<WlyyPatientDevice,W
    
        sql = sql +"AND s.`status`> 0 AND s.patient=p.CODE ";
    
        System.out.println("count:"+sql);
    
        Long total = jdbcTemplate.queryForObject(sql, Long.class);
    
        return total ;

+ 46 - 1
patient-co-manage/wlyy-manage/src/main/resources/application.yml

@ -44,7 +44,7 @@ spring:
  jpa:
    database-platform: org.hibernate.dialect.MySQL5Dialect
    hibernate.dialect: org.hibernate.dialect.MySQL5Dialect
    show-sql: true
    show-sql: false
    # REDIS
  redis:
    database: 0 # Database index used by the connection factory.
@ -141,6 +141,21 @@ Riva:
  RIVAED_KEY1: LUZ7TN3KOT8AWCD3ZA4NBMI5VNF7E50F6XYEP2WZM68JQYY5JE02L4L5FS9R4NGUGMHSCAPW9AL
  RIVAED_KEY2: C3SHUI8OWBOA4ZASS7FEYJ6RIVXA9SW6U5OA56ERUYZTRFHCRZO8AHT4TTW2MAGT80MGXN
es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_test3
    FollowUp: wlyy_followup
    Statistics: wlyy_quota_test
    QuestionnaireWinning: wlyy_questionnaire_winning
  type:
    HealthEduArticlePatient: health_edu_article_patient_test3
    FollowUpContent: wlyy_followup_content
    Statistics: wlyy_quota_test
    QuestionnaireWinning: wlyy_questionnaire_winning
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl
---
spring:
  profiles: test
@ -227,6 +242,21 @@ Riva:
  RIVAED_KEY1: LUZ7TN3KOT8AWCD3ZA4NBMI5VNF7E50F6XYEP2WZM68JQYY5JE02L4L5FS9R4NGUGMHSCAPW9AL
  RIVAED_KEY2: C3SHUI8OWBOA4ZASS7FEYJ6RIVXA9SW6U5OA56ERUYZTRFHCRZO8AHT4TTW2MAGT80MGXN
es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_test3
    FollowUp: wlyy_followup
    Statistics: wlyy_quota_test
    QuestionnaireWinning: wlyy_questionnaire_winning
  type:
    HealthEduArticlePatient: health_edu_article_patient_test3
    FollowUpContent: wlyy_followup_content
    Statistics: wlyy_quota_test
    QuestionnaireWinning: wlyy_questionnaire_winning
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl
---
spring:
  profiles: prod
@ -312,3 +342,18 @@ testPattern:
Riva:
  RIVAED_KEY1: LUZ7TN3KOT8AWCD3ZA4NBMI5VNF7E50F6XYEP2WZM68JQYY5JE02L4L5FS9R4NGUGMHSCAPW9AL
  RIVAED_KEY2: C3SHUI8OWBOA4ZASS7FEYJ6RIVXA9SW6U5OA56ERUYZTRFHCRZO8AHT4TTW2MAGT80MGXN
es:
  index:
    HealthEduArticlePatient: health_edu_article_patient
    Statistics: wlyy_quota_prod
    FollowUp: wlyy_followup
    QuestionnaireWinning: wlyy_questionnaire_winning
  type:
    HealthEduArticlePatient: health_edu_article_patient
    Statistics: wlyy_quota_prod
    FollowUpContent: wlyy_followup_content
    QuestionnaireWinning: wlyy_questionnaire_winning
  host:  http://59.61.92.90:9065,http://59.61.92.90:9067
  tHost: 59.61.92.90:9066,59.61.92.90:9068
  clusterName: jkzl

+ 0 - 1
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/patientDevice_list.jsp

@ -18,7 +18,6 @@
	<div class="m-retrieve-area f-h50 f-dn f-pr m-form-inline" data-role-form style='display: block;'>
		<div class="m-form-group f-mt10">
			<div class="m-form-control f-ml15">
				<input type="hidden" id="inp_hospital_code"value='${hospitalCode}' data-attr-scan="hospitalCode">
				<input type="text" id="inp_hospital_name" placeholder="请输入机构名称" class="f-ml10" data-attr-scan="hospitalName"/>
			</div>
			<div class="m-form-control f-ml15">

+ 0 - 1
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/patientDevice_list_js.jsp

@ -36,7 +36,6 @@
				$userName: $("#inp_user_name"),//人员姓名
                $doctorName: $("#inp_doctor_name"),//医生姓名
                $hosiptalName: $("#inp_hospital_name"),//社区名称
                $hosiptalCode: $("#hospitalCode"),//社区CODE
				init: function () {
					this.$element.show();
					this.$element.attrScan();

+ 3 - 3
patient-co-service/wlyy_service/src/main/resources/application.yml

@ -80,7 +80,7 @@ imm:
  credential: <root><org code="jkzl" /><visitor type="0" code="jkzl" key="jkzl" /></root>
zyapi:
  openCrypto: false
  openCrypto: true
#    i健康项目地址
wlyy:
  api: http://192.168.131.113:8081
@ -108,7 +108,7 @@ imm:
  credential: <root><org code="jkzl" /><visitor type="0" code="jkzl" key="jkzl" /></root>
zyapi:
  openCrypto: false
  openCrypto: true
#    i健康项目地址
wlyy:
  api: http://192.168.131.113:8081
@ -135,7 +135,7 @@ imm:
  credential: <root><org code="jkzl" /><visitor type="0" code="jkzl" key="jkzl" /></root>
zyapi:
  openCrypto: false
  openCrypto: true
#    i健康项目地址
wlyy:
  api: http://172.19.103.88:9092/wlyy

+ 1 - 1
patient-co/patient-co-wlyy-job/pom.xml

@ -474,7 +474,7 @@
                    <target>1.8</target>
                    <compilerArguments>
                        <verbose/>
                        <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
                        <bootclasspath>${java.home}/lib/rt.jar${path.separator}${java.home}/lib/jce.jar</bootclasspath>
                    </compilerArguments>
                </configuration>
                <version>3.1</version>

+ 78 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/util/LatitudeUtils.java

@ -0,0 +1,78 @@
package com.yihu.wlyy.util;
import org.apache.commons.lang.StringUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
public class LatitudeUtils {
    public static final String KEY_1 = "7d9fbeb43e975cd1e9477a7e5d5e192a";
    /**
     * 返回输入地址的经纬度坐标
     * key lng(经度),lat(纬度)
     */
    public static Map<String,String> getGeocoderLatitude(String address){
        BufferedReader in = null;
        try {
            //将地址转换成utf-8的16进制
            address = URLEncoder.encode(address, "UTF-8");
            URL tirc = new URL("http://api.map.baidu.com/geocoder?address="+ address +"&output=json&key="+ KEY_1);
            in = new BufferedReader(new InputStreamReader(tirc.openStream(),"UTF-8"));
            String res;
            StringBuilder sb = new StringBuilder("");
            while((res = in.readLine())!=null){
                sb.append(res.trim());
            }
            String str = sb.toString();
            Map<String,String> map = null;
            if(StringUtils.isNotEmpty(str)){
                int lngStart = str.indexOf("lng\":");
                int lngEnd = str.indexOf(",\"lat");
                int latEnd = str.indexOf("},\"precise");
                if(lngStart > 0 && lngEnd > 0 && latEnd > 0){
                    String lng = str.substring(lngStart+5, lngEnd);
                    String lat = str.substring(lngEnd+7, latEnd);
                    map = new HashMap<String,String>();
                    map.put("lng", lng);
                    map.put("lat", lat);
                    return map;
                }
            }
        }catch (Exception e) {
            e.printStackTrace();
        }finally{
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
    public static void main(String args[]){
        try {
            Map<String, String> json = LatitudeUtils.getGeocoderLatitude("浦东区张杨路1725号");
            System.out.println("经度 : " + json.get("lng"));
            System.out.println("纬度 : " + json.get("lat"));
        }catch (Exception e ){
            e.printStackTrace();
        }
    }
}

+ 32 - 0
patient-co/patient-co-wlyy/doc/技术文档/es/体征地图新增索引

@ -0,0 +1,32 @@
创建索引
POST  http://172.19.103.68:9200/wlyy_patient_device
查询索引
GET http://172.19.103.68:9200/wlyy_patient_device/
给索引加mapping
POST http://172.19.103.68:9200/wlyy_patient_device/wlyy_patient_device/_mapping
{
	"wlyy_patient_device": {
		"properties": {
			"createTime": {
				"type": "date"
			},
			"idCard": {
				"type": "string",
				"index": "not_analyzed"
			},
			"location": {
				"type": "geo_point"
			},
			"deviceTime": {
				"type": "date"
			},
			"deviceId": {
				"type": "long"
			},
			"deviceSn": {
				"type": "string",
				"index": "not_analyzed"
			}
		}
	}
}

+ 7 - 0
patient-co/patient-co-wlyy/pom.xml

@ -491,6 +491,13 @@
            <version>4.4.5</version>
        </dependency>
        <!--elasticsearch end-->
        <!--拼音https://mvnrepository.com/artifact/org.clojars.cbilson/pinyin4j-->
        <dependency>
            <groupId>org.clojars.cbilson</groupId>
            <artifactId>pinyin4j</artifactId>
            <version>2.5.0</version>
        </dependency>
        <!--拼音https://mvnrepository.com/artifact/org.clojars.cbilson/pinyin4j end-->
    </dependencies>
    <build>
        <finalName>wlyy</finalName>

+ 9 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/Application.java

@ -1,13 +1,22 @@
package com.yihu.wlyy;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration;
import org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration;
import org.springframework.context.ApplicationContext;
/**
 * Created by chenweida on 2017/7/28.
 */
@SpringBootApplication
@EnableAutoConfiguration(exclude = {
        ElasticsearchAutoConfiguration.class,
        ElasticsearchRepositoriesAutoConfiguration.class,
        ElasticsearchDataAutoConfiguration.class
})
public class Application {
    public static ApplicationContext ctx = null;

+ 6 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDeviceDao.java

@ -21,7 +21,7 @@ public interface PatientDeviceDao extends PagingAndSortingRepository<PatientDevi
    List<PatientDevice> findByPatient(String user);
    @Query("select a from PatientDevice a where a.user = ?1 and a.deviceSn=?2 ")
    List<PatientDevice> findByPatientAndDeviceSn(String user,String deviceSn);
    List<PatientDevice> findByPatientAndDeviceSn(String user, String deviceSn);
    List<PatientDevice> findByUser(String user, Pageable pageRequest);
@ -38,6 +38,10 @@ public interface PatientDeviceDao extends PagingAndSortingRepository<PatientDevi
    //更换患者绑定的血糖仪
    @Modifying
    @Query("update PatientDevice t set t.deviceSn = ?3 , t.userType = ?4,t.sim=?5 where t.user = ?1 and t.deviceSn = ?2 ")
    int updatePatientDevice(String user, String deviceSN, String newDeviceSN,String userType,String sim);
    int updatePatientDevice(String user, String deviceSN, String newDeviceSN, String userType, String sim);
    @Query("select new com.yihu.wlyy.entity.device.PatientDevice(p.address,a.czrq,a.userIdcard,a.deviceSn,a.deviceId) " +
            "from PatientDevice a,Patient p where a.userIdcard=p.idcard")
    List<PatientDevice> findWithArrdess();
}

+ 6 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -456,14 +456,14 @@ public class PrescriptionService extends BaseService {
                " p.create_time," +
                " GROUP_CONCAT(d.health_problem) AS health_problem," +
                " GROUP_CONCAT(d.health_problem_name) AS health_problem_name," +
                " a.total_amount" +
                " FORMAT(a.total_amount/100,1) AS total_amount" +
                " FROM" +
                " wlyy_prescription p" +
                " LEFT JOIN wlyy_prescription_diagnosis d ON p. CODE = d.prescription_code" +
                " LEFT JOIN wlyy_prescription_pay a ON p. CODE = a.prescription_code" +
                " WHERE" +
                " IF (" +
                " p. STATUS > 50," +
                " p. STATUS > 50 AND a.trade_status IS NOT NULL, " +
                " a.trade_status = 1," +
                " 1 = 1" +
                ")";
@ -530,7 +530,7 @@ public class PrescriptionService extends BaseService {
            }
        }
        DecimalFormat df = new DecimalFormat("#.0");
        jsonObject.put("totalAmount",totalAmount>0?df.format(totalAmount/100.0):0.0);
        jsonObject.put("totalAmount",totalAmount>0?df.format(totalAmount):0.0);
        sql += " limit ?,?";
        resultList = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
        jsonObject.put("list",resultList);
@ -554,13 +554,13 @@ public class PrescriptionService extends BaseService {
                " p.create_time," +
                " GROUP_CONCAT(d.health_problem) AS health_problem," +
                " GROUP_CONCAT(d.health_problem_name) AS health_problem_name,"+
                " a.total_amount"+
                " FORMAT(a.total_amount/100,1) AS total_amount"+
                " FROM" +
                " wlyy_prescription p" +
                " LEFT JOIN wlyy_prescription_diagnosis d ON p. CODE = d.prescription_code" +
                " LEFT JOIN wlyy_prescription_pay a ON p.code = a.prescription_code" +
                " WHERE" +
                " IF(p.status>50,a.trade_status=1,1=1) " ;
                " IF(p.status>50 AND a.trade_status IS NOT NULL,a.trade_status=1,1=1) " ;
        //判断关键字
        if (StringUtils.isNotBlank(keyWord)){
            sql += " AND (p.patient_name like '%"+keyWord+"%' or p.doctor_name like '%"+keyWord+"%')";
@ -575,7 +575,7 @@ public class PrescriptionService extends BaseService {
            }
        }
        DecimalFormat df = new DecimalFormat("#.0");
        jsonObject.put("totalAmount",totalAmount>0?df.format(totalAmount/100.0):0.0);
        jsonObject.put("totalAmount",totalAmount>0?df.format(totalAmount):0.0);
        sql+=" limit ?,?";
        int start = (pageNo-1)*pageSize;
        resultList = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});

+ 154 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheduling/DoctorWorkTimeService.java

@ -4,10 +4,12 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.schedule.DoctorFamousConsultTimesRemain;
import com.yihu.wlyy.entity.doctor.schedule.WlyyDoctorWorkTime;
import com.yihu.wlyy.entity.doctor.schedule.WlyyDoctorWorkWeek;
import com.yihu.wlyy.entity.message.MessageNoticeSetting;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorWorkTimeDao;
import com.yihu.wlyy.repository.doctor.DoctorWorkWeekDao;
import com.yihu.wlyy.repository.doctor.FamousDoctorTimesRemainDao;
import com.yihu.wlyy.repository.message.MessageNoticeSettingDao;
import com.yihu.wlyy.service.BaseService;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.eval.StringValueEval;
@ -39,6 +41,8 @@ public class DoctorWorkTimeService extends BaseService {
    private DoctorDao doctorDao;
    @Autowired
    private FamousDoctorTimesRemainDao timesRemainDao;
    @Autowired
    private MessageNoticeSettingDao messageNoticeSettingDao;
    @Transactional
    public void updateDoctorWorkTime(String doctorCode) {
@ -730,5 +734,155 @@ public class DoctorWorkTimeService extends BaseService {
        }
    }
    public JSONObject isDoctorWorkingWhenConsult(String doctor,String doctorHealth) throws Exception {
        JSONObject json = new JSONObject();
        Calendar calendar = Calendar.getInstance();
        int week = calendar.get(Calendar.DAY_OF_WEEK) - 1;
        if (week == 0) {
            week = 7;
        }
        //判断居民签约的全科医生是否关闭了"健康咨询在健管师邀请后参与"设置
        MessageNoticeSetting messageNoticeSetting = messageNoticeSettingDao.findByUserAndType(doctor,"1");
        if (messageNoticeSetting!=null){
            //健管师推荐开启
            if (messageNoticeSetting.getFamilyTopicSwitch()==1){
                JSONObject doctorJson = doctorWork(doctor,week,calendar);
                JSONObject doctorHealthJson = doctorWork(doctorHealth,week,calendar);
                String doctorStatus = doctorJson.getString("status");
                String doctorHealthStatus = doctorHealthJson.getString("status");
                //两个都不接受咨询时,无法咨询
                if ("0".equals(doctorStatus) && "0".equals(doctorHealthStatus)){
                    json.put("status", "0");
                    json.put("msg", "医生不接受咨询");
                }
                //两个其中有一个可以咨询时都可以咨询
                if ("1".equals(doctorStatus) || "1".equals(doctorHealthStatus)){
                    json.put("status", "1");
                    json.put("msg", "医生当前接受咨询");
                }
                //如果全科和健管师都不在时间范围
                if ("2".equals(doctorStatus) && "2".equals(doctorHealthStatus)){
                    json.put("status","2");
                    json.put("msg","全科医生和健管师当前都不在工作时间");
                }
                //健管师在工作时间,全科不在
                if ("2".equals(doctorStatus) && "1".equals(doctorHealthStatus)){
                    json.put("status","3");
                    json.put("msg","全科医生当前不在工作时间");
                }
                //全科在工作时间,健管师不在
                if ("1".equals(doctorStatus) && "2".equals(doctorHealthStatus)){
                    json.put("status","4");
                    json.put("msg","健管师当前不在工作时间");
                }
            }else {//健管师推荐关闭
                json = doctorWork(doctorHealth,week,calendar);
            }
        }
        return json;
    }
    /**
     * 医生时间设置
     * @param doctorCode
     * @param week
     * @param calendar
     * @return
     * @throws Exception
     */
    private JSONObject doctorWork(String doctorCode,int week,Calendar calendar)throws Exception{
        Map<String, Object> result = findDoctorWeekWork(doctorCode, String.valueOf(week));
        JSONObject json = new JSONObject();
        if (result.get("workTime") == null) {
            // 医生未设置时,默认7*24小时工作
            json.put("status", "1");
            json.put("msg", "医生当前接受咨询");
        } else {
            WlyyDoctorWorkTime doctorWorkTime = (WlyyDoctorWorkTime) result.get("workTime");
            if (doctorWorkTime.getReceiveConsult().equals("0")) {
                // 医生设置不接受咨询
                json.put("status", "0");
                json.put("msg", "医生不接受咨询");
            } else {
                if (StringUtils.isEmpty(doctorWorkTime.getMorningBegin()) && StringUtils.isEmpty(doctorWorkTime.getMorningEnd())
                        && StringUtils.isEmpty(doctorWorkTime.getAfternoonBegin()) && StringUtils.isEmpty(doctorWorkTime.getAfternoonEnd())
                        && StringUtils.isEmpty(doctorWorkTime.getNightBegin()) && StringUtils.isEmpty(doctorWorkTime.getNightEnd())) {
                    // 医生未设置工作时间,默认7*24小时工作
                    json.put("status", "1");
                    json.put("msg", "医生当前接受咨询");
                } else {
                    if (result.get("workWeek") != null) {
                        // 当前工作日已设置工作时间
                        int flag = 0;
                        WlyyDoctorWorkTime workTime = (WlyyDoctorWorkTime) result.get("workTime");
                        WlyyDoctorWorkWeek workWeek = (WlyyDoctorWorkWeek) result.get("workWeek");
                        int hour = calendar.get(Calendar.HOUR_OF_DAY);
                        int minute = calendar.get(Calendar.MINUTE);
                        String current = (hour < 10 ? ("0" + hour) : hour) + ":" + (hour < 10 ? ("0" + minute) : minute);
                        // 早上
                        if (workWeek.getMorning().equals("1")) {
                            String currentStart = workTime.getMorningBegin();
                            String currentEnd = workTime.getMorningEnd();
                            if (currentStart.length() == 4) {
                                currentStart = "0" + currentStart;
                            }
                            if (currentEnd.length() == 4) {
                                currentEnd = "0" + currentEnd;
                            }
                            if (current.compareTo(currentStart) >= 0 &&
                                    current.compareTo(currentEnd) < 0) {
                                flag = 1;
                            }
                        }
                        // 下午
                        if (workWeek.getAfternoon().equals("1")) {
                            String currentStart = workTime.getAfternoonBegin();
                            String currentEnd = workTime.getAfternoonEnd();
                            if (currentStart.length() == 4) {
                                currentStart = "0" + currentStart;
                            }
                            if (currentEnd.length() == 4) {
                                currentEnd = "0" + currentEnd;
                            }
                            if (current.compareTo(currentStart) >= 0 &&
                                    current.compareTo(currentEnd) < 0) {
                                flag = 1;
                            }
                        }
                        // 晚上
                        if (workWeek.getNight().equals("1")) {
                            String currentStart = workTime.getNightBegin();
                            String currentEnd = workTime.getNightEnd();
                            if (currentStart.length() == 4) {
                                currentStart = "0" + currentStart;
                            }
                            if (currentEnd.length() == 4) {
                                currentEnd = "0" + currentEnd;
                            }
                            if (current.compareTo(currentStart) >= 0 &&
                                    current.compareTo(currentEnd) < 0) {
                                flag = 1;
                            }
                        }
                        if (flag == 1) {
                            json.put("status", "1");
                            json.put("msg", "医生当前接受咨询");
                        } else {
                            json.put("status", "2");
                            json.put("msg", "医生当前不在工作时间");
                        }
                    } else {
                        json.put("status", "2");
                        json.put("msg", "医生当前不在工作时间");
                    }
                }
            }
        }
        return json;
    }
}

+ 74 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/team/AdminTeamService.java

@ -17,6 +17,7 @@ import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyRenewDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.third.jw.JwSignService;
import com.yihu.wlyy.util.PinYinUtil;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.json.JSONArray;
@ -131,6 +132,79 @@ public class AdminTeamService extends BaseService {
        }
    }
    /**
     * 根据医生code返回所有团队的医生
     * (pc端im使用)改为字母拍讯
     * @author zd 2018-02-11
     * * @param doctor
     * @return
     */
    public Map<String,Object> getTeamMembersByDoctorCodeByAlpha(String doctor){
        String sql = "SELECT " +
                "   d.code" +
                "   ,d.name" +
                "   ,d.hospital" +
                "   ,d.hospital_name hospitalName" +
                "   ,d.dept_name deptName" +
                "   ,d.job_name jobName" +
                "   ,d.level" +
                "   ,d.sex" +
                "   ,d.photo" +
                "   ,d.expertise" +
                "   ,d.introduce" +
                "   ,t.id teamCode" +
                " FROM " +
                "   wlyy_admin_team_member m" +
                "   , wlyy_admin_team t" +
                "   , wlyy_doctor d" +
                "   ,(SELECT t1.id FROM wlyy_admin_team_member m1, wlyy_admin_team t1 WHERE m1.doctor_code = '"+doctor+"' AND t1.id = m1.team_id AND t1.available = true AND m1.available = true) te" +
                " WHERE " +
                "   t.id = m.team_id AND " +
                "   m.doctor_code = d.code AND " +
                "   t.id = te.id AND " +
                "   t.available = true AND " +
                "   m.available = true ";
        List<Map<String, Object>> doctors = jdbcTemplate.queryForList(sql);
        Map<String, Map<String,Object>> result = new HashMap<>();
        if(doctors!=null&&doctors.size()>0){
            for (Map<String, Object> map:doctors){
                String code = map.get("code").toString();
                if(result.containsKey(code)){
                    Map<String,Object> map2 = result.get(code);
                    JSONArray ja = (JSONArray) map2.get("teams");
                    ja.put(map.get("teamCode"));
                }else {
                    JSONArray ja = new JSONArray();
                    ja.put(map.get("teamCode"));
                    map.put("teams",ja);
                    result.put(code,map);
                }
            }
        }
        Map<String,Object>  map =  new LinkedHashMap <>();
        JSONObject resultJson = new JSONObject();
        String[] alphatables = {"a", "b", "c", "d", "e", "f", "g", "h", "i",
                "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
        if (result.size() > 0) {
            List<Map<String,Object>> list = Lists.newArrayList(result.values());
            for (String alpha : alphatables){
                List<Map<String,Object>> resultList = new ArrayList<>();
                for (Map<String,Object> one : list){
                    String name = String.valueOf(one.get("name"));
                    String firstSpell = PinYinUtil.getFirstSpell(name).substring(0,1);
                    if (alpha.equals(firstSpell)){
                        resultList.add(one);
                        map.put(alpha,resultList);
                    }
                }
            }
            return map;
        } else {
            return map;
        }
    }
    /**
     * 获取团队数量。
     *

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

@ -435,7 +435,9 @@ public class JMJkEduArticleService extends BaseService {
            healthEduArticleES.setArticleId(article.get("articleId") + "");
            healthEduArticleES.setArticleTitle(article.get("articleTitle") + "");
            healthEduArticleES.setArticleCover(article.get("articleCover") + "");
            healthEduArticleES.setArticleContent(article.get("articleContent") + "");
            String articleContent = article.containsKey("articleContent")?article.getString("articleContent").replaceAll("</?[^>]+>", ""):"";
            healthEduArticleES.setArticleContent(articleContent.length()>0?(articleContent.length()>100?articleContent.substring(0,100):articleContent):"");
//            healthEduArticleES.setArticleContent(article.get("articleContent") + "");
            healthEduArticleES.setArticleCategoryId(article.get("articleCategoryId") + "");
            healthEduArticleES.setFirstLevelCategoryId(article.get("firstLevelCategoryId") + "");
            healthEduArticleES.setFirstLevelCategoryName(article.get("firstLevelCategoryName") + "");

+ 36 - 108
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/ImmuneService.java

@ -547,92 +547,7 @@ public class ImmuneService {
		String xml = data.getString("data");
		
//		int status = 200;
//		String xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" +
//				"<ArrayOfViewImmuneModel xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
//				"\t<ViewImmuneModel>\n" +
//				"\t\t<Org>\n" +
//				"\t\t\t<ORG_ID>106</ORG_ID>\n" +
//				"\t\t\t<CODE>350211B1009</CODE>\n" +
//				"\t\t\t<NAME>思明区鹭江街道社区卫生服务中心</NAME>\n" +
//				"\t\t\t<ADDRESS /><REMARK />\n" +
//				"\t\t\t<SHORT_NAME>思明区鹭江街道社区卫生服务中心</SHORT_NAME>\n" +
//				"\t\t\t<RESERVATION_TELEPHONE />\n" +
//				"\t\t\t<NUMBER_RELEASE_TIME xsi:nil=\"true\" />\n" +
//				"\t\t\t<NUMBER_RELEASE_DAY xsi:nil=\"true\" />\n" +
//				"\t\t\t<AVG_SCORE>10</AVG_SCORE>\n" +
//				"\t\t\t<PHONE_INTRODUCTION />\n" +
//				"\t\t\t<STATUS xsi:nil=\"true\" />\n" +
//				"\t\t\t<SORT>0</SORT>\n" +
//				"\t\t\t<ORG_TYPE xsi:nil=\"true\" />\n" +
//				"\t\t\t<ZONE_CODE>350203</ZONE_CODE>\n" +
//				"\t\t\t<UPDATE_DATE xsi:nil=\"true\" />\n" +
//				"\t\t\t<ORG_IMMUNE xsi:nil=\"true\" />\n" +
//				"\t\t</Org>\n" +
//				"\t\t<DateNumbers>\n" +
//				"\t\t\t<DateNumber>\n" +
//				"\t\t\t\t<SECTIONLIST />\n" +
//				"\t\t\t\t<ID>8adf96c561193b5e0161196985600086</ID>\n" +
//				"\t\t\t\t<DATE>2018-01-29T00:00:00</DATE>\n" +
//				"\t\t\t\t<TIME>AM</TIME>\n" +
//				"\t\t\t\t<MAX>43</MAX>\n" +
//				"\t\t\t\t<USED>1</USED>\n" +
//				"\t\t\t\t<FEE>0</FEE>\n" +
//				"\t\t\t\t<STATUS>1</STATUS>\n" +
//				"\t\t\t</DateNumber>\n" +
//				"\t\t\t<DateNumber>\n" +
//				"\t\t\t\t<SECTIONLIST />\n" +
//				"\t\t\t\t<ID>8adf96c561193b5e01611969856a0101</ID>\n" +
//				"\t\t\t\t<DATE>2018-01-29T00:00:00</DATE>\n" +
//				"\t\t\t\t<TIME>PM</TIME>\n" +
//				"\t\t\t\t<MAX>41</MAX>\n" +
//				"\t\t\t\t<USED>1</USED>\n" +
//				"\t\t\t\t<FEE>0</FEE>\n" +
//				"\t\t\t\t<STATUS>1</STATUS>\n" +
//				"\t\t\t</DateNumber>\n" +
//				"\t\t\t<DateNumber>\n" +
//				"\t\t\t\t<SECTIONLIST />\n" +
//				"\t\t\t\t<ID>8adf96c5611b73ac01611e8fd97c0e82</ID>\n" +
//				"\t\t\t\t<DATE>2018-01-30T00:00:00</DATE>\n" +
//				"\t\t\t\t<TIME>AM</TIME>\n" +
//				"\t\t\t\t<MAX>43</MAX>\n" +
//				"\t\t\t\t<USED>1</USED>\n" +
//				"\t\t\t\t<FEE>0</FEE>\n" +
//				"\t\t\t\t<STATUS>1</STATUS>\n" +
//				"\t\t\t</DateNumber>\n" +
//				"\t\t\t<DateNumber>\n" +
//				"\t\t\t\t<SECTIONLIST />\n" +
//				"\t\t\t\t<ID>8adf96c5611b73ac01611e8fd9830efd</ID>\n" +
//				"\t\t\t\t<DATE>2018-01-30T00:00:00</DATE>\n" +
//				"\t\t\t\t<TIME>PM</TIME>\n" +
//				"\t\t\t\t<MAX>41</MAX>\n" +
//				"\t\t\t\t<USED>1</USED>\n" +
//				"\t\t\t\t<FEE>0</FEE>\n" +
//				"\t\t\t\t<STATUS>1</STATUS>\n" +
//				"\t\t\t</DateNumber>\n" +
//				"\t\t\t<DateNumber>\n" +
//				"\t\t\t\t<SECTIONLIST />\n" +
//				"\t\t\t\t<ID>8adf96c5611b73ac01611e8fd97c0e82</ID>\n" +
//				"\t\t\t\t<DATE>2018-01-31T00:00:00</DATE>\n" +
//				"\t\t\t\t<TIME>AM</TIME>\n" +
//				"\t\t\t\t<MAX>43</MAX>\n" +
//				"\t\t\t\t<USED>1</USED>\n" +
//				"\t\t\t\t<FEE>0</FEE>\n" +
//				"\t\t\t\t<STATUS>1</STATUS>\n" +
//				"\t\t\t</DateNumber>\n" +
//				"\t\t\t<DateNumber>\n" +
//				"\t\t\t\t<SECTIONLIST />\n" +
//				"\t\t\t\t<ID>8adf96c5611b73ac01611e8fd9830efd</ID>\n" +
//				"\t\t\t\t<DATE>2018-01-31T00:00:00</DATE>\n" +
//				"\t\t\t\t<TIME>PM</TIME>\n" +
//				"\t\t\t\t<MAX>41</MAX>\n" +
//				"\t\t\t\t<USED>1</USED>\n" +
//				"\t\t\t\t<FEE>0</FEE>\n" +
//				"\t\t\t\t<STATUS>1</STATUS>\n" +
//				"\t\t\t</DateNumber>\n" +
//				"\t\t</DateNumbers>\n" +
//				"\t</ViewImmuneModel>\n" +
//				"</ArrayOfViewImmuneModel>";
		
//		String xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?><ArrayOfImmuneSchudleModel xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><ImmuneSchudleModel><ORG_ID>108</ORG_ID><ORG_CODE>350211B1012</ORG_CODE><ORG_NAME>思明区中华街道社区卫生服务中心</ORG_NAME><DateNumbers /></ImmuneSchudleModel></ArrayOfImmuneSchudleModel>";
		
		
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
@ -644,34 +559,47 @@ public class ImmuneService {
			
			
			Element ArrayOfImmuneSchudleModel = document.getRootElement();
			Element ViewImmuneModel = ArrayOfImmuneSchudleModel.element("ViewImmuneModel");
			Element Org = ViewImmuneModel.element("Org");
			Element ImmuneSchudleModel = ArrayOfImmuneSchudleModel.element("ImmuneSchudleModel");
			
			//机构信息
			Element ORG_ID = Org.element("ORG_ID");
			Element CODE = Org.element("CODE");
			Element NAME = Org.element("NAME");
			Element SHORT_NAME = Org.element("SHORT_NAME");
			Element SORT = Org.element("SORT");
			Element ZONE_CODE = Org.element("ZONE_CODE");
			Element AVG_SCORE = Org.element("AVG_SCORE");
			Element ORG_ID = ImmuneSchudleModel.element("ORG_ID");
			Element ORG_CODE = ImmuneSchudleModel.element("ORG_CODE");
			Element ORG_NAME = ImmuneSchudleModel.element("ORG_NAME");
			Element SHORT_NAME = ImmuneSchudleModel.element("SHORT_NAME");
			Element SORT = ImmuneSchudleModel.element("SORT");
			Element ZONE_CODE = ImmuneSchudleModel.element("ZONE_CODE");
			Element AVG_SCORE = ImmuneSchudleModel.element("AVG_SCORE");
			
			result.put("ORG_CODE",CODE.getTextTrim());//机构编码
			result.put("ORG_CODE",ORG_CODE.getTextTrim());//机构编码
			result.put("ORG_ID",ORG_ID.getTextTrim());//机构ID
			result.put("ORG_NAME",NAME.getTextTrim());//机构名称
			result.put("ORG_SHORT_NAME",SHORT_NAME.getTextTrim());//机构简称
			String hospitalcode = hospitalMappingDao.getCodeByMapping(CODE.getTextTrim(), "1");
			Hospital hospital = hospitalDao.findByCode(hospitalcode);
			result.put("ORG_PHOTO",hospital.getPhoto());//机构图片
			result.put("ORG_PHONE",hospital.getPhone());//机构电话
			result.put("ORG_ADDRESS",hospital.getAddress());//机构地址
			result.put("ORG_INFO",hospital.getIntro());//机构简介
			result.put("AVG_SCORE",AVG_SCORE.getTextTrim());
			result.put("SORT",SORT.getTextTrim());
			result.put("ZONE_CODE",ZONE_CODE.getTextTrim());//机构区域编码
			result.put("ORG_NAME",ORG_NAME.getTextTrim());//机构名称
			if(SHORT_NAME != null){
				result.put("ORG_SHORT_NAME",SHORT_NAME.getTextTrim());//机构简称
			}
			
			if(ORG_CODE != null){
				String hospitalcode = hospitalMappingDao.getCodeByMapping(ORG_CODE.getTextTrim(), "1");
				Hospital hospital = hospitalDao.findByCode(hospitalcode);
				result.put("ORG_PHOTO",hospital.getPhoto());//机构图片
				result.put("ORG_PHONE",hospital.getPhone());//机构电话
				result.put("ORG_ADDRESS",hospital.getAddress());//机构地址
				result.put("ORG_INFO",hospital.getIntro());//机构简介
			}
			if(AVG_SCORE != null){
				result.put("AVG_SCORE",AVG_SCORE.getTextTrim());
			}
			
			if(SORT != null){
				result.put("SORT",SORT.getTextTrim());
			}
			
			if(ZONE_CODE != null){
				result.put("ZONE_CODE",ZONE_CODE.getTextTrim());//机构区域编码
			}
			
			//排班列表
			Element DateNumbers = ViewImmuneModel.element("DateNumbers");
			Element DateNumbers = ImmuneSchudleModel.element("DateNumbers");
			Iterator<Element> iterator = DateNumbers.elementIterator();
			JSONArray DateNumbersJSON = new JSONArray();
			while(iterator.hasNext()){

+ 187 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DesUtil.java

@ -0,0 +1,187 @@
package com.yihu.wlyy.util;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
/**
 * ClassName: DesUtil 
 * @Description: 字符串加密 、解密 类
 * @author houzq  
 * @Company www.yihu.com
 * @date 2017-8-31 下午03:12:54
 */
public class DesUtil {
	private final static String DES = "DES";
	private final static String key = "zkzlcom1yihu67890123";
	/**
	 * Description 根据键值进行加密
	 * 
	 * @param data
	 * @param key
	 *            加密键byte数组
	 * @return
	 * @throws Exception
	 */
	public static String encrypt(String data, String key) throws Exception {
		byte[] bt = encrypt(data.getBytes(), key.getBytes());
		String strs = new BASE64Encoder().encode(bt);
		return strs;
	}
	public static String encrypt(String data) throws Exception {
		byte[] bt = encrypt(data.getBytes(), key.getBytes());
		String strs = new BASE64Encoder().encode(bt);
		return strs;
	}
	/**
	 * Description 根据键值进行解密
	 * 
	 * @param data
	 * @param key
	 *            加密键byte数组
	 * @return
	 * @throws IOException
	 * @throws Exception
	 */
	public static String decrypt(String data, String key) throws IOException, Exception {
		if (data == null)
			return null;
		BASE64Decoder decoder = new BASE64Decoder();
		byte[] buf = decoder.decodeBuffer(data);
		byte[] bt = decrypt(buf, key.getBytes());
		return new String(bt);
	}
	public static String decrypt(String data) throws IOException, Exception {
		if (data == null)
			return null;
		BASE64Decoder decoder = new BASE64Decoder();
		byte[] buf = decoder.decodeBuffer(data);
		byte[] bt = decrypt(buf, key.getBytes());
		return new String(bt);
	}
	
	/**
	 * Description 根据键值进行加密
	 * 
	 * @param data
	 * @param key
	 *            加密键byte数组
	 * @return
	 * @throws Exception
	 */
	private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
		// 生成一个可信任的随机数源
		SecureRandom sr = new SecureRandom();
		// 从原始密钥数据创建DESKeySpec对象
		DESKeySpec dks = new DESKeySpec(key);
		// 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
		SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
		SecretKey securekey = keyFactory.generateSecret(dks);
		// Cipher对象实际完成加密操作
		Cipher cipher = Cipher.getInstance(DES);
		// 用密钥初始化Cipher对象
		cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
		return cipher.doFinal(data);
	}
	/**
	 * Description 根据键值进行解密
	 * 
	 * @param data
	 * @param key
	 *            加密键byte数组
	 * @return
	 * @throws Exception
	 */
	private static byte[] decrypt(byte[] data, byte[] key) throws Exception {
		// 生成一个可信任的随机数源
		SecureRandom sr = new SecureRandom();
		// 从原始密钥数据创建DESKeySpec对象
		DESKeySpec dks = new DESKeySpec(key);
		// 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
		SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
		SecretKey securekey = keyFactory.generateSecret(dks);
		// Cipher对象实际完成解密操作
		Cipher cipher = Cipher.getInstance(DES);
		// 用密钥初始化Cipher对象
		cipher.init(Cipher.DECRYPT_MODE, securekey, sr);
		return cipher.doFinal(data);
	}
	/**
	 * MD5工具
	 * 
	 * @param string
	 * @return
	 */
	public static String md5(String string) {
		MessageDigest md = null;
		try {
			md = MessageDigest.getInstance("md5");
			md.update(string.getBytes());
			byte[] md5Bytes = md.digest();
			return bytes2Hex(md5Bytes);
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
		return null;
	}
	private static String bytes2Hex(byte[] byteArray) {
		StringBuffer strBuf = new StringBuffer();
		for (int i = 0; i < byteArray.length; i++) {
			if (byteArray[i] >= 0 && byteArray[i] < 16) {
				strBuf.append("0");
			}
			strBuf.append(Integer.toHexString(byteArray[i] & 0xFF));
		}
		return strBuf.toString();
	}
	/**
	 *  BASE64 编码
	 * @param s
	 * @return
	 */
	public static String getBASE64(String s) {
		if (s == null)
			return null;
		return (new BASE64Encoder()).encode(s.getBytes());
	}
	// 将 BASE64 编码的字符串 s 进行解码
	public static String getFromBASE64(String s) {
		if (s == null)
			return null;
		BASE64Decoder decoder = new BASE64Decoder();
		try {
			byte[] b = decoder.decodeBuffer(s);
			return new String(b);
		} catch (Exception e) {
			return null;
		}
	}
}

+ 79 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/LatitudeUtils.java

@ -0,0 +1,79 @@
package com.yihu.wlyy.util;
import org.apache.commons.lang.StringUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class LatitudeUtils {
    public static final String KEY_1 = "7d9fbeb43e975cd1e9477a7e5d5e192a";
    /**
     * 返回输入地址的经纬度坐标
     * key lng(经度),lat(纬度)
     */
    public static Map<String,String> getGeocoderLatitude(String address){
        BufferedReader in = null;
        try {
            //将地址转换成utf-8的16进制
            address = URLEncoder.encode(address, "UTF-8");
            URL tirc = new URL("http://api.map.baidu.com/geocoder?address="+ address +"&output=json&key="+ UUID.randomUUID().toString().replace("-",""));
            in = new BufferedReader(new InputStreamReader(tirc.openStream(),"UTF-8"));
            String res;
            StringBuilder sb = new StringBuilder("");
            while((res = in.readLine())!=null){
                sb.append(res.trim());
            }
            String str = sb.toString();
            Map<String,String> map = null;
            if(StringUtils.isNotEmpty(str)){
                int lngStart = str.indexOf("lng\":");
                int lngEnd = str.indexOf(",\"lat");
                int latEnd = str.indexOf("},\"precise");
                if(lngStart > 0 && lngEnd > 0 && latEnd > 0){
                    String lng = str.substring(lngStart+5, lngEnd);
                    String lat = str.substring(lngEnd+7, latEnd);
                    map = new HashMap<String,String>();
                    map.put("lng", lng);
                    map.put("lat", lat);
                    return map;
                }
            }
        }catch (Exception e) {
            e.printStackTrace();
        }finally{
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
    public static void main(String args[]){
        try {
            Map<String, String> json = LatitudeUtils.getGeocoderLatitude("浦东区张杨路1725号");
            System.out.println("经度 : " + json.get("lng"));
            System.out.println("纬度 : " + json.get("lat"));
        }catch (Exception e ){
            e.printStackTrace();
        }
    }
}

+ 62 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/PinYinUtil.java

@ -0,0 +1,62 @@
package com.yihu.wlyy.util;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
public class PinYinUtil {
	/** 
     * 获取汉字串拼音首字母,英文字符不变 
     * @param chinese 汉字串 
     * @return 汉语拼音首字母 
     */ 
    public static String getFirstSpell(String chinese) { 
            StringBuffer pybf = new StringBuffer(); 
            char[] arr = chinese.toCharArray(); 
            HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat(); 
            defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE); 
            defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE); 
            for (int i = 0; i < arr.length; i++) { 
                    if (arr[i] > 128) { 
                            try { 
                                    String[] temp = PinyinHelper.toHanyuPinyinStringArray(arr[i], defaultFormat); 
                                    if (temp != null) { 
                                            pybf.append(temp[0].charAt(0)); 
                                    } 
                            } catch (BadHanyuPinyinOutputFormatCombination e) { 
                                    e.printStackTrace(); 
                            } 
                    } else { 
                            pybf.append(arr[i]); 
                    } 
            } 
            return pybf.toString().replaceAll("\\W", "").trim(); 
    } 
    /** 
     * 获取汉字串拼音,英文字符不变 
     * @param chinese 汉字串 
     * @return 汉语拼音 
     */ 
    public static String getFullSpell(String chinese) { 
            StringBuffer pybf = new StringBuffer(); 
            char[] arr = chinese.toCharArray(); 
            HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat(); 
            defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE); 
            defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE); 
            for (int i = 0; i < arr.length; i++) { 
                    if (arr[i] > 128) { 
                            try { 
                                    pybf.append(PinyinHelper.toHanyuPinyinStringArray(arr[i], defaultFormat)[0]); 
                            } catch (BadHanyuPinyinOutputFormatCombination e) { 
                                    e.printStackTrace(); 
                            } 
                    } else { 
                            pybf.append(arr[i]); 
                    } 
            } 
            return pybf.toString(); 
    }
}

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

@ -101,6 +101,7 @@ public class FileUploadController extends BaseController {
     * @return
     * @throws IOException
     * @throws IllegalStateException
     * 备注:图片先保存到本地服务器,后续保存图片到fastDFS
     */
    @RequestMapping(value = "image", method = RequestMethod.POST  /*,headers = "Accept=image/png"*/ )
    @ResponseBody
@ -620,6 +621,7 @@ public class FileUploadController extends BaseController {
                json.put("status", 200);
                json.put("msg", "上传成功");
                json.put("urls", urls);
                logger.info("图片上传:" + json.toString());
                return json.toString();
            } catch (Exception e) {

+ 97 - 25
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandingService.java

@ -1,25 +1,30 @@
package com.yihu.wlyy.web.data;
import com.yihu.es.entity.HealthEduArticleES;
import com.yihu.es.entity.MapDataDTO;
import com.yihu.wlyy.config.es.ElastricSearchSave;
import com.yihu.wlyy.entity.device.PatientDevice;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.manage.User;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.manage.UserDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientDeviceDao;
import com.yihu.wlyy.util.ElasticsearchUtil;
import com.yihu.wlyy.util.LatitudeUtils;
import com.yihu.wlyy.util.MD5;
import net.sf.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.*;
/**
 * Created by Administrator on 2016.10.17.
@ -36,43 +41,46 @@ public class DataHandingService {
    private ElasticsearchUtil elasticsearchUtil;
    @Autowired
    private ElastricSearchSave elastricSearchSave;
    @Autowired
    private PatientDeviceDao patientDeviceDao;
    @Transactional
    public String producePatientAndDoctorPassword() {
        int patientCount=0;
        int patientErrorCount=0;
        int doctorCount=0;
        int doctorErrorCount=0;
        List<Patient> patients= patientDao.findAllIdCardPatientAndNoPassword();
        for (Patient patient:patients){
            String idcard=patient.getIdcard();
            if(!StringUtils.isEmpty(patient.getPassword())||StringUtils.isEmpty(idcard)||(idcard.length()!=15&&idcard.length()!=18)){
        int patientCount = 0;
        int patientErrorCount = 0;
        int doctorCount = 0;
        int doctorErrorCount = 0;
        List<Patient> patients = patientDao.findAllIdCardPatientAndNoPassword();
        for (Patient patient : patients) {
            String idcard = patient.getIdcard();
            if (!StringUtils.isEmpty(patient.getPassword()) || StringUtils.isEmpty(idcard) || (idcard.length() != 15 && idcard.length() != 18)) {
                patientErrorCount++;
                continue;
            }
            String password=idcard.substring(idcard.length()-6);
            String salt= UUID.randomUUID().toString().replace("-","");
            String password = idcard.substring(idcard.length() - 6);
            String salt = UUID.randomUUID().toString().replace("-", "");
            patient.setSalt(salt);
            patient.setPassword(MD5.GetMD5Code(password+salt));
            patient.setPassword(MD5.GetMD5Code(password + salt));
            patientCount++;
        }
        patientDao.save(patients);
        List<Doctor> doctors= doctorDao.findAllDoctors();
        for (Doctor doctor:doctors){
            String phone= doctor.getMobile();
            if(!StringUtils.isEmpty(doctor.getPassword())||StringUtils.isEmpty(phone)||phone.length()!=11){
        List<Doctor> doctors = doctorDao.findAllDoctors();
        for (Doctor doctor : doctors) {
            String phone = doctor.getMobile();
            if (!StringUtils.isEmpty(doctor.getPassword()) || StringUtils.isEmpty(phone) || phone.length() != 11) {
                doctorErrorCount++;
                continue;
            }
            String password=phone.substring(5);
            String salt= UUID.randomUUID().toString().replace("-","");
            String password = phone.substring(5);
            String salt = UUID.randomUUID().toString().replace("-", "");
            doctor.setSalt(salt);
            doctor.setPassword(MD5.GetMD5Code(password+salt));
            doctor.setPassword(MD5.GetMD5Code(password + salt));
            doctorCount++;
        }
        doctorDao.save(doctors);
        return "更新患者(默认身份证后六位):"+patientCount+",有身份证异常的患者:"+patientErrorCount+",更新医生(默认电话后六位):"+doctorCount+",有电话号码异常的医生:"+doctorErrorCount;
        return "更新患者(默认身份证后六位):" + patientCount + ",有身份证异常的患者:" + patientErrorCount + ",更新医生(默认电话后六位):" + doctorCount + ",有电话号码异常的医生:" + doctorErrorCount;
    }
    public String initWLyyDoctorTable2WLyyUserTable() {
        JSONObject returnjo = new JSONObject();
        List<Doctor> doctors = doctorDao.findAllDoctors();
@ -113,9 +121,73 @@ public class DataHandingService {
        userDao.save(userTemp);
    }
    public Boolean esToEs(){
    public Boolean esToEs() {
        String sql = " SELECT * FROM health_edu_article_patient_test ";
        List<HealthEduArticleES> esList = elasticsearchUtil.excute(sql, HealthEduArticleES.class, "health_edu_article_patient_test", "health_edu_article_patient_test");
        return  elastricSearchSave.save(esList, "health_edu_article_patient", "health_edu_article_patient");
        return elastricSearchSave.save(esList, "health_edu_article_patient", "health_edu_article_patient");
    }
    @Value("${es.index.patientDevice}")
    private String patientDeviceIndex;
    @Value("${es.type.patientDevice}")
    private String patientDeviceType;
    private Logger logger = LoggerFactory.getLogger(DataHandingService.class);
    public net.sf.json.JSONObject deviceData2Es() {
        net.sf.json.JSONObject jo = new net.sf.json.JSONObject();
        try {
            //得到已经已经绑定的体征设备
            List<PatientDevice> patientDevices = patientDeviceDao.findWithArrdess();
            List<MapDataDTO> dataDTOs = new ArrayList<>();
            Integer error = 0;
            for (int i = 0; i < patientDevices.size(); i++) {
                PatientDevice one = patientDevices.get(i);
                MapDataDTO mapDataDTO = new MapDataDTO();
                mapDataDTO.setCreateTime(new Date());
                mapDataDTO.setDeviceTime(one.getCzrq());
                mapDataDTO.setDeviceId(one.getDeviceId());
                mapDataDTO.setDeviceSn(one.getDeviceSn());
                mapDataDTO.setIdCard(one.getUserIdcard());
                if (StringUtils.isEmpty(one.getAddress())) {
                    error++;
                    continue;
                }
                Map<String, String> json = LatitudeUtils.getGeocoderLatitude(one.getAddress().replace("G.", "").replace("(糖友网)", "").replace("(高友网)", ""));
                if (json == null) {
                    error++;
                    continue;
                }
                logger.info("地址:," + one.getAddress() + "坐标" + json.toString());
                mapDataDTO.setLocation(Double.valueOf(json.get("lat")), Double.valueOf(json.get("lng")));
                dataDTOs.add(mapDataDTO);
        }
            elastricSearchSave.save(dataDTOs, patientDeviceIndex, patientDeviceType);
            return jo;
        } catch (Exception e) {
            e.printStackTrace();
            return jo;
        }
    }
    public JSONArray getAllDeviceData() {
        JSONArray ja = new JSONArray();
        List<Map<String, Object>> returnData = elasticsearchUtil.excuteDataModel("SELECT location,idCard FROM wlyy_patient_device");
        returnData.stream().forEach(one->{
            net.sf.json.JSONObject jo=new net.sf.json.JSONObject();
            jo.put("idcard",one.get("idCard"));
            net.sf.json.JSONObject locatio=new net.sf.json.JSONObject();
            locatio.put("lat",one.get("location.lat")); //纬度 -90 ~~ 90
            locatio.put("lon",one.get("location.lon")); //经度 -180 ~~ 180
            jo.put("location",locatio);
            ja.add(jo);
        });
        return ja;
    }
}

+ 23 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java

@ -9,6 +9,7 @@ import com.yihu.wlyy.web.third.jkedu.service.EduArticleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
@ -197,15 +198,15 @@ public class DataHandlingController extends BaseController {
        return write(200, "数据更新成功!", "data", flag);
    }
    @RequestMapping(value = "/getArticleStatics",method = RequestMethod.GET)
    @RequestMapping(value = "/getArticleStatics", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("将旧数据文章的相关统计数据转移到新数据库")
    public String getArticleStatics(){
    public String getArticleStatics() {
        boolean flag = eduArticleService.getArticleStatics();
        if (flag){
        if (flag) {
            return write(200, "数据更新成功!");
        }else {
        } else {
            return write(200, "数据更新失败!");
        }
    }
@ -238,7 +239,7 @@ public class DataHandlingController extends BaseController {
    @RequestMapping(value = "/esToEs", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("正式环境test数据清洗到prod中")
    public String esToEs(){
    public String esToEs() {
        Boolean flag = dataHandingService.esToEs();
        if (flag) {
            return write(200, "EStest数据清洗到ESprod成功!");
@ -246,4 +247,21 @@ public class DataHandlingController extends BaseController {
            return write(0, "EStest数据清洗到ESprod失败!");
        }
    }
    @RequestMapping(value = "/deviceData2Es", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("把地图数据生成到ES中")
    public String deviceData2Es() {
        JSONObject jsonObject = dataHandingService.deviceData2Es();
        return write(200, jsonObject.toString());
    }
    @RequestMapping(value = "/getAllDeviceData", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("得到全部的地图数据")
    public String getAllDeviceData() {
        JSONArray jsonObject = dataHandingService.getAllDeviceData();
        return write(200, jsonObject.toString());
    }
}

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -661,6 +661,8 @@ public class PrescriptionInfoController extends BaseController {
            return write(200, "查询成功", "data", prescriptionService.getPrescriptionByCondition(level,area,disease,status,type,startTime,endTime,Integer.valueOf(pageNo),Integer.valueOf(pageSize)));
        } catch (Exception e) {
            error(e);
            e.printStackTrace();
            System.out.print("错误信息"+e.getMessage());
            return error(-1, "查询失败");
        }
    }

+ 4 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/team/AdminTeamController.java

@ -61,14 +61,16 @@ public class AdminTeamController extends BaseController {
    /**
     * pc端im使用
     * 备注:2018-02-11service改为用字母拍讯 zd
     * @return
     */
    @RequestMapping(value = "/doctorTeamMembers", method = RequestMethod.GET)
    @ApiOperation(value = "根据医生code返回所有团队的医生")
    public String getTeamMembersByDoctorCode(){
        try {
            JSONArray jsonArray = teamService.getTeamMembersByDoctorCode(getUID());
            return write(200, "OK", "data", jsonArray);
            //JSONArray jsonArray = teamService.getTeamMembersByDoctorCode(getUID());
            Map<String,Object> map = teamService.getTeamMembersByDoctorCodeByAlpha(getUID());
            return write(200, "OK", "data", map);
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());

+ 19 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -221,6 +221,25 @@ public class ConsultController extends WeixinBaseController {
        }
    }
    /**
     * 患者端在发起家庭医生咨询时检查全科医生和健管师是否在工作
     * @param doctor
     * @param healthDoctor
     * @return
     */
    @RequestMapping(value = "isDoctorWorkWhenconsult",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("全科医生和健管师是否在工作")
    public String isDoctorWorkWhenconsult(String doctor,String healthDoctor) {
        try {
            JSONObject result = doctorWorkTimeService.isDoctorWorkingWhenConsult(doctor,healthDoctor);
            return write(200, result.getString("msg"), "data", result.getString("status"));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    /**
     * 名医是否在工作
     *

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/application-dev.yml

@ -111,11 +111,13 @@ es:
    Statistics: wlyy_quota_test
    FollowUp: wlyy_followup
    QuestionnaireWinning: wlyy_questionnaire_winning
    patientDevice: wlyy_patient_device
  type:
    HealthEduArticlePatient: health_edu_article_patient_test2
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
    QuestionnaireWinning: wlyy_questionnaire_winning
    patientDevice: wlyy_patient_device
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl

+ 3 - 1
patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

@ -109,11 +109,13 @@ es:
    FollowUp: wlyy_followup
    Statistics: wlyy_quota_test
    QuestionnaireWinning: wlyy_questionnaire_winning
    patientDevice: wlyy_patient_device
  type:
    HealthEduArticlePatient: health_edu_article_patient_test3
    FollowUpContent: wlyy_followup_content
    Statistics: wlyy_quota_test
    QuestionnaireWinning: wlyy_questionnaire_winning
    patientDevice: wlyy_patient_device
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl
@ -131,7 +133,7 @@ activemq:
  password: admin
  url: tcp://172.19.103.87:61616
  queue:
    healtHarticleQueue: healthArticleChannel_devtest  #健康文章推送
    healtHarticleQueue: healthArticleChannel_test  #健康文章推送
##如果是外网项目就是flase 内网是true
neiwang:

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/application-local.yml

@ -103,11 +103,13 @@ es:
    Statistics: wlyy_quota_prod
    FollowUp: wlyy_followup
    QuestionnaireWinning: wlyy_questionnaire_winning
    patientDevice: wlyy_patient_device
  type:
    HealthEduArticlePatient: health_edu_article_patient
    Statistics: wlyy_quota_prod
    FollowUpContent: wlyy_followup_content
    QuestionnaireWinning: wlyy_questionnaire_winning
    patientDevice: wlyy_patient_device
  host:  http://10.95.22.155:9200,http://10.95.22.156:9200
  tHost: 10.95.22.155:9300,10.95.22.156:9300
  clusterName: jkzl

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/application-localtest.yml

@ -104,11 +104,13 @@ es:
    Statistics: wlyy_quota_test
    FollowUp: wlyy_followup
    QuestionnaireWinning: wlyy_questionnaire_winning
    patientDevice: wlyy_patient_device
  type:
    HealthEduArticlePatient: health_edu_article_patient_test
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
    QuestionnaireWinning: wlyy_questionnaire_winning
    patientDevice: wlyy_patient_device
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl

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

@ -109,11 +109,13 @@ es:
    Statistics: wlyy_quota_prod
    FollowUp: wlyy_followup
    QuestionnaireWinning: wlyy_questionnaire_winning
    patientDevice: wlyy_patient_device
  type:
    HealthEduArticlePatient: health_edu_article_patient
    Statistics: wlyy_quota_prod
    FollowUpContent: wlyy_followup_content
    QuestionnaireWinning: wlyy_questionnaire_winning
    patientDevice: wlyy_patient_device
  host:  http://59.61.92.90:9065,http://59.61.92.90:9067
  tHost: 59.61.92.90:9066,59.61.92.90:9068
  clusterName: jkzl

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/application-test.yml

@ -102,11 +102,13 @@ es:
    FollowUp: wlyy_followup
    Statistics: wlyy_quota_test
    QuestionnaireWinning: wlyy_questionnaire_winning
    patientDevice: wlyy_patient_device
  type:
    HealthEduArticlePatient: health_edu_article_patient_test3
    FollowUpContent: wlyy_followup_content
    Statistics: wlyy_quota_test
    QuestionnaireWinning: wlyy_questionnaire_winning
    patientDevice: wlyy_patient_device
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl

+ 1 - 1
patient-co/patient-co-wlyy/src/main/resources/system.properties

@ -31,7 +31,7 @@ patient_QRCode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={ap
#居民产检计划
patient_prenata_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2ffybj%2fhtml%2fyunjianjihua.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#居民免疫计划
patient_immune_url=#居民抽奖图片地址
patient_immune_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2ffybj%2fhtml%2fmianyijihua.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#居民wifi图片地址
patient_wifi_pic_url = {server}/images/wifi.png
#居民抽奖图片地址