Jelajahi Sumber

Merge branch 'dev' of huangwenjie/patient-co-management into dev

yeshijie 7 tahun lalu
induk
melakukan
f92a3ae33b

+ 11 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionFollowupContent.java

@ -20,6 +20,7 @@ public class PrescriptionFollowupContent extends IdEntity {
	private String followupProject;   //随访问卷详情类型ID(目前有1-10,和随访信息详情分类一致)
	private String followupKey;       //随访问卷详情指标KEY(和随访记录一致)
	private String followupValue;     //随访问卷详情指标值(和随访记录一致)
	private String patientCode;       //患者CODE
	private Date createTime;
	
	@Basic
@ -91,4 +92,14 @@ public class PrescriptionFollowupContent extends IdEntity {
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	@Basic
	@Column(name = "patient_code")
	public String getPatientCode() {
		return patientCode;
	}
	
	public void setPatientCode(String patientCode) {
		this.patientCode = patientCode;
	}
}

+ 0 - 2
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/config/es/ElastricSearchSave.java

@ -1,11 +1,9 @@
package com.yihu.wlyy.config.es;
import com.alibaba.fastjson.JSONObject;
import io.searchbox.client.JestClient;
import io.searchbox.core.Bulk;
import io.searchbox.core.BulkResult;
import io.searchbox.core.Index;
import io.searchbox.core.Update;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionFollowupContentDao.java

@ -23,4 +23,7 @@ public interface PrescriptionFollowupContentDao extends
	@Modifying
	@Query("delete PrescriptionFollowupContent p where p.prescriptionCode=?1 and p.followupProject=?2")
	void deleteByPrescriptioncodeAndFollowupProject(String prescriptioncode, String followupProject);
	
	@Query("from PrescriptionFollowupContent p where p.prescriptionCode=?1")
	List<PrescriptionFollowupContent> findByPrescriptionCode(String prescriptioncode);
}

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

