Forráskód Böngészése

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

huangwenjie 7 éve
szülő
commit
8ba252062f

+ 80 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java

@ -0,0 +1,80 @@
package com.yihu.wlyy.web.doctor.imm;
import com.yihu.wlyy.entity.imm.ChildInfoVO;
import com.yihu.wlyy.service.imm.ChildFamilyImmuneService;
import com.yihu.wlyy.service.imm.ChildInfoService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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;
import java.util.Map;
/**
 * 医生端免疫计划接口
 * @author huangwenjie
 * @date 2018/6/20 15:49
 */
@RestController
@RequestMapping(value = "/doctor/imm", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-计划免疫接口")
public class DoctorImmController extends BaseController {
	@Autowired
	private ChildFamilyImmuneService childFamilyImmuneService;
	@Autowired
	private ChildInfoService childInfoService;
	
	/**
	 * 家庭免疫成员查询
	 * @param patient 居民CODE
	 * @return
	 */
	@RequestMapping(value = "/members", method = RequestMethod.GET)
	@ApiOperation(value = "家庭成员查询")
	public String getPatientFamilyMembers(@RequestParam(required = false) String patient) {
		try {
			List<Map<String, Object>> immrs = childFamilyImmuneService.getImmunemembers(patient);
			JSONArray jsonArray = new JSONArray();
			if (immrs != null) {
				for (Map<String, Object> map : immrs) {
					JSONObject json = new JSONObject();
					json.put("child_code", map.get("child_code"));//儿童编码
					json.put("name", map.get("name"));//儿童姓名
					json.put("photo", map.get("photo"));//头像
					json.put("idcard", map.get("idcard"));//新生儿身份证号
					json.put("barcode", map.get("barcode"));//新生儿条码
					json.put("family_code", map.get("family_code"));//家人CODE
					json.put("relation", map.get("relation"));//---1父亲 2母亲 3老公 4老婆 5儿子 6女儿 7其他
					json.put("del", map.get("del"));//0为有效,1为删除状态
					jsonArray.put(json);
				}
			}
			return write(200, "查询成功", "data", jsonArray);
		} catch (Exception e) {
			e.printStackTrace();
			return error(-1, "查询失败");
		}
	}
	
	@RequestMapping(value = "/getImmChildInfo", method = RequestMethod.GET)
	@ApiOperation(value = "根据新生儿编码获取新生儿基础信息")
	public String getImmChildInfo(@ApiParam(name = "code", value = "新生儿CODE", defaultValue = "")
	                              @RequestParam(value = "code", required = true) String code){
		try {
			ChildInfoVO childInfo = childInfoService.getChildInfoVOByCode(code);
			return write(200,"查询成功!","data",childInfo);
		} catch (Exception e) {
			error(e);
			return error(-1, e.getMessage());
		}
	}
}