| 
					
				 | 
			
			
				@ -4,8 +4,11 @@ import com.yihu.mm.controller.BaseController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.mm.entity.Patient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.mm.service.PatientService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.mm.service.PhysicalExaminationService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.mm.util.HttpClientUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.json.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.RequestMapping; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -13,6 +16,9 @@ import org.springframework.web.bind.annotation.RequestParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.ResponseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.RestController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import javax.servlet.http.HttpServletRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import javax.servlet.http.HttpSession; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@RestController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@RequestMapping(value = "/medicine/physicalExamination") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				public class PhysicalExaminationController extends BaseController { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -20,6 +26,9 @@ public class PhysicalExaminationController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${examCode}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String examCode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value(("${yuerenApi}")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String yuerenApi; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PatientService patientService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -30,28 +39,38 @@ public class PhysicalExaminationController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "获取试卷列表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @RequestMapping(value = "/findExames",produces="application/json;charset=UTF-8") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ResponseBody 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String findExames(@ApiParam(name = "tp_type", value = "'问卷类型',(备选值:1,2,4)1:初筛问卷,2:助理问卷,4:现场问卷", required = true)@RequestParam(required = false, name = "tp_type") String tp_type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        physicalExaminationService.findExames(tp_type,examCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String findExames(@ApiParam(name = "tp_type", value = "'问卷类型',(备选值:1,2,4)1:初筛问卷,2:助理问卷,4:现场问卷", required = true)@RequestParam(required = false, name = "tp_type") String tp_type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             HttpServletRequest req 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpSession session = req.getSession(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String key = (String) session.getAttribute("key"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isBlank(key)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            key = HttpClientUtil.postBody(yuerenApi + "/phonekey", new JSONObject()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            session.setMaxInactiveInterval(60*60*4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            session.setAttribute("key",key); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return physicalExaminationService.findExames(key,tp_type, examCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "新增预约单/获取咨询编号等信息") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @RequestMapping(value = "/insertslip",produces="application/json;charset=UTF-8") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ResponseBody 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String insertslip(@ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String insertslip(@ApiParam(name = "patientCode", value = "居民code", required = true)@RequestParam(required = true, name = "patientCode") String patientCode, HttpServletRequest req){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String key = (String) req.getSession().getAttribute("key"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Patient patient = patientService.findByCode(patientCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return physicalExaminationService.insertslip(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return physicalExaminationService.insertslip(key,patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "获取试题") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @RequestMapping(value = "/findExames",produces="application/json;charset=UTF-8") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @RequestMapping(value = "/findQuestion",produces="application/json;charset=UTF-8") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ResponseBody 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String findQuestion(@ApiParam(name = "tp_id", value = "试卷id", required = true)@RequestParam(required = false, name = "tp_id") String tp_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                               @ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = false, name = "pb_id") String pb_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                               @ApiParam(name = "pb_id", value = "咨询编号", required = true)@RequestParam(required = false, name = "pb_id") String ct_id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                               @ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = false, name = "ct_id") String ct_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                               HttpServletRequest req){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String key = (String) req.getSession().getAttribute("key"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return physicalExaminationService.findQuestion(key,tp_id,pb_id,ct_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "提交试卷答案") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -60,9 +79,11 @@ public class PhysicalExaminationController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String handleExam(@ApiParam(name = "tp_id", value = "试卷id", required = true)@RequestParam(required = true, name = "tp_id") String tp_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                               @ApiParam(name = "pb_id", value = "问卷编号,第一题为0", required = true)@RequestParam(required = true, name = "pb_id") String pb_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                               @ApiParam(name = "dc_answer", value = "问题答案", required = true)@RequestParam(required = true, name = "dc_answer") String dc_answer, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             @ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             @ApiParam(name = "ct_id", value = "咨询编号", required = true)@RequestParam(required = true, name = "ct_id") String ct_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            HttpServletRequest req){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String key = (String) req.getSession().getAttribute("key"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return physicalExaminationService.handleExam(key,tp_id,pb_id,dc_answer,ct_id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "四诊资料采集") 
			 |