PersonnelDictService.java 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  1. package thyyxxk.webserver.service.dictionary;
  2. import lombok.extern.slf4j.Slf4j;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.stereotype.Service;
  5. import thyyxxk.webserver.config.exception.ExceptionEnum;
  6. import thyyxxk.webserver.dao.his.dictionary.EmployeeMiDao;
  7. import thyyxxk.webserver.dao.his.dictionary.PersonnelDictDao;
  8. import thyyxxk.webserver.dao.his.dictionary.ZdEducationCodeDao;
  9. import thyyxxk.webserver.dao.his.dictionary.ZdEmpInmarkDao;
  10. import thyyxxk.webserver.dao.his.dictionary.ZdEmpPositionDao;
  11. import thyyxxk.webserver.dao.his.dictionary.ZdEmpTitleDao;
  12. import thyyxxk.webserver.dao.his.dictionary.ZdIfcadreDao;
  13. import thyyxxk.webserver.dao.his.dictionary.ZdUnitClassDao;
  14. import thyyxxk.webserver.dao.his.dictionary.ZdUnitCodeDao;
  15. import thyyxxk.webserver.entity.ResultVo;
  16. import thyyxxk.webserver.entity.dictionary.CodeName;
  17. import thyyxxk.webserver.entity.dictionary.EmployeeMi;
  18. import thyyxxk.webserver.entity.dictionary.EmployeeMiVo;
  19. import thyyxxk.webserver.entity.dictionary.ZdEducationCode;
  20. import thyyxxk.webserver.entity.dictionary.ZdEmpInmark;
  21. import thyyxxk.webserver.entity.dictionary.ZdEmpPosition;
  22. import thyyxxk.webserver.entity.dictionary.ZdEmpTitle;
  23. import thyyxxk.webserver.entity.dictionary.ZdIfcadre;
  24. import thyyxxk.webserver.entity.dictionary.ZdUnitClass;
  25. import thyyxxk.webserver.entity.dictionary.ZdUnitCode;
  26. import thyyxxk.webserver.entity.login.UserInfo;
  27. import thyyxxk.webserver.service.redislike.RedisLikeService;
  28. import thyyxxk.webserver.utils.DateUtil;
  29. import thyyxxk.webserver.utils.PingYinUtils;
  30. import thyyxxk.webserver.utils.ResultVoUtil;
  31. import thyyxxk.webserver.utils.StringUtil;
  32. import thyyxxk.webserver.utils.TokenUtil;
  33. import java.util.HashMap;
  34. import java.util.List;
  35. import java.util.Map;
  36. /**
  37. * @Description: 人事字典
  38. * @Author: hsh
  39. * @CreateTime: 2023-10-16 16:39
  40. * @Version: 1.0
  41. */
  42. @Service
  43. @Slf4j
  44. public class PersonnelDictService {
  45. private final PersonnelDictDao dao;
  46. private final ZdUnitCodeDao deptDao;
  47. private final RedisLikeService redis;
  48. private final ZdUnitClassDao deptClassDao;
  49. private final ZdEmpPositionDao empPositionDao;
  50. private final ZdEmpTitleDao empTitleDao;
  51. private final ZdEducationCodeDao educationCodeDao;
  52. private final ZdIfcadreDao ifcadreDao;
  53. private final ZdEmpInmarkDao empInmarkDao;
  54. private final EmployeeMiDao employeeMiDao;
  55. @Autowired
  56. public PersonnelDictService(PersonnelDictDao dao, ZdUnitCodeDao deptDao, RedisLikeService redis,
  57. ZdUnitClassDao deptClassDao, ZdEmpPositionDao empPositionDao, ZdEmpTitleDao empTitleDao,
  58. ZdEducationCodeDao educationCodeDao, ZdIfcadreDao ifcadreDao, ZdEmpInmarkDao empInmarkDao,
  59. EmployeeMiDao employeeMiDao) {
  60. this.dao = dao;
  61. this.deptDao = deptDao;
  62. this.redis = redis;
  63. this.deptClassDao = deptClassDao;
  64. this.empPositionDao = empPositionDao;
  65. this.empTitleDao = empTitleDao;
  66. this.educationCodeDao = educationCodeDao;
  67. this.ifcadreDao = ifcadreDao;
  68. this.empInmarkDao = empInmarkDao;
  69. this.employeeMiDao = employeeMiDao;
  70. }
  71. public ResultVo<List<ZdUnitCode>> selectZdUnitCode(String text){
  72. return ResultVoUtil.success(deptDao.selectZdUnitCode(text));
  73. }
  74. /**
  75. * @description: 查询科室字典信息
  76. * @author: hsh
  77. * @date: 2023/10/16 16:41
  78. * @param: [text]
  79. * @return: ResultVo<List<ZdUnitCode>>
  80. **/
  81. public ResultVo<List<ZdUnitCode>> selectDeptDict(String text){
  82. return ResultVoUtil.success(deptDao.selectDeptDictAll(text));
  83. }
  84. /**
  85. * @description: 查询有效科室
  86. * @author: hsh
  87. * @date: 2023/10/17 9:48
  88. * @param: []
  89. * @return: ResultVo<List<ZdUnitCode>>
  90. **/
  91. public ResultVo<List<ZdUnitCode>> selectDeptDictForEffective(){
  92. return ResultVoUtil.success(deptDao.selectDeptDictForEffective());
  93. }
  94. /**
  95. * @description: 查询科室分类字典
  96. * @author: hsh
  97. * @date: 2023/10/17 9:48
  98. * @param: []
  99. * @return: ResultVo<List<Map<String,Object>>>
  100. **/
  101. public ResultVo<List<Map<String, Object>>> selectUnitClass(){
  102. return ResultVoUtil.success(dao.selectUnitClass());
  103. }
  104. /**
  105. * @description: 根据科室code查询科室字典信息
  106. * @author: hsh
  107. * @date: 2023/10/19 16:23
  108. * @param: [code]
  109. * @return: ResultVo<ZdUnitCode>
  110. **/
  111. public ResultVo<ZdUnitCode> selectDeptDictByCode(String code){
  112. return ResultVoUtil.success(deptDao.selectDeptDictByCode(code));
  113. }
  114. /**
  115. * @description: 保存或更新科室字典信息
  116. * @author: hsh
  117. * @date: 2023/10/20 16:25
  118. * @param: [zdUnitCode]
  119. * @return: ResultVo<Map<String,Object>>
  120. **/
  121. public ResultVo<Map<String, Object>> saveDeptDict(ZdUnitCode zdUnitCode){
  122. if(null == zdUnitCode || zdUnitCode.getCode() == null){
  123. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "科室字典信息不存在,请检查!");
  124. }
  125. Map<String, Object> resultMap = new HashMap<>();
  126. String code = zdUnitCode.getCode();
  127. ZdUnitCode dept = deptDao.selectDeptDictByCode(code);
  128. UserInfo user = redis.getUserInfoByCode(TokenUtil.getInstance().getTokenUserId());
  129. // 根据名称生成新的拼音码和五笔码
  130. zdUnitCode.setPyCode(PingYinUtils.pyShouZiMuDaXie(zdUnitCode.getName()));
  131. zdUnitCode.setDCode(PingYinUtils.getWBCode(zdUnitCode.getName()));
  132. zdUnitCode.setOpId(user.getCode());
  133. zdUnitCode.setOpDate(DateUtil.now());
  134. int num;
  135. try{
  136. if(null != dept){
  137. // 更新科室字典信息(这里仅限于更新老系统科室字典信息,其他信息修改待定)
  138. num = deptDao.updateDeptDictByCode(zdUnitCode);
  139. } else {
  140. // 新增科室字典信息(这里仅限于新增老系统科室字典信息,其他信息新增待定)
  141. num = deptDao.insert(zdUnitCode);
  142. }
  143. if(num == 0){
  144. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存科室字典失败!");
  145. }
  146. resultMap.put("cg", "保存科室字典成功!");
  147. return ResultVoUtil.success(resultMap);
  148. } catch(Exception e){
  149. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存科室字典失败!");
  150. }
  151. }
  152. /**
  153. * @description: 根据科室编码更新科室停用状态
  154. * @author: hsh
  155. * @date: 2023/11/9 17:18
  156. * @param: [code, delFlag]
  157. * @return: ResultVo<ZdUnitCode>
  158. **/
  159. public ResultVo<Map<String, Object>> updateDeptStopOrUsed(String code, String delFlag){
  160. if(StringUtil.isBlank(code)) {
  161. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有科室编码,请检查!");
  162. }
  163. ZdUnitCode dept = deptDao.selectDeptDictByCode(code);
  164. if(null == dept){
  165. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, code + "的科室字典信息不存在,请检查!");
  166. }
  167. Map<String, Object> resultMap = new HashMap<>();
  168. try{
  169. int num = deptDao.updateDeptDictDelFlagByCode(code, delFlag);
  170. if(num == 0){
  171. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新科室字典停用或启用失败!");
  172. }
  173. resultMap.put("cg", "更新科室字典停用或启用成功!");
  174. return ResultVoUtil.success(resultMap);
  175. } catch(Exception e){
  176. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新科室字典停用或启用失败!");
  177. }
  178. }
  179. /**
  180. * 根据科室编码删除科室字典
  181. * @param code 科室编码
  182. * @return map
  183. */
  184. public ResultVo<Map<String, Object>> delDeptDictByCode(String code) {
  185. if (StringUtil.isBlank(code)) {
  186. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有科室编码,请检查!");
  187. }
  188. Map<String, Object> resultMap = new HashMap<>();
  189. try{
  190. int num = deptDao.deleteByCode(code);
  191. if(num == 0){
  192. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除科室字典失败!");
  193. }
  194. resultMap.put("cg", "删除科室字典成功!");
  195. return ResultVoUtil.success(resultMap);
  196. } catch(Exception e){
  197. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除科室字典失败!");
  198. }
  199. }
  200. /**
  201. * 查询科室分类字典
  202. * @return ResultVo<ZdUnitClass>
  203. */
  204. public ResultVo<List<ZdUnitClass>> selectDeptClass(){
  205. return ResultVoUtil.success(deptClassDao.selectDeptClass());
  206. }
  207. /**
  208. * 保存科室分类
  209. * @param zdUnitClass 科室分类信息
  210. * @return map
  211. */
  212. public ResultVo<Map<String, Object>> saveDeptClass(ZdUnitClass zdUnitClass){
  213. if(null == zdUnitClass || zdUnitClass.getCode() == null){
  214. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "科室分类信息不存在,请检查!");
  215. }
  216. Map<String, Object> resultMap = new HashMap<>();
  217. String code = zdUnitClass.getCode();
  218. ZdUnitClass deptClass = deptClassDao.selectDeptClassByCode(code);
  219. // 根据名称生成新的拼音码和五笔码
  220. zdUnitClass.setPyCode(PingYinUtils.pyShouZiMuDaXie(zdUnitClass.getName()));
  221. zdUnitClass.setDCode(PingYinUtils.getWBCode(zdUnitClass.getName()));
  222. int num;
  223. try{
  224. if(null != deptClass){
  225. num = deptClassDao.updateDeptClassByCode(zdUnitClass);
  226. } else {
  227. num = deptClassDao.insert(zdUnitClass);
  228. }
  229. if(num == 0){
  230. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存科室分类失败!");
  231. }
  232. resultMap.put("cg", "保存科室分类成功!");
  233. return ResultVoUtil.success(resultMap);
  234. } catch(Exception e){
  235. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存科室分类失败!");
  236. }
  237. }
  238. /**
  239. * 根据code删除科室分类
  240. * @param code 科室分类code
  241. * @return map
  242. */
  243. public ResultVo<Map<String, Object>> delDeptClassByCode(String code) {
  244. if (StringUtil.isBlank(code)) {
  245. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有科室分类编码,请检查!");
  246. }
  247. Map<String, Object> resultMap = new HashMap<>();
  248. try{
  249. int num = deptClassDao.deleteDeptClassByCode(code);
  250. if(num == 0){
  251. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除科室分类失败!");
  252. }
  253. resultMap.put("cg", "删除科室分类成功!");
  254. return ResultVoUtil.success(resultMap);
  255. } catch(Exception e){
  256. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除科室分类失败!");
  257. }
  258. }
  259. /**
  260. * @Description 查询行政职务字典
  261. * @Author hsh
  262. * @Date 2023/12/19 15:17
  263. */
  264. public ResultVo<List<ZdEmpPosition>> selectEmpPosition(){
  265. return ResultVoUtil.success(empPositionDao.selectEmpPosition());
  266. }
  267. /**
  268. * @Description 保存行政职务字典
  269. * @Author hsh
  270. * @param zdEmpPosition 行政职务字典信息
  271. * @return map
  272. * @Date 2023/12/20 9:47
  273. */
  274. public ResultVo<Map<String, Object>> saveEmpPosition(ZdEmpPosition zdEmpPosition){
  275. if(null == zdEmpPosition || zdEmpPosition.getCode() == null){
  276. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "行政职务字典信息不存在,请检查!");
  277. }
  278. if(StringUtil.notBlank(zdEmpPosition.getDelFlag()) && zdEmpPosition.getDelFlag().length() > 1){
  279. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除标志过长,不允许超出一个字符,请检查!");
  280. }
  281. Map<String, Object> resultMap = new HashMap<>();
  282. String code = zdEmpPosition.getCode();
  283. ZdEmpPosition empPosition = empPositionDao.selectEmpPositionByCode(code);
  284. // 根据名称生成新的拼音码和五笔码
  285. zdEmpPosition.setPyCode(PingYinUtils.pyShouZiMuDaXie(zdEmpPosition.getName()));
  286. zdEmpPosition.setDCode(PingYinUtils.getWBCode(zdEmpPosition.getName()));
  287. int num;
  288. try{
  289. if(null != empPosition){
  290. num = empPositionDao.updateEmpPositionByCode(zdEmpPosition);
  291. } else {
  292. num = empPositionDao.insert(zdEmpPosition);
  293. }
  294. if(num == 0){
  295. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存行政职务字典失败!");
  296. }
  297. resultMap.put("cg", "保存行政职务字典成功!");
  298. return ResultVoUtil.success(resultMap);
  299. } catch(Exception e){
  300. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存行政职务字典失败!");
  301. }
  302. }
  303. /**
  304. * @Description 根据code删除行政职务字典
  305. * @Author hsh
  306. * @param code 行政职务字典code
  307. * @return map
  308. * @Date 2023/12/20 9:48
  309. */
  310. public ResultVo<Map<String, Object>> delEmpPositionByCode(String code) {
  311. if (StringUtil.isBlank(code)) {
  312. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有行政职务字典编码,请检查!");
  313. }
  314. Map<String, Object> resultMap = new HashMap<>();
  315. try{
  316. int num = empPositionDao.deleteEmpPositionByCode(code);
  317. if(num == 0){
  318. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除行政职务字典失败!");
  319. }
  320. resultMap.put("cg", "删除行政职务字典成功!");
  321. return ResultVoUtil.success(resultMap);
  322. } catch(Exception e){
  323. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除行政职务字典失败!");
  324. }
  325. }
  326. /**
  327. * @Description 查询专业技术职称
  328. * @Author hsh
  329. * @return ZdEmpTitle
  330. * @Date 2023/12/20 14:39
  331. */
  332. public ResultVo<List<ZdEmpTitle>> selectEmpTitle(){
  333. return ResultVoUtil.success(empTitleDao.selectEmpTitle());
  334. }
  335. /**
  336. * @Description 保存专业技术职称
  337. * @Author hsh
  338. * @param zdEmpTitle 专业技术职称信息
  339. * @return map
  340. * @Date 2023/12/20 14:40
  341. */
  342. public ResultVo<Map<String, Object>> saveEmpTitle(ZdEmpTitle zdEmpTitle){
  343. if(null == zdEmpTitle || zdEmpTitle.getCode() == null){
  344. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "专业技术职称信息不存在,请检查!");
  345. }
  346. if(StringUtil.notBlank(zdEmpTitle.getDelFlag()) && zdEmpTitle.getDelFlag().length() > 1){
  347. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除标志过长,不允许超出一个字符,请检查!");
  348. }
  349. if(StringUtil.notBlank(zdEmpTitle.getTitGrade()) && zdEmpTitle.getTitGrade().length() > 1){
  350. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "专业技术等级过长,不允许超出一个字符,请检查!");
  351. }
  352. if(StringUtil.notBlank(zdEmpTitle.getOrderCode()) && zdEmpTitle.getOrderCode().length() > 6){
  353. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "专业技术等级过长,不允许超出六个字符,请检查!");
  354. }
  355. Map<String, Object> resultMap = new HashMap<>();
  356. String code = zdEmpTitle.getCode();
  357. ZdEmpTitle empTitle = empTitleDao.selectEmpTitleByCode(code);
  358. // 根据名称生成新的拼音码和五笔码
  359. zdEmpTitle.setPyCode(PingYinUtils.pyShouZiMuDaXie(zdEmpTitle.getName()));
  360. zdEmpTitle.setDCode(PingYinUtils.getWBCode(zdEmpTitle.getName()));
  361. int num;
  362. try{
  363. if(null != empTitle){
  364. num = empTitleDao.updateEmpTitleByCode(zdEmpTitle);
  365. } else {
  366. num = empTitleDao.insert(zdEmpTitle);
  367. }
  368. if(num == 0){
  369. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存专业技术职称失败!");
  370. }
  371. resultMap.put("cg", "保存专业技术职称成功!");
  372. return ResultVoUtil.success(resultMap);
  373. } catch(Exception e){
  374. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存专业技术职称失败!");
  375. }
  376. }
  377. /**
  378. * @Description 根据code删除专业技术职称
  379. * @Author hsh
  380. * @param code 专业技术职称编码
  381. * @return map
  382. * @Date 2023/12/20 14:47
  383. */
  384. public ResultVo<Map<String, Object>> delEmpTitleByCode(String code) {
  385. if (StringUtil.isBlank(code)) {
  386. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有专业技术职称编码,请检查!");
  387. }
  388. Map<String, Object> resultMap = new HashMap<>();
  389. try{
  390. int num = empTitleDao.deleteEmpTitleByCode(code);
  391. if(num == 0){
  392. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除专业技术职称失败!");
  393. }
  394. resultMap.put("cg", "删除专业技术职称成功!");
  395. return ResultVoUtil.success(resultMap);
  396. } catch(Exception e){
  397. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除专业技术职称失败!");
  398. }
  399. }
  400. /**
  401. * @Description 查询文化程度字典
  402. * @Author hsh
  403. * @return ZdEducationCode
  404. * @Date 2023/12/20 16:00
  405. */
  406. public ResultVo<List<ZdEducationCode>> selectEducation(){
  407. return ResultVoUtil.success(educationCodeDao.selectEducation());
  408. }
  409. /**
  410. * @Description 保存文化程度字典
  411. * @Author hsh
  412. * @param zdEducationCode 文化程度字典信息
  413. * @return map
  414. * @Date 2023/12/20 16:01
  415. */
  416. public ResultVo<Map<String, Object>> saveEducation(ZdEducationCode zdEducationCode){
  417. if(null == zdEducationCode || zdEducationCode.getCode() == null){
  418. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "文化程度字典信息不存在,请检查!");
  419. }
  420. Map<String, Object> resultMap = new HashMap<>();
  421. String code = zdEducationCode.getCode();
  422. ZdEducationCode education = educationCodeDao.selectEducationByCode(code);
  423. // 根据名称生成新的拼音码和五笔码
  424. zdEducationCode.setPyCode(PingYinUtils.pyShouZiMuDaXie(zdEducationCode.getName()));
  425. zdEducationCode.setDCode(PingYinUtils.getWBCode(zdEducationCode.getName()));
  426. int num;
  427. try{
  428. if(null != education){
  429. num = educationCodeDao.updateEducationByCode(zdEducationCode);
  430. } else {
  431. num = educationCodeDao.insert(zdEducationCode);
  432. }
  433. if(num == 0){
  434. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存文化程度字典失败!");
  435. }
  436. resultMap.put("cg", "保存文化程度字典成功!");
  437. return ResultVoUtil.success(resultMap);
  438. } catch(Exception e){
  439. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存文化程度字典失败!");
  440. }
  441. }
  442. /**
  443. * @Description 根据code删除文化程度字典
  444. * @Author hsh
  445. * @param code 文化程度字典编码
  446. * @return map
  447. * @Date 2023/12/20 16:02
  448. */
  449. public ResultVo<Map<String, Object>> delEducationByCode(String code) {
  450. if (StringUtil.isBlank(code)) {
  451. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有文化程度字典编码,请检查!");
  452. }
  453. Map<String, Object> resultMap = new HashMap<>();
  454. try{
  455. int num = educationCodeDao.deleteEducationByCode(code);
  456. if(num == 0){
  457. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除文化程度字典失败!");
  458. }
  459. resultMap.put("cg", "删除文化程度字典成功!");
  460. return ResultVoUtil.success(resultMap);
  461. } catch(Exception e){
  462. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除文化程度字典失败!");
  463. }
  464. }
  465. /**
  466. * @Description 查询干工标志字典
  467. * @Author hsh
  468. * @return ZdIfcadre 干工标志字典信息
  469. * @Date 2023/12/20 16:22
  470. */
  471. public ResultVo<List<ZdIfcadre>> selectIfcadre(){
  472. return ResultVoUtil.success(ifcadreDao.selectIfcadre());
  473. }
  474. /**
  475. * @Description 保存干工标志字典
  476. * @Author hsh
  477. * @param zdIfcadre 干工标志字典信息
  478. * @return map
  479. * @Date 2023/12/20 16:22
  480. */
  481. public ResultVo<Map<String, Object>> saveIfcadre(ZdIfcadre zdIfcadre){
  482. if(null == zdIfcadre || zdIfcadre.getCode() == null){
  483. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "干工标志字典信息不存在,请检查!");
  484. }
  485. Map<String, Object> resultMap = new HashMap<>();
  486. String code = zdIfcadre.getCode();
  487. ZdIfcadre cadre = ifcadreDao.selectIfcadreByCode(code);
  488. // 根据名称生成新的拼音码和五笔码
  489. zdIfcadre.setPyCode(PingYinUtils.pyShouZiMuDaXie(zdIfcadre.getName()));
  490. zdIfcadre.setDCode(PingYinUtils.getWBCode(zdIfcadre.getName()));
  491. int num;
  492. try{
  493. if(null != cadre){
  494. num = ifcadreDao.updateIfcadreByCode(zdIfcadre);
  495. } else {
  496. num = ifcadreDao.insert(zdIfcadre);
  497. }
  498. if(num == 0){
  499. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存干工标志字典失败!");
  500. }
  501. resultMap.put("cg", "保存干工标志字典成功!");
  502. return ResultVoUtil.success(resultMap);
  503. } catch(Exception e){
  504. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存干工标志字典失败!");
  505. }
  506. }
  507. /**
  508. * @Description 根据code删除干工标志字典
  509. * @Author hsh
  510. * @param code 干工标志字典编码
  511. * @return map
  512. * @Date 2023/12/20 16:23
  513. */
  514. public ResultVo<Map<String, Object>> delIfcadreByCode(String code) {
  515. if (StringUtil.isBlank(code)) {
  516. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有干工标志字典编码,请检查!");
  517. }
  518. Map<String, Object> resultMap = new HashMap<>();
  519. try{
  520. int num = ifcadreDao.deleteIfcadreByCode(code);
  521. if(num == 0){
  522. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除干工标志字典失败!");
  523. }
  524. resultMap.put("cg", "删除干工标志字典成功!");
  525. return ResultVoUtil.success(resultMap);
  526. } catch(Exception e){
  527. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除干工标志字典失败!");
  528. }
  529. }
  530. /**
  531. * @Description 查询在院标志字典
  532. * @Author hsh
  533. * @return ZdEmpInmark 在院标志字典信息
  534. * @Date 2023/12/20 16:44
  535. */
  536. public ResultVo<List<ZdEmpInmark>> selectEmpInmark(){
  537. return ResultVoUtil.success(empInmarkDao.selectEmpInmark());
  538. }
  539. /**
  540. * @Description 保存在院标志字典
  541. * @Author hsh
  542. * @param zdEmpInmark 在院标志字典信息
  543. * @return map
  544. * @Date 2023/12/20 16:45
  545. */
  546. public ResultVo<Map<String, Object>> saveEmpInmark(ZdEmpInmark zdEmpInmark){
  547. if(null == zdEmpInmark || zdEmpInmark.getCode() == null){
  548. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "在院标志字典信息不存在,请检查!");
  549. }
  550. if(StringUtil.notBlank(zdEmpInmark.getCode()) && zdEmpInmark.getCode().length() > 1){
  551. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "在院标志字典编码仅限一个字符,请检查!");
  552. }
  553. Map<String, Object> resultMap = new HashMap<>();
  554. String code = zdEmpInmark.getCode();
  555. ZdEmpInmark mark = empInmarkDao.selectEmpInmarkByCode(code);
  556. // 根据名称生成新的拼音码和五笔码
  557. zdEmpInmark.setPyCode(PingYinUtils.pyShouZiMuDaXie(zdEmpInmark.getName()));
  558. zdEmpInmark.setDCode(PingYinUtils.getWBCode(zdEmpInmark.getName()));
  559. int num;
  560. try{
  561. if(null != mark){
  562. num = empInmarkDao.updateEmpInmarkByCode(zdEmpInmark);
  563. } else {
  564. num = empInmarkDao.insert(zdEmpInmark);
  565. }
  566. if(num == 0){
  567. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存在院标志字典失败!");
  568. }
  569. resultMap.put("cg", "保存在院标志字典成功!");
  570. return ResultVoUtil.success(resultMap);
  571. } catch(Exception e){
  572. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "保存在院标志字典失败!");
  573. }
  574. }
  575. /**
  576. * @Description 根据code删除在院标志字典
  577. * @Author hsh
  578. * @param code 在院标志字典编码
  579. * @return map
  580. * @Date 2023/12/20 16:46
  581. */
  582. public ResultVo<Map<String, Object>> delEmpInmarkByCode(String code) {
  583. if (StringUtil.isBlank(code)) {
  584. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有在院标志字典编码,请检查!");
  585. }
  586. Map<String, Object> resultMap = new HashMap<>();
  587. try{
  588. int num = empInmarkDao.deleteEmpInmarkByCode(code);
  589. if(num == 0){
  590. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除在院标志字典失败!");
  591. }
  592. resultMap.put("cg", "删除在院标志字典成功!");
  593. return ResultVoUtil.success(resultMap);
  594. } catch(Exception e){
  595. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除在院标志字典失败!");
  596. }
  597. }
  598. /**
  599. * @Description 根据text查询职工信息
  600. * @Author hsh
  601. * @param text 关键字
  602. * @return EmployeeMiVo 职工信息
  603. * @Date 2023/12/25 10:51
  604. */
  605. public ResultVo<List<EmployeeMiVo>> selectEmployeeMi(String text){
  606. return ResultVoUtil.success(employeeMiDao.selectEmployeeMiAll(text));
  607. }
  608. /**
  609. * @Description 根据code查询职工信息
  610. * @Author hsh
  611. * @param code 职工编码
  612. * @return EmployeeMi 职工信息
  613. * @Date 2023/12/26 10:39
  614. */
  615. public ResultVo<EmployeeMi> selectEmployeeMiByCode(String code){
  616. return ResultVoUtil.success(employeeMiDao.selectEmployeeMiByCode(code));
  617. }
  618. /**
  619. * @Description 根据code删除职工信息
  620. * @Author hsh
  621. * @param code 职工编码
  622. * @return map
  623. * @Date 2023/12/26 10:54
  624. */
  625. public ResultVo<Map<String, Object>> delEmployeeMiByCode(String code){
  626. if (StringUtil.isBlank(code)) {
  627. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有职工编码,请检查!");
  628. }
  629. Map<String, Object> resultMap = new HashMap<>();
  630. try{
  631. int num = employeeMiDao.deleteEmployeeMiByCode(code);
  632. if(num == 0){
  633. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除职工字典失败!");
  634. }
  635. resultMap.put("cg", "删除职工字典成功!");
  636. return ResultVoUtil.success(resultMap);
  637. } catch(Exception e){
  638. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "删除职工字典失败!");
  639. }
  640. }
  641. /**
  642. * @Description 根据code更新员工信息停用状态
  643. * @Author hsh
  644. * @param code 员工编码
  645. * @return map
  646. * @Date 2023/12/26 14:46
  647. */
  648. public ResultVo<Map<String, Object>> updateEmployeeMiDelFlagByCode(String code, String delFlag){
  649. if(StringUtil.isBlank(code)) {
  650. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有职工编码,请检查!");
  651. }
  652. EmployeeMi emp = employeeMiDao.selectEmployeeMiByCode(code);
  653. if(null == emp){
  654. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, code + "的职工字典信息不存在,请检查!");
  655. }
  656. Map<String, Object> resultMap = new HashMap<>();
  657. try{
  658. int num = employeeMiDao.updateEmployeeMiDelFlagByCode(code, delFlag);
  659. if(num == 0){
  660. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新职工字典停用或启用失败!");
  661. }
  662. resultMap.put("cg", "更新职工字典停用或启用成功!");
  663. return ResultVoUtil.success(resultMap);
  664. } catch(Exception e){
  665. return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "更新职工字典停用或启用失败!");
  666. }
  667. }
  668. /**
  669. * @Description 根据text模糊查询,获取所有在职医生(字典用)
  670. * @Author hsh
  671. * @param text 模糊查询
  672. * @return CodeName 字典信息
  673. * @Date 2024/1/29 10:38
  674. */
  675. public ResultVo<List<CodeName>> selectEmployeeByCode(String text){
  676. return ResultVoUtil.success(employeeMiDao.selectEmployeeByCode(text));
  677. }
  678. }