Commit dad16d4e3849c7a4fd64f4bb446b19535c56f34a
1 parent
4bd4b809ab
Exists in
master
and in
6 other branches
听力诊断模块
Showing 2 changed files with 34 additions and 5 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientMarkHospitalController.java
View file @
dad16d4
| ... | ... | @@ -4,15 +4,13 @@ |
| 4 | 4 | import com.lyms.platform.common.base.BaseController; |
| 5 | 5 | import com.lyms.platform.common.base.LoginContext; |
| 6 | 6 | import com.lyms.platform.common.result.BaseResponse; |
| 7 | +import com.lyms.platform.common.utils.StringUtils; | |
| 7 | 8 | import com.lyms.platform.operate.web.facade.PatientMarkHospServiceFacade; |
| 8 | 9 | import com.lyms.platform.operate.web.request.PatientMarkRequest; |
| 9 | 10 | import com.lyms.platform.permission.model.PatientMarkHospital; |
| 10 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 12 | import org.springframework.stereotype.Controller; |
| 12 | -import org.springframework.web.bind.annotation.PathVariable; | |
| 13 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 14 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 15 | -import org.springframework.web.bind.annotation.ResponseBody; | |
| 13 | +import org.springframework.web.bind.annotation.*; | |
| 16 | 14 | |
| 17 | 15 | import javax.servlet.http.HttpServletRequest; |
| 18 | 16 | |
| ... | ... | @@ -69,7 +67,11 @@ |
| 69 | 67 | @TokenRequired |
| 70 | 68 | public BaseResponse create(PatientMarkHospital patientMarkHospital, HttpServletRequest request) { |
| 71 | 69 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 72 | - return patientMarkHospFacade.addPatientMarkHospital(patientMarkHospital, loginState.getId()); | |
| 70 | + if(StringUtils.isNotEmpty(patientMarkHospital.getId())){ | |
| 71 | + return patientMarkHospFacade.updatePatientMarkHospital(patientMarkHospital, 1, loginState.getId()); | |
| 72 | + }else{ | |
| 73 | + return patientMarkHospFacade.addPatientMarkHospital(patientMarkHospital, loginState.getId()); | |
| 74 | + } | |
| 73 | 75 | } |
| 74 | 76 | |
| 75 | 77 | /** |
| ... | ... | @@ -99,6 +101,19 @@ |
| 99 | 101 | @RequestMapping(value = "/{id}", method = RequestMethod.GET) |
| 100 | 102 | public BaseResponse findOnePatientMarkHospital(@PathVariable String id) { |
| 101 | 103 | return patientMarkHospFacade.findOnePatientMarkHospital(id); |
| 104 | + } | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * 根据Id获取开通记录信息 | |
| 108 | + * | |
| 109 | + * @param patientId 开通服务id | |
| 110 | + * @return | |
| 111 | + */ | |
| 112 | + @ResponseBody | |
| 113 | + @TokenRequired | |
| 114 | + @RequestMapping(value = "/get", method = RequestMethod.GET) | |
| 115 | + public BaseResponse findOneMarkHospByPatientId(String patientId) { | |
| 116 | + return patientMarkHospFacade.findOneMarkHospByPatientId(patientId); | |
| 102 | 117 | } |
| 103 | 118 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientMarkHospServiceFacade.java
View file @
dad16d4
| ... | ... | @@ -510,5 +510,19 @@ |
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | + public BaseResponse findOneMarkHospByPatientId(String patientId) { | |
| 514 | + BaseResponse baseResponse = new BaseResponse(); | |
| 515 | + PatientMarkHospitalQuery patientMarkHospQuery = new PatientMarkHospitalQuery(); | |
| 516 | + patientMarkHospQuery.setPatientId(patientId); | |
| 517 | + | |
| 518 | + List<PatientMarkHospital> patientMarkHospitals = patientMarkHospitalService.queryPatientMarkHospital(patientMarkHospQuery); | |
| 519 | + if (CollectionUtils.isNotEmpty(patientMarkHospitals)) { | |
| 520 | + PatienMarkHospResult PatienMarkHospResult = convertToResult(patientMarkHospitals.get(0)); | |
| 521 | + baseResponse.setObject(PatienMarkHospResult); | |
| 522 | + } | |
| 523 | + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 524 | + baseResponse.setErrormsg("成功"); | |
| 525 | + return baseResponse; | |
| 526 | + } | |
| 513 | 527 | } |