Przeglądaj źródła

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

humingfen 7 lat temu
rodzic
commit
396ecfa9c3
29 zmienionych plików z 825 dodań i 111 usunięć
  1. 8 8
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyScreenResult.java
  2. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  3. 23 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/util/DateUtil.java
  4. 6 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyScreenResultDao.java
  5. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyTemplateResultDao.java
  6. 23 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  7. 109 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java
  8. 133 41
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  9. 42 17
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/survey/SurveyScreenResultService.java
  10. 123 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistScreenResultService.java
  11. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java
  12. 125 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/GuahaoXMService.java
  13. 0 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/IGuahaoService.java
  14. 82 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java
  15. 4 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/SpecialistController.java
  16. 62 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/SpecialistScreenResultController.java
  17. 5 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java
  18. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java
  19. 18 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/survey/PatientQuestionnaireController.java
  20. 40 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/zysoft/BookingController.java
  21. 12 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java
  22. 4 3
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  23. BIN
      patient-co/patient-co-wlyy/src/main/webapp/images/SpBanner.png
  24. BIN
      patient-co/patient-co-wlyy/src/main/webapp/images/banner01.png
  25. BIN
      patient-co/patient-co-wlyy/src/main/webapp/images/familycontract.png
  26. BIN
      patient-co/patient-co-wlyy/src/main/webapp/images/operatinginstructions.png
  27. BIN
      patient-co/patient-co-wlyy/src/main/webapp/images/patientPrenata.png
  28. BIN
      patient-co/patient-co-wlyy/src/main/webapp/images/visit.png
  29. BIN
      patient-co/patient-co-wlyy/src/main/webapp/images/xufangzhiyin_img.png

+ 8 - 8
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyScreenResult.java

@ -41,7 +41,7 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
    //是否高危预警(0不是  1是)
    private Integer isDanger;
    //是否预约(0未预约 1已预约)
    private Integer order;
    private Integer isOrder;
    //是否跟踪(0未跟踪 1已跟踪)
    private Integer following;
    //是否进行健康教育(0没有  1有)
@ -70,7 +70,7 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
    public SurveyScreenResult() {
    }
    public SurveyScreenResult(String code, String templateCode, String templateTitle, int disease, String doctor, String patientCode, String openId, String patientName, String screenResultCode, Integer screenResultScore, String screenResult, Integer isDanger, Integer order, Integer following, Integer isEducate, Integer over, String reservationCode, Date czrq, int isAgain, String parentCode, String originCode, String adviceCode, String otherAdvice, int source, Date updateTime) {
    public SurveyScreenResult(String code, String templateCode, String templateTitle, int disease, String doctor, String patientCode, String openId, String patientName, String screenResultCode, Integer screenResultScore, String screenResult, Integer isDanger, Integer isOrder, Integer following, Integer isEducate, Integer over, String reservationCode, Date czrq, int isAgain, String parentCode, String originCode, String adviceCode, String otherAdvice, int source, Date updateTime) {
        this.code = code;
        this.templateCode = templateCode;
        this.templateTitle = templateTitle;
@ -83,7 +83,7 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
        this.screenResultScore = screenResultScore;
        this.screenResult = screenResult;
        this.isDanger = isDanger;
        this.order = order;
        this.isOrder = isOrder;
        this.following = following;
        this.isEducate = isEducate;
        this.over = over;
@ -206,13 +206,13 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
        this.isDanger = isDanger;
    }
    @Column(name = "order")
    public int getOrder() {
        return order;
    @Column(name = "is_order")
    public Integer getIsOrder() {
        return isOrder;
    }
    public void setOrder(int order) {
        this.order = order;
    public void setIsOrder(Integer isOrder) {
        this.isOrder = isOrder;
    }
    @Column(name = "following")

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java

@ -30,7 +30,7 @@ public class Message extends IdEntity {
	/** type
	 *  消息类型(1.是家庭签约信息  2.体征消息  3分配健管师 4.随访提醒 5.咨询回复提醒,6.续方咨询待审核提醒,7.续方消息待取药
	 *  8.续方支付成功后团队长分配健管师,9线下调整完成,10意见反馈 11账号申诉,12.协同服务 13.孕检提醒 14.文章提交审核消息  15、健康文章审核结果
	 *  16.专科医生申请签约消息 18.专科医生同意签约发送给全科医生消息
	 *  16.专科医生申请签约消息,17、家庭医生转诊预约消息
	 *  101患者申请取消签约、102患者同意取消签约、103患者拒绝取消签约、104患者填写了血糖记录、105患者填写了血压记录、106患者填写了体重记录、
	 *  107患者填写了腰围记录、108患者填写了运动记录、109患者填写了用药记录、110患者填写了饮食记录、111患者提交了问卷随访、112请求添加好友消息、
	 *  113入群消息、114群解散消息、115踢出群消息、116新的网络咨询、117网络咨询追问、

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

@ -901,4 +901,27 @@ public class DateUtil {
		Timestamp nousedate = new Timestamp(date.getTime());
		return nousedate;
	}
	/**
	 * 获取周一
	 * @return
	 */
	public static String getSundayOfThisDate(Date date) {
		SimpleDateFormat df2 = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
		return df2.format(getSundayOfThisDateToDate(date));
	}
	/**
	 * 得到本周周日
	 *
	 * @return yyyy-MM-dd
	 */
	public static Date getSundayOfThisDateToDate(Date date) {
		Calendar c = Calendar.getInstance();
		c.setTime(date);
		int day_of_week = c.get(Calendar.DAY_OF_WEEK) - 1;
		if (day_of_week == 0)
			day_of_week = 7;
		c.add(Calendar.DATE, -day_of_week + 7);
		return c.getTime();
	}
}

+ 6 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyScreenResultDao.java

@ -11,16 +11,21 @@ import java.util.List;
 * Created by zhangdan on 2018/7/2.
 */
public interface SurveyScreenResultDao extends PagingAndSortingRepository<SurveyScreenResult, Long> {
    @Query("select surveyScreenResult from SurveyScreenResult surveyScreenResult where surveyScreenResult.code=?1")
    SurveyScreenResult getSurveyScreenResultByCode(String code);
    @Query(nativeQuery = true, value = "SELECT * FROM `wlyy_survey_screen_result` WHERE template_code=?1 ORDER BY czrq DESC LIMIT 1")
    List<SurveyScreenResult> findNewOneByTemplateCode(String templateCode);
    @Query("select a from  SurveyScreenResult a where a.parentCode=?1 and a.templateCode=?2")
    @Query("select a from  SurveyScreenResult a where a.patientCode=?1 and a.templateCode=?2")
    List<SurveyScreenResult> getByPatientCodeAndTemplateCode(String patientCode,String templateCode);
    @Modifying
    @Query("update SurveyScreenResult s set s.isAgain=0 where s.code=?1")
    void updateNoAgain(String code);
    @Query("select a from  SurveyScreenResult a where a.reservationCode=?1")
    List<SurveyScreenResult> getByReservationCode(String reservationCode);
}

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyTemplateResultDao.java

@ -6,13 +6,14 @@ import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.lang.annotation.Native;
import java.util.List;
/**
 * Created by zhangdan on 2018/7/4.
 */
public interface SurveyTemplateResultDao extends PagingAndSortingRepository<SurveyTemplateResult, Long> {
    @Query("select a from SurveyTemplateResult a where a.templateCode=?1 and a.lowScore<=?2 and a.highScore>=?2")
    @Query(value = "SELECT * FROM  wlyy_survey_template_result WHERE template_code =?1 AND IF(high_score IS NULL,low_score<=?2,low_score <= ?2 AND high_score >= ?2)",nativeQuery = true)
    SurveyTemplateResult getByTemplateCodeAndLowScoreAndHighScore (String template,int score);
}

+ 23 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -60,7 +60,7 @@ 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,12,101,14,15) 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,101,14,15,16,17) 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")
@ -123,4 +123,26 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query(" select a from Message a where a.type=?2 and a.del='1' and a.read=1 and a.receiver=?1 and a.over='1' order by a.createTime desc ")
    List<Message> findUnReadByReceiverAndType(String receiver,Integer type);
    @Query("select a from Message a where a.read= ?2 and a.receiver = ?1 and a.state = 1 and a.over = ?3 and a.type = 16 order by a.czrq desc")
    List<Message> getSpecialistApply(String receiver,Integer read,String over);
    @Query("select a from Message a where a.receiver = ?1 and a.state = 1 and a.type = 17 order by a.czrq desc")
    List<Message> getFamilyTransfer(String receiver);
    @Query("select a from Message a where a.receiver = ?1 and a.state = 1 and a.type = 18 order by a.czrq desc")
    List<Message> getFamilySign(String receiver);
    @Query("select a from Message a where a.receiver = ?1 and a.state = 1 and a.type = 18")
    List<Message> selectFamilySign(String receiver,Pageable pageableRequest);
    @Query("select a from Message a where a.read= ?2 and a.receiver = ?1 and a.state = 1 and a.over = ?3 and a.type = 17 order by a.czrq desc")
    List<Message> getFamilyTransferReadAndOver(String receiver,Integer read,String over);
    @Query("select a from Message a where a.read= ?2 and a.receiver = ?1 and a.state = 1 and a.over = ?3 and a.type = ?4 order by a.czrq desc")
    List<Message> getSpecialistUntreated(String receiver,Integer read,String over,Pageable pageable,Integer type);
    @Query("select a from Message a where a.code = ?1")
    Message findByCode(String code);
}