@ -913,7 +913,7 @@ public class FollowUpService extends BaseService {
    }
    
    /**
     * 获取面访项目数据
     * ES获取面访项目数据
     */
    public FollowupContentESDO esGetFollowupProjectData(String id, String followupProject) throws Exception {
        //根据随访ID、分类ID获取随访记录详情

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

@ -57,7 +57,7 @@ public class PrescriptionFollowupContentService extends BaseService {
	 * @param followupProjectData
	 * @throws Exception
	 */
	public void saveInfo(String prescriptioncode, String followupProjectData) throws Exception{
	public void saveInfo(String prescriptioncode, String followupProjectData,String patientCode) throws Exception{
		JSONArray objects = JSON.parseArray(followupProjectData);
		
		if(objects!= null & objects.size() >0){
@ -76,6 +76,7 @@ public class PrescriptionFollowupContentService extends BaseService {
							prescriptionFollowupContent.setFollowupProject(followupProject);
							prescriptionFollowupContent.setFollowupKey(key);
							prescriptionFollowupContent.setFollowupValue(value);
							prescriptionFollowupContent.setPatientCode(patientCode);
							savedatas.add(prescriptionFollowupContent);
						});
					}
@ -90,4 +91,65 @@ public class PrescriptionFollowupContentService extends BaseService {
			throw new Exception("保存的分类数据不能为空!");
		}
	}
	
	/**
	 *根据续方CODE获取随访调查问卷列表
	 * @param prescriptioncode
	 * @return
	 */
	public JSONArray getList(String prescriptioncode) throws Exception{
		PrescriptionFollowupContent prescriptionFollowupContent1 = null;
		PrescriptionFollowupContent prescriptionFollowupContent2 = null;
		
		List<PrescriptionFollowupContent>  list = prescriptionFollowupContentDao.findByPrescriptionCode(prescriptioncode);
		
		for (PrescriptionFollowupContent prescriptionFollowupContent: list) {
			
			if("1".equals(prescriptionFollowupContent.getFollowupProject())){
				if(prescriptionFollowupContent1 != null){
					prescriptionFollowupContent1 = prescriptionFollowupContent;
				}else{
					continue;
				}
			}
			
			if("2".equals(prescriptionFollowupContent.getFollowupProject())){
				if(prescriptionFollowupContent2 != null){
					prescriptionFollowupContent2 = prescriptionFollowupContent;
				}else{
					continue;
				}
			}
			
			if("4".equals(prescriptionFollowupContent.getFollowupProject())){
				if(prescriptionFollowupContent2 != null){
					prescriptionFollowupContent2 = prescriptionFollowupContent;
				}else{
					continue;
				}
			}
		}
		
		JSONArray result = new JSONArray();
		
		if(prescriptionFollowupContent1 != null){
			JSONObject jsonObject1 = new JSONObject();
			jsonObject1.put("type","1");
			jsonObject1.put("name","身份异常症状问卷");
			jsonObject1.put("statue","已填写");
			jsonObject1.put("createtime",prescriptionFollowupContent1.getCreateTime());
			result.add(jsonObject1);
		}
		
		if(prescriptionFollowupContent2 != null){
			JSONObject jsonObject2 = new JSONObject();
			jsonObject2.put("type","2");
			jsonObject2.put("name","体征及生活方式调查问卷");
			jsonObject2.put("statue","已填写");
			jsonObject2.put("createtime",prescriptionFollowupContent1.getCreateTime());
			result.add(jsonObject2);
		}
		
		return result;
	}
}

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

@ -0,0 +1,79 @@
package com.yihu.wlyy.web.doctor.prescription;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionFollowupContent;
import com.yihu.wlyy.service.app.prescription.PrescriptionFollowupContentService;
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.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.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 医生端-续方咨询问卷相关方法
 * @author huangwenjie
 * @date 2017/11/3 08:38
 */
@RestController
@RequestMapping(value = "/doctor/prescription/followupcontent/")
@Api(description = "医生-续方咨询问卷相关接口")
public class DoctorPrescriptionFollowupContentController extends BaseController {
	
	@Autowired
	private PrescriptionFollowupContentService prescriptionFollowupContentService;
	
	
	@RequestMapping(value = "/getinfo", method = RequestMethod.GET)
	@ApiOperation("根据续方CODE、类型CODE,获取随访调查分类数据")
	public String getinfoByPrescriptionCodeAndFollowupProject(
			@ApiParam(name = "prescriptioncode", value = "续方CODE", defaultValue = "续方CODE")
			@RequestParam(value = "prescriptioncode", required = true) String prescriptioncode,
			@ApiParam(name = "followupProject", value = "续方CODE", defaultValue = "问卷类型(症状、体征和问卷)")
			@RequestParam(value = "followupProject", required = true) String followupProject){
		try {
			
			List<PrescriptionFollowupContent> result = prescriptionFollowupContentService.getByPrescriptionCodeAndFollowupProject(prescriptioncode,followupProject);
			
			Map<String, String> datamap = new HashMap<>();
			
			if(!result.isEmpty()){
				for (PrescriptionFollowupContent prescriptionFollowupContent: result) {
					datamap.put(prescriptionFollowupContent.getFollowupKey(),prescriptionFollowupContent.getFollowupValue());
				}
			}
			
			return write(200, "请求成功!","data",datamap);
			
		}catch (Exception e){
			//日志文件中记录异常信息
			error(e);
			//返回接口异常信息处理结果
			return error(-1, "请求失败,地址不可派送!");
		}
	}
	
	@RequestMapping(value = "/list", method = RequestMethod.GET)
	@ApiOperation("根据续方CODE获取随访调查问卷列表")
	public String getList(
			@ApiParam(name = "prescriptioncode", value = "续方CODE", defaultValue = "续方CODE")
			@RequestParam(value = "prescriptioncode", required = true) String prescriptioncode){
		try {
			JSONArray result = prescriptionFollowupContentService.getList(prescriptioncode);
			return write(200, "请求成功!");
		}catch (Exception e){
			//日志文件中记录异常信息
			error(e);
			//返回接口异常信息处理结果
			return error(-1, "请求失败!"+e.getMessage());
		}
	}
}

+ 17 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionFollowupContentController.java

@ -12,10 +12,12 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 续方咨询问卷相关方法
 * 患者端-续方咨询问卷相关方法
 * @author huangwenjie
 * @date 2017/11/1 22:50
 */
@ -29,7 +31,7 @@ public class PatientPrescriptionFollowupContentController extends BaseController
	
	@RequestMapping(value = "/getinfo", method = RequestMethod.GET)
	@ApiOperation("根据续方CODE、类型CODE,获取随访调查分类数据")
	public String getByPrescriptionCodeAndFollowupProject(
	public String getinfoByPrescriptionCodeAndFollowupProject(
			@ApiParam(name = "prescriptioncode", value = "续方CODE", defaultValue = "续方CODE")
			@RequestParam(value = "prescriptioncode", required = true) String prescriptioncode,
			@ApiParam(name = "followupProject", value = "续方CODE", defaultValue = "问卷类型(症状、体征和问卷)")
@ -37,7 +39,16 @@ public class PatientPrescriptionFollowupContentController extends BaseController
		try {
			
			List<PrescriptionFollowupContent> result = prescriptionFollowupContentService.getByPrescriptionCodeAndFollowupProject(prescriptioncode,followupProject);
			return write(200, "请求成功!","data",result);
			
			Map<String, String> datamap = new HashMap<>();
			
			if(!result.isEmpty()){
				for (PrescriptionFollowupContent prescriptionFollowupContent: result) {
					datamap.put(prescriptionFollowupContent.getFollowupKey(),prescriptionFollowupContent.getFollowupValue());
				}
			}
			
			return write(200, "请求成功!","data",datamap);
			
		}catch (Exception e){
			//日志文件中记录异常信息
@ -50,11 +61,11 @@ public class PatientPrescriptionFollowupContentController extends BaseController
	@RequestMapping(value = "/saveinfo", method = RequestMethod.POST)
	@ApiOperation("保存随访调查分类数据")
	public String saveInfo(@ApiParam(name = "prescriptioncode", value = "续方CODE", defaultValue = "续方CODE")
	                           @RequestParam(value = "prescriptioncode", required = true) String prescriptioncode,
	                       @RequestParam(value = "prescriptioncode", required = true) String prescriptioncode,
	                       @ApiParam(name = "followupProjectData", value = "调查分类数据", defaultValue = "[{\"followupProject\":\"1\",\"projectData\":{\"WEIGHT\":\"76\",\"WEIGHT_EXP\":\"60\",\"BMI\":\"11\"}}]")
	                       @RequestParam(value = "followupProjectData", required = true) String followupProjectData){
		try {
			prescriptionFollowupContentService.saveInfo(prescriptioncode,followupProjectData);
			prescriptionFollowupContentService.saveInfo(prescriptioncode,followupProjectData,getUID());
			return write(200, "请求成功!");
		}catch (Exception e){
			//日志文件中记录异常信息
@ -62,6 +73,6 @@ public class PatientPrescriptionFollowupContentController extends BaseController
			//返回接口异常信息处理结果
			return error(-1, "请求失败!"+e.getMessage());
		}
	
		
	}
}