|
@@ -91,6 +91,7 @@ func (this *DialysisAPIController) Scheduals() {
|
91
|
91
|
|
92
|
92
|
if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
|
93
|
93
|
scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)
|
|
94
|
+
|
94
|
95
|
if err != nil {
|
95
|
96
|
this.ErrorLog("获取排班信息失败:%v", err)
|
96
|
97
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
@@ -117,6 +118,7 @@ func (this *DialysisAPIController) Scheduals() {
|
117
|
118
|
} else {
|
118
|
119
|
|
119
|
120
|
}
|
|
121
|
+
|
120
|
122
|
this.ServeSuccessJSON(map[string]interface{}{
|
121
|
123
|
"scheduals": dat,
|
122
|
124
|
"redis": "true",
|
|
@@ -1163,6 +1165,71 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
|
1163
|
1165
|
DisplaceSpeed: displace_speed,
|
1164
|
1166
|
}
|
1165
|
1167
|
|
|
1168
|
+ //查询最近透析准备表里是否存在 透析器 灌流器
|
|
1169
|
+
|
|
1170
|
+ //
|
|
1171
|
+ //splitStr := strings.Split(dialysis_dialyszers, ",")
|
|
1172
|
+ //
|
|
1173
|
+ //splitIrrigation := strings.Split(dialysis_irrigation, ",")
|
|
1174
|
+ //
|
|
1175
|
+ //mation, _ := service.GetGoodInfoMation(adminUserInfo.Org.Id)
|
|
1176
|
+ //if len(mation)>0{
|
|
1177
|
+ // for _, item := range splitStr {
|
|
1178
|
+ // for _,it := range mation{
|
|
1179
|
+ // if(item == it.SpecificationName){
|
|
1180
|
+ //
|
|
1181
|
+ // //查询最近一次的透析器
|
|
1182
|
+ // _, errcode := service.GetDialysisBeforePrepare(it.GoodTypeId, it.ID, adminUserInfo.Org.Id,id)
|
|
1183
|
+ //
|
|
1184
|
+ // if errcode == gorm.ErrRecordNotFound{
|
|
1185
|
+ // //插入数据
|
|
1186
|
+ // prepare := models.DialysisBeforePrepare{
|
|
1187
|
+ // UserOrgId: adminUserInfo.Org.Id,
|
|
1188
|
+ // PatientId: id,
|
|
1189
|
+ // RecordDate: recordDate.Unix(),
|
|
1190
|
+ // GoodTypeId: it.GoodTypeId,
|
|
1191
|
+ // GoodId: it.ID,
|
|
1192
|
+ // Count: 1,
|
|
1193
|
+ // Ctime: time.Now().Unix(),
|
|
1194
|
+ // Creater: adminUserInfo.AdminUser.Id,
|
|
1195
|
+ // Status:1,
|
|
1196
|
+ //
|
|
1197
|
+ // }
|
|
1198
|
+ // errcode := service.CreateDialysisBeforePrepareOne(&prepare)
|
|
1199
|
+ // fmt.Println("",errcode)
|
|
1200
|
+ // }
|
|
1201
|
+ // }
|
|
1202
|
+ // }
|
|
1203
|
+ //
|
|
1204
|
+ // }
|
|
1205
|
+ //
|
|
1206
|
+ // for _, item := range splitIrrigation {
|
|
1207
|
+ // for _,it := range mation{
|
|
1208
|
+ // if(item == it.SpecificationName){
|
|
1209
|
+ // //查询最近一次的透析器
|
|
1210
|
+ // _, errcode := service.GetDialysisBeforePrepare(it.GoodTypeId, it.ID, adminUserInfo.Org.Id,id)
|
|
1211
|
+ // if errcode == gorm.ErrRecordNotFound{
|
|
1212
|
+ // //插入数据
|
|
1213
|
+ // prepare := models.DialysisBeforePrepare{
|
|
1214
|
+ // UserOrgId: adminUserInfo.Org.Id,
|
|
1215
|
+ // PatientId: id,
|
|
1216
|
+ // RecordDate: recordDate.Unix(),
|
|
1217
|
+ // GoodTypeId: it.GoodTypeId,
|
|
1218
|
+ // GoodId: it.ID,
|
|
1219
|
+ // Count: 1,
|
|
1220
|
+ // Ctime: time.Now().Unix(),
|
|
1221
|
+ // Creater: adminUserInfo.AdminUser.Id,
|
|
1222
|
+ // Status:1,
|
|
1223
|
+ //
|
|
1224
|
+ // }
|
|
1225
|
+ // errcode := service.CreateDialysisBeforePrepareOne(&prepare)
|
|
1226
|
+ // fmt.Println(errcode)
|
|
1227
|
+ // }
|
|
1228
|
+ // }
|
|
1229
|
+ // }
|
|
1230
|
+ // }
|
|
1231
|
+ //}
|
|
1232
|
+
|
1166
|
1233
|
_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
|
1167
|
1234
|
if dialysisPrescription.ID == 0 { //新增
|
1168
|
1235
|
//if mode_id > 0 {
|
|
@@ -2063,8 +2130,75 @@ func (c *DialysisAPIController) PostSolution() {
|
2063
|
2130
|
BodyFluidOther: body_fluid_other,
|
2064
|
2131
|
ReplacementTotal: replacement_total,
|
2065
|
2132
|
TargetKtv: target_ktv,
|
|
2133
|
+ DialysisDialyszers: dialysis_dialyszers,
|
|
2134
|
+ DialysisIrrigation: dialysis_irrigation,
|
2066
|
2135
|
}
|
2067
|
2136
|
service.SavePrescriptionAndCreateSolution(&solution, &prescription)
|
|
2137
|
+
|
|
2138
|
+ //查询最近透析准备表里是否存在 透析器 灌流器
|
|
2139
|
+
|
|
2140
|
+ //splitStr := strings.Split(dialysis_dialyszers, ",")
|
|
2141
|
+ //
|
|
2142
|
+ //splitIrrigation := strings.Split(dialysis_irrigation, ",")
|
|
2143
|
+ //
|
|
2144
|
+ //mation, _ := service.GetGoodInfoMation(adminUserInfo.Org.Id)
|
|
2145
|
+ //if len(mation)>0{
|
|
2146
|
+ // for _, item := range splitStr {
|
|
2147
|
+ // for _,it := range mation{
|
|
2148
|
+ // if(item == it.SpecificationName){
|
|
2149
|
+ //
|
|
2150
|
+ // //查询最近一次的透析器
|
|
2151
|
+ // _, errcode := service.GetDialysisBeforePrepare(it.GoodTypeId, it.ID, adminUserInfo.Org.Id,id)
|
|
2152
|
+ //
|
|
2153
|
+ // if errcode == gorm.ErrRecordNotFound{
|
|
2154
|
+ // //插入数据
|
|
2155
|
+ // prepare := models.DialysisBeforePrepare{
|
|
2156
|
+ // UserOrgId: adminUserInfo.Org.Id,
|
|
2157
|
+ // PatientId: id,
|
|
2158
|
+ // RecordDate: recordDate.Unix(),
|
|
2159
|
+ // GoodTypeId: it.GoodTypeId,
|
|
2160
|
+ // GoodId: it.ID,
|
|
2161
|
+ // Count: 1,
|
|
2162
|
+ // Ctime: time.Now().Unix(),
|
|
2163
|
+ // Creater: adminUserInfo.AdminUser.Id,
|
|
2164
|
+ // Status:1,
|
|
2165
|
+ //
|
|
2166
|
+ // }
|
|
2167
|
+ // errcode := service.CreateDialysisBeforePrepareOne(&prepare)
|
|
2168
|
+ // fmt.Println("",errcode)
|
|
2169
|
+ // }
|
|
2170
|
+ // }
|
|
2171
|
+ // }
|
|
2172
|
+ //
|
|
2173
|
+ // }
|
|
2174
|
+ //
|
|
2175
|
+ // for _, item := range splitIrrigation {
|
|
2176
|
+ // for _,it := range mation{
|
|
2177
|
+ // if(item == it.SpecificationName){
|
|
2178
|
+ // //查询最近一次的透析器
|
|
2179
|
+ // _, errcode := service.GetDialysisBeforePrepare(it.GoodTypeId, it.ID, adminUserInfo.Org.Id,id)
|
|
2180
|
+ // if errcode == gorm.ErrRecordNotFound{
|
|
2181
|
+ // //插入数据
|
|
2182
|
+ // prepare := models.DialysisBeforePrepare{
|
|
2183
|
+ // UserOrgId: adminUserInfo.Org.Id,
|
|
2184
|
+ // PatientId: id,
|
|
2185
|
+ // RecordDate: recordDate.Unix(),
|
|
2186
|
+ // GoodTypeId: it.GoodTypeId,
|
|
2187
|
+ // GoodId: it.ID,
|
|
2188
|
+ // Count: 1,
|
|
2189
|
+ // Ctime: time.Now().Unix(),
|
|
2190
|
+ // Creater: adminUserInfo.AdminUser.Id,
|
|
2191
|
+ // Status:1,
|
|
2192
|
+ //
|
|
2193
|
+ // }
|
|
2194
|
+ // errcode := service.CreateDialysisBeforePrepareOne(&prepare)
|
|
2195
|
+ // fmt.Println(errcode)
|
|
2196
|
+ // }
|
|
2197
|
+ // }
|
|
2198
|
+ // }
|
|
2199
|
+ // }
|
|
2200
|
+ //}
|
|
2201
|
+
|
2068
|
2202
|
c.ServeSuccessJSON(map[string]interface{}{
|
2069
|
2203
|
"solution": &solution,
|
2070
|
2204
|
"prescription": &prescription,
|
|
@@ -3053,21 +3187,21 @@ func (c *DialysisAPIController) CreateConsumables() {
|
3053
|
3187
|
}
|
3054
|
3188
|
|
3055
|
3189
|
count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
|
3056
|
|
- //commdity_code := items["commdity_code"].(string)
|
3057
|
|
- //fmt.Println("新建22222222222222",commdity_code)
|
|
3190
|
+ commdity_code := items["commdity_code"].(string)
|
|
3191
|
+ fmt.Println("新建22222222222222", commdity_code)
|
3058
|
3192
|
adminUser := c.GetMobileAdminUserInfo()
|
3059
|
3193
|
prepare := &models.DialysisBeforePrepare{
|
3060
|
|
- UserOrgId: adminUser.Org.Id,
|
3061
|
|
- PatientId: patient_id,
|
3062
|
|
- RecordDate: record_time,
|
3063
|
|
- GoodId: good_id,
|
3064
|
|
- GoodTypeId: good_type_id,
|
3065
|
|
- Count: count,
|
3066
|
|
- Ctime: time.Now().Unix(),
|
3067
|
|
- Mtime: time.Now().Unix(),
|
3068
|
|
- Creater: adminUser.AdminUser.Id,
|
3069
|
|
- Modifier: 0,
|
3070
|
|
- //CommdityCode:commdity_code,
|
|
3194
|
+ UserOrgId: adminUser.Org.Id,
|
|
3195
|
+ PatientId: patient_id,
|
|
3196
|
+ RecordDate: record_time,
|
|
3197
|
+ GoodId: good_id,
|
|
3198
|
+ GoodTypeId: good_type_id,
|
|
3199
|
+ Count: count,
|
|
3200
|
+ Ctime: time.Now().Unix(),
|
|
3201
|
+ Mtime: time.Now().Unix(),
|
|
3202
|
+ Creater: adminUser.AdminUser.Id,
|
|
3203
|
+ Modifier: 0,
|
|
3204
|
+ CommdityCode: commdity_code,
|
3071
|
3205
|
}
|
3072
|
3206
|
record_count := service.FindDialysisBeforePrepare(prepare.PatientId, prepare.GoodId, prepare.GoodTypeId, adminUser.Org.Id, record_time)
|
3073
|
3207
|
if record_count == 0 {
|
|
@@ -3146,22 +3280,22 @@ func (c *DialysisAPIController) CreateConsumables() {
|
3146
|
3280
|
}
|
3147
|
3281
|
ctime := int64(items["ctime"].(float64))
|
3148
|
3282
|
|
3149
|
|
- //commdity_code := items["commdity_code"].(string)
|
3150
|
|
- //fmt.Println("commdityecode22222222222222222222",commdity_code)
|
|
3283
|
+ commdity_code := items["commdity_code"].(string)
|
|
3284
|
+ fmt.Println("commdityecode22222222222222222222", commdity_code)
|
3151
|
3285
|
prepare := &models.DialysisBeforePrepare{
|
3152
|
|
- ID: id,
|
3153
|
|
- UserOrgId: adminUser.Org.Id,
|
3154
|
|
- PatientId: patient_id,
|
3155
|
|
- RecordDate: record_time,
|
3156
|
|
- GoodId: good_id,
|
3157
|
|
- GoodTypeId: good_type_id,
|
3158
|
|
- Count: count,
|
3159
|
|
- Ctime: ctime,
|
3160
|
|
- Mtime: time.Now().Unix(),
|
3161
|
|
- Creater: creater,
|
3162
|
|
- Modifier: adminUser.AdminUser.Id,
|
3163
|
|
- Status: 1,
|
3164
|
|
- //CommdityCode: commdity_code,
|
|
3286
|
+ ID: id,
|
|
3287
|
+ UserOrgId: adminUser.Org.Id,
|
|
3288
|
+ PatientId: patient_id,
|
|
3289
|
+ RecordDate: record_time,
|
|
3290
|
+ GoodId: good_id,
|
|
3291
|
+ GoodTypeId: good_type_id,
|
|
3292
|
+ Count: count,
|
|
3293
|
+ Ctime: ctime,
|
|
3294
|
+ Mtime: time.Now().Unix(),
|
|
3295
|
+ Creater: creater,
|
|
3296
|
+ Modifier: adminUser.AdminUser.Id,
|
|
3297
|
+ Status: 1,
|
|
3298
|
+ CommdityCode: commdity_code,
|
3165
|
3299
|
}
|
3166
|
3300
|
updateBeforePrepares = append(updateBeforePrepares, prepare)
|
3167
|
3301
|
|
|
@@ -3458,23 +3592,23 @@ func (c *DialysisAPIController) EditConsumables() {
|
3458
|
3592
|
return
|
3459
|
3593
|
}
|
3460
|
3594
|
ctime := int64(items["ctime"].(float64))
|
3461
|
|
- //commdity_code := items["commdity_code"].(string)
|
3462
|
|
- //fmt.Println("commdityecode22222222222222222222",commdity_code)
|
|
3595
|
+ commdity_code := items["commdity_code"].(string)
|
|
3596
|
+ fmt.Println("commdityecode22222222222222222222", commdity_code)
|
3463
|
3597
|
adminUser := c.GetMobileAdminUserInfo()
|
3464
|
3598
|
prepare := &models.DialysisBeforePrepare{
|
3465
|
|
- ID: id,
|
3466
|
|
- UserOrgId: adminUser.Org.Id,
|
3467
|
|
- PatientId: patient_id,
|
3468
|
|
- RecordDate: record_time,
|
3469
|
|
- GoodId: good_id,
|
3470
|
|
- GoodTypeId: good_type_id,
|
3471
|
|
- Count: count,
|
3472
|
|
- Ctime: ctime,
|
3473
|
|
- Mtime: time.Now().Unix(),
|
3474
|
|
- Creater: creater,
|
3475
|
|
- Modifier: adminUser.AdminUser.Id,
|
3476
|
|
- Status: 1,
|
3477
|
|
- //CommdityCode: commdity_code,
|
|
3599
|
+ ID: id,
|
|
3600
|
+ UserOrgId: adminUser.Org.Id,
|
|
3601
|
+ PatientId: patient_id,
|
|
3602
|
+ RecordDate: record_time,
|
|
3603
|
+ GoodId: good_id,
|
|
3604
|
+ GoodTypeId: good_type_id,
|
|
3605
|
+ Count: count,
|
|
3606
|
+ Ctime: ctime,
|
|
3607
|
+ Mtime: time.Now().Unix(),
|
|
3608
|
+ Creater: creater,
|
|
3609
|
+ Modifier: adminUser.AdminUser.Id,
|
|
3610
|
+ Status: 1,
|
|
3611
|
+ CommdityCode: commdity_code,
|
3478
|
3612
|
}
|
3479
|
3613
|
beforePrepares = append(beforePrepares, prepare)
|
3480
|
3614
|
|
|
@@ -4004,6 +4138,9 @@ func (c *DialysisAPIController) GetDialysisGoods() {
|
4004
|
4138
|
|
4005
|
4139
|
goodTypes, _ := service.FindAllGoodType(adminUser.Org.Id)
|
4006
|
4140
|
|
|
4141
|
+ //获取当天该病人的透析处方
|
|
4142
|
+ prescribe, parseDateErr := service.GetDialysisPrescribe(adminUser.Org.Id, patient_id, date.Unix())
|
|
4143
|
+ good_info, _ := service.FindAllGoodInfo(adminUser.Org.Id)
|
4007
|
4144
|
if err == gorm.ErrRecordNotFound {
|
4008
|
4145
|
|
4009
|
4146
|
dialysisGoods, _, total := service.MobileGetDialysisGoods(adminUser.Org.Id, date.Unix(), schedule_type, partition_id, page, 0, patient_id, "", schedualEndDate)
|
|
@@ -4020,6 +4157,8 @@ func (c *DialysisAPIController) GetDialysisGoods() {
|
4020
|
4157
|
"dialysis_goods": dialysisGoods,
|
4021
|
4158
|
"good_type": goodTypes,
|
4022
|
4159
|
"total": total,
|
|
4160
|
+ "prescribe": prescribe,
|
|
4161
|
+ "good_info": good_info,
|
4023
|
4162
|
})
|
4024
|
4163
|
return
|
4025
|
4164
|
|
|
@@ -4043,6 +4182,8 @@ func (c *DialysisAPIController) GetDialysisGoods() {
|
4043
|
4182
|
"dialysis_goods": dialysisGoods,
|
4044
|
4183
|
"good_type": goodTypes,
|
4045
|
4184
|
"total": total,
|
|
4185
|
+ "prescribe": prescribe,
|
|
4186
|
+ "good_info": good_info,
|
4046
|
4187
|
})
|
4047
|
4188
|
return
|
4048
|
4189
|
|
|
@@ -4109,11 +4250,17 @@ func (c *DialysisAPIController) GetStockInGoodInfo() {
|
4109
|
4250
|
|
4110
|
4251
|
goodUser, _ := service.GetAllStockOutUserDetail(patient_id, adminUser.Org.Id, date.Unix())
|
4111
|
4252
|
lastGoodUserDetial, _ := service.GetLastDialysisGoods(patient_id, adminUser.Org.Id, date.Unix())
|
|
4253
|
+
|
|
4254
|
+ //获取今日患者的透析处方参数
|
|
4255
|
+
|
|
4256
|
+ prescribe, parseDateErr := service.GetDialysisPrescribe(adminUser.Org.Id, patient_id, date.Unix())
|
|
4257
|
+
|
4112
|
4258
|
c.ServeSuccessJSON(map[string]interface{}{
|
4113
|
4259
|
"good_type": goodTypes,
|
4114
|
4260
|
"good_user": goodUser,
|
4115
|
4261
|
"good_info": good_info,
|
4116
|
4262
|
"last_good_user": lastGoodUserDetial,
|
|
4263
|
+ "prescription": prescribe,
|
4117
|
4264
|
})
|
4118
|
4265
|
return
|
4119
|
4266
|
|
|
@@ -4155,15 +4302,16 @@ func (c *DialysisAPIController) CreateOtherStockOutInfo() {
|
4155
|
4302
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
4156
|
4303
|
return
|
4157
|
4304
|
}
|
4158
|
|
- good_id := int64(items["good_id"].(float64))
|
4159
|
4305
|
|
|
4306
|
+ good_id := int64(items["good_id"].(float64))
|
|
4307
|
+ fmt.Println("goood_id2222222222222222", good_id)
|
4160
|
4308
|
if items["good_type_id"] == nil || reflect.TypeOf(items["good_type_id"]).String() != "float64" {
|
4161
|
4309
|
utils.ErrorLog("good_type_id")
|
4162
|
4310
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
4163
|
4311
|
return
|
4164
|
4312
|
}
|
4165
|
4313
|
good_type_id := int64(items["good_type_id"].(float64))
|
4166
|
|
-
|
|
4314
|
+ fmt.Println("goood_id2222222222222222", good_type_id)
|
4167
|
4315
|
if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "string" {
|
4168
|
4316
|
utils.ErrorLog("count")
|
4169
|
4317
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
@@ -4171,7 +4319,7 @@ func (c *DialysisAPIController) CreateOtherStockOutInfo() {
|
4171
|
4319
|
}
|
4172
|
4320
|
|
4173
|
4321
|
count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
|
4174
|
|
-
|
|
4322
|
+ fmt.Println("count22222222", count)
|
4175
|
4323
|
adminUser := c.GetMobileAdminUserInfo()
|
4176
|
4324
|
prepare := &models.DialysisBeforePrepare{
|
4177
|
4325
|
UserOrgId: adminUser.Org.Id,
|
|
@@ -4421,3 +4569,45 @@ func (c *DialysisAPIController) GetDepartment() {
|
4421
|
4569
|
}
|
4422
|
4570
|
|
4423
|
4571
|
}
|
|
4572
|
+
|
|
4573
|
+func (c *DialysisAPIController) GetMobilePrintStockGood() {
|
|
4574
|
+
|
|
4575
|
+ types, _ := c.GetInt("type", 0)
|
|
4576
|
+ start_time := c.GetString("start_time")
|
|
4577
|
+ end_time := c.GetString("end_time")
|
|
4578
|
+ orgId := c.GetMobileAdminUserInfo().Org.Id
|
|
4579
|
+
|
|
4580
|
+ timeLayout := "2006-01-02"
|
|
4581
|
+ loc, _ := time.LoadLocation("Local")
|
|
4582
|
+ var startTime int64
|
|
4583
|
+ if len(start_time) > 0 {
|
|
4584
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
4585
|
+ if err != nil {
|
|
4586
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
4587
|
+ return
|
|
4588
|
+ }
|
|
4589
|
+ startTime = theTime.Unix()
|
|
4590
|
+ }
|
|
4591
|
+ var endTime int64
|
|
4592
|
+ if len(end_time) > 0 {
|
|
4593
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
|
|
4594
|
+ if err != nil {
|
|
4595
|
+ utils.ErrorLog(err.Error())
|
|
4596
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
4597
|
+ return
|
|
4598
|
+ }
|
|
4599
|
+ endTime = theTime.Unix()
|
|
4600
|
+ }
|
|
4601
|
+
|
|
4602
|
+ list, err := service.FindPrintStockGoodInfoByType(types, startTime, endTime, orgId)
|
|
4603
|
+ stockTotal, err := service.GetOutStockTotalCountTwo(startTime, endTime, orgId)
|
|
4604
|
+ if err != nil {
|
|
4605
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
4606
|
+ } else {
|
|
4607
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
4608
|
+ "list": list,
|
|
4609
|
+ "type": types,
|
|
4610
|
+ "stockTotal": stockTotal,
|
|
4611
|
+ })
|
|
4612
|
+ }
|
|
4613
|
+}
|