+ 109 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.app.message;
import com.alibaba.fastjson.JSONArray;
import com.yihu.device.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.message.Message;
@ -15,7 +16,6 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.IdCardUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -224,6 +224,26 @@ public class MessageService extends BaseService {
            deviceMesJson.put("amount", 0);
        }
        //居民签约申请
        List<Message> familyList = messageDao.getFamilySign(doctor);
        JSONObject familyMesJson = new JSONObject();
        JSONArray array = new JSONArray();
        if (familyList != null && familyList.size() > 0) {
            familyMesJson.put("amount", familyList.size());
            JSONObject  familyJson = new JSONObject();
            familyJson.put("title", familyList.get(0).getTitle());
            familyJson.put("type", familyList.get(0).getType());
            familyJson.put("msg", familyList.get(0).getContent());
            familyJson.put("msgTime", DateUtil.dateToStrLong(familyList.get(0).getCreateTime()));
            familyJson.put("relationCode",familyList.get(0).getRelationCode());
            familyJson.put("reason",familyList.get(0).getReason());
            familyMesJson.put("lastMessage", familyJson);
        }else{
            familyMesJson.put("amount", 0);
        }
        JSONObject json = new JSONObject();
        json.put("imMsgCount", getImMsgAmount(doctor));//IM消息数量
        json.put("sign", signJson);//签约数
@ -233,6 +253,7 @@ public class MessageService extends BaseService {
        json.put("callService", callServiceMesJson);//协同服务消息
        json.put("articleCheck", articleMesJson);//健康文章审核消息
        json.put("deviceUnbind",deviceMesJson);//设备解绑消息
        json.put("familyList",familyMesJson);//居民签约申请
        return json;
    }
@ -788,4 +809,91 @@ public class MessageService extends BaseService {
        jsonObject.put("deviceType",String.valueOf(deviceMap.get("deviceType")));
        return  jsonObject;
    }
    /**
     * 待处理状态
     *
     * @param doctor 医生code
     * @return
     */
    public JSONObject selectUntreated(String doctor){
        //专科医生签约平台
        List<Message> specialist = messageDao.getSpecialistApply(doctor,1,"1");
        JSONObject specialistJson = new JSONObject();
        if (specialist != null && specialist.size() != 0){
            specialistJson.put("amount", specialist.size());
            JSONObject specialistObject = new JSONObject();
            specialistObject.put("title", specialist.get(0).getTitle());
            specialistObject.put("type", specialist.get(0).getType());
            specialistObject.put("msg", specialist.get(0).getContent());
            specialistObject.put("msgTime", DateUtil.dateToStrLong(specialist.get(0).getCreateTime()));
            specialistObject.put("relationCode",specialist.get(0).getRelationCode());
            specialistJson.put("specialist",specialistObject);
        }
        //家庭医生转诊
        List<Message> familyList = messageDao.getFamilyTransferReadAndOver(doctor,1,"1");
        JSONObject familyJson = new JSONObject();
        if (familyList != null && familyList.size() != 0){
            familyJson.put("amount", familyList.size());
            JSONObject familyObject = new JSONObject();
            familyObject.put("title", familyList.get(0).getTitle());
            familyObject.put("type", familyList.get(0).getType());
            familyObject.put("msg", familyList.get(0).getContent());
            familyObject.put("msgTime", DateUtil.dateToStrLong(familyList.get(0).getCreateTime()));
            familyObject.put("relationCode",familyList.get(0).getRelationCode());
            familyJson.put("familyList",familyObject);
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("specialist",specialistJson);
        jsonObject.put("familyList",familyJson);
        return jsonObject;
    }
    /**
     * 获取签约居民申请消息列表
     *
     * @param receiver 接收者
     * @param page 页码
     * @param size 分页大小
     * @return
     * @throws Exception
     */
    public List<Message> getFamilySign(String receiver,Integer page, Integer size) throws Exception{
        // 排序
        Sort sort = new Sort(Sort.Direction.DESC, "read","over","createTime");
        // 分页信息
        Pageable pageRequest = new PageRequest(page - 1, size, sort);
        return messageDao.selectFamilySign(receiver,pageRequest);
    }
    /**
     * 获取待处理的接口
     *
     * @param message {}
     * @param page 页码
     * @param size 分页大小
     * @return
     * @throws Exception
     */
    public List<Message> getSpecialistUnTreated(Message message, Integer page, Integer size) throws Exception{
        // 排序
        Sort sort = new Sort(Sort.Direction.DESC, "read","over","createTime");
        // 分页信息
        Pageable pageRequest = new PageRequest(page - 1, size, sort);
        return messageDao.getSpecialistUntreated(message.getReceiver(),message.getRead(),message.getOver(),pageRequest,message.getType());
    }
}

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

@ -5402,6 +5402,7 @@ public class StatisticsESService {
        String index_86 = "86";//设备绑定量统计指标
        String index_87 = "87";//设备使用量统计指标
        String index_88 = "88";//设备异常数据24H统计指标
        String index_96 = "96";//设备本周使用量
        //String lastDate = year + "-06-30";
        //String timeKey = elasticsearchUtil.getQuotaTime();
        String timeKey = DateUtil.getStringDateShort();//当前时间
@ -5410,12 +5411,13 @@ public class StatisticsESService {
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
        Map<String, Object> resultMap = new HashedMap();
        DecimalFormat df = new DecimalFormat("0.00");
        List<Map<String, Object>> resultList = new ArrayList<>();
        SaveModel grantSaveModel = null;
        SaveModel bindingSaveModel = null;
        List<SaveModel> startUseSaveModel = null;
        List<SaveModel> endUseSaveModel = null;
//        List<SaveModel> startUseSaveModel = null;
//        List<SaveModel> endUseSaveModel = null;
        SaveModel useSaveModel = null;
        SaveModel anomalySaveModel = null;
        String allCountSql = "";
        String anomalyCountSql = "";
@ -5436,7 +5438,8 @@ public class StatisticsESService {
                grantSaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey, area, level, index_85, SaveModel.timeLevel_DDL, "hemopiezometer");
                bindingSaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey, area, level, index_86, SaveModel.timeLevel_DDL, "hemopiezometer");
                allCountSql = "SELECT COUNT(*) FROM device.wlyy_devices d where device_name like '%血压%' " + areaCondition;
                useCountSql = "SELECT COUNT(DISTINCT p.device_sn)  FROM device.wlyy_patient_health_index p LEFT JOIN device.wlyy_devices d on d.device_code=p.device_sn WHERE p.type IN (1, 2) and p.del=1 and p.type=1 and p.czrq>= '"+mondayTime+"' AND p.czrq < '"+currentTime+"' "+areaCondition ;
//                useCountSql = "SELECT COUNT(DISTINCT p.device_sn)  FROM device.wlyy_patient_health_index p LEFT JOIN device.wlyy_devices d on d.device_code=p.device_sn WHERE p.type IN (1, 2) and p.del=1 and p.type=1 and p.czrq>= '"+mondayTime+"' AND p.czrq < '"+currentTime+"' "+areaCondition ;
                useSaveModel = elasticsearchUtil.findOneDateQuotaLevel1(DateUtil.getSundayOfThisDate(new Date()), area, level, index_96, SaveModel.timeLevel_ZL, "1");
//                startUseSaveModel = elasticsearchUtil.findDateQuotaLevel1(mondayTime, mondayTime, area, level, index_87, SaveModel.timeLevel_DDL, "hemopiezometer", null, null);
//                endUseSaveModel = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index_87, SaveModel.timeLevel_DDL, "hemopiezometer", null, null);
                anomalySaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey, area, level, index_88, SaveModel.timeLevel_DDL, "hemopiezometer");
