Forráskód Böngészése

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

zd_123 7 éve
szülő
commit
a4e4f70f03
22 módosított fájl, 204 hozzáadás és 197 törlés
  1. 10 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallService.java
  2. 11 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallService.java
  3. 26 28
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java
  4. 1 1
      patient-co-manage/wlyy-manage/src/main/resources/application.yml
  5. 0 63
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/PrescriptionAgeConvert.java
  6. 1 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/charge/ChargeDao.java
  7. 1 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionPayDao.java
  8. 6 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  9. 14 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java
  10. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java
  11. 25 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java
  12. 19 36
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionFollowupContentService.java
  13. 3 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  14. 9 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  15. 29 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java
  16. 3 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java
  17. 30 28
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  18. 4 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java
  19. 5 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java
  20. 4 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/call/CallRecordController.java
  21. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  22. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java

+ 10 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallService.java

@ -31,7 +31,7 @@ public class CallService extends IdEntity {
    private Integer type; //服务类型:0.咨询,1.预约
    private Integer dealType; //处理方式:1.电话回复,2.客服回复
    private Date dealTime; //处理时间
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民,3.预约失败
    private String dealContent; // 处理内容
    private Integer dealReason; // 处理取消原因:0.没有号源、1.病人取消
    private String orderHospital; //预约医院code
@ -41,6 +41,7 @@ public class CallService extends IdEntity {
    private String orderDoctor; //预约医生code
    private String orderDoctorName; //预约医生名称
    private String orderTime; //预约时间段
    private Date registerTime; //挂号时间
    private String user; //创建人
    private String userName; //创建人
    private Long adminTeamCode; //团队id
@ -287,4 +288,12 @@ public class CallService extends IdEntity {
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getRegisterTime() {
        return registerTime;
    }
    public void setRegisterTime(Date registerTime) {
        this.registerTime = registerTime;
    }
}

+ 11 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallService.java

@ -14,7 +14,7 @@ import java.util.Date;
@Table(name = "manage_call_service")
public class CallService extends IdEntity {
    private String code; //服务编号
    private String code; //服务编号.
    private String callCode; //关联通话记录
    private String patient; //服务对象(患者code)
    private String patientName; // 服务对象名称(患者名称)
@ -31,7 +31,7 @@ public class CallService extends IdEntity {
    private Integer type; //服务类型:0.咨询,1.预约
    private Integer dealType; //处理方式:1.电话回复,2.客服回复
    private Date dealTime; //处理时间
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民,3.预约失败
    private String dealContent; // 处理内容
    private Integer dealReason; // 处理取消原因:0.没有号源、1.病人取消
    private String orderHospital; //预约医院code
@ -41,6 +41,7 @@ public class CallService extends IdEntity {
    private String orderDoctor; //预约医生code
    private String orderDoctorName; //预约医生名称
    private String orderTime; //预约时间段
    private Date registerTime; //挂号时间
    private String user; //创建人
    private String userName; //创建人
    private Long adminTeamCode; //团队id
@ -287,4 +288,12 @@ public class CallService extends IdEntity {
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getRegisterTime() {
        return registerTime;
    }
    public void setRegisterTime(Date registerTime) {
        this.registerTime = registerTime;
    }
}

+ 26 - 28
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.service.manager.account;
import com.yihu.wlyy.entity.*;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallService;
import com.yihu.wlyy.repository.DoctorDao;
import com.yihu.wlyy.repository.MessageDao;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.repository.UserDao;
@ -56,6 +57,8 @@ public class CustomerService extends BaseService{
	private JdbcTemplate jdbcTemplate;
	@Autowired
	private MessageDao messageDao;
	@Autowired
	private DoctorDao doctorDao;
	@Value(("${doctorAssistant.api}")+"/wlyygc/doctor/message")
	private String messageApi;
@ -408,31 +411,17 @@ public class CustomerService extends BaseService{
		callService.setUser(user);
		User u = userDao.findByCode(user);
		callService.setUserName(u.getName());
		//存储患者信息
		Patient p = patientDao.findByCode(callService.getCode());
		callService.setIdcard(p.getIdcard());
		callService.setSsc(p.getSsc());
		//存储医生
		SignFamily sf = familyService.findByPatientCode(callService.getPatient());
		callService.setAdminTeamCode(sf.getAdminTeamId());
		callService.setCreateTime(new Date());
		callServiceDao.save(callService);
		//待处理发送消息给医生
		if(callService.getState()==1){
			Patient p = patientDao.findByCode(callService.getPatient());
			// 添加签约消息
			Message message = new Message();
			message.setCzrq(new Date());
			message.setCreateTime(new Date());
			message.setContent("您有一条新的协同服务消息!");
			message.setRead(1);//设置未读
			message.setReceiver(callService.getDoctor());//设置接受医生的code
			message.setSender(callService.getPatient());//设置发送的用户
			message.setSenderName(callService.getPatientName());
			message.setCode(getCode());
			message.setSenderPhoto(p.getPhoto());
			message.setTitle("协同服务消息");
			message.setType(12);//协同服务消息
			message.setReadonly(1);//是否只读消息
			message.setSex(p.getSex());
			message.setOver("1");//未处理
			messageDao.save(message);
		}
		sendCallServiceMes(callService,u);
		return "1";
	}
@ -443,7 +432,12 @@ public class CustomerService extends BaseService{
		User u = userDao.findByCode(user);
		callService.setUserName(u.getName());
		callServiceDao.save(callService);
		//待处理发送消息给医生
		sendCallServiceMes(callService,u);
		return "1";
	}
	public void sendCallServiceMes(CallService callService,User u){
		//待处理发送消息给医生
		if(callService.getState()==1){
			Patient p = patientDao.findByCode(callService.getPatient());
@ -451,7 +445,12 @@ public class CustomerService extends BaseService{
			Message message = new Message();
			message.setCzrq(new Date());
			message.setCreateTime(new Date());
			message.setContent("您有一条新的协同服务消息!");
			if("1".equals(callService.getType())){
				message.setContent(u.getName()+"需要预约挂号");
			}else{
				message.setContent(u.getName()+"发起咨询");
			}
			message.setRead(1);//设置未读
			message.setReceiver(callService.getDoctor());//设置接受医生的code
			message.setSender(callService.getPatient());//设置发送的用户
@ -463,11 +462,10 @@ public class CustomerService extends BaseService{
			message.setReadonly(1);//是否只读消息
			message.setSex(p.getSex());
			message.setOver("1");//未处理
			message.setDel("1");
			message.setRelationCode(callService.getCode());
			messageDao.save(message);
		}
		return "1";
	}
	public Map<String,Object> getCallServices(String keyword, Integer serverType,Integer state,String patientName,String ssc,String idCard,String doctorName,String code,Integer adminTeamCode ,String startDate,String endDate,Integer page,Integer size){
@ -527,7 +525,7 @@ public class CustomerService extends BaseService{
			sql +=" AND (s.patient_name = '"+keyword+"' OR s.ssc ='"+keyword+"' OR s.Idcard ='"+keyword+"')";
		}
		if(serverType!=null){
			sql += " AND s.server_type ='"+serverType+"' " ;
			sql += " AND s.type ='"+serverType+"' " ;
		}
		if(state != null){
			sql +=" AND s.state ='"+state+"'";

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

@ -109,7 +109,7 @@ im-service:
yueren:
  api: http://120.77.209.211:8080
doctorAssistant:
  api: http://172.19.103.88:10090/wlyy
  api: http://172.19.103.88:443/assistant
wlyyService:
  api: http://ehr.yihu.com/wlyy/
image:

+ 0 - 63
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/PrescriptionAgeConvert.java

@ -1,63 +0,0 @@
package com.yihu.wlyy.statistics.etl.convert.wlyy;
import com.yihu.wlyy.entity.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.etl.convert.Convert;
import com.yihu.wlyy.statistics.util.Contant;
import com.yihu.wlyy.statistics.util.IdCardUtil;
import com.yihu.wlyy.statistics.vo.DataModel;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by chenweida on 2017/6/5.
 */
public class PrescriptionAgeConvert implements Convert {
    /**
     * @param oneList    数据
     * @param slaveLevel 从1开始
     * @return
     */
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List<DataModel> oneList, String slaveLevel, WlyyDimensionQuota temp ) {
        Map<String,Object> tempMap = new HashMap<>();
        List<DataModel> result = new ArrayList<>();
        for(DataModel one:oneList) {
            try {
                Object value = one.getIdcard();
                Integer age= IdCardUtil.getAgeForIdcard(String.valueOf(value));
                String key = getAgeCode(age);
                if("63".equals(temp.getQuotaCode())){
                    if(tempMap.containsKey(String.valueOf(value))){
                        continue;
                    }
                }
                tempMap.put(String.valueOf(value),one);
                DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(one, key);
//                result.add(one);
            } catch (Exception e) {
                e.printStackTrace();
            }
        };
        return oneList;
    }
    public String getAgeCode(Integer age) {
        if (age >= 0 && age <= 6) {
            return Contant.convert.level_age_1;
        } else if (age >= 7 && age <= 18) {
            return Contant.convert.level_age_2;
        } else if (age >= 19 && age <= 30) {
            return Contant.convert.level_age_3;
        } else if (age >= 31 && age <= 50) {
            return Contant.convert.level_age_4;
        } else if (age >= 51 && age <= 64) {
            return Contant.convert.level_age_5;
        } else {
            return Contant.convert.level_age_6;
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/charge/ChargeDao.java

@ -64,6 +64,6 @@ public interface ChargeDao extends PagingAndSortingRepository<WlyyCharge, Long>,
    List<WlyyCharge> findByTradeStatusAndMiRegisterNoAndUpdateTime(int tradestatus, Date enddate, Date startdate);
    //   查询当天支付,页面回调及异步回调均失败的支付 tradeStatus为空
    @Query(value = "SELECT t.`code` FROM wlyy_charge t WHERE t.trade_status is null AND t.create_time >= date(now()) AND t.create_time < DATE_ADD(date(now()), INTERVAL 1 DAY)", nativeQuery = true)
    @Query(value = "SELECT t.`code` FROM wlyy_charge t WHERE t.trade_status != '0' AND t.create_time >= date(now()) AND t.create_time < DATE_ADD(date(now()), INTERVAL 1 DAY) ", nativeQuery = true)
    List<String> findTodayUnpay();
}

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionPayDao.java

@ -19,6 +19,6 @@ public interface PrescriptionPayDao extends PagingAndSortingRepository<Prescript
    PrescriptionPay findByCode(String code);
    //   查询当天支付,页面回调及异步回调均失败的支付 tradeStatus为空
    @Query(value = "SELECT t.`code` FROM wlyy_prescription_pay t WHERE t.trade_status is null AND t.create_time >= date(now()) AND t.create_time < DATE_ADD(date(now()), INTERVAL 1 DAY)", nativeQuery = true)
    @Query(value = "SELECT t.`code` FROM wlyy_prescription_pay t WHERE t.trade_status != '1' AND t.create_time >= date(now()) AND t.create_time < DATE_ADD(date(now()), INTERVAL 1 DAY) ", nativeQuery = true)
    List<String> findTodayUnpay();
}

+ 6 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -56,13 +56,13 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("update Message a set a.read = 0 where a.receiver = ?1 and a.sender=?2 and a.tzType=?3")
    int updateHealthIndexMessageByPatient(String doctor, String patient, String type);
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2,6,7) order by a.czrq desc")
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2,6,7,12) order by a.czrq desc")
    List<Message> getSystemMessageUnread(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.prescriptionStatus=?2 and a.type in (6,7) order by a.createTime desc")
    List<Message> getSysTemMessageByPrescription(String doctor, String prescriptionStatus);
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6,7)")
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6,7,12)")
    List<Message> getSystemMessage(String doctor, Pageable pageRequest);
    @Query("select a from Message a where a.receiver = ?1 and a.type=?2 and a.prescriptionStatus='0' ")
@ -98,9 +98,12 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("from Message a where a.type = 8 and a.state=0 and a.del='1' and a.over='0' and relationCode = ?1  ")
    Message findByRelationCode(String relationCode);
    @Query("from Message a where a.type = 12 and a.state=0 and a.del='1' and a.over='0' and receiver = ?1  ")
    @Query("from Message a where a.type = 12 and a.del='1' and a.over='1' and receiver = ?1  ")
    List<Message> findByReceiverCallService(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.type=?2 ")
    List<Message> getMessageByType(String doctor, Integer type, Pageable pageRequest);
    @Query("from Message a where a.type = 12 and a.del='1' and a.over='1' and relationCode = ?1  ")
    List<Message> findByCallServiceRelationCode(String relationCode);
}

+ 14 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java

@ -163,12 +163,17 @@ public class FamilyMemberService extends BaseService {
        memberDao.save(fm);
        memberDao.save(fmt);
        //设置家人openid
        if(StringUtils.isBlank(m.getOpenid())){
        //设置家人openid 加入undefined 判断
        if(!"undefined".equals(m.getOpenid())&&StringUtils.isNotBlank(m.getOpenid())){
            m.setOpenid(p.getOpenid());
            m.setOpenidTime(new Date());
            patientDao.save(m);
        }
//        if(StringUtils.isBlank(m.getOpenid())){
//            m.setOpenid(p.getOpenid());
//            m.setOpenidTime(new Date());
//            patientDao.save(m);
//        }
        return 1;
    }
@ -1130,12 +1135,18 @@ public class FamilyMemberService extends BaseService {
        memberDao.save(fmt);
        //设置家人openid
        if(StringUtils.isBlank(m.getOpenid())){
        if(!"undefined".equals(m.getOpenid())&&StringUtils.isNotBlank(m.getOpenid())){
            m.setOpenid(p.getOpenid());
            m.setOpenidTime(new Date());
            patientDao.save(m);
        }
//        if(StringUtils.isBlank(m.getOpenid())){
//            m.setOpenid(p.getOpenid());
//            m.setOpenidTime(new Date());
//            patientDao.save(m);
//        }
        return 1;
    }

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java

@ -469,6 +469,7 @@ public class PatientHealthIndexService extends BaseService {
            message.setTitle("预警值信息");
            message.setContent(content);
            message.setType(2);
            message.setDel("1");
            message.setValue1(Double.valueOf(model.getValue1()));
            message.setValue2(Double.valueOf(model.getValue2()));
            message.setTzCode(String.valueOf(model.getId()));//消息关联的体征id

+ 25 - 15
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java

@ -10,8 +10,11 @@ import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.prescription.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ElasticsearchUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
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.jdbc.core.JdbcTemplate;
@ -27,6 +30,8 @@ import java.util.*;
@Service
@Transactional
public class PrescriptionExpressageService extends BaseService {
    private Logger logger = LoggerFactory.getLogger(ElasticsearchUtil.class);
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
@ -559,23 +564,28 @@ public class PrescriptionExpressageService extends BaseService {
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
            prescriptionLogDao.save(prescriptionLog);
            //更新二维码(isUse)
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.finByCode(prescriptionCode);
            if(prescriptionDispensaryCode!=null){
                //修改取药码code为已经使用
                prescriptionDispensaryCode.setIsUse(1);
                prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
            try {
                //更新二维码(isUse)
                PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.finByCode(prescriptionCode);
                if(prescriptionDispensaryCode!=null){
                    //修改取药码code为已经使用
                    prescriptionDispensaryCode.setIsUse(1);
                    prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
                    //更新配送信息
                    PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
                    if(prescriptionExpressage!=null){
                        prescriptionExpressage.setHospitalDoctor(doctor);
                        prescriptionExpressage.setHospitalDoctorCode(d.getCode());
                        prescriptionExpressage.setFetchingMedicineTime(new Date());
                        prescriptionExpressageDao.save(prescriptionExpressage);
                    }
                }
            }catch (Exception e){
                logger.info("更新二维码(isUse),更新配送信息 异常:"+e.getMessage());
            }
            //更新配送信息
            PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
            if(prescriptionExpressage!=null){
                prescriptionExpressage.setHospitalDoctor(doctor);
                prescriptionExpressage.setHospitalDoctorCode(d.getCode());
                prescriptionExpressage.setFetchingMedicineTime(new Date());
                prescriptionExpressageDao.save(prescriptionExpressage);
            }
            return "1";
        }
        return "0";

+ 19 - 36
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionFollowupContentService.java

@ -328,45 +328,28 @@ public class PrescriptionFollowupContentService extends BaseService {
			
			//餐前
			if(StringUtils.isNotBlank(obj.getString("value1"))){
				followupProjectData = "{'BS_FPG':'"+obj.getString("value1")+"'}";
				
				
				Integer valueType = obj.getInteger("value2");
				
				//餐前
				if(1 == valueType || 3 == valueType || 5 == valueType){
					followupProjectData = "{'BS_FPG':'"+obj.getString("value1")+"'}";
				}
				
				//参后
				if(2 == valueType || 4 == valueType || 6 == valueType){
					followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value1")+"'}";
				}
				
				//睡前-随机血糖
				if(7 == valueType ){
					followupProjectData = "{'RANDOM_BLOOD_SUGAR':'"+obj.getString("value1")+"'}";
				}
				
				imBloodSugarValue = obj.getString("value1");
			}
			
			if(StringUtils.isNotBlank(obj.getString("value3"))){
				followupProjectData = "{'BS_FPG':'"+obj.getString("value3")+"'}";
				imBloodSugarValue = obj.getString("value3");
			}
			
			if(StringUtils.isNotBlank(obj.getString("value5"))){
				followupProjectData = "{'BS_FPG':'"+obj.getString("value5")+"'}";
				imBloodSugarValue = obj.getString("value5");
			}
			//餐后
			if(StringUtils.isNotBlank(obj.getString("value2"))){
				followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value2")+"'}";
				imBloodSugarValue = obj.getString("value2");
			}
			
			
			if(StringUtils.isNotBlank(obj.getString("value4"))){
				followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value4")+"'}";
				imBloodSugarValue = obj.getString("value4");
			}
			
			if(StringUtils.isNotBlank(obj.getString("value6"))){
				followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value6")+"'}";
				imBloodSugarValue = obj.getString("value6");
			}
			
			//随机血糖
			if(StringUtils.isNotBlank(obj.getString("value7"))){
				followupProjectData = "{'RANDOM_BLOOD_SUGAR':'"+obj.getString("value7")+"'}";
				imBloodSugarValue = obj.getString("value7");
			}
			
			
			
			
			FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectData(followup_id,"3");
			
			if(followupContentESDO == null){

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

@ -551,7 +551,9 @@ public class FamilyContractService extends BaseService {
            p.setTown(town);
            p.setTownName(townName);
            p.setAddress(address);
            p.setOpenid(openid);
            if(!"undefined".equals(openid)&&StringUtils.isNotBlank(openid)){
                p.setOpenid(openid);
            }
            p.setOpenidTime(new Date());
            p.setIdcard(idcard);
            p.setMobile(mobile);

+ 9 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -449,8 +449,13 @@ public class StatisticsESService {
        //已缴费
        SaveModel paidSaveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, "1", "2");
        //未交费
        SaveModel noPaySaveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, "14", "2");
        SaveModel noPaySaveModel =null;
        //因为14的指标 16年度是分为 已缴费 未交费 已退费  17年度过后就只有未交费  所以16年度用1级指标 17年度用0级指标
        if("2017-06-30".equals(endDate)){
             noPaySaveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, "14", "2","0");
        }else{
            noPaySaveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, "14", "2");
        }
        List<Map<String, Object>> resultList = new ArrayList<>();
        DecimalFormat df = new DecimalFormat("0.0000");
        long paidTotal = paidSaveModel.getResult2().longValue();
@ -1205,7 +1210,7 @@ public class StatisticsESService {
        if (date.compareTo(dateFormat.format(new Date())) >= 0) {
            date = elasticsearchUtil.getQuotaTime();
        }
        List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel1(date, area, level, index, SaveModel.timeLevel_DDL, low_level, low_level);
        List<SaveModel> esModelList = elasticsearchUtil.findListDateQuotaLevel1(date, area, level, index, SaveModel.timeLevel_DDL,lowLevel, lowCode);
        //esModelList=elasticsearchUtil.findDateQuotaLevel1(date,date,area,level,index,SaveModel.timeLevel_DDL,1,lowCode,"",low_level);
        if (esModelList != null && esModelList.size() > 0) {
            for (SaveModel one : esModelList) {
@ -2629,8 +2634,7 @@ public class StatisticsESService {
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index, "2", "", low_level);
        } else {
            //续签量
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel1(DateUtil.getNextDay(new Date(), -1), DateUtil.getNextDay(new Date(), -1), area, level, index, "2", lowCode, "", low_level);
            //renewSaveModels = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index, "2",1,lowCode,"",low_level);
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel1(timeKey,timeKey, area, level, index, "2", lowCode, "", low_level);
        }

+ 29 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.call;
import com.alibaba.fastjson.JSONArray;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallService;
import com.yihu.wlyy.entity.message.Message;
@ -46,13 +47,12 @@ public class CustomerService extends BaseService{
				" s.create_time AS createTime, " +
				" s.user, " +
				" s.user_name AS userName ," +
				" s.create_Time AS createTime ," +
				" p.sex," +
				" p.photo," +
				" TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age" +
				" FROM " +
				" manage_call_service s " +
				" LEFT JOIN wlyy_patient p ON s.code = s.patient" +
				" LEFT JOIN wlyy_patient p ON p.code = s.patient" +
				" WHERE " +
				" s.state >0 ";
		if(StringUtils.isNotBlank(keyword)){
@ -116,6 +116,13 @@ public class CustomerService extends BaseService{
		CallService callService = callServiceDao.findByCode(code);
		CallRecord callRecord = callRecordDao.findByCode(callService.getCallCode());
		Map<String,Object> rs = new HashedMap();
		String id = callRecord.getIdcard();
		if(StringUtils.isNotBlank(id)){
			String idCard = id.substring(0,id.length()-10)+"*******"+id.substring(id.length()-2,id.length());
			callRecord.setIdcard(idCard);
			callService.setIdcard(idCard);
		}
		rs.put("callService",callService);
		rs.put("callRecord",callRecord);
		return rs;
@ -129,6 +136,15 @@ public class CustomerService extends BaseService{
		 callService.setDealTime(new Date());
		 callService.setState(2);
		 callServiceDao.save(callService);
		List<Message> mes = messageDao.findByCallServiceRelationCode(code);
		if(mes!=null&&mes.size()>0){
			for(Message m :mes){
				m.setOver("0");
				m.setRead(0);
				messageDao.save(m);
			}
		}
		return "1";
	}
@ -145,7 +161,7 @@ public class CustomerService extends BaseService{
	 * @param orderHospital
     * @return
     */
	public String dealAppointCallService(String type ,String code,Integer dealReason,String dealContent, String orderHospital,String orderHospitalName,String orderDept,String orderDeptName,String orderDoctor,String orderDoctorName,String orderTime){
	public String dealAppointCallService(String type ,String code,Integer dealReason,String dealContent, String orderHospital,String orderHospitalName,String orderDept,String orderDeptName,String orderDoctor,String orderDoctorName,String orderTime,String registerTime){
		CallService cs = callServiceDao.findByCode(code);
		//预约成功
		if("1".equals(type)){
@ -158,6 +174,7 @@ public class CustomerService extends BaseService{
			cs.setOrderHospitalName(orderHospitalName);
			cs.setOrderTime(orderTime);
			cs.setDealTime(new Date());
			cs.setRegisterTime(new Date());
			cs.setDealState(1);
		//预约失败
		}else{
@ -168,6 +185,15 @@ public class CustomerService extends BaseService{
			cs.setDealContent(dealContent);
		}
		callServiceDao.save(cs);
		List<Message> mes = messageDao.findByCallServiceRelationCode(code);
		if(mes!=null&&mes.size()>0){
			for(Message m :mes){
				m.setOver("0");
				m.setRead(0);
				messageDao.save(m);
			}
		}
		return "1";
	}
}

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -142,7 +142,9 @@ public class PatientService extends TokenService {
            patient.setOpenidTime(new Date());
        }
        //System.out.println("========openid=======");
        patient.setOpenid(openid);
        if(!"undefined".equals(openid)&&StringUtils.isNotBlank(openid)){
            patient.setOpenid(openid);
        }
        Patient ps = patientDao.save(patient);
        System.out.print(new JSONObject(ps));
        if (StringUtils.isNotEmpty(patient.getOpenid())) {

+ 30 - 28
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java

@ -82,33 +82,33 @@ public class OnePayService {
    /**
     * 查询绑卡信息(本人)
     */
    public BindCard bindCard(String patient, String openid) throws Exception {
        BindCard card = ownerCard(openid);
        //更新患者信息
        if (card != null) {
            Patient p = patientDao.findByCode(patient);
            p.setOpenid(openid);
            p.setSsc(card.getAttachCardNo());
//            增加绑定电子社保卡信息
            p.setSicardStatus(1);
            if (p.getSicardTime() == null) {
                p.setSicardTime(new Date());
            }
            ;
            if (card.getAttachIdType() == "01")      //身份证
            {
                p.setIdcard(card.getAttachIdNo());
            }
            if (!card.getAttachName().equals(p.getName())) {
                System.out.print("姓名不一致,姓名:" + p.getName() + "  社保姓名:" + card.getAttachName());
            }
            patientDao.save(p);
        }
        return card;
    }
//    public BindCard bindCard(String patient, String openid) throws Exception {
//        BindCard card = ownerCard(openid);
//
//        //更新患者信息
//        if (card != null) {
//            Patient p = patientDao.findByCode(patient);
//            p.setOpenid(openid);
//            p.setSsc(card.getAttachCardNo());
////            增加绑定电子社保卡信息
//            p.setSicardStatus(1);
//            if (p.getSicardTime() == null) {
//                p.setSicardTime(new Date());
//            }
//            ;
//            if (card.getAttachIdType() == "01")      //身份证
//            {
//                p.setIdcard(card.getAttachIdNo());
//            }
//            if (!card.getAttachName().equals(p.getName())) {
//                System.out.print("姓名不一致,姓名:" + p.getName() + "  社保姓名:" + card.getAttachName());
//            }
//
//            patientDao.save(p);
//        }
//
//        return card;
//    }
    /**
     * 查询绑卡信息(本人)
@ -694,7 +694,9 @@ public class OnePayService {
                //保存到患者表
                Patient p = patientDao.findByCode(patient);
                p.setOpenid(openid);
                if(!"undefined".equals(openid)&&StringUtils.isNotBlank(openid)){
                    p.setOpenid(openid);
                }
//            增加绑定电子社保卡信息
                if (!"1".equals(p.getSicardStatus())){
                    p.setSicardTime(new Date());

+ 4 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java

@ -16,6 +16,7 @@ import org.springframework.util.ReflectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.*;
@ApiResponses(value = {
@ -255,10 +256,12 @@ public class BaseController {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, list);
            return mapper.writeValueAsString(map);
            String s = mapper.writeValueAsString(map);
            return s;
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");

+ 5 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java

@ -278,10 +278,14 @@ public class WechatController extends WeixinBaseController {
            password = StringUtils.reverse(password);
            patient.setPassword(MD5.GetMD5Code(password + salt));
            patient.setSsc(ssc);
            if (!org.springframework.util.StringUtils.isEmpty(openid)) {
            if(!"undefined".equals(openid)&&StringUtils.isNotBlank(openid)){
                patient.setOpenid(openid);
                patient.setOpenidTime(new Date());
            }
//            if (!org.springframework.util.StringUtils.isEmpty(openid)) {
//                patient.setOpenid(openid);
//                patient.setOpenidTime(new Date());
//            }
            JSONObject json = patientService.register(idcard, ssc, name, mobile, MD5.GetMD5Code(password + salt)
                    ,salt,openid,3);
            if (json != null) {

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

@ -40,6 +40,7 @@ public class CallRecordController extends BaseController {
                                  @ApiParam(name="page",value="第几页,从1开始")@RequestParam(required = true)Integer page,
                                  @ApiParam(name="size",value="每页大小")@RequestParam(required = true)Integer size){
        try {
            return write(200,"保存成功","data",customerService.getCallServices(keyword, serverType,state,patientName,ssc,idCard,doctorName, code,adminTeamCode,startDate, endDate, page, size));
        }catch (Exception e){
            error(e);
@ -96,9 +97,10 @@ public class CallRecordController extends BaseController {
                                         @ApiParam(name="orderDeptName",value="科室")@RequestParam(required = false)String orderDeptName,
                                         @ApiParam(name="orderDoctor",value="预约医生编码")@RequestParam(required = false)String orderDoctor,
                                         @ApiParam(name="orderDoctorName",value="预约医生")@RequestParam(required = false)String orderDoctorName,
                                         @ApiParam(name="orderTime",value="预约时间,按需求格式拼接字符串")@RequestParam(required = false)String orderTime){
                                         @ApiParam(name="orderTime",value="预约时间,按需求格式拼接字符串")@RequestParam(required = false)String orderTime,
                                         @ApiParam(name="registerTime",value="挂号时间")@RequestParam(required = false)String registerTime){
        try {
            return write(200,"保存成功","data",customerService.dealAppointCallService( type , code, dealReason, dealContent,  orderHospital, orderHospitalName, orderDept, orderDeptName, orderDoctor, orderDoctorName, orderTime));
            return write(200,"保存成功","data",customerService.dealAppointCallService( type , code, dealReason, dealContent,  orderHospital, orderHospitalName, orderDept, orderDeptName, orderDoctor, orderDoctorName, orderTime,registerTime));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -356,6 +356,7 @@ public class EsStatisticsController extends BaseController {
                if(!"16".equals(idx)){
                    result.put("index_" + idx, statisticsESService.getIndexLevelTwototal(endDate, area, level, idx));
                }else{
                    //16的指标删除 改成 1和14
                    result.put("index_"+idx,statisticsESService.getPayPremiums(endDate,area,level));
                }
            }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java

@ -771,7 +771,7 @@ public class OnePayController extends WeixinBaseController {
                String outChargeNo = code.get("code").toString();
                pay.chargeQuery(outChargeNo,getAccessToken());
            }*/
            String url = doctorAssistant + "/wllyy/feldsher/sendDoctorTemplates";
            String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("type", "5"));
            params.add(new BasicNameValuePair("openId", "orrOgwATDaljVunlAq_Tdx3imhYg"));