Browse Source

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

chenweida 7 years ago
parent
commit
cdfb92401d

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/followup/Followup.java

@ -51,7 +51,7 @@ public class Followup extends IdEntity {
	private String idcard;
	//数据来源 1基卫 2APP
	private String dataFrom;
	//状态 0取消 1已完成 2未开始 3进行中
	//状态 0取消 1已完成 2未开始 3进行中 4待审核
	private String status;
	//电话随访内容
	private String followupContentPhone;

+ 5 - 1
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/ChargeZYService.java

@ -163,7 +163,11 @@ public class ChargeZYService {
                }else {
                    charge.setNeedUpload("2");
                    content = objectMapper.writeValueAsString(charge);
                    charge.setUploadLog(content + "\r\n" + msg);
                    content = content + "\r\n" + msg;
                    if(content.length() > 4000){
                        content = content.substring(0,3900);
                    }
                    charge.setUploadLog(content);
                }
                chargeDao.save(charge);
            } catch (Exception ex)

+ 8 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java

@ -59,4 +59,12 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
     */
    @Query("select d.code,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus,c.code,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo from Followup a, Doctor d, Doctor c where a.doctorCode = d.code and a.creater = c.code and a.patientCode = ?1 and a.adminTeamCode = ?2 and (a.status = '1' or a.status = '3')")
    Page<Object> findRecordByPatientAndTeam(String patient, Long teamCode, Pageable pageable);
    
    /**
     * 根据续方CODE获取随访记录
     * @param prescriptionCode
     * @return
     */
    @Query("select a from Followup a where a.prescriptionCode = ?1 and a.status <> '0'")
	Followup getFollowupByPrescriptionCode(String prescriptionCode);
}

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

@ -0,0 +1,26 @@
package com.yihu.wlyy.repository.prescription;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionFollowupContent;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * 续方咨询问卷相关方法
 * @author huangwenjie
 * @date 2017/11/2 09:07
 */
public interface PrescriptionFollowupContentDao extends
		PagingAndSortingRepository<PrescriptionFollowupContent, Long>,
		JpaSpecificationExecutor<PrescriptionFollowupContent> {
	
	@Query("from PrescriptionFollowupContent p where p.prescriptionCode=?1 and p.followupProject=?2")
	List<PrescriptionFollowupContent> findByPrescriptionCodeAndFollowupProject(String prescriptionCode, String followupProject);
	
	@Modifying
	@Query("delete PrescriptionFollowupContent p where p.prescriptionCode=?1 and p.followupProject=?2")
	void deleteByPrescriptioncodeAndFollowupProject(String prescriptioncode, String followupProject);
}

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

@ -1012,5 +1012,12 @@ public class FollowUpService extends BaseService {
        
        return followupContentESDOList;
    }
    
    public String getFollowupByPrescriptionCode(String prescriptionCode) {
        Followup followup = followupDao.getFollowupByPrescriptionCode(prescriptionCode);
    
        String jsonString = JSON.toJSONString(followup);
        
        return jsonString;
    }
}

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

@ -0,0 +1,93 @@
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.wlyy.entity.patient.prescription.PrescriptionFollowupContent;
import com.yihu.wlyy.repository.prescription.PrescriptionFollowupContentDao;
import com.yihu.wlyy.service.BaseService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
 * 续方咨询问卷相关方法
 * @author huangwenjie
 * @date 2017/11/2 09:06
 */
@Service
@Component
@Transactional(rollbackFor = Exception.class)
public class PrescriptionFollowupContentService extends BaseService {
	
	@Autowired
	private PrescriptionFollowupContentDao prescriptionFollowupContentDao;
	
	/**
	 * 根据续方CODE,文件类型获取数据
	 * @param prescriptionCode
	 * @param followupProject
	 * @return
	 */
	public List<PrescriptionFollowupContent> getByPrescriptionCodeAndFollowupProject(String prescriptionCode, String followupProject) throws Exception{
		
		//如果传多个类型,则返回多组数据
		if(followupProject.contains(",")){
			List<PrescriptionFollowupContent> datalist = new ArrayList<>();
			String[] projectArray = followupProject.split(",");
			
			for (String project: projectArray) {
				List<PrescriptionFollowupContent>  list = prescriptionFollowupContentDao.findByPrescriptionCodeAndFollowupProject(prescriptionCode,project);
				datalist.addAll(list);
			}
			
			return datalist;
		}else{
			return prescriptionFollowupContentDao.findByPrescriptionCodeAndFollowupProject(prescriptionCode,followupProject);
		}
	}
	
