소스 검색

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

chenweida 7 년 전
부모
커밋
dd5ace563c

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/feedback/AppealService.java

@ -261,7 +261,7 @@ public class AppealService extends BaseService {
                //wlyy给医生发送系统消息
                Doctor doctor = doctorDao.findByCode(creater);
                String doctorOpenID = doctor.getOpenid();
                String url = wlyyService + "/doctor/feedback/sendMessage";
                String url = wlyyService + "/third/template/sendMessage";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("receiver", creater));
                params.add(new BasicNameValuePair("title", title));

+ 3 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/feedback/FeedbackService.java

@ -217,8 +217,9 @@ public class FeedbackService extends BaseService {
                String patientName = patient.getName();
                String patientOpendID = patient.getOpenid();
                if (StringUtils.isNotEmpty(patientOpendID)) {
                    String url = wlyyService + "/patient/feedback/sendTemplate";
                    String url = wlyyService + "/third/template/sendTemplate";
                    List<NameValuePair> params = new ArrayList<>();
                    params.add(new BasicNameValuePair("type", "2"));
                    params.add(new BasicNameValuePair("toUser", patientOpendID));
                    params.add(new BasicNameValuePair("url", null));
                    params.add(new BasicNameValuePair("first", "您好!您提交的意见反馈已处理"));
@ -252,7 +253,7 @@ public class FeedbackService extends BaseService {
                //wlyy给医生发送系统消息
                Doctor doctor = doctorDao.findByCode(creater);
                String doctorOpenID = doctor.getOpenid();
                String url = wlyyService + "/doctor/feedback/sendMessage";
                String url = wlyyService + "/third/template/sendMessage";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("receiver", creater));
                params.add(new BasicNameValuePair("title", title));

+ 5 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -2641,9 +2641,9 @@ public class ConsultTeamService extends ConsultService {
    public void addPrescriptionBloodStatusConsult(String prescriptionCode, String type,String followupid) throws Exception {
        
        if("1".equals(type)){//血压
            prescriptionFollowupContentService.importPatientBloodPressureToFollowup(prescriptionCode,followupid,true);
            prescriptionFollowupContentService.importPatientBloodPressureToFollowup(prescriptionCode,followupid,true,"");
        }else if("2".equals(type)){//血糖
            prescriptionFollowupContentService.importPatientBloodSugarToFollowup(prescriptionCode,followupid,true);
            prescriptionFollowupContentService.importPatientBloodSugarToFollowup(prescriptionCode,followupid,true,"");
        }
        
    }
@ -2668,8 +2668,8 @@ public class ConsultTeamService extends ConsultService {
        contentobj.put("isSendWxTemplate",true);//是否发送咨询回复的微信模板
        //医生发送Im消息
        ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "17", contentobj.toString(), null);
        contentobj.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
        //居民发送Im消息
        ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "17", contentobj.toString(), null);
//        contentobj.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
//        //居民发送Im消息
//        ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "17", contentobj.toString(), null);
    }
}

+ 8 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java

