28169 2 weeks ago
parent
commit
b322f389c0

BIN
XT_New.exe View File


+ 12 - 7
controllers/patient_api_controller.go View File

330
 	patientSoureType, _ := c.GetInt64("patientSoureType")
330
 	patientSoureType, _ := c.GetInt64("patientSoureType")
331
 	patient_type, _ := c.GetInt64("patient_type")
331
 	patient_type, _ := c.GetInt64("patient_type")
332
 	nurse, _ := c.GetInt64("nurse")
332
 	nurse, _ := c.GetInt64("nurse")
333
+	insuplc_admdvs_name := c.GetString("insuplc_admdvs_name")
333
 	if page <= 0 {
334
 	if page <= 0 {
334
 		page = 1
335
 		page = 1
335
 	}
336
 	}
368
 
369
 
369
 	var patients []*models.Patients
370
 	var patients []*models.Patients
370
 	var total int64
371
 	var total int64
371
-	patients, total, err = service.GetPatientList(adminUserInfo.CurrentOrgId, keywords, page, limit, schedulType, bindingState, lapseto, source, theStartTIme, theEndtTIme, contagion, reimbursement_way, isscheduling, isprescription, isStartTime, isEndTime, patientSoureType, nurse, patient_type)
372
+	patients, total, err = service.GetPatientList(adminUserInfo.CurrentOrgId, keywords, page, limit, schedulType, bindingState, lapseto, source, theStartTIme, theEndtTIme, contagion, reimbursement_way, isscheduling, isprescription, isStartTime, isEndTime, patientSoureType, nurse, patient_type, insuplc_admdvs_name)
372
 
373
 
373
 	c.ServeSuccessJSON(map[string]interface{}{
374
 	c.ServeSuccessJSON(map[string]interface{}{
374
 		"patients": patients,
375
 		"patients": patients,
6304
 	limit, _ := c.GetInt64("limit", 10)
6305
 	limit, _ := c.GetInt64("limit", 10)
6305
 	adminUserInfo := c.GetAdminUserInfo()
6306
 	adminUserInfo := c.GetAdminUserInfo()
6306
 	total, patients, _ := service.GetAllWaitRemindPatient(adminUserInfo.CurrentOrgId, page, limit)
6307
 	total, patients, _ := service.GetAllWaitRemindPatient(adminUserInfo.CurrentOrgId, page, limit)
6308
+
6309
+	patientZoneList, _ := service.GetPatientZoneList(adminUserInfo.CurrentOrgId)
6307
 	_, errcode := service.GetOrgFollowIsExist(c.GetAdminUserInfo().CurrentOrgId)
6310
 	_, errcode := service.GetOrgFollowIsExist(c.GetAdminUserInfo().CurrentOrgId)
6308
 	if errcode == gorm.ErrRecordNotFound {
6311
 	if errcode == gorm.ErrRecordNotFound {
6309
 		information, err := service.GetAdminUserRoleInformation(0)
6312
 		information, err := service.GetAdminUserRoleInformation(0)
6313
 			return
6316
 			return
6314
 		}
6317
 		}
6315
 		c.ServeSuccessJSON(map[string]interface{}{
6318
 		c.ServeSuccessJSON(map[string]interface{}{
6316
-			"total":       total,
6317
-			"patients":    patients,
6318
-			"information": information,
6319
+			"total":           total,
6320
+			"patients":        patients,
6321
+			"information":     information,
6322
+			"patientZoneList": patientZoneList,
6319
 		})
6323
 		})
6320
 	} else if errcode == nil {
6324
 	} else if errcode == nil {
6321
 		information, err := service.GetAdminUserRoleInformation(c.GetAdminUserInfo().CurrentOrgId)
6325
 		information, err := service.GetAdminUserRoleInformation(c.GetAdminUserInfo().CurrentOrgId)
6325
 			return
6329
 			return
6326
 		}
6330
 		}
6327
 		c.ServeSuccessJSON(map[string]interface{}{
6331
 		c.ServeSuccessJSON(map[string]interface{}{
6328
-			"total":       total,
6329
-			"patients":    patients,
6330
-			"information": information,
6332
+			"total":           total,
6333
+			"patients":        patients,
6334
+			"information":     information,
6335
+			"patientZoneList": patientZoneList,
6331
 		})
6336
 		})
6332
 	}
6337
 	}
