|
@@ -98,15 +98,25 @@ func (c *ScheduleApiController) CoverSch() {
|
98
|
98
|
id_two, _ := c.GetInt64("id_two")
|
99
|
99
|
sch, _ := service.GetScheduleTen(c.GetAdminUserInfo().CurrentOrgId, id_one)
|
100
|
100
|
sch_two, _ := service.GetScheduleTen(c.GetAdminUserInfo().CurrentOrgId, id_two)
|
|
101
|
+ //order, _ := service.GetDialysisOrder(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
|
|
102
|
+ //if order.ID > 0 {
|
|
103
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderOne)
|
|
104
|
+ // return
|
|
105
|
+ //}
|
101
|
106
|
order, _ := service.GetDialysisOrder(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
|
102
|
107
|
if order.ID > 0 {
|
103
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderOne)
|
104
|
|
- return
|
105
|
|
- }
|
106
|
|
- order2, _ := service.GetDialysisOrder(sch_two.ScheduleDate, sch_two.PatientId, sch_two.UserOrgId)
|
107
|
|
- if order2.ID > 0 {
|
108
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderTwo)
|
109
|
|
- return
|
|
108
|
+
|
|
109
|
+ service.UpdateDialysiOrderByPatientId(id_two, sch_two.ScheduleType, sch_two.PartitionId, sch_two.BedId)
|
|
110
|
+ redis := service.RedisClient()
|
|
111
|
+ key := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.PatientId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_order"
|
|
112
|
+ redis.Set(key, "", time.Second)
|
|
113
|
+ keyOne := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_orders_list_all"
|
|
114
|
+
|
|
115
|
+ //清空key 值
|
|
116
|
+ redis.Set(keyOne, "", time.Second)
|
|
117
|
+
|
|
118
|
+ //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderTwo)
|
|
119
|
+ //return
|
110
|
120
|
}
|
111
|
121
|
//替换者和被替换的排班日期不是同一天,则进行一个患者一天不能有多个排班提醒
|
112
|
122
|
if sch.ScheduleDate != sch_two.ScheduleDate && sch.PatientId != sch_two.PatientId {
|
|
@@ -154,16 +164,12 @@ func (c *ScheduleApiController) ExchangeSch() {
|
154
|
164
|
id_two, _ := c.GetInt64("id_two")
|
155
|
165
|
sch, _ := service.GetSchedule(c.GetAdminUserInfo().CurrentOrgId, id_one)
|
156
|
166
|
sch_two, _ := service.GetSchedule(c.GetAdminUserInfo().CurrentOrgId, id_two)
|
157
|
|
- order, _ := service.GetDialysisOrder(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
|
158
|
|
- if order.ID > 0 {
|
159
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderOne)
|
160
|
|
- return
|
161
|
|
- }
|
162
|
|
- order2, _ := service.GetDialysisOrder(sch_two.ScheduleDate, sch_two.PatientId, sch_two.UserOrgId)
|
163
|
|
- if order2.ID > 0 {
|
164
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderTwo)
|
165
|
|
- return
|
166
|
|
- }
|
|
167
|
+
|
|
168
|
+ //order2, _ := service.GetDialysisOrder(sch_two.ScheduleDate, sch_two.PatientId, sch_two.UserOrgId)
|
|
169
|
+ //if order2.ID > 0 {
|
|
170
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderTwo)
|
|
171
|
+ // return
|
|
172
|
+ //}
|
167
|
173
|
|
168
|
174
|
//替换者和被替换的排班日期不是同一天,则进行一个患者一天不能有多个排班提醒
|
169
|
175
|
if sch.ScheduleDate != sch_two.ScheduleDate && sch.PatientId != sch_two.PatientId {
|
|
@@ -181,6 +187,22 @@ func (c *ScheduleApiController) ExchangeSch() {
|
181
|
187
|
}
|
182
|
188
|
|
183
|
189
|
err := service.UpdateScheduleThree(sch, sch_two)
|
|
190
|
+
|
|
191
|
+ order, _ := service.GetDialysisOrder(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
|
|
192
|
+ if order.ID > 0 {
|
|
193
|
+ //查询该患者的排班机位
|
|
194
|
+ pSchedule, _ := service.GetPscheduleDate(sch.ScheduleDate, sch.PatientId, sch.UserOrgId)
|
|
195
|
+ service.UpdateDialysiOrderByPatientId(id_two, pSchedule.ScheduleType, pSchedule.PartitionId, pSchedule.BedId)
|
|
196
|
+ redis := service.RedisClient()
|
|
197
|
+ key := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.PatientId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_order"
|
|
198
|
+ redis.Set(key, "", time.Second)
|
|
199
|
+ keyOne := strconv.FormatInt(sch_two.UserOrgId, 10) + ":" + strconv.FormatInt(sch_two.ScheduleDate, 10) + ":dialysis_orders_list_all"
|
|
200
|
+
|
|
201
|
+ //清空key 值
|
|
202
|
+ redis.Set(keyOne, "", time.Second)
|
|
203
|
+ //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientDialysisOrderOne)
|
|
204
|
+ //return
|
|
205
|
+ }
|
184
|
206
|
if err == nil {
|
185
|
207
|
|
186
|
208
|
//去除当天患者排班中重复数据,保留最后一条数据
|
|
@@ -1667,16 +1689,16 @@ func (c *ScheduleApiController) CreateScheduleTwo() {
|
1667
|
1689
|
return
|
1668
|
1690
|
}
|
1669
|
1691
|
|
1670
|
|
- order, err := service.GetOneDialysisOrder(adminINfo.CurrentOrgId, schedule_two.ScheduleDate, schedule_two.PatientId)
|
1671
|
|
- if err != nil {
|
1672
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
1673
|
|
- return
|
1674
|
|
- }
|
1675
|
|
-
|
1676
|
|
- if order != nil {
|
1677
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDelScheduleFailByDialysis)
|
1678
|
|
- return
|
1679
|
|
- }
|
|
1692
|
+ //order, err := service.GetOneDialysisOrder(adminINfo.CurrentOrgId, schedule_two.ScheduleDate, schedule_two.PatientId)
|
|
1693
|
+ //if err != nil {
|
|
1694
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
1695
|
+ // return
|
|
1696
|
+ //}
|
|
1697
|
+ //
|
|
1698
|
+ //if order != nil {
|
|
1699
|
+ // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDelScheduleFailByDialysis)
|
|
1700
|
+ // return
|
|
1701
|
+ //}
|
1680
|
1702
|
|
1681
|
1703
|
schedule_two.Status = 0
|
1682
|
1704
|
schedule_two.UpdatedTime = time.Now().Unix()
|
|
@@ -1696,7 +1718,7 @@ func (c *ScheduleApiController) CreateScheduleTwo() {
|
1696
|
1718
|
var schedule models.Schedule
|
1697
|
1719
|
dataBody := make(map[string]interface{}, 0)
|
1698
|
1720
|
|
1699
|
|
- err = json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
|
|
1721
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
|
1700
|
1722
|
if err != nil {
|
1701
|
1723
|
utils.ErrorLog(err.Error())
|
1702
|
1724
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -1858,6 +1880,7 @@ func (c *ScheduleApiController) CreateScheduleTwo() {
|
1858
|
1880
|
//}
|
1859
|
1881
|
//同天同位置只能排一个
|
1860
|
1882
|
pointSchedule, err := service.GetPointSchedule(adminUserInfo.CurrentOrgId, schedule.ScheduleDate, schedule.ScheduleWeek, schedule.ScheduleType, schedule.BedId)
|
|
1883
|
+
|
1861
|
1884
|
if err != nil {
|
1862
|
1885
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
1863
|
1886
|
return
|
|
@@ -1867,9 +1890,26 @@ func (c *ScheduleApiController) CreateScheduleTwo() {
|
1867
|
1890
|
return
|
1868
|
1891
|
}
|
1869
|
1892
|
schedule.IsExport = 1000
|
|
1893
|
+
|
1870
|
1894
|
err = service.CreateSchedule(&schedule, id)
|
1871
|
1895
|
|
1872
|
1896
|
lastSchedule, _ := service.GetLastSchedule(patientID, adminUserInfo.CurrentOrgId)
|
|
1897
|
+
|
|
1898
|
+ //查询上机床位号 更改床位号
|
|
1899
|
+ order, err := service.GetOneDialysisOrder(adminINfo.CurrentOrgId, schedule_two.ScheduleDate, schedule_two.PatientId)
|
|
1900
|
+
|
|
1901
|
+ if order.ID > 0 {
|
|
1902
|
+ service.UpdateDialysiOrderByPatientId(order.ID, schedule.ScheduleType, schedule.PartitionId, order.BedID)
|
|
1903
|
+ redis := service.RedisClient()
|
|
1904
|
+ key := strconv.FormatInt(adminINfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":dialysis_order"
|
|
1905
|
+ redis.Set(key, "", time.Second)
|
|
1906
|
+ keyOne := strconv.FormatInt(adminINfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(schedule.ScheduleDate, 10) + ":dialysis_orders_list_all"
|
|
1907
|
+
|
|
1908
|
+ //清空key 值
|
|
1909
|
+ redis.Set(keyOne, "", time.Second)
|
|
1910
|
+
|
|
1911
|
+ }
|
|
1912
|
+
|
1873
|
1913
|
if err == nil {
|
1874
|
1914
|
redis := service.RedisClient()
|
1875
|
1915
|
key := "scheduals_" + scheduleDate + "_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
|
|
@@ -1976,6 +2016,13 @@ func (c *ScheduleApiController) DeleteSchedule() {
|
1976
|
2016
|
}
|
1977
|
2017
|
}
|
1978
|
2018
|
|
|
2019
|
+ if adminINfo.CurrentOrgId == 10206 {
|
|
2020
|
+ advice, _ := service.GetHisDoctorAdviceListTwenty(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
|
|
2021
|
+ if len(advice) > 0 {
|
|
2022
|
+ service.UpdateHisAdviceObj(schedule.PatientId, schedule.ScheduleDate, adminINfo.CurrentOrgId)
|
|
2023
|
+ }
|
|
2024
|
+ }
|
|
2025
|
+
|
1979
|
2026
|
redis := service.RedisClient()
|
1980
|
2027
|
|
1981
|
2028
|
//处方
|