@ -927,17 +927,19 @@ public class FollowUpService extends BaseService {
            Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                    .build();
            SearchResult result = jestClient.execute(search);
            List<FollowupContentESDO> dataList = result.getSourceAsObjectList(FollowupContentESDO.class);
            FollowupContentESDO followupContentESDO = result.getSourceAsObject(FollowupContentESDO.class);
            //删除原有记录
            this.esDeleteFollowUpContent(dataList);
            List<FollowupContentESDO> dataList = new ArrayList<>();
            if(followupContentESDO != null){
                dataList.add(followupContentESDO);
                //删除原有记录
                this.esDeleteFollowUpContent(dataList);
            }
            //保存新的随访详情信息
            List<FollowupContentESDO> newdatalist = new ArrayList<>();
            FollowupContentESDO followupContentESDO = new FollowupContentESDO();
            followupContentESDO = new FollowupContentESDO();
            followupContentESDO = JSON.parseObject(followupProjectData, FollowupContentESDO.class);
            followupContentESDO.setFollowup_id(id);
            followupContentESDO.setFollowup_project(followupProject);
            followupContentESDO.setCreate_time(new Date());

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

@ -3,11 +3,13 @@ package com.yihu.wlyy.service.app.prescription;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.device.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.entity.followup.FollowupDrugs;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionFollowupContent;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionInfo;
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.followup.FollowUpDao;
import com.yihu.wlyy.repository.followup.FollowupDrugsDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
@ -55,6 +57,8 @@ public class PrescriptionFollowupContentService extends BaseService {
	private ImUtill ImUtill;
	@Autowired
	JdbcTemplate jdbcTemplate;
	@Autowired
	private DevicePatientHealthIndexDao devicePatientHealthIndexDao;
	
	/**
	 * 根据续方CODE,文件类型获取数据
@ -266,7 +270,7 @@ public class PrescriptionFollowupContentService extends BaseService {
	 * @param prescriptioncode
	 * @param followup_id
	 */
	public void importPatientBloodSugarToFollowup(String prescriptioncode, String followup_id,boolean sendIM) throws Exception {
	public void importPatientBloodSugarToFollowup(String prescriptioncode, String followup_id,boolean sendIM,String healthindexid) throws Exception {
		Long followupId = Long.valueOf(followup_id);
		
		Followup followup =followUpDao.findOne(followupId);
@ -284,7 +288,6 @@ public class PrescriptionFollowupContentService extends BaseService {
		
		List<Object> list = healthIndexService.findIndexByPatient2(patientCode, 1, stardate, enddate, 0, 2);
		
		
		String followupProjectData = "";
		
		org.json.JSONObject contentDoctor = new org.json.JSONObject();
@ -302,58 +305,57 @@ public class PrescriptionFollowupContentService extends BaseService {
			contentDoctor.put("deviceMsg","您未绑定血糖智能设备,请手动上传体征数据,绑定设备后系统将会自动将您的体征数据上报给医生");
		}
		
		if(!list.isEmpty()){
		if(StringUtils.isNotBlank(healthindexid) || !list.isEmpty()){
			
			for (Object o: list) {
				
				JSONObject obj = (JSONObject)o;
				
				imBloodSugarDate = obj.getDate("recordDate");
				
				//餐前
				if(StringUtils.isNotBlank(obj.getString("value1"))){
					followupProjectData = "{'BS_FPG':'"+obj.getString("value1")+"'}";
					imBloodSugarValue = obj.getString("value1");
					break;
				}
				
				if(StringUtils.isNotBlank(obj.getString("value3"))){
					followupProjectData = "{'BS_FPG':'"+obj.getString("value3")+"'}";
					imBloodSugarValue = obj.getString("value3");
					break;
				}
				
				if(StringUtils.isNotBlank(obj.getString("value5"))){
					followupProjectData = "{'BS_FPG':'"+obj.getString("value5")+"'}";
					imBloodSugarValue = obj.getString("value5");
					break;
				}
				//餐后
				if(StringUtils.isNotBlank(obj.getString("value2"))){
					followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value2")+"'}";
					imBloodSugarValue = obj.getString("value2");
					break;
				}
				
				
				if(StringUtils.isNotBlank(obj.getString("value4"))){
					followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value4")+"'}";
					imBloodSugarValue = obj.getString("value4");
					break;
				}
				
				if(StringUtils.isNotBlank(obj.getString("value6"))){
					followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value6")+"'}";
					imBloodSugarValue = obj.getString("value6");
					break;
				}
				
				//随机血糖
				if(StringUtils.isNotBlank(obj.getString("value7"))){
					followupProjectData = "{'RANDOM_BLOOD_SUGAR':'"+obj.getString("value7")+"'}";
					imBloodSugarValue = obj.getString("value7");
					break;
				}
			JSONObject obj = new JSONObject();
			
			//如果有传体征ID,则查体征数据
			if(StringUtils.isNotBlank(healthindexid)){
				DevicePatientHealthIndex devicePatientHealthIndex = devicePatientHealthIndexDao.findOne(new Long(healthindexid));
				obj = (JSONObject)JSON.toJSON(devicePatientHealthIndex);
			}else{
				//如果没传体征ID,则获取最近的一条
				obj = (JSONObject)list.get(0);
			}
			
			imBloodSugarDate = obj.getDate("recordDate");
			
			//餐前
			if(StringUtils.isNotBlank(obj.getString("value1"))){
				followupProjectData = "{'BS_FPG':'"+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");
			}
			
			followUpService.esSaveFollowupProjectData(followup_id, "3", followupProjectData);
@ -416,7 +418,7 @@ public class PrescriptionFollowupContentService extends BaseService {
	 * @param followup_id
	 * @param sendIM 是否发送IM消息
	 */
	public void importPatientBloodPressureToFollowup(String prescriptioncode, String followup_id,boolean sendIM) throws Exception {
	public void importPatientBloodPressureToFollowup(String prescriptioncode, String followup_id,boolean sendIM,String healthindexid) throws Exception {
		
		Long followupId = Long.valueOf(followup_id);
		
@ -432,7 +434,41 @@ public class PrescriptionFollowupContentService extends BaseService {
		
		String stardate = DateUtil.getNextMonth(new Date(),-1)+" 00:00:00";
		String enddate = DateUtil.getStringDateShort()+" 23:59:59";
		org.json.JSONArray jsonArray = healthIndexService.findIndexByPatient(patientCode, 2, stardate, enddate, 0, 2);
		org.json.JSONArray jsonArray = new org.json.JSONArray();
		
		if(StringUtils.isBlank(healthindexid)){
			
			jsonArray = healthIndexService.findIndexByPatient(patientCode, 2, stardate, enddate, 0, 2);
		}else{
			DevicePatientHealthIndex devicePatientHealthIndex = devicePatientHealthIndexDao.findOne(new Long(healthindexid));
			
			if(devicePatientHealthIndex != null){
				org.json.JSONObject json = new org.json.JSONObject();
				json.put("id", devicePatientHealthIndex.getId());
				json.put("patient",devicePatientHealthIndex.getUser());
				json.put("value1", devicePatientHealthIndex.getValue1());
				json.put("value2", devicePatientHealthIndex.getValue2());
				json.put("value3", devicePatientHealthIndex.getValue3());
				json.put("value4", devicePatientHealthIndex.getValue4());
				json.put("value5", devicePatientHealthIndex.getValue5());
				json.put("value6", devicePatientHealthIndex.getValue6());
				json.put("value7", devicePatientHealthIndex.getValue7());
				json.put("deviceSn",devicePatientHealthIndex.getDeviceSn());
				json.put("type", devicePatientHealthIndex.getType());
				
				Date date = devicePatientHealthIndex.getRecordDate();
				if (devicePatientHealthIndex.getType() == 2) {
					json.put("date", DateUtil.dateToStr(date, DateUtil.YYYY_MM_DD_HH_MM_SS));
				} else {
					json.put("date", DateUtil.dateToStr(date, DateUtil.YYYY_MM_DD));
				}
				json.put("sortDate",devicePatientHealthIndex.getSortDate());
				json.put("czrq", devicePatientHealthIndex.getCzrq());
				
				jsonArray.put(json);
			}
		}
		
		String followupProjectData = "";
		

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -670,8 +670,8 @@ public class PrescriptionInfoService extends BaseService {
                //获取智业待结算接口,更新药品金额
                prescriptionService.getPerscriptionInfoCostFromPayInfo(p.getCode());
                //更新随访记录的状态为完成
                followUpDao.updateStatusByPrescriptionCode(p.getCode(),"1");
//                //更新随访记录的状态为完成
//                followUpDao.updateStatusByPrescriptionCode(p.getCode(),"1");
                //发送Im消息
                JSONObject content = new JSONObject();

+ 8 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/DoctorPrescriptionFollowupContentController.java

@ -101,9 +101,11 @@ public class DoctorPrescriptionFollowupContentController extends BaseController
			@ApiParam(name = "prescriptioncode", value = "续方CODE", defaultValue = "")
			@RequestParam(value = "prescriptioncode", required = true) String prescriptioncode,
			@ApiParam(name = "followupid", value = "随访ID", defaultValue = "")
			@RequestParam(value = "followupid", required = true) String followupid){
			@RequestParam(value = "followupid", required = true) String followupid,
			@ApiParam(name = "healthindexid", value = "体征ID", defaultValue = "")
			@RequestParam(value = "healthindexid", required = true) String healthindexid){
		try {
			prescriptionFollowupContentService.importPatientBloodSugarToFollowup(prescriptioncode,followupid,false);
			prescriptionFollowupContentService.importPatientBloodSugarToFollowup(prescriptioncode,followupid,false,healthindexid);
			return write(200, "操作成功!");
		}catch (Exception e){
			//日志文件中记录异常信息
@ -119,9 +121,11 @@ public class DoctorPrescriptionFollowupContentController extends BaseController
			@ApiParam(name = "prescriptioncode", value = "续方CODE", defaultValue = "")
			@RequestParam(value = "prescriptioncode", required = true) String prescriptioncode,
			@ApiParam(name = "followupid", value = "随访ID", defaultValue = "")
			@RequestParam(value = "followupid", required = true) String followupid){
			@RequestParam(value = "followupid", required = true) String followupid,
			@ApiParam(name = "healthindexid", value = "体征ID", defaultValue = "")
			@RequestParam(value = "healthindexid", required = true) String healthindexid){
		try {
			prescriptionFollowupContentService.importPatientBloodPressureToFollowup(prescriptioncode,followupid,false);
			prescriptionFollowupContentService.importPatientBloodPressureToFollowup(prescriptioncode,followupid,false,healthindexid);
			return write(200, "操作成功!");
		}catch (Exception e){
			//日志文件中记录异常信息

+ 5 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -492,6 +492,9 @@ public class EsStatisticsController extends BaseController {
                    if (org.springframework.util.StringUtils.isEmpty(year)) {
                        year = Constant.getNowYear();
                    }
                    if ("13".equals(idx)){
                        idx="1";
                    }
//                    JSONObject json = statisticsAllService.getDateTotal(startDate, endDate, interval, area, level, idx, lowCode,year);
                    JSONObject json = statisticsESService.getDateTotal(startDate, endDate, interval, area, level, idx, lowCode, year);
                    result.put("index_" + idx, json);
@ -832,7 +835,7 @@ public class EsStatisticsController extends BaseController {
        try {
            return write(200, "查询成功", "data", statisticsESService.getStatTitleInfo(getUID(), startDate, endDate));
            //return write(200, "查询成功", "data", statisticsESService.getStatTitleInfo("zbqD201703150222",startDate,endDate));
            //return write(200, "查询成功", "data", statisticsESService.getStatTitleInfo("xh1D201703150222",startDate,endDate));
        } catch (Exception e) {
            error(e);
@ -885,7 +888,7 @@ public class EsStatisticsController extends BaseController {
                                   @RequestParam(required = true) String isNow) {
        try {
            return write(200, "查询成功", "data", statisticsESService.getReyStatbyTeamNow(getUID(), startDate, endDate, isNow));
            //return write(200, "查询成功", "data", statisticsESService.getReyStatbyTeamNow("zbqD201703150222",startDate,endDate,isNow));
            //return write(200, "查询成功", "data", statisticsESService.getReyStatbyTeamNow("xh1D201703150222",startDate,endDate,isNow));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -867,7 +867,7 @@ public class StatisticsController extends BaseController {
        try {
            return write(200, "查询成功", "data", statisticsService.getStatTitleInfo(getUID(), startDate, endDate));
            //return write(200, "查询成功", "data", statisticsService.getStatTitleInfo("zbqD201703150222",startDate,endDate));
            //return write(200, "查询成功", "data", statisticsService.getStatTitleInfo("xh1D201703150222",startDate,endDate));
        } catch (Exception e) {
            error(e);
@ -922,7 +922,7 @@ public class StatisticsController extends BaseController {
                                   @RequestParam(required = true) String isNow) {
        try {
            return write(200, "查询成功", "data", statisticsService.getReyStatbyTeamNow(getUID(), startDate, endDate, isNow));
            //return write(200, "查询成功", "data", statisticsService.getReyStatbyTeamNow("zbqD201703150222",startDate,endDate,isNow));
            //return write(200, "查询成功", "data", statisticsService.getReyStatbyTeamNow("xh1D201703150222",startDate,endDate,isNow));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");

+ 32 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/template/ThirdTemplateController.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.web.third.template;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.wechat.util.WeiXinTempMsgSendUtils;
import io.swagger.annotations.Api;
@ -24,6 +25,8 @@ public class ThirdTemplateController extends BaseController {
    @Autowired
    private WeiXinTempMsgSendUtils tempMsgSendUtils;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Value("${wechat.message.template_doctor_survey}")
    private String template_doctor_survey;
@ -60,10 +63,35 @@ public class ThirdTemplateController extends BaseController {
        }
    }
    /**
     * 医生端发送系统消息
     * @param receiver 接受者
     * @param title 标题
     * @param content 内容
     * @return
     */
    @RequestMapping(value = "/sendMessage", method = RequestMethod.POST)
    @ApiOperation(value = "医生端发送系统消息")
    @ResponseBody
    @ObserverRequired
    public String saveFeedback(
            @RequestParam String receiver,
            @RequestParam String title,
            @RequestParam String type,
            @RequestParam String content) {
        try {
            pushMsgTask.put(receiver, type, title, content, "");
            return write(200, "发送成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "发送失败!");
        }
    }
    /**
     * 根据第三方type 匹配对应模板ID
     *
     * @param type 1.代办事项
     * @param type 1.代办事项 2.处理结果通知(模板未定)
     * @return
     */
    private String getTemplateId(String type) throws Exception {
@ -72,6 +100,9 @@ public class ThirdTemplateController extends BaseController {
            case "1":
                templateId = template_doctor_survey;
                break;
            case "2":
                templateId = "";
                break;
            default:
                templateId = template_doctor_survey;
                break;