@ -5449,7 +5452,8 @@ public class StatisticsESService {
                grantSaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey, area, level, index_85, SaveModel.timeLevel_DDL, "glucometer");
                bindingSaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey, area, level, index_86, SaveModel.timeLevel_DDL, "glucometer");
                allCountSql = "SELECT COUNT(*) FROM device.wlyy_devices d where device_name like '%血糖%' " + areaCondition;
                useCountSql = "SELECT COUNT(DISTINCT p.device_sn)  FROM device.wlyy_patient_health_index p LEFT JOIN device.wlyy_devices d on d.device_code=p.device_sn WHERE p.type IN (1, 2) and p.del=1 and p.type=2 and p.czrq>= '"+mondayTime+"' AND p.czrq < '"+currentTime+"' "+areaCondition ;
//                useCountSql = "SELECT COUNT(DISTINCT p.device_sn)  FROM device.wlyy_patient_health_index p LEFT JOIN device.wlyy_devices d on d.device_code=p.device_sn WHERE p.type IN (1, 2) and p.del=1 and p.type=2 and p.czrq>= '"+mondayTime+"' AND p.czrq < '"+currentTime+"' "+areaCondition ;
                useSaveModel = elasticsearchUtil.findOneDateQuotaLevel1(DateUtil.getSundayOfThisDate(new Date()), area, level, index_96, SaveModel.timeLevel_ZL, "2");
//                startUseSaveModel = elasticsearchUtil.findDateQuotaLevel1(mondayTime, mondayTime, area, level, index_87, SaveModel.timeLevel_DDL, "glucometer", null, null);
//                endUseSaveModel = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index_87, SaveModel.timeLevel_DDL, "glucometer", null, null);
                anomalySaveModel = elasticsearchUtil.findOneDateQuotaLevel1(timeKey, area, level, index_88, SaveModel.timeLevel_DDL, "glucometer");