6333
 }
6338
 }

+ 2 - 1
controllers/pharmacy_controller.go View File

315
 	list, err = service.GetPatientMedication(orgid, patient_id, stime, etime, is_medicine)
315
 	list, err = service.GetPatientMedication(orgid, patient_id, stime, etime, is_medicine)
316
 	list_p, err := service.GetPatientProject(orgid, patient_id, stime, etime, is_medicine)
316
 	list_p, err := service.GetPatientProject(orgid, patient_id, stime, etime, is_medicine)
317
 	list = append(list, list_p...)
317
 	list = append(list, list_p...)
318
-	//baseList, _ := service.GetAllBaseDrugListTwo(orgid)
318
+	baseList, _ := service.GetAllBaseDrugListTwo(orgid)
319
 	patients, _ := service.GetPatientByIDOne(orgid, patient_id)
319
 	patients, _ := service.GetPatientByIDOne(orgid, patient_id)
320
 	//zoneList, _ := service.GetAllZoneByList(orgid)
320
 	//zoneList, _ := service.GetAllZoneByList(orgid)
321
 	appId := this.GetAdminUserInfo().CurrentAppId
321
 	appId := this.GetAdminUserInfo().CurrentAppId
337
 	return_value["prescription"] = prescriptionListByToDay
337
 	return_value["prescription"] = prescriptionListByToDay
338
 	return_value["diagnose"] = diagnose
338
 	return_value["diagnose"] = diagnose
339
 	return_value["config"] = config
339
 	return_value["config"] = config
340
+	return_value["baseList"] = baseList
340
 
341
 
341
 	this.ServeSuccessJSON(return_value)
342
 	this.ServeSuccessJSON(return_value)
342
 	return
343
 	return

+ 0 - 1
controllers/statistics_api_controller.go View File

1396
 	var startTime int64
1396
 	var startTime int64
1397
 	if len(start_date) > 0 {
1397
 	if len(start_date) > 0 {
1398
 		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_date+" 00:00:00", loc)
1398
 		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_date+" 00:00:00", loc)
1399
-		fmt.Println("err-----------", err)
1400
 		if err != nil {
1399
 		if err != nil {
1401
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1400
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1402
 			return
1401
 			return

+ 2 - 0
models/patient_models.go View File

105
 	CheckTime      int64 `gorm:"column:check_time" json:"check_time" form:"check_time"`
105
 	CheckTime      int64 `gorm:"column:check_time" json:"check_time" form:"check_time"`
106
 	CheckState     int64 `gorm:"column:check_state" json:"check_state" form:"check_state"`
106
 	CheckState     int64 `gorm:"column:check_state" json:"check_state" form:"check_state"`
107
 	ParentId       int64 `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
107
 	ParentId       int64 `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
108
+	AdviceType     int64 `gorm:"column:advice_type" json:"advice_type" form:"advice_type"`
108
 }
109
 }
109
 
110
 
110
 func (VMDoctorAdviceForList) TableName() string {
111
 func (VMDoctorAdviceForList) TableName() string {
1268
 	TreatmentPlan                string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
1269
 	TreatmentPlan                string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
1269
 	Url                          string  `gorm:"column:url" json:"url" form:"url"`
1270
 	Url                          string  `gorm:"column:url" json:"url" form:"url"`
1270
 	FirstLetter                  string  `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
1271
 	FirstLetter                  string  `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
1272
+	InsuplcAdmdvsName            string  `gorm:"column:insuplc_admdvs_name" json:"insuplc_admdvs_name" form:"insuplc_admdvs_name"`
1271
 }
1273
 }
1272
 
1274
 
1273
 func (XtPatients) TableName() string {
1275
 func (XtPatients) TableName() string {

+ 16 - 4
service/patient_service.go View File

14
 )
14
 )
15
 
