Przeglądaj źródła

续方咨询,随访相关接口BUG修改

huangwenjie 7 lat temu
rodzic
commit
1857197a21

+ 2 - 2
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,"");
        }
        
    }

+ 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){
			//日志文件中记录异常信息