	/**
	 * 保存随访调查分类数据
	 * @param prescriptioncode
	 * @param followupProjectData
	 * @throws Exception
	 */
	public void saveInfo(String prescriptioncode, String followupProjectData) throws Exception{
		JSONArray objects = JSON.parseArray(followupProjectData);
		
		if(objects!= null & objects.size() >0){
			for (int i = 0; i < objects.size(); i++) {
				List<PrescriptionFollowupContent> savedatas = new ArrayList<>();
				JSONObject jsonObject = objects.getJSONObject(i);
				String followupProject = jsonObject.getString("followupProject");
				String projectValueStr = jsonObject.getString("projectData");
				if(StringUtils.isNotBlank(projectValueStr)){
					HashMap<String,String> projectValueMap = (HashMap)JSON.parse(projectValueStr);
					if(!projectValueMap.isEmpty()){
						projectValueMap.forEach( (key,value)->{
							PrescriptionFollowupContent prescriptionFollowupContent = new PrescriptionFollowupContent();
							prescriptionFollowupContent.setCode(UUID.randomUUID().toString());
							prescriptionFollowupContent.setPrescriptionCode(prescriptioncode);
							prescriptionFollowupContent.setFollowupProject(followupProject);
							prescriptionFollowupContent.setFollowupKey(key);
							prescriptionFollowupContent.setFollowupValue(value);
							savedatas.add(prescriptionFollowupContent);
						});
					}
				}
				if(!savedatas.isEmpty()){
					prescriptionFollowupContentDao.deleteByPrescriptioncodeAndFollowupProject(prescriptioncode,followupProject);
					prescriptionFollowupContentDao.save(savedatas);
				}
			}
			
		}else{
			throw new Exception("保存的分类数据不能为空!");
		}
	}
}

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

@ -17,6 +17,7 @@ import com.yihu.wlyy.service.app.account.DoctorInfoService;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.consult.ConsultService;
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
import com.yihu.wlyy.service.app.followup.FollowUpService;
import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
import com.yihu.wlyy.service.app.prescription.PrescriptionDiagnosisService;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
@ -66,8 +67,6 @@ public class DoctorConsultController extends WeixinBaseController {
    @Autowired
    private DoctorWorkTimeService doctorWorkTimeService;
    @Autowired
    private ConsultService consultService;
    @Autowired
    private TalkGroupService talkGroupService;
    @Autowired
    private CommonUtil CommonUtil;
@ -83,6 +82,8 @@ public class DoctorConsultController extends WeixinBaseController {
    private ConsultDao consultDao;
    @Autowired
    private PrescriptionDiagnosisService prescriptionDiagnosisService;
    @Autowired
    private FollowUpService followUpService;
    /**
     * 三师咨询列表查询
@ -1118,6 +1119,7 @@ public class DoctorConsultController extends WeixinBaseController {
            json.put("status",prescription.getStatus());//状态 (-1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,21支付失败  20 配药中/支付成功, 21 等待领药 ,30 配送中 ,100配送成功/已完成)
            json.put("prescriptionDt",prescriptionDiagnosisService.getPrescriptionDiagnosis(prescriptionCode));//续方疾病类型
            json.put("prescriptionInfo",prescriptionDiagnosisService.getPrescriptionInfo(prescriptionCode));//续方药品信息
            json.put("followup",followUpService.getFollowupByPrescriptionCode(prescriptionCode));//续方关联的随访记录
            //服务类型
            List<SignFamilyServer> list = signFamilyServerDao.findBySignCodeAndType(consult1.getSignCode());

+ 67 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionFollowupContentController.java

@ -0,0 +1,67 @@
package com.yihu.wlyy.web.patient.prescription;
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.List;
/**
 * 续方咨询问卷相关方法
 * @author huangwenjie
 * @date 2017/11/1 22:50
 */
@RestController
@RequestMapping(value = "/patient/prescription/followupcontent/")
@Api(description = "患者-续方咨询问卷相关接口")
public class PatientPrescriptionFollowupContentController extends BaseController {
	@Autowired
	private PrescriptionFollowupContentService prescriptionFollowupContentService;
	
	
	@RequestMapping(value = "/getinfo", method = RequestMethod.GET)
	@ApiOperation("根据续方CODE、类型CODE,获取随访调查分类数据")
	public String getByPrescriptionCodeAndFollowupProject(
			@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);
			return write(200, "请求成功!","data",result);
			
		}catch (Exception e){
			//日志文件中记录异常信息
			error(e);
			//返回接口异常信息处理结果
			return error(-1, "请求失败,地址不可派送!");
		}
	}
	
	@RequestMapping(value = "/saveinfo", method = RequestMethod.POST)
	@ApiOperation("保存随访调查分类数据")
	public String saveInfo(@ApiParam(name = "prescriptioncode", value = "续方CODE", defaultValue = "续方CODE")
	                           @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);
			return write(200, "请求成功!");
		}catch (Exception e){
			//日志文件中记录异常信息
			error(e);
			//返回接口异常信息处理结果
			return error(-1, "请求失败!"+e.getMessage());
		}
	
	}
}