Commit d7fb70ea3f9e5ed77fb5f92e8fd098f7f954ba42
1 parent
092a250f89
Exists in
master
and in
6 other branches
秦皇岛-高危儿出院诊断自定义模块- crd
Showing 3 changed files with 231 additions and 0 deletions
platform-dal/src/main/java/com/lyms/platform/pojo/QhdDischargedDiagnose.java
View file @
d7fb70e
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import com.lyms.platform.beans.SerialIdEnum; | |
| 4 | +import com.lyms.platform.common.base.IConvertToNativeQuery; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | +import com.lyms.platform.common.enums.ChildCareEnums; | |
| 9 | +import com.lyms.platform.common.result.BaseModel; | |
| 10 | +import com.lyms.platform.common.utils.DateUtil; | |
| 11 | +import com.lyms.platform.common.utils.StringUtils; | |
| 12 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 13 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 14 | + | |
| 15 | +import java.util.Date; | |
| 16 | +import java.util.List; | |
| 17 | +import java.util.Map; | |
| 18 | +import java.util.Objects; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * 秦皇岛-高危儿出院诊断自定义 | |
| 22 | + * | |
| 23 | + * @author shy | |
| 24 | + */ | |
| 25 | +@Document(collection = "lyms_baby_discharged_diagnose") | |
| 26 | +public class QhdDischargedDiagnose extends BaseModel implements IConvertToNativeQuery { | |
| 27 | + | |
| 28 | + private String id; | |
| 29 | + //编码 | |
| 30 | + private String code; | |
| 31 | + //诊断名称 | |
| 32 | + private String diagnoseName; | |
| 33 | + //是否删除(1未删除,0已删除) | |
| 34 | + private Integer yn; | |
| 35 | + | |
| 36 | + public Integer getYn() { | |
| 37 | + return yn; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setYn(Integer yn) { | |
| 41 | + this.yn = yn; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public String getId() { | |
| 45 | + return id; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setId(String id) { | |
| 49 | + this.id = id; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public String getCode() { | |
| 53 | + return code; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setCode(String code) { | |
| 57 | + this.code = code; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public String getDiagnoseName() { | |
| 61 | + return diagnoseName; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public void setDiagnoseName(String diagnoseName) { | |
| 65 | + this.diagnoseName = diagnoseName; | |
| 66 | + } | |
| 67 | + | |
| 68 | + | |
| 69 | + @Override | |
| 70 | + public MongoQuery convertToQuery() { | |
| 71 | + MongoCondition condition = MongoCondition.newInstance(); | |
| 72 | + | |
| 73 | + if (StringUtils.isNotEmpty(id)) { | |
| 74 | + condition = condition.and("id", id, MongoOper.IS); | |
| 75 | + } | |
| 76 | + if (StringUtils.isNotEmpty(code)) { | |
| 77 | + condition = condition.and("code", code, MongoOper.IS); | |
| 78 | + } | |
| 79 | + if (StringUtils.isNotEmpty(diagnoseName)) { | |
| 80 | + condition = condition.and("diagnoseName", diagnoseName, MongoOper.IS); | |
| 81 | + } | |
| 82 | + | |
| 83 | + | |
| 84 | + Criteria c = null; | |
| 85 | + | |
| 86 | + if (c != null) { | |
| 87 | + return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); | |
| 88 | + } | |
| 89 | + | |
| 90 | + return condition.toMongoQuery(); | |
| 91 | + } | |
| 92 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/QhdDischargedDiagnoseController.java
View file @
d7fb70e
| 1 | +package com.lyms.platform.operate.web.controller; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.annotation.TokenRequired; | |
| 4 | +import com.lyms.platform.common.base.BaseController; | |
| 5 | +import com.lyms.platform.common.base.LoginContext; | |
| 6 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 7 | +import com.lyms.platform.common.result.BaseResponse; | |
| 8 | +import com.lyms.platform.operate.web.facade.ApplyOrderFacade; | |
| 9 | +import com.lyms.platform.operate.web.facade.QhdDischargedDiagnoseFacade; | |
| 10 | +import com.lyms.platform.operate.web.request.*; | |
| 11 | +import com.lyms.platform.pojo.QhdDischargedDiagnose; | |
| 12 | +import org.apache.commons.lang.StringUtils; | |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | +import org.springframework.stereotype.Controller; | |
| 15 | +import org.springframework.web.bind.annotation.*; | |
| 16 | + | |
| 17 | +import javax.servlet.http.HttpServletRequest; | |
| 18 | +import javax.servlet.http.HttpServletResponse; | |
| 19 | +import javax.validation.Valid; | |
| 20 | +import java.util.HashMap; | |
| 21 | +import java.util.Map; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * 秦皇岛-高危儿出院诊断自定义接口 | |
| 25 | + * | |
| 26 | + * Created by shy on 2021/10/16 | |
| 27 | + */ | |
| 28 | +@Controller | |
| 29 | +public class QhdDischargedDiagnoseController extends BaseController { | |
| 30 | + | |
| 31 | + @Autowired | |
| 32 | + private QhdDischargedDiagnoseFacade qhdDischargedDiagnoseFacade; | |
| 33 | + | |
| 34 | + //查询-秦皇岛-高危儿出院诊断自定义 | |
| 35 | + @RequestMapping(method = RequestMethod.GET, value = "/queryDischargedDiagnose") | |
| 36 | + @ResponseBody | |
| 37 | + @TokenRequired | |
| 38 | + public BaseResponse queryDischargedDiagnose(QhdDischargedDiagnose qhdDischargedDiagnose, HttpServletRequest request) { | |
| 39 | + | |
| 40 | + return qhdDischargedDiagnoseFacade.queryDischargedDiagnose(qhdDischargedDiagnose); | |
| 41 | + } | |
| 42 | + | |
| 43 | + //增加-秦皇岛-高危儿出院诊断自定义 | |
| 44 | + @RequestMapping(method = RequestMethod.POST, value = "/addDischargedDiagnose") | |
| 45 | + @ResponseBody | |
| 46 | + @TokenRequired | |
| 47 | + public BaseResponse addDischargedDiagnose(@RequestBody QhdDischargedDiagnose qhdDischargedDiagnose, HttpServletRequest request) { | |
| 48 | + return qhdDischargedDiagnoseFacade.addDischargedDiagnose(qhdDischargedDiagnose); | |
| 49 | + } | |
| 50 | + | |
| 51 | + //删除-秦皇岛-高危儿出院诊断自定义 | |
| 52 | + @RequestMapping(method = RequestMethod.DELETE, value = "/delDischargedDiagnose/{id}") | |
| 53 | + @ResponseBody | |
| 54 | + @TokenRequired | |
| 55 | + public BaseResponse delDischargedDiagnose(@PathVariable("id") String id,HttpServletRequest request) { | |
| 56 | + qhdDischargedDiagnoseFacade.delDischargedDiagnose(id,getUserId(request)); | |
| 57 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
| 58 | + } | |
| 59 | + | |
| 60 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/QhdDischargedDiagnoseFacade.java
View file @
d7fb70e
| 1 | +package com.lyms.platform.operate.web.facade; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 4 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | +import com.lyms.platform.common.enums.OptActionEnums; | |
| 9 | +import com.lyms.platform.common.enums.YnEnums; | |
| 10 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
| 11 | +import com.lyms.platform.common.result.BaseResponse; | |
| 12 | +import com.lyms.platform.pojo.*; | |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 15 | +import org.springframework.data.mongodb.core.query.Query; | |
| 16 | +import org.springframework.stereotype.Component; | |
| 17 | + | |
| 18 | +import java.util.List; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * 秦皇岛-高危儿出院诊断自定义 | |
| 22 | + * | |
| 23 | + * Created by shy on 2021/10/16 | |
| 24 | + */ | |
| 25 | +@Component | |
| 26 | +public class QhdDischargedDiagnoseFacade extends BaseMongoDAOImpl<QhdDischargedDiagnose> { | |
| 27 | + | |
| 28 | + @Autowired | |
| 29 | + private OperateLogFacade operateLogFacade; | |
| 30 | + @Autowired | |
| 31 | + private AutoMatchFacade autoMatchFacade; | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 添加出院诊断 | |
| 35 | + * @param qhdDischargedDiagnose | |
| 36 | + * @return | |
| 37 | + */ | |
| 38 | + public BaseObjectResponse addDischargedDiagnose(QhdDischargedDiagnose qhdDischargedDiagnose) { | |
| 39 | + QhdDischargedDiagnose dischargedDiagnose=save(qhdDischargedDiagnose); | |
| 40 | + | |
| 41 | + BaseObjectResponse br = new BaseObjectResponse(); | |
| 42 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 43 | + br.setErrormsg("成功"); | |
| 44 | + br.setData(dischargedDiagnose.getId()); | |
| 45 | + return br; | |
| 46 | + } | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 查询所有出院诊断 | |
| 50 | + * @param qhdDischargedDiagnose | |
| 51 | + * @return | |
| 52 | + */ | |
| 53 | + public BaseObjectResponse queryDischargedDiagnose(QhdDischargedDiagnose qhdDischargedDiagnose) { | |
| 54 | + MongoQuery query = qhdDischargedDiagnose.convertToQuery(); | |
| 55 | + List<QhdDischargedDiagnose> list=find(query.convertToMongoQuery()); | |
| 56 | + BaseObjectResponse br = new BaseObjectResponse(); | |
| 57 | + br.setData(list); | |
| 58 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 59 | + br.setErrormsg("成功"); | |
| 60 | + return br; | |
| 61 | + } | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 删除指定id出院诊断 | |
| 65 | + * @param id | |
| 66 | + * @param userId | |
| 67 | + */ | |
| 68 | + public void delDischargedDiagnose(String id,Integer userId) { | |
| 69 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 70 | + QhdDischargedDiagnose qhdDischargedDiagnose= findById(id); | |
| 71 | + //删除 | |
| 72 | + QhdDischargedDiagnose qhdDischargedDiagnosedel= new QhdDischargedDiagnose(); | |
| 73 | + qhdDischargedDiagnosedel.setYn(YnEnums.NO.getId()); | |
| 74 | + qhdDischargedDiagnosedel.setId(id); | |
| 75 | + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), qhdDischargedDiagnosedel); | |
| 76 | + //存入操作日志 | |
| 77 | + operateLogFacade.addDeleteOptLog(userId, Integer.valueOf(hospitalId), qhdDischargedDiagnose, OptActionEnums.DELETE.getId(), "删除高危儿出院诊断自定义"); | |
| 78 | + } | |
| 79 | +} |