Sfoglia il codice sorgente

11月8日库存管理

XMLWAN 2 anni fa
parent
commit
7836cffa5c

+ 1 - 1
conf/app.conf Vedi File

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9531
2
+httpport = 9529
3 3
 runmode = dev
4 4
 
5 5
 #

+ 10 - 9
controllers/dialysis_record_api_controller.go Vedi File

@@ -77,7 +77,7 @@ func (this *DialysisRecordAPIController) GetSchedules() {
77 77
 	redis := service.RedisClient()
78 78
 	defer redis.Close()
79 79
 	key := "scheduals_" + schedualDate + "_" + strconv.FormatInt(orgID, 10)
80
-	patients, _ := service.GetAllPcPatientListByListSeven(orgID)
80
+	patients, _ := service.GetAllPcPatientListByListEight(orgID)
81 81
 	scheduals_json_str, _ := redis.Get(key).Result()
82 82
 
83 83
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
@@ -277,6 +277,7 @@ func (this *DialysisRecordAPIController) DialysisSchedule() {
277 277
 
278 278
 	go func() {
279 279
 		doctorAdvices, _ = service.MobileGetDoctorAdvices(adminInfo.CurrentOrgId, patientID, date.Unix())
280
+
280 281
 		ch <- struct{}{}
281 282
 	}()
282 283
 
@@ -388,13 +389,6 @@ func (this *DialysisRecordAPIController) DialysisSchedule() {
388 389
 
389 390
 	dialysisSolution, _ := service.GetDialysisSolution(adminInfo.CurrentOrgId, patientID, schedual.ModeId)
390 391
 
391
-	//
392
-	//if getDialysisSolutionErr != nil {
393
-	//	this.ErrorLog("获取透析方案失败:%v", getDialysisSolutionErr)
394
-	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
395
-	//	return
396
-	//}
397
-
398 392
 	lastDialysisPrescribe, _ := service.GetLastDialysisPrescribeByModeId(adminInfo.CurrentOrgId, patientID, schedual.ModeId)
399 393
 
400 394
 	systemDialysisPrescribe, _ := service.GetSystemDialysisPrescribeByModeId(adminInfo.CurrentOrgId, schedual.ModeId)
@@ -409,10 +403,15 @@ func (this *DialysisRecordAPIController) DialysisSchedule() {
409 403
 	headNurses, _ := service.GetAllSpecialPermissionAdminUsersWithoutStatus(adminInfo.CurrentOrgId, adminInfo.CurrentAppId, models.SpecialPermissionTypeHeadNurse)
410 404
 
411 405
 	var his_advices []*models.HisDoctorAdviceInfo
412
-	fmt.Println("hhh2333223322323223", is_open_config.IsOpen)
406
+
413 407
 	if is_open_config.IsOpen == 1 {
414 408
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.CurrentOrgId, patientID, date.Unix())
415 409
 	}
410
+	//查询是否是开起
411
+	adviceConfig, _ := service.FindAdviceSettingById(adminInfo.CurrentOrgId)
412
+	if adviceConfig.IsAdviceOpen == 1 {
413
+		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.CurrentOrgId, patientID, date.Unix())
414
+	}
416 415
 
417 416
 	_, errcode := service.GetOrgFollowIsExist(adminInfo.CurrentOrgId)
418 417
 	if errcode == gorm.ErrRecordNotFound {
@@ -447,6 +446,7 @@ func (this *DialysisRecordAPIController) DialysisSchedule() {
447 446
 			"prepare":                     prepare,
448 447
 			"lastAssessment":              lastAssessment,
449 448
 			"information":                 information,
449
+			"is_advice_open":              adviceConfig,
450 450
 		}
451 451
 		this.ServeSuccessJSON(returnData)
452 452
 
@@ -482,6 +482,7 @@ func (this *DialysisRecordAPIController) DialysisSchedule() {
482 482
 			"prepare":                     prepare,
483 483
 			"lastAssessment":              lastAssessment,
484 484
 			"information":                 information,
485
+			"is_advice_open":              adviceConfig,
485 486
 		}
486 487
 		this.ServeSuccessJSON(returnData)
487 488
 	}

+ 71 - 45
controllers/his_api_controller.go Vedi File

@@ -1869,16 +1869,17 @@ func (c *HisApiController) DeletePrescription() {
1869 1869
 					total, _ := service.FindAllCancelStockTotal(c.GetAdminUserInfo().CurrentOrgId)
1870 1870
 					total = total + 1
1871 1871
 					orderNumber := "CKTKD" + strconv.FormatInt(c.GetAdminUserInfo().CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
1872
-
1872
+					houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
1873 1873
 					cancelStock := models.CancelStock{
1874
-						OrderNumber: orderNumber,
1875
-						OperaTime:   operation_time,
1876
-						OrgId:       c.GetAdminUserInfo().CurrentOrgId,
1877
-						Creater:     creater,
1878
-						Ctime:       time.Now().Unix(),
1879
-						Status:      1,
1880
-						ReturnTime:  item.RecordDate,
1881
-						Type:        1,
1874
+						OrderNumber:  orderNumber,
1875
+						OperaTime:    operation_time,
1876
+						OrgId:        c.GetAdminUserInfo().CurrentOrgId,
1877
+						Creater:      creater,
1878
+						Ctime:        time.Now().Unix(),
1879
+						Status:       1,
1880
+						ReturnTime:   item.RecordDate,
1881
+						Type:         1,
1882
+						StorehouseId: houseConfig.StorehouseOutInfo,
1882 1883
 					}
1883 1884
 					_, msgerrkonde := service.GetCancelStockDetailByOrderNumberOne(item.RecordDate, c.GetAdminUserInfo().CurrentOrgId)
1884 1885
 					if msgerrkonde == gorm.ErrRecordNotFound {
@@ -1914,6 +1915,7 @@ func (c *HisApiController) DeletePrescription() {
1914 1915
 							WarehouseInfoId: info.WarehouseInfotId,
1915 1916
 							PatientId:       info.PatientId,
1916 1917
 							RecordDate:      info.SysRecordTime,
1918
+							StorehouseId:    houseConfig.StorehouseOutInfo,
1917 1919
 						}
1918 1920
 
1919 1921
 						service.CreateCancelStockInfoOne(&cancelStockInfo)
@@ -1950,6 +1952,7 @@ func (c *HisApiController) DeletePrescription() {
1950 1952
 							CancelOutDetailId:       cancelInfo.ID,
1951 1953
 							ProductDate:             info.ProductDate,
1952 1954
 							ExpireDate:              info.ExpiryDate,
1955
+							StorehouseId:            houseConfig.StorehouseOutInfo,
1953 1956
 						}
1954 1957
 						service.CreateStockFlowOne(flow)
1955 1958
 
@@ -2002,6 +2005,7 @@ func (c *HisApiController) DeletePrescription() {
2002 2005
 									Manufacturer:            0,
2003 2006
 									Type:                    1,
2004 2007
 									IsSys:                   1,
2008
+									StorehouseId:            houseConfig.StorehouseOutInfo,
2005 2009
 								}
2006 2010
 								err := service.AddSigleWarehouseOut(&warehouseOut)
2007 2011
 								if err != nil {
@@ -2009,24 +2013,26 @@ func (c *HisApiController) DeletePrescription() {
2009 2013
 									return
2010 2014
 								}
2011 2015
 								prepare := &models.DialysisBeforePrepare{
2012
-									UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
2013
-									PatientId:  info.PatientId,
2014
-									RecordDate: info.SysRecordTime,
2015
-									GoodId:     item.ProjectId,
2016
-									GoodTypeId: info.GoodTypeId,
2017
-									Count:      cha_count,
2016
+									UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
2017
+									PatientId:    info.PatientId,
2018
+									RecordDate:   info.SysRecordTime,
2019
+									GoodId:       item.ProjectId,
2020
+									GoodTypeId:   info.GoodTypeId,
2021
+									Count:        cha_count,
2022
+									StorehouseId: houseConfig.StorehouseOutInfo,
2018 2023
 								}
2019 2024
 								//出库
2020 2025
 								service.ConsumablesDelivery(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, prepare, &warehouseOut, cha_count)
2021 2026
 							} else if err == nil {
2022 2027
 
2023 2028
 								prepare := &models.DialysisBeforePrepare{
2024
-									UserOrgId:  c.GetAdminUserInfo().CurrentOrgId,
2025
-									PatientId:  info.PatientId,
2026
-									RecordDate: info.SysRecordTime,
2027
-									GoodId:     item.ProjectId,
2028
-									GoodTypeId: info.GoodTypeId,
2029
-									Count:      cha_count,
2029
+									UserOrgId:    c.GetAdminUserInfo().CurrentOrgId,
2030
+									PatientId:    info.PatientId,
2031
+									RecordDate:   info.SysRecordTime,
2032
+									GoodId:       item.ProjectId,
2033
+									GoodTypeId:   info.GoodTypeId,
2034
+									Count:        cha_count,
2035
+									StorehouseId: houseConfig.StorehouseOutInfo,
2030 2036
 								}
2031 2037
 								//出库
2032 2038
 								service.ConsumablesDelivery(c.GetAdminUserInfo().CurrentOrgId, info.PatientId, info.SysRecordTime, prepare, &out, cha_count)
@@ -2087,7 +2093,7 @@ func (c *HisApiController) DeletePrescription() {
2087 2093
 						total, _ := service.FindAllDrugCancelStockTotal(adminUserInfo.CurrentOrgId)
2088 2094
 						total = total + 1
2089 2095
 						orderNumber := "CKTKD" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
2090
-
2096
+						houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
2091 2097
 						cancelStock := models.DrugCancelStock{
2092 2098
 							OrderNumber:  orderNumber,
2093 2099
 							OperaTime:    operation_time,
@@ -2099,6 +2105,7 @@ func (c *HisApiController) DeletePrescription() {
2099 2105
 							Dealer:       info.Dealer,
2100 2106
 							Manufacturer: info.Manufacturer,
2101 2107
 							Type:         1,
2108
+							StorehouseId: houseConfig.DrugStorehouseOut,
2102 2109
 						}
2103 2110
 						service.AddSigleDrugCancelStock(&cancelStock)
2104 2111
 
@@ -2127,6 +2134,7 @@ func (c *HisApiController) DeletePrescription() {
2127 2134
 							ProductDate:      info.ProductDate,
2128 2135
 							ExpiryDate:       info.ExpiryDate,
2129 2136
 							BatchNumberId:    info.WarehouseInfoId,
2137
+							StorehouseId:     houseConfig.DrugStorehouseOut,
2130 2138
 						}
2131 2139
 
2132 2140
 						flow := models.DrugFlow{
@@ -2162,6 +2170,7 @@ func (c *HisApiController) DeletePrescription() {
2162 2170
 							MaxUnit:                 info.CountUnit,
2163 2171
 							MinUnit:                 "",
2164 2172
 							AdviceId:                info.AdviceId,
2173
+							StorehouseId:            houseConfig.DrugStorehouseOut,
2165 2174
 						}
2166 2175
 						service.CreatedCancelStock(cancelStockInfo)
2167 2176
 						service.CreateDrugFlowOne(flow)
@@ -2171,6 +2180,7 @@ func (c *HisApiController) DeletePrescription() {
2171 2180
 						//删除流水
2172 2181
 						service.UpdateDrugFlowTens(info.PatientId, info.WarehouseOutOrderNumber, info.DrugId, item.ID)
2173 2182
 					} else {
2183
+						houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
2174 2184
 						floatPrescrip := strconv.FormatFloat(item.PrescribingNumber, 'f', -1, 32)
2175 2185
 
2176 2186
 						prescribingNumber, _ := strconv.ParseInt(floatPrescrip, 10, 64)
@@ -2205,6 +2215,7 @@ func (c *HisApiController) DeletePrescription() {
2205 2215
 							Dealer:       info.Dealer,
2206 2216
 							Manufacturer: info.Manufacturer,
2207 2217
 							Type:         1,
2218
+							StorehouseId: houseConfig.DrugStorehouseOut,
2208 2219
 						}
2209 2220
 						service.AddSigleDrugCancelStock(&cancelStock)
2210 2221
 
@@ -2234,6 +2245,7 @@ func (c *HisApiController) DeletePrescription() {
2234 2245
 							ProductDate:      info.ProductDate,
2235 2246
 							ExpiryDate:       info.ExpiryDate,
2236 2247
 							BatchNumberId:    info.WarehouseInfoId,
2248
+							StorehouseId:     houseConfig.DrugStorehouseOut,
2237 2249
 						}
2238 2250
 
2239 2251
 						flow := models.DrugFlow{
@@ -2270,6 +2282,7 @@ func (c *HisApiController) DeletePrescription() {
2270 2282
 							MaxUnit:                 info.CountUnit,
2271 2283
 							MinUnit:                 "",
2272 2284
 							AdviceId:                info.AdviceId,
2285
+							StorehouseId:            houseConfig.DrugStorehouseOut,
2273 2286
 						}
2274 2287
 						service.CreatedCancelStock(cancelStockInfo)
2275 2288
 						service.CreateDrugFlowOne(flow)
@@ -2350,7 +2363,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
2350 2363
 						total, _ := service.FindAllDrugCancelStockTotal(adminUserInfo.CurrentOrgId)
2351 2364
 						total = total + 1
2352 2365
 						orderNumber := "CKTKD" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
2353
-
2366
+						houseConfig, _ := service.GetAllStoreHouseConfig(adminUserInfo.CurrentOrgId)
2354 2367
 						cancelStock := models.DrugCancelStock{
2355 2368
 							OrderNumber:  orderNumber,
2356 2369
 							OperaTime:    operation_time,
@@ -2362,6 +2375,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
2362 2375
 							Dealer:       info.Dealer,
2363 2376
 							Manufacturer: info.Manufacturer,
2364 2377
 							Type:         1,
2378
+							StorehouseId: houseConfig.DrugStorehouseOut,
2365 2379
 						}
2366 2380
 						service.AddSigleDrugCancelStock(&cancelStock)
2367 2381
 
@@ -2390,6 +2404,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
2390 2404
 							ProductDate:      info.ProductDate,
2391 2405
 							ExpiryDate:       info.ExpiryDate,
2392 2406
 							BatchNumberId:    info.WarehouseInfoId,
2407
+							StorehouseId:     houseConfig.DrugStorehouseOut,
2393 2408
 						}
2394 2409
 
2395 2410
 						flow := models.DrugFlow{
@@ -2425,6 +2440,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
2425 2440
 							MaxUnit:                 info.CountUnit,
2426 2441
 							MinUnit:                 "",
2427 2442
 							AdviceId:                info.AdviceId,
2443
+							StorehouseId:            houseConfig.DrugStorehouseOut,
2428 2444
 						}
2429 2445
 						service.CreatedCancelStock(cancelStockInfo)
2430 2446
 						service.CreateDrugFlowOne(flow)
@@ -2434,7 +2450,8 @@ func (c *HisApiController) DeleteDoctorAdvice() {
2434 2450
 						//删除流水
2435 2451
 						service.UpdateDrugFlowTens(info.PatientId, info.WarehouseOutOrderNumber, info.DrugId, advice.ID)
2436 2452
 					} else {
2437
-
2453
+						adminUserInfo := c.GetAdminUserInfo()
2454
+						houseConfig, _ := service.GetAllStoreHouseConfig(adminUserInfo.CurrentOrgId)
2438 2455
 						floatPrescrip := strconv.FormatFloat(advice.PrescribingNumber, 'f', -1, 32)
2439 2456
 
2440 2457
 						prescribingNumber, _ := strconv.ParseInt(floatPrescrip, 10, 64)
@@ -2447,7 +2464,6 @@ func (c *HisApiController) DeleteDoctorAdvice() {
2447 2464
 
2448 2465
 						}
2449 2466
 
2450
-						adminUserInfo := c.GetAdminUserInfo()
2451 2467
 						operation_time := time.Now().Unix()
2452 2468
 						creater := adminUserInfo.AdminUser.Id
2453 2469
 
@@ -2469,6 +2485,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
2469 2485
 							Dealer:       info.Dealer,
2470 2486
 							Manufacturer: info.Manufacturer,
2471 2487
 							Type:         1,
2488
+							StorehouseId: houseConfig.DrugStorehouseOut,
2472 2489
 						}
2473 2490
 						service.AddSigleDrugCancelStock(&cancelStock)
2474 2491
 
@@ -2497,6 +2514,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
2497 2514
 							ProductDate:      info.ProductDate,
2498 2515
 							ExpiryDate:       info.ExpiryDate,
2499 2516
 							BatchNumberId:    info.WarehouseInfoId,
2517
+							StorehouseId:     houseConfig.DrugStorehouseOut,
2500 2518
 						}
2501 2519
 
2502 2520
 						flow := models.DrugFlow{
@@ -2532,6 +2550,7 @@ func (c *HisApiController) DeleteDoctorAdvice() {
2532 2550
 							MaxUnit:                 info.CountUnit,
2533 2551
 							MinUnit:                 "",
2534 2552
 							AdviceId:                info.AdviceId,
2553
+							StorehouseId:            houseConfig.DrugStorehouseOut,
2535 2554
 						}
2536 2555
 						service.CreatedCancelStock(cancelStockInfo)
2537 2556
 						service.CreateDrugFlowOne(flow)
@@ -2574,6 +2593,7 @@ func (c *HisApiController) DeleteProject() {
2574 2593
 			fmt.Println(err)
2575 2594
 		}
2576 2595
 		if project.Type == 3 {
2596
+			houseConfig, _ := service.GetAllStoreHouseConfig(c.GetAdminUserInfo().CurrentOrgId)
2577 2597
 			good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
2578 2598
 			f_count, _ := strconv.ParseFloat(project.Count, 64)
2579 2599
 			good.Total = good.Total + f_count
@@ -2589,14 +2609,15 @@ func (c *HisApiController) DeleteProject() {
2589 2609
 			orderNumber := "CKTKD" + strconv.FormatInt(adminInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000" + strconv.FormatInt(total, 10)
2590 2610
 
2591 2611
 			cancelStock := models.CancelStock{
2592
-				OrderNumber: orderNumber,
2593
-				OperaTime:   operation_time,
2594
-				OrgId:       adminInfo.CurrentOrgId,
2595
-				Creater:     creater,
2596
-				Ctime:       time.Now().Unix(),
2597
-				Status:      1,
2598
-				ReturnTime:  project.RecordDate,
2599
-				Type:        1,
2612
+				OrderNumber:  orderNumber,
2613
+				OperaTime:    operation_time,
2614
+				OrgId:        adminInfo.CurrentOrgId,
2615
+				Creater:      creater,
2616
+				Ctime:        time.Now().Unix(),
2617
+				Status:       1,
2618
+				ReturnTime:   project.RecordDate,
2619
+				Type:         1,
2620
+				StorehouseId: houseConfig.StorehouseOutInfo,
2600 2621
 			}
2601 2622
 			_, msgerrkonde := service.GetCancelStockDetailByOrderNumberOne(project.RecordDate, adminInfo.CurrentOrgId)
2602 2623
 			if msgerrkonde == gorm.ErrRecordNotFound {
@@ -2633,6 +2654,7 @@ func (c *HisApiController) DeleteProject() {
2633 2654
 					WarehouseInfoId: info.WarehouseInfotId,
2634 2655
 					PatientId:       info.PatientId,
2635 2656
 					RecordDate:      info.SysRecordTime,
2657
+					StorehouseId:    houseConfig.StorehouseOutInfo,
2636 2658
 				}
2637 2659
 
2638 2660
 				service.CreateCancelStockInfoOne(&cancelStockInfo)
@@ -2669,6 +2691,7 @@ func (c *HisApiController) DeleteProject() {
2669 2691
 					CancelOutDetailId:       cancelInfo.ID,
2670 2692
 					ProductDate:             info.ProductDate,
2671 2693
 					ExpireDate:              info.ExpiryDate,
2694
+					StorehouseId:            houseConfig.StorehouseOutInfo,
2672 2695
 				}
2673 2696
 				service.CreateStockFlowOne(flow)
2674 2697
 
@@ -2721,6 +2744,7 @@ func (c *HisApiController) DeleteProject() {
2721 2744
 							Manufacturer:            0,
2722 2745
 							Type:                    1,
2723 2746
 							IsSys:                   1,
2747
+							StorehouseId:            houseConfig.StorehouseOutInfo,
2724 2748
 						}
2725 2749
 						err := service.AddSigleWarehouseOut(&warehouseOut)
2726 2750
 						if err != nil {
@@ -2728,23 +2752,25 @@ func (c *HisApiController) DeleteProject() {
2728 2752
 							return
2729 2753
 						}
2730 2754
 						prepare := &models.DialysisBeforePrepare{
2731
-							UserOrgId:  adminInfo.CurrentOrgId,
2732
-							PatientId:  info.PatientId,
2733
-							RecordDate: info.SysRecordTime,
2734
-							GoodId:     project.ProjectId,
2735
-							GoodTypeId: info.GoodTypeId,
2736
-							Count:      cha_count,
2755
+							UserOrgId:    adminInfo.CurrentOrgId,
2756
+							PatientId:    info.PatientId,
2757
+							RecordDate:   info.SysRecordTime,
2758
+							GoodId:       project.ProjectId,
2759
+							GoodTypeId:   info.GoodTypeId,
2760
+							Count:        cha_count,
2761
+							StorehouseId: houseConfig.StorehouseOutInfo,
2737 2762
 						}
2738 2763
 						//出库
2739 2764
 						service.ConsumablesDelivery(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, prepare, &warehouseOut, cha_count)
2740 2765
 					} else if err == nil {
2741 2766
 						prepare := &models.DialysisBeforePrepare{
2742
-							UserOrgId:  adminInfo.CurrentOrgId,
2743
-							PatientId:  info.PatientId,
2744
-							RecordDate: info.SysRecordTime,
2745
-							GoodId:     project.ProjectId,
2746
-							GoodTypeId: info.GoodTypeId,
2747
-							Count:      cha_count,
2767
+							UserOrgId:    adminInfo.CurrentOrgId,
2768
+							PatientId:    info.PatientId,
2769
+							RecordDate:   info.SysRecordTime,
2770
+							GoodId:       project.ProjectId,
2771
+							GoodTypeId:   info.GoodTypeId,
2772
+							Count:        cha_count,
2773
+							StorehouseId: houseConfig.StorehouseOutInfo,
2748 2774
 						}
2749 2775
 						//出库
2750 2776
 						service.ConsumablesDelivery(adminInfo.CurrentOrgId, info.PatientId, info.SysRecordTime, prepare, &out, cha_count)

+ 4 - 0
controllers/his_project_api_controller.go Vedi File

@@ -1117,6 +1117,9 @@ func (this *HisProjectApiController) GetPatientcaseHistory() {
1117 1117
 	history, _ := service.GetPatientCaseHistory(patient_id)
1118 1118
 	hispatient, _ := service.GetHisPatientById(patient_id)
1119 1119
 
1120
+	//获取患者最后一次的血管通路
1121
+	accessList, _ := service.GetPatientVascularAccess(patient_id)
1122
+
1120 1123
 	if err != nil {
1121 1124
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
1122 1125
 		return
@@ -1125,6 +1128,7 @@ func (this *HisProjectApiController) GetPatientcaseHistory() {
1125 1128
 		"patient":    patient,
1126 1129
 		"history":    history,
1127 1130
 		"hispatient": hispatient,
1131
+		"accessList": accessList,
1128 1132
 	})
1129 1133
 }
1130 1134
 

+ 7 - 29
controllers/mobile_api_controllers/dialysis_api_controller.go Vedi File

@@ -197,20 +197,6 @@ func (this *DialysisAPIController) Scheduals() {
197 197
 				project, _ = service.GetAllHisProjectPrescription(orgID, date.Unix())
198 198
 			}
199 199
 
200
-			//获取今日透析准备的数据
201
-			//goodList, err := service.MobileGetDialysisGoodsSeven(orgID, date.Unix())
202
-
203
-			//list, err := service.MobileGetDialysisGoodsSix(orgID, date.Unix())
204
-
205
-			//autoList, _ := service.GetMobileAutoReduce(orgID, date.Unix())
206
-			//for _, item := range goodList {
207
-			//	for _, it := range list {
208
-			//		if item.RecordDate == it.RecordDate && item.PatientId == it.PatientId {
209
-			//			item.Children = append(item.Children, it)
210
-			//		}
211
-			//	}
212
-			//}
213
-			//fmt.Println("goodlist888888888888888888888", goodList, err)
214 200
 			this.ServeSuccessJSON(map[string]interface{}{
215 201
 				"scheduals": scheduals,
216 202
 				"project":   project,
@@ -580,19 +566,10 @@ func (this *DialysisAPIController) DialysisRecord() {
580 566
 		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
581 567
 	}
582 568
 
583
-	//获取今日透析准备的数据
584
-	//goodList, _ := service.MobileGetDialysisGoodsSeven(adminInfo.Org.Id, date.Unix())
585
-	//list, _ := service.MobileGetDialysisGoodsSix(adminInfo.Org.Id, date.Unix())
586
-	//
587
-	//autoList, _ := service.GetMobileAutoReduce(adminInfo.Org.Id, date.Unix())
588
-	//for _, item := range goodList {
589
-	//	for _, it := range list {
590
-	//		if item.RecordDate == it.RecordDate && item.PatientId == it.PatientId {
591
-	//			item.Children = append(item.Children, it)
592
-	//		}
593
-	//	}
594
-	//}
595
-
569
+	is_advice_open, _ := service.FindAdviceSettingById(adminInfo.Org.Id)
570
+	if is_advice_open.IsAdviceOpen == 1 {
571
+		his_advices, _ = service.GetAllHisDoctorAdvice(adminInfo.Org.Id, patientID, date.Unix())
572
+	}
596 573
 	returnData := map[string]interface{}{
597 574
 		"patient":                        patient,
598 575
 		"schedual":                       schedual,
@@ -623,8 +600,7 @@ func (this *DialysisAPIController) DialysisRecord() {
623 600
 		"is_project_open_config":         is_project_open_config,
624 601
 		"project":                        projects,
625 602
 		"team_projects":                  team_projects,
626
-		//"goodList":                       goodList,
627
-		//"autoList":                       autoList,
603
+		"is_advice_open":                 is_advice_open,
628 604
 	}
629 605
 	this.ServeSuccessJSON(returnData)
630 606
 }
@@ -3277,6 +3253,7 @@ func (c *DialysisAPIController) GetLongAdvice() {
3277 3253
 	adminUserInfo := c.GetMobileAdminUserInfo()
3278 3254
 	_, config := service.FindDoctorAdviceRecordByOrgId(adminUserInfo.Org.Id)
3279 3255
 	_, hisConfig := service.FindXTHisRecordByOrgId(adminUserInfo.Org.Id)
3256
+	is_advice_open, _ := service.FindAdviceSettingById(adminUserInfo.Org.Id)
3280 3257
 	//patient, _ := service.FindPatientIsOpenRemindById(patient_id, adminUserInfo.Org.Id)
3281 3258
 	if config.IsOpenRemind == 0 { //针对老用户,即没开启推送功能,也没有	不开启推送功能,不做任何处理
3282 3259
 		c.ServeSuccessJSON(map[string]interface{}{
@@ -3358,6 +3335,7 @@ func (c *DialysisAPIController) GetLongAdvice() {
3358 3335
 				"advices_two":     RemoveRepeatedElement(advice_three),
3359 3336
 				"is_open_remind":  config.IsOpenRemind,
3360 3337
 				"his_config_open": hisConfig.IsOpen,
3338
+				"is_advice_open":  is_advice_open.IsAdviceOpen,
3361 3339
 			})
3362 3340
 		}
3363 3341
 	}

+ 2 - 2
controllers/mobile_api_controllers/mobile_api_base_controller.go Vedi File

@@ -53,8 +53,7 @@ type MobileBaseAPIAuthController struct {
53 53
 func (this *MobileBaseAPIAuthController) Prepare() {
54 54
 	token := this.Ctx.GetCookie("token_cookie")
55 55
 	logout_cookie := this.Ctx.GetCookie("logout_cookie")
56
-	fmt.Println("token232232232323232332232332323322332232323", token)
57
-	fmt.Println("login232232232323232332232332323322332232323", logout_cookie)
56
+
58 57
 	//if len(token) == 0{
59 58
 	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
60 59
 	//	this.StopRun()
@@ -70,6 +69,7 @@ func (this *MobileBaseAPIAuthController) Prepare() {
70 69
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLogOut)
71 70
 			this.StopRun()
72 71
 		} else {
72
+
73 73
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLoginTimeout)
74 74
 			this.StopRun()
75 75
 		}

+ 2 - 0
controllers/mobile_api_controllers/patient_api_controller.go Vedi File

@@ -628,6 +628,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
628 628
 			//清空key 值
629 629
 			redis.Set(key, "", time.Second)
630 630
 			keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":advice_list_all"
631
+
631 632
 			redis.Set(keyTwo, "", time.Second)
632 633
 			keyThree := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":his_doctor_advice"
633 634
 			redis.Set(keyThree, "", time.Second)
@@ -648,6 +649,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
648 649
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
649 650
 			redis := service.RedisClient()
650 651
 			keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":advice_list_all"
652
+
651 653
 			redis.Set(keyTwo, "", time.Second)
652 654
 			keyThree := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":his_doctor_advice"
653 655
 			redis.Set(keyThree, "", time.Second)

+ 1 - 0
controllers/new_mobile_api_controllers/new_login_api_controller.go Vedi File

@@ -23,6 +23,7 @@ type NewLoginApiController struct {
23 23
 
24 24
 func (this *NewLoginApiController) GetLogin() {
25 25
 	token_cookie := this.Ctx.GetCookie("token_cookie")
26
+
26 27
 	if len(token_cookie) == 0 {
27 28
 		this.ServeSuccessJSON(map[string]interface{}{
28 29
 			"isLogin": false,

+ 5 - 1
controllers/patient_api_controller.go Vedi File

@@ -735,7 +735,11 @@ func (c *PatientApiController) EditLapseto() {
735 735
 	err = service.EditPatientLapseto(&patient, &lapseto)
736 736
 
737 737
 	if lapseto.LapsetoType == 3 || lapseto.LapsetoType == 2 {
738
-		service.UpdateScheduleByDeathTime(id, lapsetoTimeUnix.Unix())
738
+		timeStr := time.Now().Format("2006-01-02")
739
+		timeLayout := "2006-01-02 15:04:05"
740
+		timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
741
+		timenow := timeStringToTime.Unix()
742
+		service.UpdateScheduleByDeathTime(id, timenow)
739 743
 		service.UpdateScheduleItemByPatientId(id)
740 744
 	}
741 745
 

+ 20 - 1
controllers/schedule_api_controller.go Vedi File

@@ -1894,7 +1894,16 @@ func (this *ScheduleApiController) ExportScheduleTemplate() {
1894 1894
 				for _, item := range schedules {
1895 1895
 					service.CreateScheduleTemplate(item)
1896 1896
 				}
1897
-
1897
+				//查询已经转出或者死亡的患者
1898
+				patientList, _ := service.GetDeathPatient(this.GetAdminUserInfo().CurrentOrgId)
1899
+				for _, it := range patientList {
1900
+					timeStr := time.Now().Format("2006-01-02")
1901
+					timeLayout := "2006-01-02 15:04:05"
1902
+					timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
1903
+					timenow := timeStringToTime.Unix()
1904
+					service.UpdateScheduleByDeathTime(it.ID, timenow)
1905
+					service.UpdateScheduleItemByPatientId(it.ID)
1906
+				}
1898 1907
 				log := models.ExportLog{
1899 1908
 					LogType:    3,
1900 1909
 					UserOrgId:  this.GetAdminUserInfo().CurrentOrgId,
@@ -2217,6 +2226,16 @@ func (this *ScheduleApiController) GetCopyPatientSchedules() {
2217 2226
 		}
2218 2227
 
2219 2228
 		err := service.AddPatientSchedule(&schedule)
2229
+		patientList, _ := service.GetDeathPatient(this.GetAdminUserInfo().CurrentOrgId)
2230
+		for _, it := range patientList {
2231
+			timeStr := time.Now().Format("2006-01-02")
2232
+			timeLayout := "2006-01-02 15:04:05"
2233
+			timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
2234
+			timenow := timeStringToTime.Unix()
2235
+			service.UpdateScheduleByDeathTime(it.ID, timenow)
2236
+			service.UpdateScheduleItemByPatientId(it.ID)
2237
+		}
2238
+
2220 2239
 		if err != nil {
2221 2240
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2222 2241
 			return

+ 7 - 0
service/dialysis_service.go Vedi File

@@ -1433,6 +1433,13 @@ func GetAllPcPatientListByListSeven(orgID int64) (patients []*MSchedualPatientVM
1433 1433
 	return patients, err
1434 1434
 }
1435 1435
 
1436
+func GetAllPcPatientListByListEight(orgID int64) (patients []*MSchedualPatientVMList, err error) {
1437
+
1438
+	err = readDb.Where("user_org_id=? and status=1", orgID).Find(&patients).Error
1439
+
1440
+	return patients, err
1441
+}
1442
+
1436 1443
 func GetAllPcPatientListByList(orgID int64) (patients []*MSchedualPatientVMList, err error) {
1437 1444
 	redis := RedisClient()
1438 1445
 	defer redis.Close()

+ 6 - 0
service/his_project_service.go Vedi File

@@ -758,3 +758,9 @@ func GetNewAdminUserES(orgID int64) (es []*models.AdminUserElectronicSignature,
758 758
 	err = readUserDb.Model(&models.AdminUserElectronicSignature{}).Where("org_id=?  and status=1", orgID).Find(&es).Error
759 759
 	return
760 760
 }
761
+
762
+func GetPatientVascularAccess(patient_id int64) (models.XtPatientVascularAccess, error) {
763
+	access := models.XtPatientVascularAccess{}
764
+	err = XTReadDB().Where("patient_id = ? and status = 1", patient_id).Last(&access).Error
765
+	return access, err
766
+}

+ 6 - 0
service/schedule_service.go Vedi File

@@ -1154,3 +1154,9 @@ func GetSolutionScheduleBySchedule(orgid int64, zonid int64, classtype int64, sc
1154 1154
 	}).Find(&schedule).Error
1155 1155
 	return schedule, err
1156 1156
 }
1157
+
1158
+func GetDeathPatient(orgid int64) (patient []*models.XtPatients, err error) {
1159
+
1160
+	err = XTReadDB().Where("user_org_id = ? and (lapseto = 2 || lapseto = 3) and status = 1", orgid).Find(&patient).Error
1161
+	return patient, err
1162
+}

+ 4 - 0
service/self_drug_service.go Vedi File

@@ -547,6 +547,10 @@ type Drugs struct {
547 547
 	HospApprFlag          int64    `gorm:"column:hosp_appr_flag" json:"hosp_appr_flag" form:"hosp_appr_flag"`
548 548
 	LmtUsedFlag           int64    `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
549 549
 	PrescribingNumberUnit string   `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
550
+	MinNumber             int64    `gorm:"column:min_number" json:"min_number" form:"min_number"`
551
+	Dose                  float64  `gorm:"column:dose" json:"dose" form:"dose"`
552
+	DoseUnit              string   `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
553
+	MaxUnit               string   `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
550 554
 }
551 555
 
552 556
 func (Drugs) TableName() string {