@ -5463,7 +5467,8 @@ public class StatisticsESService {
                bindingSaveModel = elasticsearchUtil.findOneDateQuotaLevel0(timeKey, area, level, index_86, SaveModel.timeLevel_DDL);
                anomalySaveModel = elasticsearchUtil.findOneDateQuotaLevel0(timeKey, area, level, index_88, SaveModel.timeLevel_DDL);
                allCountSql = "SELECT COUNT(*) FROM device.wlyy_devices d where 1=1 " + areaCondition;
                useCountSql = "SELECT COUNT(DISTINCT p.device_sn)  FROM device.wlyy_patient_health_index p LEFT JOIN device.wlyy_devices d on d.device_code=p.device_sn WHERE p.type IN (1, 2) and p.del=1  and p.czrq>= '"+mondayTime+"' AND p.czrq < '"+currentTime+"' "+areaCondition ;
//                useCountSql = "SELECT COUNT(DISTINCT p.device_sn)  FROM device.wlyy_patient_health_index p LEFT JOIN device.wlyy_devices d on d.device_code=p.device_sn WHERE p.type IN (1, 2) and p.del=1  and p.czrq>= '"+mondayTime+"' AND p.czrq < '"+currentTime+"' "+areaCondition ;
                useSaveModel = elasticsearchUtil.findOneDateQuotaLevel0(DateUtil.getSundayOfThisDate(new Date()), area, level, index_96, SaveModel.timeLevel_ZL);
                anomalyCountSql = " SELECT COUNT(i.id) FROM device.wlyy_patient_health_index i left join device.wlyy_devices d on i.device_sn=d.device_code where  i.status=1 and i.del=1 " + areaCondition;
//                startUseSaveModel = elasticsearchUtil.findDateQuotaLevel0(mondayTime, mondayTime, area, level, index_87, SaveModel.timeLevel_DDL, null, null);
//                endUseSaveModel = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index_87, SaveModel.timeLevel_DDL, null, null);
@ -5490,7 +5495,8 @@ public class StatisticsESService {
//        Double startTotalUseAccount = startUseSaveModel.size() > 0 ? startUseSaveModel.get(0).getResult1() : 0.0;
//        Double endTotalUseAccount = endUseSaveModel.size() > 0 ? endUseSaveModel.get(0).getResult1() : 0.0;
//        Double totalUseAccount = endTotalUseAccount-startTotalUseAccount;
        Integer useCount = jdbcTemplate.queryForObject(useCountSql, Integer.class);
//        Integer useCount = jdbcTemplate.queryForObject(useCountSql, Integer.class);
        Integer useCount = useSaveModel!=null?useSaveModel.getResult1().intValue():0;
        resultMap.put("totalUse", useCount);//本周使用量
        if (grantSaveModel.getResult1() > 0) {
            resultMap.put("totalUseRange", df.format(useCount.doubleValue() > 0.0 ? ((useCount.doubleValue()) / (grantSaveModel.getResult1() * 1.0000) * 100) : 0.0) + "%");//本周使用率
@ -5521,43 +5527,20 @@ public class StatisticsESService {
                }
            }
        }
        Map<String, SaveModel> bingdingMap = new HashMap<>();
        bindingAmountList.stream().forEach(one -> {
            if ("5".equals(low_level)) {
                bingdingMap.put(one.getTeam(), one);
            } else if ("4".equals(low_level)) {
                bingdingMap.put(one.getHospital(), one);
            } else if ("3".equals(low_level)) {
                bingdingMap.put(one.getTown(), one);
            }
        });
        //自建结果集
        resultList = getLowLevelMapKey(level, low_level, area);
        List<Map<String, Object>> resultList = getDeviceLowLevelMapKey(level, low_level, area,allMap,bingdingMap);
        if (resultList != null && resultList.size() > 0) {
            Map<String, SaveModel> bingdingMap = new HashMap<>();
            bindingAmountList.stream().forEach(one -> {
                if ("5".equals(low_level)) {
                    bingdingMap.put(one.getTeam(), one);
                } else if ("4".equals(low_level)) {
                    bingdingMap.put(one.getHospital(), one);
                } else if ("3".equals(low_level)) {
                    bingdingMap.put(one.getTown(), one);
                }
            });
            for (Map<String, Object> reMap : resultList) {
                reMap.put("amount", reMap.get("amount") != null ? Long.valueOf(reMap.get("amount").toString()) : 0L);
                int bindingAmount = 0;
                Integer allAmount = 0;
                //获取绑定数量
                if (bingdingMap != null && bingdingMap.size() > 0) {
                    SaveModel one = bingdingMap.get(reMap.get("code").toString());
                    if (one != null) {
                        bindingAmount = one.getResult2().intValue();
                    }
                }
                if (allMap != null && allMap.size() > 0) {
                    allAmount = allMap.get(reMap.get("code").toString());
                    if (allAmount == null) {
                        allAmount = 0;
                    }
                } else {
                }
                reMap.put("allNum", allAmount);
                reMap.put("bindingNum", bindingAmount);
                reMap.put("rate", getRange(bindingAmount, allAmount, 2));//续签率是 续签量/去年的签约数
            }
            if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
                translateTeamLeaderName(resultList);
@ -5584,6 +5567,115 @@ public class StatisticsESService {
        }
    }
    /**
     * 获取下级统计key
     *
     * @param level
     * @param lowLevel
     * @param area
     * @return
     */
    public List<Map<String, Object>> getDeviceLowLevelMapKey(int level, String lowLevel, String area,Map<String, Integer> allMap,Map<String, SaveModel> bingdingMap) {
        List<Map<String, Object>> resultList = new ArrayList<>();
        if (SaveModel.townLevel.equals(lowLevel)) {
            List<Town> towns = townDao.findByCityCode(area);
            if (towns != null) {
                for (Town town : towns) {
                    Map<String, Object> obj = new HashMap<>();
                    obj.put("code", town.getCode());
                    obj.put("name", town.getName());
                    obj.put("amount", "0");
                    obj = deviceRateList(obj,allMap,bingdingMap);
                    resultList.add(obj);
                }
            }
        } else if (lowLevel.equals("4")) {
            List<Town> towns = new ArrayList<>();
            if (SaveModel.cityLevel.equals(level + "")) {
                towns = townDao.findByCityCode(area);
            } else if (SaveModel.townLevel.equals(level + "")) {
                Town town = townDao.findByCode(area);
                if (town != null) {
                    towns.add(town);
                }
            }
            if (towns != null && towns.size() > 0) {
                for (Town town : towns) {
                    List<Hospital> hospitals = hospitalDao.findByTownCode(town.getCode());
                    for (Hospital hos : hospitals) {
                        if (hos.getCode().length() > 10) {
                            continue;
                        }
                        Map<String, Object> obj = new HashMap<>();
                        obj.put("code", hos.getCode());
                        obj.put("name", hos.getName());
                        obj.put("amount", "0");
                        obj = deviceRateList(obj,allMap,bingdingMap);
                        resultList.add(obj);
                    }
                }
            }
        } else if (SaveModel.teamLevel.equals(lowLevel)) {
            List<Hospital> hospitals = new ArrayList<>();
            if (level == 2) {
                hospitals = hospitalDao.findByCity(area);
            } else if (SaveModel.townLevel.equals(level + "")) {
                hospitals = hospitalDao.findByTownCode(area);
            } else {
                Hospital hos = hospitalDao.findByCode(area);
                if (hos != null) {
                    hospitals.add(hos);
                }
            }
            if (hospitals != null && hospitals.size() > 0) {
                for (Hospital hos : hospitals) {
                    if (hos.getCode().length() > 10) {
                        continue;
                    }
                    List<AdminTeam> teams = adminTeamDao.findByOrgCode(hos.getCode());
                    for (AdminTeam team : teams) {
                        Map<String, Object> obj = new HashMap<>();
                        obj.put("code", String.valueOf(team.getId()));
                        obj.put("name", team.getName());
                        obj.put("amount", "0");
                        obj = deviceRateList(obj,allMap,bingdingMap);
                        resultList.add(obj);
                    }
                }
            }
        }
        return resultList;
    }
    public Map<String, Object> deviceRateList(Map<String, Object> reMap,Map<String, Integer> allMap,Map<String, SaveModel> bingdingMap){
        reMap.put("amount", reMap.get("amount") != null ? Long.valueOf(reMap.get("amount").toString()) : 0L);
        int bindingAmount = 0;
        Integer allAmount = 0;
        //获取绑定数量
        if (bingdingMap != null && bingdingMap.size() > 0) {
            SaveModel one = bingdingMap.get(reMap.get("code").toString());
            if (one != null) {
                bindingAmount = one.getResult2().intValue();
            }
        }
        if (allMap != null && allMap.size() > 0) {
            allAmount = allMap.get(reMap.get("code").toString());
            if (allAmount == null) {
                allAmount = 0;
            }
        } else {
        }
        reMap.put("allNum", allAmount);
        reMap.put("bindingNum", bindingAmount);
        reMap.put("rate", getRange(bindingAmount, allAmount, 2));//续签率是 续签量/去年的签约数
        return reMap;
    }
    //i健康活动统计1.4.8版本
    public Map<String, Object> statisticsActivity(String area, int level, int sort,String lowLevel,String slaveKey1) throws Exception {
        Map<String, Object> resultMap = new HashMap<>();

+ 42 - 17
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/survey/SurveyScreenResultService.java

@ -47,11 +47,15 @@ public class SurveyScreenResultService extends BaseService {
    @Autowired
    private SurveyTemplateQuestionsDao surveyTemplateQuestionsDao;
    @Autowired
    private SurveyOptionAnswersDao surveyOptionAnswersDao;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private SurveyAdviceDao surveyAdviceDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private ManagerQuestionnaireService managerQuestionnaireService;
    private Logger logger = LoggerFactory.getLogger(this.getClass());
@ -84,7 +88,7 @@ public class SurveyScreenResultService extends BaseService {
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("1",dealType)){
            //已预约
            sql += " AND ssr.order = 1";
            sql += " AND ssr.is_order = 1";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("2",dealType)){
            //已跟踪
@ -92,11 +96,11 @@ public class SurveyScreenResultService extends BaseService {
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("3",dealType)){
            //已接诊
            sql += " AND ssr.order = 2";
            sql += " AND ssr.is_order = 2";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("4",dealType)){
            //待处理
            sql +=" AND ssr.`order` = 0 AND ssr.following= 0";
            sql +=" AND ssr.is_order = 0 AND ssr.following= 0";
        }
        List<Map<String,Object>> maps = jdbcTemplate.queryForList(sql);
        sql += " limit "+start+","+pageSize;
@ -117,7 +121,7 @@ public class SurveyScreenResultService extends BaseService {
     */
    public List<SurveyTemplates> getScreenList(int pageNo,int pageSize,int labelType){
        int start = (pageNo-1)*pageSize;
        String sql = "SELECT st.* FROM wlyy_survey_templates st LEFT JOIN wlyy_survey_label_info sli ON st.`code`= sli.relation_code WHERE st.del = 1 and sli.label="+labelType+" limit "+start+","+pageSize;
        String sql = "SELECT st.* FROM wlyy_survey_templates st LEFT JOIN wlyy_survey_label_info sli ON st.`code`= sli.relation_code WHERE st.del = 1 and sli.label="+labelType+" order by st.create_time desc limit "+start+","+pageSize;
        List<SurveyTemplates> surveyTemplatesList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyTemplates.class));
        return surveyTemplatesList;
    }
@ -129,7 +133,7 @@ public class SurveyScreenResultService extends BaseService {
     * @param source
     * @param jsonData
     */
    public String saveScreenResult(String patientCode,String doctor,int isAgain,int source, JSONObject jsonData){
    public String saveScreenResultAndAnswer(String patientCode,String doctor,int isAgain,int source, JSONObject jsonData)throws Exception{
        System.out.println("********保存筛查结果--jsonData********* " + jsonData);
        String surveyCode = jsonData.get("surveyCode").toString();
        SurveyTemplates surveyTemplates = surveyTemplatesDao.findById(surveyCode);
@ -138,6 +142,7 @@ public class SurveyScreenResultService extends BaseService {
        //解析json保存各种答案--获取一维数组
        JSONArray questions = jsonData.getJSONArray("questions");
        int totalScore = 0;
        for (int i = 0; i < questions.length(); i++) {
            //获取每一道题的信息
            JSONObject question = new JSONObject(questions.get(i).toString());
@ -148,7 +153,20 @@ public class SurveyScreenResultService extends BaseService {
                    JSONArray options = question.getJSONArray("options");
                    for (int j = 0; j < options.length(); j++) {
                        JSONObject option = new JSONObject(options.get(j).toString());
                        int score = Integer.parseInt(option.getString("score"));
                        /*String code = getCode();
                        String optionCode = option.get("optionCode").toString();
                        String comment = null;
                        int haveComment = 0;
                        if (option.has("comment")) {
                            comment = option.get("comment").toString();
                            haveComment = 1;
                        }
                        //保存到选择题答案表
                        SurveyOptionAnswers optionAnswer = new SurveyOptionAnswers(code, patientCode, surveyCode, qstCode, optionCode, comment, type, createTime,patient.getOpenid());
                        surveyOptionAnswersDao.save(optionAnswer);
                        //选择题修改统计表数量
                        surveyStatisticsDao.modifyAmount(surveyCode, qstCode, optionCode);*/
                        int score = option.getInt("score");
                        totalScore += score;
                    }
                }
@ -199,11 +217,12 @@ public class SurveyScreenResultService extends BaseService {
            surveyScreenResult.setPatientName(patient.getName());
            surveyScreenResult.setOpenId(patient.getOpenid());
        }
        surveyScreenResult.setOrder(0);
        surveyScreenResult.setIsOrder(0);
        surveyScreenResult.setFollowing(0);
        surveyScreenResult.setOver(1);
        surveyScreenResult.setCzrq(new Date());
        surveyScreenResult.setIsAgain(1);
        surveyScreenResult.setIsEducate(0);
        surveyScreenResult.setScreenResultScore(totalScore);
        if (surveyTemplateResult!=null){
            surveyScreenResult.setScreenResultCode(surveyTemplateResult.getCode());
@ -211,8 +230,8 @@ public class SurveyScreenResultService extends BaseService {
            surveyScreenResult.setScreenResult(surveyTemplateResult.getResult());
        }
        surveyScreenResultDao.save(surveyScreenResult);
        managerQuestionnaireService.saveAnswer(patientCode,code,jsonData);
        return code;
    }
    public JSONObject getScreenResultDetail(String code)throws Exception{
@ -225,9 +244,9 @@ public class SurveyScreenResultService extends BaseService {
            json.put("message","没有改筛查结果!");
            return json;
        }
        /*String idcard = String.valueOf(infoMap.get("idcard"));
        String idcard = String.valueOf(infoMap.get("idcard"));
        infoMap.put("sex",IdCardUtil.getSexForIdcard(idcard));
        infoMap.put("age",IdCardUtil.getAgeForIdcard(idcard));*/
        infoMap.put("age",IdCardUtil.getAgeForIdcard(idcard));
        String templateCode = String.valueOf(infoMap.get("template_code"));
        //String doctorCode = String.valueOf(infoMap.get("doctor"));
        String patientCode = String.valueOf(infoMap.get("patient_code"));
@ -244,7 +263,8 @@ public class SurveyScreenResultService extends BaseService {
        //题目和答案
        List<SurveyTemplateQuestions> questionList = surveyTemplateQuestionsDao.findById(templateCode);
        String sql = "SELECT soa.*,sto.score FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_template_options sto ON soa.options_code= sto.code WHERE soa.screen_result_code=? AND soa.patient=? AND soa.survey_code=?";
        Map<String,Object> answerMap = new HashMap<>();
        String sql = "SELECT soa.*,sto.score,sto.content FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_template_options sto ON soa.options_code= sto.code WHERE soa.screen_result_code=? AND soa.patient=? AND soa.survey_code=?";
        List<Map<String,Object>> optionAnswersList = jdbcTemplate.queryForList(sql,new Object[]{code,patientCode,templateCode});
        for (SurveyTemplateQuestions surveyTemplateQuestions : questionList){
            Map<String,Object> map = new HashMap<>();
@ -255,13 +275,14 @@ public class SurveyScreenResultService extends BaseService {
                    map.put("option",option);
                }
            }
            json.put(surveyTemplateQuestions.getSort()+"",map);
            answerMap.put(surveyTemplateQuestions.getSort()+"",map);
        }
        json.put("answer",answerMap);
        //结果
        String reultSql ="SELECT ssr.screen_result_score,ssr.screen_result,str.advice FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_survey_template_result str ON ssr.screen_result_code = str.code WHERE ssr.code='"+code+"'";
        Map<String,Object> resultMap = jdbcTemplate.queryForMap(reultSql);
        int following = Integer.parseInt(String.valueOf(infoMap.get("following")));
        int order = Integer.parseInt(String.valueOf(infoMap.get("order")));
        int order = Integer.parseInt(String.valueOf(infoMap.get("is_order")));
        if (order>0){
            //已转诊
            String doctorSql ="SELECT pr.doctor_name FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_patient_reservation pr ON ssr.reservation_code= pr.`code` where ssr.`code`='"+code+"'";
@ -279,7 +300,8 @@ public class SurveyScreenResultService extends BaseService {
                    surveyAdviceList.add(surveyAdviceDao.getByCode(adviceCode));
                }
            }
            resultMap.put("advice",surveyAdviceList);
            resultMap.put("doctorAdvice",surveyAdviceList);
            resultMap.put("doctorOtherAdvice",infoMap.get("other_advice"));
        }
        json.put("result",resultMap);
        return json;
@ -321,10 +343,13 @@ public class SurveyScreenResultService extends BaseService {
            mapList.add(sMap);
        }
        map.put("screenList",mapList);
        return map;
    }
    public List<SurveyScreenResult> patientGetResult(String patientCode){
        Map<String,Object> map = new HashedMap();
        String sql = "SELECT a.* FROM (SELECT * FROM wlyy_survey_screen_result WHERE patient_code='"+patientCode+"' ORDER BY czrq DESC) a  GROUP BY a.template_code";
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        map.put("result",surveyScreenResultList);
        return map;
        return surveyScreenResultList;
    }
    public List<Map<String,Object>> getResultByTemplateCode(int pageNo,int pageSize,String templateCode,String patientCode){
@ -359,7 +384,7 @@ public class SurveyScreenResultService extends BaseService {
            if (surveyScreenResult.getFollowing()==1){
                followCount++;
            }
            if (surveyScreenResult.getOrder()==1){
            if (surveyScreenResult.getIsOrder()==1){
                orderCount++;
            }
            if (StringUtils.isNotEmpty(surveyScreenResult.getParentCode())){

+ 123 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistScreenResultService.java

@ -0,0 +1,123 @@
package com.yihu.wlyy.service.specialist;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.specialist.PatientDiseaseServer;
import com.yihu.wlyy.entity.specialist.SpecialDisease;
import com.yihu.wlyy.entity.specialist.TeamDiseaseRelation;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.SignPatientLabelDao;
import com.yihu.wlyy.repository.doctor.SignPatientLabelInfoDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.specialist.PatientDiseaseServerDao;
import com.yihu.wlyy.repository.specialist.SpecialDiseaseDao;
import com.yihu.wlyy.repository.specialist.TeamDiseaseRelationDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2018/5/31.
 */
@Service
@Transactional
public class SpecialistScreenResultService extends BaseService {
    private static org.slf4j.Logger logger = LoggerFactory.getLogger(SpecialistScreenResultService.class);
    @Autowired
    private SignPatientLabelDao signPatientLabelDao;
    @Autowired
    private SignPatientLabelInfoDao signPatientLabelInfoDao;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Value("${specialist.url}")
    private String specialistUrl;
    @Autowired
    private DoctorAdminTeamDao doctorAdminTeamDao;
    @Autowired
    private TeamDiseaseRelationDao teamDiseaseRelationDao;
    @Autowired
    private PatientDiseaseServerDao patientDiseaseServerDao;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private SpecialDiseaseDao specialDiseaseDao;
    @Autowired
    private MessageDao messageDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    public JSONArray getScreenList(String doctor,int type,Integer page,Integer size) throws Exception {
        Map<String, Object> param = new HashedMap();
        param.put("doctor", doctor);
        param.put("type", type);
        param.put("pageNo", page);
        param.put("pageSize", size);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/getScreenResult", param);
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
            return  rs.getJSONArray("detailModelList");
        }
        return null;
    }
    public JSONObject getScreenCount(String doctor) throws Exception {
        JSONObject jsonObject = new JSONObject();
        Map<String, Object> param = new HashedMap();
        param.put("doctor", doctor);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/getScreenCount", param);
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
            jsonObject =  rs.getJSONObject("obj");
            return  jsonObject;
        }
        jsonObject.put("status",-1);
        jsonObject.put("message",rs.get("message"));
        return jsonObject;
    }
    public JSONObject getSpecialScreenResultDetail(String code) throws Exception {
        Map<String, Object> param = new HashedMap();
        JSONObject jsonObject = new JSONObject();
        param.put("code", code);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/getScreenResultDetail", param);
        JSONObject rs = new JSONObject(response.getContent());
        if (rs.getInt("status")==200) {
            jsonObject = rs.getJSONObject("obj");
            return  jsonObject;
        }
        jsonObject.put("status",-1);
        jsonObject.put("message",rs.get("message"));
        return jsonObject;
    }
}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java

@ -1759,7 +1759,7 @@ public class ManagerQuestionnaireService extends BaseService {
//            获取每一道题的信息
            JSONObject question = new JSONObject(questions.get(i).toString());
            String qstCode = question.get("qstCode").toString();
            int qstsort = Integer.parseInt(question.get("sort").toString());
            //int qstsort = Integer.parseInt(question.get("sort").toString());
            int type = Integer.parseInt(question.get("type").toString());
            if (type != 2) {
                if (question.has("options")) {
@ -1769,7 +1769,7 @@ public class ManagerQuestionnaireService extends BaseService {
                        JSONObject option = new JSONObject(options.get(j).toString());
                        String code = getCode();
                        String optionCode = option.get("optionCode").toString();
                        int optsort = Integer.parseInt(option.get("sort").toString());
                        //int optsort = Integer.parseInt(option.get("sort").toString());
                        String comment = null;
                        int haveComment = 0;
                        if (option.has("comment")) {

+ 125 - 15
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/GuahaoXMService.java

@ -1,12 +1,20 @@
package com.yihu.wlyy.service.third.guahao;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.survey.SurveyScreenResult;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientReservation;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.SurveyScreenResultDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientReservationDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.consult.ConsultService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.third.httplog.LogService;
@ -20,6 +28,7 @@ import org.dom4j.Element;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
@ -30,7 +39,7 @@ import java.util.*;
 * 厦门市民健康网挂号服务
 */
@Service
public class GuahaoXMService implements IGuahaoService {
public class GuahaoXMService extends BaseService implements IGuahaoService {
    private int nextDays = 8;  //一周内预约号
    private String ORG_LIST = "GetOrgListNew";//获取医院列表
@ -55,6 +64,13 @@ public class GuahaoXMService implements IGuahaoService {
    JwSmjkService jwSmjkService;
    @Autowired
    SignFamilyDao signFamilyDao;
    @Autowired
    private MessageDao messageDao;
    @Autowired
    private SurveyScreenResultDao surveyScreenResultDao;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private LogService logService;
@ -62,14 +78,22 @@ public class GuahaoXMService implements IGuahaoService {
    @Autowired
    private ConsultService consultService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private DoctorDao doctorDao;
    private ObjectMapper objectMapper = new ObjectMapper();
    /**
     * 解析挂号后
     */
    private String CreateOrderAfter(String response, String hospitalId, String hospitalName, String hosDeptId, String hosDeptName, String doctorId, String doctorName, String sectionType, String startTime, String endTime, String patient, String patientName, String cardNo, String clinicCard, String patientPhone, String dname, String dcode) throws Exception {
        String code = "";
        if (response.startsWith("error") || response.startsWith("System-Error")) {
    private String CreateOrderAfter(String response, String hospitalId, String hospitalName, String hosDeptId, String hosDeptName, String doctorId, String doctorName, String sectionType, String startTime, String endTime, String patient, String patientName, String cardNo, String clinicCard, String patientPhone, String dname, String dcode,String surveyCode) throws Exception {
        String code = "321321321";
       /* if (response.startsWith("error") || response.startsWith("System-Error")) {
            throw new Exception(response);
        } else if (response.toLowerCase().startsWith("ok")) {      //预约成功
            // 预约成功,获取预约号
@ -78,16 +102,23 @@ public class GuahaoXMService implements IGuahaoService {
            code = response.split("\\|")[0];
        } else {
            throw new Exception(response);
        }
        }*/
        Patient patient1 = null;
        try {
            patient1 = patientDao.findByCode(patient);
        }catch (Exception e){
            e.printStackTrace();
            System.out.println("获取病人信息失败");
        }
        // 查询医生职称和头像
        GuahaoDoctor doctor = null;
        try{
        /*try{
            doctor = jwSmjkService.getGuahaoDoctor(doctorId, hospitalId, hosDeptId);
        }catch (Exception e){
            e.printStackTrace();
            System.out.println("获取医生信息失败");
        }
        }*/
        // 保存预约记录
        PatientReservation reservation = new PatientReservation();
        reservation.setCode(code);
@ -99,10 +130,10 @@ public class GuahaoXMService implements IGuahaoService {
        reservation.setDeptName(hosDeptName);
        reservation.setDoctorCode(doctorId);
        reservation.setDoctorName(doctorName);
        if(doctor!=null){
        /*if(doctor!=null){
            reservation.setDoctorJob(doctor.getTitle());
            reservation.setDoctorPhoto(doctor.getPhoto());
        }
        }*/
        reservation.setIdcard(cardNo);
        reservation.setName(patientName);
        reservation.setPatient(patient);
@ -128,12 +159,47 @@ public class GuahaoXMService implements IGuahaoService {
        }
        // 保存预约记录
        patientReservationDao.save(reservation);
        PatientReservation patientReservation = patientReservationDao.save(reservation);
        if(StringUtils.isNotBlank(dcode)){
            Patient p = patientService.findByCode(patient);
            consultService.sendMucMessageBySingnType(dcode,dname,patient,"我已成功为您预约:" + startTime + "," + hospitalName + hosDeptName + doctorName + "医生的号源。您可直接前往医院就诊</br><a name='guahao' href='javascript:void(0)' data-id='" + reservation.getId() + "'>点击查看详情</a>","1",p.getName());
        }
        if (StringUtils.isNoneBlank(surveyCode)){
            SurveyScreenResult surveyScreenResult = surveyScreenResultDao.getSurveyScreenResultByCode(surveyCode);
            surveyScreenResult.setIsOrder(1);
            surveyScreenResult.setReservationCode(patientReservation.getCode());
            String sql = "update wlyy_survey_screen_result ssr set ssr.is_order = "+surveyScreenResult.getIsOrder()+"," +
                    "reservation_code = '"+surveyScreenResult.getReservationCode()+"' where ssr.id = '"+surveyScreenResult.getId()+"'";
            jdbcTemplate.update(sql);
            //发送消息
            Message message = new Message();
            message.setCzrq(new Date());
            message.setCreateTime(new Date());
            message.setContent("您有一个居民开通专科服务");
            message.setRead(1);//设置未读
            message.setReceiver(doctorId);//设置接受医生的code
            message.setSender(patient);//设置发送的用户
            message.setSenderName(patientName);
            message.setCode(getCode());
            message.setSenderPhoto(patient1.getPhoto());
            message.setTitle("专科医生共管通知");
            message.setType(17);//家庭签约取消信息
            message.setReadonly(1);//是否只读消息
            message.setSex(patient1.getSex());
            message.setOver("1");//未处理
            message.setRelationCode(patientReservation.getCode());
            message.setDel("1");
            message.setState(1);
            JSONObject object = new JSONObject();
            object.put("name",patient1.getName());
            object.put("carq",patientReservation.getCzrq());
            object.put("title",surveyScreenResult.getTemplateTitle());
            object.put("screenResult",surveyScreenResult.getScreenResult());
            message.setReason(object.toString());
            messageDao.save(message);
        }
        return code;
    }
@ -653,7 +719,7 @@ public class GuahaoXMService implements IGuahaoService {
            verificationXml(response,"获取医生排班表失败!",ORDER_CREATE,content,method,msgBody,res);
            //保存http日志
            logService.saveHttpLog(true,ORDER_CREATE,content,method,null,msgBody,res,null,logService.archiveType);
            re = CreateOrderAfter(response, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, null, null);
            re = CreateOrderAfter(response, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, null, null,null);
        } else {
            throw new Exception("该排班信息错误或者不存在!");
        }
@ -1161,7 +1227,7 @@ public class GuahaoXMService implements IGuahaoService {
    /**
     * 转诊预约挂号
     */
    public String CreateOrderByDoctor(String hospitalId, String hospitalName, String hosDeptId, String hosDeptName, String doctorId, String doctorName, String arrangeDate, String patient, String patientName, String cardNo, String clinicCard, String patientPhone, String dname, String dcode) throws Exception {
    public String CreateOrderByDoctor(String hospitalId, String hospitalName, String hosDeptId, String hosDeptName, String doctorId, String doctorName, String arrangeDate, String patient, String patientName, String cardNo, String clinicCard, String patientPhone, String dname, String dcode,String surveyCode) throws Exception {
        String re = "";
        Patient p = patientService.findByCode(patient);
@ -1175,9 +1241,9 @@ public class GuahaoXMService implements IGuahaoService {
            String startTime = map.get("startTime");
            String endTime = map.get("endTime");
            String response = jwSmjkService.webRegisterByFamily(cardNo, patientName, clinicCard, sectionType, startTime, hospitalId, hosDeptId, hosDeptName, doctorId, doctorName,patientPhone);
            re = CreateOrderAfter(response, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode);
           /* String response = jwSmjkService.webRegisterByFamily(cardNo, patientName, clinicCard, sectionType, startTime, hospitalId, hosDeptId, hosDeptName, doctorId, doctorName,patientPhone);
*/
            re = CreateOrderAfter(null, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode,surveyCode);
        } else {
            throw new Exception("该排班信息错误或者不存在!");
        }
@ -1185,4 +1251,48 @@ public class GuahaoXMService implements IGuahaoService {
        return re;
    }
    /**
     * 获取转诊信息
     *
     * @param relationCode 关联code
     * @return
     */
    public com.alibaba.fastjson.JSONObject getPatientReservationInfo(String relationCode){
        PatientReservation patientReservation = patientReservationDao.findByCode(relationCode);
        List<SurveyScreenResult> surveyScreenResults = null;
        Patient patient = null;
        SignFamily signFamily = null;
        Doctor doctor = null;
        int age = 0;
        if (patientReservation != null){
            surveyScreenResults = surveyScreenResultDao.getByReservationCode(relationCode);
            patient = patientDao.findByCode(patientReservation.getPatient());
            age = DateUtil.getAgeByBirthday(patient.getBirthday());
            signFamily = signFamilyDao.findByPatient(patientReservation.getPatient());
            doctor = doctorDao.findByCode(signFamily.getDoctor());
        }
        com.alibaba.fastjson.JSONObject object = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(patientReservation);
        object.put("surveyScreenResults",surveyScreenResults);
        object.put("patient",patient);
        object.put("age",age);
        object.put("signFamily",signFamily);
        object.put("doctor",doctor);
        return object;
    }
    public JSONObject updateRecode(String messageCode,String surveyCode){
        Message message = messageDao.findByCode(messageCode);
        message.setOver("0");
        messageDao.save(message);
        SurveyScreenResult surveyScreenResult = surveyScreenResultDao.getSurveyScreenResultByCode(surveyCode);
        surveyScreenResult.setIsOrder(2);
        surveyScreenResultDao.save(surveyScreenResult);
        JSONObject object = new JSONObject();
        object.put("message",message);
        object.put("surveyScreenResult",surveyScreenResult);
        return object;
    }
}

+ 0 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/IGuahaoService.java

@ -2,8 +2,6 @@
package com.yihu.wlyy.service.third.guahao;
import com.yihu.wlyy.entity.patient.PatientReservation;
import java.util.List;
import java.util.Map;

+ 82 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.message;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.consult.ConsultTeam;
@ -503,4 +504,85 @@ public class DoctorMessageController extends BaseController {
            return error( -1, "操作失败!");
        }
    }
    /**
     * 待处理
     *
     * @return
     */
    @RequestMapping(value = "unTreated",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("专科医生待处理消息")
    public String selectUntreated() {
        try {
            JSONObject json = messageService.selectUntreated(getUID());
            return write(200, "获取消息总数成功!", "data", json);
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
    /**
     * 居民签约申请消息列表
     *
     * @param page 页码
     * @param pageSize 每页大小
     * @return
     */
    @RequestMapping(value = "getFimalySign",method = RequestMethod.GET)
    @ApiOperation("居民签约申请消息列表")
    @ResponseBody
    public String getFimalySign(@ApiParam(name="page",value="第几页",defaultValue = "1") @RequestParam(value="page",required = true) String page,
                                          @ApiParam(name="pageSize",value="",defaultValue = "10") @RequestParam(value="pageSize",required = true) String pageSize){
        if (StringUtils.isBlank(pageSize)) {
            pageSize = "10";
        }
        if (page.equals("0")) {
            page = "1";
        }
        try {
            return write(200,"查询成功!","data",messageService.getFamilySign(getUID(),Integer.valueOf(page),Integer.valueOf(pageSize)));
        }catch (Exception e){
            error(e);
            return error( -1, "查询失败!");
        }
    }
    /**
     *
     * @param message
     * @param page
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "getSpecialist",method = RequestMethod.GET)
    @ApiOperation("专科医生待处理列表")
    @ResponseBody
    public String getSpecialist(@ApiParam(name = "message",value = "消息对象")@RequestParam(value = "message")String message,
                                @ApiParam(name="page",value="第几页",defaultValue = "1") @RequestParam(value="page",required = true) String page,
                                @ApiParam(name="pageSize",value="",defaultValue = "10") @RequestParam(value="pageSize",required = true) String pageSize){
        if (StringUtils.isBlank(pageSize)) {
            pageSize = "10";
        }
        if (page.equals("0")) {
            page = "1";
        }
        Message message1 = new Message();
        com.alibaba.fastjson.JSONObject object = JSON.parseObject(message);
        message1.setType(object.getInteger("type"));
        message1.setOver(object.getString("over"));
        message1.setRead(object.getInteger("read"));
        message1.setReceiver(getUID());
        try {
            return write(200,"查询成功!","data",messageService.getSpecialistUnTreated(message1,Integer.valueOf(page),Integer.valueOf(pageSize)));
        }catch (Exception e){
            error(e);
            return error( -1, "查询失败!");
        }
    }
}

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

@ -10,10 +10,12 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2018/5/31.

+ 62 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/SpecialistScreenResultController.java

@ -0,0 +1,62 @@
package com.yihu.wlyy.web.doctor.specialist;
import com.yihu.wlyy.service.specialist.SpecialistScreenResultService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
 * Created by zhangdan on 2018/7/6.
 */
@RestController
@RequestMapping(value = "/doctor/specialist/screen", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "专科医生-疾病筛查部分")
public class SpecialistScreenResultController extends BaseController {
    @Autowired
    private SpecialistScreenResultService specialistScreenResultService;
    @RequestMapping(value = "/getList",method = RequestMethod.GET)
    @ApiOperation(value = "专科医生获取筛查记录列表")
    public String createSpecialistPatientRelation(@ApiParam(name = "doctor", value = "专科医生ID")@RequestParam(value = "doctor")String doctor,
                                                                         @ApiParam(value = "当前页")@RequestParam(value = "pageNo") int pageNo,
                                                                         @ApiParam(value = "显示记录数")@RequestParam(value = "pageSize") int pageSize,
                                                                         @ApiParam(value = "1已跟踪 2已预约")@RequestParam(value = "type",required = false) int type){
        try {
            return write(200,"获取成功!","data",specialistScreenResultService.getScreenList(doctor,type,pageNo,pageSize));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
    @RequestMapping(value = "getScreenCount",method = RequestMethod.POST)
    @ApiOperation(value = "专科医生首页--筛查已跟踪和已预约的数目")
    public String findSpecialistPatientRelation(@ApiParam(name = "doctor", value = "专科医生ID")@RequestParam(value = "doctor")String doctor){
        try {
            return write(200,"获取成功!","data",specialistScreenResultService.getScreenCount(doctor));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
    @RequestMapping(value = "getScreenResultDetail",method = RequestMethod.GET)
    @ApiOperation(value = "查看筛查结果记录详情")
    public String getScreenResultDetail(@ApiParam(value = "筛查结果唯一code")@RequestParam(value = "code") String code) {
        try {
            return write(200,"获取成功!","data",specialistScreenResultService.getSpecialScreenResultDetail(code));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
}

+ 5 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java

@ -568,19 +568,18 @@ public class ManagerQuestionnaireController extends WeixinBaseController {
    @ResponseBody
    public String saveAnswer( @RequestParam String jsonData,
                              @ApiParam(value = "居民code")@RequestParam(value = "patientCode")String patientCode,
                              @ApiParam(value = "问卷标签")@RequestParam(value = "labelType")int labelType,
                              @ApiParam(value = "问卷标签")@RequestParam(value = "labelType")Integer labelType,
                              @ApiParam(value = "筛查入口(labelType=5时要填),0是第一次筛查 1是再次评估")@RequestParam(value = "isAgain")int isAgain,
                              @ApiParam(value = "来源(1医生发放 2居民自我评估)")@RequestParam(value = "source")int source) {
        try {
            JSONObject json = new JSONObject(jsonData);
            //如果是评分筛查还要保存最后记录
            String screenResultcode = "";
            if (labelType==5){
                screenResultcode = surveyScreenResultService.saveScreenResult(patientCode,getUID(),isAgain,source,json);
                return  write(200, "保存成功!","data",surveyScreenResultService.saveScreenResultAndAnswer(patientCode,getUID(),isAgain,source,json));
            }else {
                managerQuestionnaireService.saveAnswer(patientCode, "",json);
                return write(200, "保存成功!");
            }
            managerQuestionnaireService.saveAnswer(patientCode, screenResultcode,json);
            return write(200, "保存成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "保存失败!");

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java

@ -439,8 +439,8 @@ public class PatientDeviceController extends BaseController {
                message.setDel("1");
                messageDao.save(message);
                //全部解绑后去判断就更新设备表中是否绑定字段
                deviceDetailService.unBindUpdateIsBinding(pd.getDeviceSn());
                patientDeviceLogService.savePatientDeviceLog(pd,pd.getDeviceSn(),2,2);
                deviceDetailService.unBindUpdateIsBinding(pd.getDeviceSn());
                return success("设备已删除!");
            } else {
                return error(-1, "不存在该设备!");

+ 18 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/survey/PatientQuestionnaireController.java

@ -102,8 +102,8 @@ public class    PatientQuestionnaireController extends BaseController {
    //----------------------------------疾病筛查-----------------------------------------//
    @RequestMapping(value = "getResultAndScreenList", method = RequestMethod.GET)
    @ApiOperation(value = "根据问卷标签类型获取筛查问卷列表和自己的筛查结果")
    @RequestMapping(value = "getScreenList", method = RequestMethod.GET)
    @ApiOperation(value = "根据问卷标签类型获取筛查问卷列表")
    @ResponseBody
    public String getResultAndScreenList(@ApiParam(value = "当前页")@RequestParam(value = "pageNo") int pageNo,
                                @ApiParam(value = "显示记录数")@RequestParam(value = "pageSize") int pageSize,
@ -116,6 +116,18 @@ public class    PatientQuestionnaireController extends BaseController {
        }
    }
    @RequestMapping(value = "getResultList", method = RequestMethod.GET)
    @ApiOperation(value = "获取自己的筛查结果")
    @ResponseBody
    public String getResultnList() {
        try {
            return write(200, "获取成功!", "data", surveyScreenResultService.patientGetResult(getRepUID()));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "getResultByTemplateCode", method = RequestMethod.GET)
    @ApiOperation(value = "居民查看具体一个筛查模板自己的结果")
    @ResponseBody
@ -167,12 +179,12 @@ public class    PatientQuestionnaireController extends BaseController {
            JSONObject json = new JSONObject(jsonData);
            //如果是评分筛查还要保存最后记录
            String screenResultcode = "";
            if (labelType==5){
                screenResultcode = surveyScreenResultService.saveScreenResult(patientCode,getUID(),isAgain,source,json);
                return  write(200, "保存成功!","data",surveyScreenResultService.saveScreenResultAndAnswer(patientCode,getUID(),isAgain,source,json));
            }else {
                managerQuestionnaireService.saveAnswer(patientCode, "",json);
                return write(200, "保存成功!");
            }
            managerQuestionnaireService.saveAnswer(patientCode, screenResultcode,json);
            return write(200, "保存成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "保存失败!");

+ 40 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/zysoft/BookingController.java

@ -604,9 +604,11 @@ public class BookingController extends WeixinBaseController {
                                      @ApiParam(name = "dcode", value = "代预约医生编号", defaultValue = "test00000000005")
                                      @RequestParam(value = "dcode", required = true) String dcode,
                                      @ApiParam(name = "dname", value = "代预约医生名称", defaultValue = "组2全科医生")
                                      @RequestParam(value = "dname", required = true) String dname) {
                                      @RequestParam(value = "dname", required = true) String dname,
                                      @ApiParam(name="surveyCode",value = "筛选code",defaultValue = "a")
                                      @RequestParam(value = "surveyCode",required = true)String surveyCode) {
        try {
            String orderCode = guahaoXM.CreateOrderByDoctor(hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, arrangeDate, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode);
            String orderCode = guahaoXM.CreateOrderByDoctor(hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, arrangeDate, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode,surveyCode);
            //获取预约信息查询是否挂号成功
            PatientReservation obj = patientReservationService.findByCode(orderCode);
            if (obj != null) {
@ -833,6 +835,42 @@ public class BookingController extends WeixinBaseController {
    }
    /**
     * 获取病人转诊信息
     *
     * @param relationCode 关联预约记录code
     *
     * @return
     */
    @RequestMapping(value = "getPatientReservationInfo", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取病人转诊信息")
    public String getPatientReservationInfo(
            @ApiParam(name = "relationCode", value = "关联code")
            @RequestParam(value = "relationCode", required = true) String relationCode) {
        try {
            return write(200, "获取病人转诊信息", "data", guahaoXM.getPatientReservationInfo(relationCode));
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "updateRecode", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("已转诊")
    public String updateRecode(
            @ApiParam(name = "messageCode", value = "消息code")
            @RequestParam(value = "messageCode", required = true) String messageCode,
            @ApiParam(name = "surveyCode", value = "筛选code")
            @RequestParam(value = "surveyCode", required = true) String surveyCode) {
        try {
            return write(200, "已转诊", "data", guahaoXM.updateRecode(messageCode,surveyCode));
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
}

+ 12 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

@ -440,6 +440,17 @@ public class WeiXinEventProcess {
            // 构建回复消息XML
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        }else if (StringUtils.isNotEmpty(eventKey) && (eventKey.startsWith("sp_disease_")||eventKey.startsWith("qrscene_sp_disease_"))){
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            // 图文信息
            List<Map<String, String>> articles = new ArrayList<>();
            // 二维码参数
            String[] keys = eventKey.replace("sp_disease_", "").split("_");
            //设置图文消息
            setSpDisease(articles,keys[0],keys[1],systemConf);
            // 构建回复消息XMLs
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        }else {
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
@ -802,7 +813,7 @@ public class WeiXinEventProcess {
            // 构建回复消息XML
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        }else if (StringUtils.isNotEmpty(eventKey) && eventKey.startsWith("sp_disease_")){
        }else if (StringUtils.isNotEmpty(eventKey) && (eventKey.startsWith("sp_disease_")||eventKey.startsWith("qrscene_sp_disease_"))){
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            // 图文信息

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

@ -35,7 +35,8 @@ im:
#专病配置
specialist:
  url: http://localhost:8070/
  #url: http://172.19.103.33:9797/svr-wlyy-specialist
  url: http://localhost:10051/svr-wlyy-specialist
#物联网配置
iot:
#  url: http://192.168.131.24:8088/svr-iot/
@ -114,8 +115,8 @@ images:
sign:
  #check_upload: http://172.19.103.88:8011/wlyy_service
  check_upload: http://localhost:8070/
  check_upload: http://172.19.103.88:8011/wlyy_service
  #check_upload: http://localhost:8070/
express:

BIN
patient-co/patient-co-wlyy/src/main/webapp/images/SpBanner.png


BIN
patient-co/patient-co-wlyy/src/main/webapp/images/banner01.png


BIN
patient-co/patient-co-wlyy/src/main/webapp/images/familycontract.png


BIN
patient-co/patient-co-wlyy/src/main/webapp/images/operatinginstructions.png


BIN
patient-co/patient-co-wlyy/src/main/webapp/images/patientPrenata.png


BIN
patient-co/patient-co-wlyy/src/main/webapp/images/visit.png


BIN
patient-co/patient-co-wlyy/src/main/webapp/images/xufangzhiyin_img.png