15
 
16
 // GetPatientList 返回患者的列表
16
 // GetPatientList 返回患者的列表
17
-func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool, patientSoureType int64, nurse int64, patient_type int64) (patients []*models.Patients, total int64, err error) {
17
+func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bindingState, lapseto, source, startTime, endTime, contagion, reimbursementWay, isscheduling, isprescription int64, isStartTime, isEndTime bool, patientSoureType int64, nurse int64, patient_type int64, insuplc_admdvs_name string) (patients []*models.Patients, total int64, err error) {
18
 
18
 
19
 	db := readDb.Table("xt_patients as p").Where("p.status=1")
19
 	db := readDb.Table("xt_patients as p").Where("p.status=1")
20
 	if orgID > 0 {
20
 	if orgID > 0 {
26
 		db = db.Where("p.name LIKE ? OR p.dialysis_no LIKE ? OR p.first_letter LIKE ?", likeKey, likeKey, likeKey)
26
 		db = db.Where("p.name LIKE ? OR p.dialysis_no LIKE ? OR p.first_letter LIKE ?", likeKey, likeKey, likeKey)
27
 	}
27
 	}
28
 
28
 
29
+	if insuplc_admdvs_name != "全部" {
30
+
31
+		db = db.Where("p.insuplc_admdvs_name = ?", insuplc_admdvs_name)
32
+	}
33
+
29
 	if schedulType > 0 {
34
 	if schedulType > 0 {
30
 		db = db.Joins("JOIN xt_schedule as s ON s.patient_id=p.id")
35
 		db = db.Joins("JOIN xt_schedule as s ON s.patient_id=p.id")
31
 		db = db.Where("s.status=1 and s.schedule_type=?", schedulType)
36
 		db = db.Where("s.status=1 and s.schedule_type=?", schedulType)
1900
 	return totals.Count, patient, err
1905
 	return totals.Count, patient, err
1901
 }
1906
 }
1902
 
1907
 
1908
+func GetPatientZoneList(org_id int64) (patients []*models.XtPatients, err error) {
1909
+
1910
+	err = XTReadDB().Where("user_org_id = ? and status =1 and patient_type =1 and insuplc_admdvs_name!=''", org_id).Group("insuplc_admdvs_name").Find(&patients).Error
1911
+
1912
+	return patients, err
1913
+}
1914
+
1903
 func UpdatePatientRemindStatus(patient_id int64, remind int64, org_id int64) (err error) {
1915
 func UpdatePatientRemindStatus(patient_id int64, remind int64, org_id int64) (err error) {
1904
 	err = writeDb.Model(&models.Patients{}).Where("status = 1  AND id = ? AND user_org_id = ?", patient_id, org_id).Updates(map[string]interface{}{"is_open_remind": remind}).Error
1916
 	err = writeDb.Model(&models.Patients{}).Where("status = 1  AND id = ? AND user_org_id = ?", patient_id, org_id).Updates(map[string]interface{}{"is_open_remind": remind}).Error
1905
 	return
1917
 	return
3317
 func GetAdviceList(user_org_id int64, advice_date int64, pat_type int64) (advice []*models.VMDoctorAdviceForList, err error) {
3329
 func GetAdviceList(user_org_id int64, advice_date int64, pat_type int64) (advice []*models.VMDoctorAdviceForList, err error) {
3318
 
3330
 
3319
 	if pat_type == 0 {
3331
 	if pat_type == 0 {
3320
-		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =7 and check_time = 0", user_org_id, advice_date).Find(&advice).Error
3332
+		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =7 and check_time = 0 and (advice_type=2 or advice_type =3)", user_org_id, advice_date).Find(&advice).Error
3321
 	}
3333
 	}
3322
 	//待医嘱核对
3334
 	//待医嘱核对
3323
 	if pat_type == 1 {
3335
 	if pat_type == 1 {
3324
-		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =1 and check_time = 0", user_org_id, advice_date).Find(&advice).Error
3336
+		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =1 and check_time = 0 and (advice_type=2 or advice_type =3)", user_org_id, advice_date).Find(&advice).Error
3325
 	}
3337
 	}
3326
 	//待医嘱执行
3338
 	//待医嘱执行
3327
 	if pat_type == 6 {
3339
 	if pat_type == 6 {
3328
-		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =1 and execution_state = 2", user_org_id, advice_date).Find(&advice).Error
3340
+		err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status =1 and execution_state = 2 and (advice_type=2 or advice_type =3)", user_org_id, advice_date).Find(&advice).Error
3329
 
3341
 
3330
 	}
3342
 	}
3331
 	return advice, err
3343
 	return advice, err

+ 11 - 11
service/warhouse_service.go View File

6112
 	return err
6112
 	return err
6113
 }
6113
 }
6114
 
6114
 
6115
-func UpdateNewDrugWarehouseOutInfo(id int64, warehouse_info_id int64, org_id int64, over_count int64, drug_price float64, tx *gorm.DB) error {
6115
+func UpdateNewDrugWarehouseOutInfo(id int64, warehouse_info_id int64, org_id int64, over_count int64, drug_price float64, batch_number string, tx *gorm.DB) error {
6116
 
6116
 
6117
-	err = tx.Model(&models.DrugWarehouseOutInfo{}).Where("id = ? and org_id = ? and status = 1", id, org_id).Update(map[string]interface{}{"warehouse_info_id": warehouse_info_id, "over_count": over_count, "price": drug_price, "retail_price": drug_price}).Error
6117
+	err = tx.Model(&models.DrugWarehouseOutInfo{}).Where("id = ? and org_id = ? and status = 1", id, org_id).Update(map[string]interface{}{"warehouse_info_id": warehouse_info_id, "over_count": over_count, "price": drug_price, "retail_price": drug_price, "batch_number": batch_number}).Error
6118
 	if err != nil {
6118
 	if err != nil {
6119
 		tx.Rollback()
6119
 		tx.Rollback()
6120
 		return err
6120
 		return err
6145
 	return flow, err
6145
 	return flow, err
6146
 }
6146
 }
6147
 
6147
 
6148
-func UpdateNewGoodWarehouseOutById(id int64, warehouse_info_id int64, org_id int64, over_count int64, tx *gorm.DB) error {
6148
+func UpdateNewGoodWarehouseOutById(id int64, warehouse_info_id int64, org_id int64, over_count int64, number string, tx *gorm.DB) error {
6149
 
6149
 
6150
-	err := tx.Model(models.WarehouseOutInfo{}).Where("id = ?  and org_id = ? and status = 1", id, org_id).Update(map[string]interface{}{"warehouse_info_id": warehouse_info_id, "over_count": over_count}).Error
6150
+	err := tx.Model(models.WarehouseOutInfo{}).Where("id = ?  and org_id = ? and status = 1", id, org_id).Update(map[string]interface{}{"warehouse_info_id": warehouse_info_id, "over_count": over_count, "number": number}).Error
6151
 	if err != nil {
6151
 	if err != nil {
6152
 		tx.Rollback()
6152
 		tx.Rollback()
6153
 		return err
6153
 		return err
8340
 		}
8340
 		}
8341
 
8341
 
8342
 		//添加入库ID
8342
 		//添加入库ID
8343
-		errWarehouse := UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, orgID, sum_count, tx)
8343
+		errWarehouse := UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, orgID, sum_count, warehouse.Number, tx)
8344
 		if errWarehouse != nil {
8344
 		if errWarehouse != nil {
8345
 			goodErrcode := models.XtGoodErrcode{
8345
 			goodErrcode := models.XtGoodErrcode{
8346
 				UserOrgId:      orgID,
8346
 				UserOrgId:      orgID,
8668
 			ModifyNewAddGoodSumCount(goods.StorehouseId, flow.Count, orgID, goods.GoodId, tx)
8668
 			ModifyNewAddGoodSumCount(goods.StorehouseId, flow.Count, orgID, goods.GoodId, tx)
8669
 		}
8669
 		}
8670
 
8670
 
8671
-		errWarehouse := UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, orgID, sum_count, tx)
8671
+		errWarehouse := UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, orgID, sum_count, warehouse.Number, tx)
8672
 		if errWarehouse != nil {
8672
 		if errWarehouse != nil {
8673
 			goodErrcode := models.XtGoodErrcode{
8673
 			goodErrcode := models.XtGoodErrcode{
8674
 				UserOrgId:      orgID,
8674
 				UserOrgId:      orgID,
8934
 
8934
 
8935
 		ModifyNewGoodSumCount(goods.StorehouseId, stock_number, orgID, goods.GoodId, tx)
8935
 		ModifyNewGoodSumCount(goods.StorehouseId, stock_number, orgID, goods.GoodId, tx)
8936
 
8936
 
8937
-		UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, orgID, sum_count, tx)
8937
+		UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, orgID, sum_count, warehouse.Number, tx)
8938
 
8938
 
8939
 	}
8939
 	}
8940
 	dialyPrepareOne := &models.DialysisBeforePrepare{
8940
 	dialyPrepareOne := &models.DialysisBeforePrepare{
10925
 		CreateOutInfoLog(outInfoLog, tx)
10925
 		CreateOutInfoLog(outInfoLog, tx)
10926
 
10926
 
10927
 		//添加入库ID
10927
 		//添加入库ID
10928
-		UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, goods.OrgId, sum_count, tx)
10928
+		UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, goods.OrgId, sum_count, warehouse.Number, tx)
10929
 
10929
 
10930
 		//更新出库数量
10930
 		//更新出库数量
10931
 		ModifyNewGoodSumCount(goods.StorehouseId, goods.Count, goods.OrgId, goods.GoodId, tx)
10931
 		ModifyNewGoodSumCount(goods.StorehouseId, goods.Count, goods.OrgId, goods.GoodId, tx)
11002
 
11002
 
11003
 		CreateOutInfoLog(outInfoLog, tx)
11003
 		CreateOutInfoLog(outInfoLog, tx)
11004
 
11004
 
11005
-		UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, goods.OrgId, sum_count, tx)
11005
+		UpdateNewGoodWarehouseOutById(goods.ID, warehouse.ID, goods.OrgId, sum_count, warehouse.Number, tx)
11006
 
11006
 
11007
 		//更新出库数量
11007
 		//更新出库数量
11008
 		ModifyNewGoodSumCount(goods.StorehouseId, stock_number, goods.OrgId, goods.GoodId, tx)
11008
 		ModifyNewGoodSumCount(goods.StorehouseId, stock_number, goods.OrgId, goods.GoodId, tx)
11268
 		CreateDrugOutInfoLog(outInfoLog, tx)
11268
 		CreateDrugOutInfoLog(outInfoLog, tx)
11269
 
11269
 
11270
 		//更新出库id
11270
 		//更新出库id
11271
-		UpdateNewDrugWarehouseOutInfo(advice.ID, warehouse.ID, advice.OrgId, over_count, drug_price, tx)
11271
+		UpdateNewDrugWarehouseOutInfo(advice.ID, warehouse.ID, advice.OrgId, over_count, drug_price, warehouse.BatchNumber, tx)
11272
 
11272
 
11273
 		return nil
11273
 		return nil
11274
 
11274
 
11348
 		}
11348
 		}
11349
 		CreateDrugOutInfoLog(outInfoLog, tx)
11349
 		CreateDrugOutInfoLog(outInfoLog, tx)
11350
 		//更新出库id
11350
 		//更新出库id
11351
-		UpdateNewDrugWarehouseOutInfo(advice.ID, warehouse.ID, advice.OrgId, over_count, drug_price, tx)
11351
+		UpdateNewDrugWarehouseOutInfo(advice.ID, warehouse.ID, advice.OrgId, over_count, drug_price, warehouse.Number, tx)
11352
 		// 出库完成后,要将该批次库存清零
11352
 		// 出库完成后,要将该批次库存清零
11353
 
11353
 
11354
 		prescribingNumber_two_temp := deliver_number - stock_number
11354
 		prescribingNumber_two_temp := deliver_number - stock_number